|
@@ -100,7 +100,10 @@ class Action():
|
|
|
def __init__(self, name, kind, extra=None, toggled=False, delay=0):
|
|
|
self.name = name
|
|
|
self.kind = kind
|
|
|
- self.extra = extra
|
|
|
+ if extra is not None:
|
|
|
+ self.extra = extra
|
|
|
+ else:
|
|
|
+ self.extra = {}
|
|
|
self.toggled = toggled
|
|
|
self.delay = delay
|
|
|
self.max_delay = delay
|
|
@@ -288,7 +291,7 @@ class Tyrell():
|
|
|
if act.max_delay == 0 and act.toggled:
|
|
|
print_info(f"{key} -> {act.name}")
|
|
|
else:
|
|
|
- print_info(f"{key} -> {act.name} = {act.toggled} ({act.delay} ticks)")
|
|
|
+ print_info(f"{key} -> {act.name} = {act.toggled} ({act.max_delay} ticks)")
|
|
|
print_ok("Please use " + style("CTRL+C", fg="bright_yellow") + " to stop")
|
|
|
|
|
|
def tick(self):
|
|
@@ -343,7 +346,22 @@ class Tyrell():
|
|
|
print_info(style("OFF", fg="bright_red"))
|
|
|
return
|
|
|
if state == "up" or state == "down":
|
|
|
- print(f"Got: '{mirror_host}' {state}")
|
|
|
+ act = self.keybinds[mirror_host]
|
|
|
+ if act.toggled:
|
|
|
+ if act.extra["write"] != None or len(act.extra["write"]) != 0:
|
|
|
+ if state == "up":
|
|
|
+ print(f"'{bind}' -> {act.name} UP")
|
|
|
+ key_up(act.extra["write"])
|
|
|
+ elif state == "down":
|
|
|
+ print(f"'{bind}' -> {act.name} DOWN")
|
|
|
+ key_down(act.extra["write"])
|
|
|
+ elif act.extra["button"] != None or len(act.extra["button"]) != 0:
|
|
|
+ if state == "up":
|
|
|
+ print(f"'{bind}' -> {act.name} UP")
|
|
|
+ mouse_up(button=act.extra["button"])
|
|
|
+ elif state == "down":
|
|
|
+ print(f"'{bind}' -> {act.name} DOWN")
|
|
|
+ mouse_down(button=act.extra["button"])
|
|
|
return
|
|
|
if not self.toggled:
|
|
|
return
|
|
@@ -352,7 +370,15 @@ class Tyrell():
|
|
|
self.disable()
|
|
|
print_info(style("OFF", fg="bright_red"))
|
|
|
return
|
|
|
- print(f"Got: '{bind}' {state}")
|
|
|
+ act = self.keybinds[bind]
|
|
|
+ if act.toggled:
|
|
|
+ print(f"'{bind}' -> {act.name}")
|
|
|
+ act.do(self.delay, self.hold)
|
|
|
+ elif act.max_delay != 0 or act.kind == "mirror":
|
|
|
+ if act.toggle():
|
|
|
+ print(f"'{bind}' -> {act.name} " + style("ON", fg="bright_green"))
|
|
|
+ else:
|
|
|
+ print(f"'{bind}' -> {act.name} " + style("OFF", fg="bright_red"))
|
|
|
self.disable()
|
|
|
print_info(style("OFF", fg="bright_red"))
|
|
|
|