#95 added default config for when forward_key isn't set but used

This commit is contained in:
Adam Saudagar 2023-12-15 18:37:16 +05:30
parent d29b801657
commit a59909de9d
3 changed files with 10 additions and 5 deletions

View File

@ -120,9 +120,12 @@ class FullAuto(IEngine):
walking_time = dist / self.calibrator.move_factor walking_time = dist / self.calibrator.move_factor
logging.debug(f"walking for {walking_time}") logging.debug(f"walking for {walking_time}")
kb.press(config.get("forward_key"))
forward_key = config.get("forward_key", 'w')
kb.press(forward_key)
time.sleep(walking_time) time.sleep(walking_time)
kb.release(config.get("forward_key")) kb.release(forward_key)
logging.debug("done") logging.debug("done")
# todo: maybe check if it reached the destination before returning true? # todo: maybe check if it reached the destination before returning true?
return True return True

View File

@ -63,9 +63,11 @@ class Calibrator(IMode):
x1, y1, rot1 = coords x1, y1, rot1 = coords
kb.press(config.get("forward_key")) forward_key = config.get("forward_key", 'w')
kb.press(forward_key)
time.sleep(walking_time) time.sleep(walking_time)
kb.release(config.get("forward_key")) kb.release(forward_key)
time.sleep(0.5) time.sleep(0.5)
coords = self.engine.get_coords() coords = self.engine.get_coords()

View File

@ -145,7 +145,7 @@ def start_semifisher_config(gui: 'GUI'):
gui._notify_check['state'] = tk.NORMAL gui._notify_check['state'] = tk.NORMAL
gui._notify.set(is_subbed[0]) gui._notify.set(is_subbed[0])
ttk.Label(controls_frame, text="action Key:").grid(row=1, column=0) ttk.Label(controls_frame, text="Action Key:").grid(row=1, column=0)
action_key_entry = ttk.Entry(controls_frame, justify=tk.CENTER) action_key_entry = ttk.Entry(controls_frame, justify=tk.CENTER)
action_key_entry.grid(row=1, column=1) action_key_entry.grid(row=1, column=1)
action_key_entry.insert(0, config.get("action_key", "e")) action_key_entry.insert(0, config.get("action_key", "e"))