Skip to content

Commit 0ce1dae

Browse files
committed
浮窗的设置部分
1 parent 06d37e6 commit 0ce1dae

2 files changed

Lines changed: 37 additions & 15 deletions

File tree

app/view/floating_window/levitation.py

Whitespace-only changes.

app/view/settings/floating_window_management.py

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def __init__(self, parent=None):
7474
)
7575
)
7676
self.startup_display_floating_window_switch.checkedChanged.connect(
77-
self.startup_display_floating_window_switch_changed
77+
lambda checked: update_settings(
78+
"floating_window_management", "startup_display_floating_window", checked
79+
)
7880
)
7981

8082
# 浮窗透明度
@@ -89,7 +91,9 @@ def __init__(self, parent=None):
8991
* 100
9092
)
9193
self.floating_window_opacity_spinbox.valueChanged.connect(
92-
self.floating_window_opacity_spinbox_changed
94+
lambda value: update_settings(
95+
"floating_window_management", "floating_window_opacity", value / 100
96+
)
9397
)
9498

9599
# 重置浮窗位置按钮
@@ -107,6 +111,23 @@ def __init__(self, parent=None):
107111
self.reset_floating_window_position_button_clicked
108112
)
109113

114+
# 浮窗长按拖动时间
115+
self.floating_window_long_press_duration_spinbox = SpinBox()
116+
self.floating_window_long_press_duration_spinbox.setFixedWidth(WIDTH_SPINBOX)
117+
self.floating_window_long_press_duration_spinbox.setRange(50, 3000)
118+
self.floating_window_long_press_duration_spinbox.setSingleStep(100)
119+
self.floating_window_long_press_duration_spinbox.setSuffix("ms")
120+
self.floating_window_long_press_duration_spinbox.setValue(
121+
readme_settings_async(
122+
"floating_window_management", "floating_window_long_press_duration"
123+
)
124+
)
125+
self.floating_window_long_press_duration_spinbox.valueChanged.connect(
126+
lambda value: update_settings(
127+
"floating_window_management", "floating_window_long_press_duration", value
128+
)
129+
)
130+
110131
# 添加设置项到分组
111132
self.addGroup(
112133
get_theme_icon("ic_fluent_desktop_sync_20_filled"),
@@ -128,6 +149,16 @@ def __init__(self, parent=None):
128149
),
129150
self.floating_window_opacity_spinbox,
130151
)
152+
self.addGroup(
153+
get_theme_icon("ic_fluent_gesture_20_filled"),
154+
get_content_name_async(
155+
"floating_window_management", "floating_window_long_press_duration"
156+
),
157+
get_content_description_async(
158+
"floating_window_management", "floating_window_long_press_duration"
159+
),
160+
self.floating_window_long_press_duration_spinbox,
161+
)
131162
self.addGroup(
132163
get_theme_icon("ic_fluent_arrow_reset_20_filled"),
133164
get_content_name_async(
@@ -139,20 +170,11 @@ def __init__(self, parent=None):
139170
self.reset_floating_window_position_button,
140171
)
141172

142-
def startup_display_floating_window_switch_changed(self, checked):
143-
update_settings(
144-
"floating_window_management", "startup_display_floating_window", checked
145-
)
146-
147-
def floating_window_opacity_spinbox_changed(self, value):
148-
update_settings(
149-
"floating_window_management", "floating_window_opacity", value / 100
150-
)
151-
152173
def reset_floating_window_position_button_clicked(self):
153-
# 这里应该实现重置浮窗位置的逻辑
154-
logger.debug("重置浮窗位置按钮被点击")
155-
174+
"""重置浮窗位置按钮点击处理"""
175+
# 更新设置为默认位置
176+
update_settings("float_position", "x", 100)
177+
update_settings("float_position", "y", 100)
156178

157179
# ==================================================
158180
# 浮动窗口管理 - 外观设置

0 commit comments

Comments
 (0)