Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit c62a4b3

Browse files
committed
WIP add toggle for cursor movement
1 parent 67f0120 commit c62a4b3

1 file changed

Lines changed: 42 additions & 9 deletions

File tree

src/gui/pages/page_cursor.py

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,29 @@ def __init__(
5252

5353
# Slider divs
5454
self.divs = self.create_divs({
55-
"Move up": ["spd_up", "", 1, 100],
56-
"Move down": ["spd_down", "", 1, 100],
57-
"Move right": ["spd_right", "", 1, 100],
58-
"Move left": ["spd_left", "", 1, 100],
55+
"Move up": ["spd_up", "", 1, 100, True],
56+
"Move down": ["spd_down", "", 1, 100, True],
57+
"Move right": ["spd_right", "", 1, 100, True],
58+
"Move left": ["spd_left", "", 1, 100, True],
5959
"(Advanced) Smooth pointer": [
6060
"pointer_smooth",
6161
"Controls the smoothness of the\nmouse cursor. Enables the user\nto reduce jitteriness",
62-
1, 100
62+
1,
63+
100,
64+
False
6365
],
6466
"(Advanced) Smooth blendshapes": [
6567
"shape_smooth", "Reduces the flickering of the action\ntrigger",
66-
1, 100
68+
1,
69+
100,
70+
False
6771
],
6872
"(Advanced) Hold trigger delay(ms)": [
6973
"hold_trigger_ms",
7074
"Controls how long the user should\nhold a gesture in milliseconds\nfor an action to trigger",
71-
1, MAX_HOLD_TRIG
75+
1,
76+
MAX_HOLD_TRIG,
77+
False
7278
]
7379
})
7480

@@ -95,9 +101,35 @@ def create_divs(self, directions: dict):
95101
out_dict = {}
96102

97103
for idx, (show_name, (cfg_name, balloon_text, slider_min,
98-
slider_max)) in enumerate(directions.items()):
104+
slider_max, has_toggle)) in enumerate(directions.items()):
99105

100106
help_image = self.help_icon if balloon_text != "" else None
107+
108+
# Toggle switch
109+
# TODO: figure out what I actually need from here
110+
if has_toggle:
111+
toggle_switch = customtkinter.CTkSwitch(
112+
master=self,
113+
text="",
114+
width=200,
115+
border_color="transparent",
116+
switch_height=18,
117+
switch_width=32,
118+
variable=MouseController().is_active,
119+
command=lambda: master_callback(
120+
"toggle_switch", {"switch_status": self.toggle_switch.get()}),
121+
onvalue=1,
122+
offvalue=0,
123+
)
124+
else:
125+
toggle_switch = None
126+
127+
"""
128+
No idea what this does, yet
129+
if ConfigManager().config["auto_play"]:
130+
self.toggle_switch.select()
131+
"""
132+
101133
# Label
102134
label = customtkinter.CTkLabel(master=self,
103135
image=help_image,
@@ -146,7 +178,8 @@ def create_divs(self, directions: dict):
146178
"entry": entry,
147179
"entry_var": entry_var,
148180
"entry_trace_id": entry_var_trace_id,
149-
"entry_trace_fn": entry_trace_fn
181+
"entry_trace_fn": entry_trace_fn,
182+
"toggle_switch": toggle_switch
150183
}
151184
return out_dict
152185

0 commit comments

Comments
 (0)