-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreset_var.py
190 lines (169 loc) · 5.09 KB
/
preset_var.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
from PIL import ImageFont
import screeninfo
import yaml
import subprocess
no_device_debug = False
with open("config.yaml") as f:
config_file = yaml.safe_load(f)
def get_canvas_size():
monitor_info = screeninfo.get_monitors()
size = 500
if config_file["auto_large_ui"]:
for monitor in monitor_info:
if monitor.width < monitor.height: size = 1080
return size
canvas_size = get_canvas_size()
def get_com_list():
subprocess.run(['powershell', """
$number = (Get-WMIObject Win32_PnPEntity | Where-Object {$_.name -match "com\\d"}).Name
try{
$name = (Get-WMIObject Win32_PnPEntity | Where-Object {$_.name -match "com\\d"}).GetDeviceProperties("DEVPKEY_Device_BusReportedDeviceDesc").deviceProperties.Data
}catch{
exit
}
$i=0
foreach($num in $number){
$num = $num -replace "[^com\\d\\d]", ""
if($exist -eq 1){
break
}else{
[PSCustomObject]@{ Number = $num; Name = $name[$i] } | Export-Csv -NoTypeInformation -Path ./com_list.csv -Append
$exist=1
}
$i++
$exist=0
}
"""])
sensor_area = tuple([i for i in "ABCDE"])
SENSOR_INFO = (
"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8",
"B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8",
"C1", "C2",
"D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8",
"E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8"
)
nkro_key = ("wedcxzaq", "89632147")
connect_stat = {
0: "Click the connect button to start.",
1: "Program is running normally.",
2: "Program is executing ",
3: "",
}
buttons = {
"Sensitivity adjust": 'cmds.sense',
"LED brightness": 'cmds.level',
"Buttons adjust": 'cmds',
"Aime": 'cmds.aime',
"Test": 'cmds',
"HID mode": 'cmds.hid',
"Update firmware": 'cmds.update',
}
message_box_prompts = {
"Denied": ("Error", "Unable to connect to the port, make sure it is not in use."),
"Reconfig": ("COM port reconfigured", "Port settings have reconfigured, please click the connect button again to try.\nIf the port is still incorrect, please manually correct it in config.yaml."),
"Not_detected": ("Error", "Failed to connect to the port, make sure it is connected, and Powershell is not disabled."),
"Manual_port_repeat": ("Repeated value", "Value can't be the same."),
"Manual_port_empty": ("Empty value", "Value can't be empty."),
"Manual_port_fail": ("Failed to connect", "Please check your connection, or specify the correct port."),
"Update_firmware": ("Exiting", "The program will now exit.\nPut your firmware file into the disk that appeared."),
"Aime_unsupported": ("Failed to configure Aime", "The firmware you are using now does not support Aime.\nPlease upgrade to a newer one.")
}
CANVAS_FONT_SET = (
ImageFont.truetype("fonts/NotoSans.ttf", 53),
ImageFont.truetype("fonts/NotoSans.ttf", 30),
ImageFont.truetype("fonts/NotoSans.ttf", 41)
)
CMD_TITLE_POSITION = (540,300)
SETTINGS_SPACING = 85
KEY_PROMPTING_POSITION = (130,800)
CANVAS_CENTER_POSITION = (540,540)
area_title_position = {
"A1": (670,90),
"A2": (910,310),
"A3": (900,650),
"A4": (670,900),
"A5": (340,900),
"A6": (110,650),
"A7": (110,320),
"A8": (340,90),
"B1": (600,290),
"B2": (710,410),
"B3": (710,570),
"B4": (590,690),
"B5": (420,690),
"B6": (300,570),
"B7": (310,410),
"B8": (420,290),
"C1": (560,490),
"C2": (450,490),
"D1": (510,30),
"D2": (830,170),
"D3": (960,490),
"D4": (820,810),
"D5": (510,950),
"D6": (200,810),
"D7": (50,490),
"D8": (180,170),
"E1": (510,180),
"E2": (730,270),
"E3": (820,490),
"E4": (730,710),
"E5": (510,800),
"E6": (290,710),
"E7": (200,490),
"E8": (290,270)
}
area_subtitl_position = {
"A1": (680,150),
"A2": (920,370),
"A3": (910,720),
"A4": (680,960),
"A5": (350,960),
"A6": (120,720),
"A7": (120,380),
"A8": (350,150),
"B1": (610,350),
"B2": (720,470),
"B3": (720,630),
"B4": (600,750),
"B5": (430,750),
"B6": (310,630),
"B7": (320,470),
"B8": (430,350),
"C1": (570,550),
"C2": (460,550),
"D1": (520,90),
"D2": (840,230),
"D3": (970,550),
"D4": (830,870),
"D5": (520,1010),
"D6": (210,870),
"D7": (60,550),
"D8": (190,230),
"E1": (520,240),
"E2": (730,330),
"E3": (830,550),
"E4": (730,770),
"E5": (520,860),
"E6": (300,770),
"E7": (210,550),
"E8": (300,330)
}
cmds_sense_text = (
"Sensitivity configuration",
"Type the area using your keyboard.\n\nPress 'g' for global sensitivity.",
"Adjusting: Arrow <Left> or <Right>\n\nBack: <Backspace>\n\nApply: <Enter>",
)
cmds_hid_text = (
"HID mode configuration",
"Joy mode (io4)",
"Default keyboard 1P",
"Default keyboard 2P",
"Switch option: Arrow <Up> or <Down>\n\nApply: <Enter>",
)
cmds_aime_text = (
"Aime configuration",
"Virtual AIC",
"Protocol mode",
"Switch option: Arrow <Up> or <Down>\n\nAdjust: Arrow <Left> or <Right>\n\nApply: <Enter>",
)