增加键位

main
Dawn_Ocean 2023-10-19 21:08:27 +08:00
parent 90d6668280
commit 861ad5294e
2 changed files with 15 additions and 8 deletions

View File

@ -3,11 +3,18 @@
# 文件以 '$' 号单独占一行结束,请勿删除 # 文件以 '$' 号单独占一行结束,请勿删除
# 映射配置格式:[按钮编号]:[键位] # 映射配置格式:[按钮编号]:[键位]
0 : Q A0 : Q
1 : W A1 : W
2 : E A2 : E
3 : R A3 : R
4 : T A4 : T
5 : Y A5 : Y
D2 : U
D3 : I
D4 : O
D5 : P
D6 : [
D7 : ]
$ $

View File

@ -31,7 +31,7 @@ def detect():
def com_simulate(message): def com_simulate(message):
print(message) print(message)
key = maps[int(message[1])] # 判断按下了哪个按钮 key = maps[message[0:2]] # 判断按下了哪个按钮
if 'U' in message: if 'U' in message:
keyUp(key) keyUp(key)
elif 'D' in message: elif 'D' in message:
@ -52,7 +52,7 @@ if __name__ == "__main__":
while line != "$": while line != "$":
if line: if line:
keymap = line.split(':') keymap = line.split(':')
maps[int(keymap[0].strip())] = keymap[1].strip() maps[keymap[0].strip()] = keymap[1].strip()
line = f.readline().strip().split('#')[0] line = f.readline().strip().split('#')[0]
print("构建完毕!") print("构建完毕!")