mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
#95 created config for forward key
This commit is contained in:
parent
43651b81fd
commit
d29b801657
@ -1 +1,2 @@
|
||||
from fishy.engine.semifisher.engine import SemiFisherEngine
|
||||
from fishy.engine.fullautofisher.engine import FullAuto
|
@ -120,9 +120,9 @@ class FullAuto(IEngine):
|
||||
|
||||
walking_time = dist / self.calibrator.move_factor
|
||||
logging.debug(f"walking for {walking_time}")
|
||||
kb.press('w')
|
||||
kb.press(config.get("forward_key"))
|
||||
time.sleep(walking_time)
|
||||
kb.release('w')
|
||||
kb.release(config.get("forward_key"))
|
||||
logging.debug("done")
|
||||
# todo: maybe check if it reached the destination before returning true?
|
||||
return True
|
||||
|
@ -63,9 +63,9 @@ class Calibrator(IMode):
|
||||
|
||||
x1, y1, rot1 = coords
|
||||
|
||||
kb.press('w')
|
||||
kb.press(config.get("forward_key"))
|
||||
time.sleep(walking_time)
|
||||
kb.release('w')
|
||||
kb.release(config.get("forward_key"))
|
||||
time.sleep(0.5)
|
||||
|
||||
coords = self.engine.get_coords()
|
||||
|
@ -13,11 +13,20 @@ from fishy.helper.config import config
|
||||
from fishy.helper.popup import PopUp
|
||||
|
||||
|
||||
def start_fullfisher_config(gui: 'GUI'):
|
||||
top = PopUp(helper.empty_function, gui._root, background=gui._root["background"])
|
||||
def del_entry_key(event):
|
||||
event.widget.delete(0, "end")
|
||||
event.widget.insert(0, str(event.char))
|
||||
|
||||
|
||||
def start_fullfisher_config(gui: 'GUI' ):
|
||||
def save():
|
||||
gui.config.set("forward_key", forward_key_entry.get())
|
||||
|
||||
top = PopUp(save, gui._root, background=gui._root["background"])
|
||||
controls_frame = ttk.Frame(top)
|
||||
top.title("Config")
|
||||
|
||||
|
||||
def file_name():
|
||||
file = config.get("full_auto_rec_file", None)
|
||||
if file is None:
|
||||
@ -63,6 +72,14 @@ def start_fullfisher_config(gui: 'GUI'):
|
||||
|
||||
row += 1
|
||||
|
||||
ttk.Label(controls_frame, text="Forward key:").grid(row=row, column=0)
|
||||
forward_key_entry = ttk.Entry(controls_frame, justify=tk.CENTER)
|
||||
forward_key_entry.grid(row=row, column=1)
|
||||
forward_key_entry.insert(0, config.get("forward_key", "w"))
|
||||
forward_key_entry.bind("<KeyRelease>", del_entry_key)
|
||||
|
||||
row += 1
|
||||
|
||||
ttk.Label(controls_frame, text="Edit Mode: ").grid(row=row, column=0)
|
||||
edit_state = tk.NORMAL if config.get("full_auto_mode", 0) == FullAutoMode.Recorder.value else tk.DISABLED
|
||||
edit_cb = ttk.Checkbutton(controls_frame, variable=edit_var, state=edit_state, command=lambda: config.set("edit_recorder_mode", edit_var.get()))
|
||||
@ -111,9 +128,7 @@ def start_semifisher_config(gui: 'GUI'):
|
||||
if web.sub():
|
||||
gui._notify.set(1)
|
||||
|
||||
def del_entry_key(event):
|
||||
event.widget.delete(0, "end")
|
||||
event.widget.insert(0, str(event.char))
|
||||
|
||||
|
||||
top = PopUp(save, gui._root, background=gui._root["background"])
|
||||
controls_frame = ttk.Frame(top)
|
||||
@ -130,7 +145,7 @@ def start_semifisher_config(gui: 'GUI'):
|
||||
gui._notify_check['state'] = tk.NORMAL
|
||||
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.grid(row=1, column=1)
|
||||
action_key_entry.insert(0, config.get("action_key", "e"))
|
||||
@ -160,4 +175,5 @@ if __name__ == '__main__':
|
||||
from fishy.gui import GUI
|
||||
gui = GUI(lambda: IEngineHandler())
|
||||
gui.call_in_thread(lambda: start_semifisher_config(gui))
|
||||
gui.call_in_thread(lambda: start_fullfisher_config(gui))
|
||||
gui.create()
|
||||
|
Loading…
Reference in New Issue
Block a user