diff --git a/fishy/engine/fullautofisher/player.py b/fishy/engine/fullautofisher/player.py index b72a337..a406933 100644 --- a/fishy/engine/fullautofisher/player.py +++ b/fishy/engine/fullautofisher/player.py @@ -7,6 +7,7 @@ from fishy.engine.semifisher import fishing_event, fishing_mode from fishy.engine.fullautofisher.engine import FullAuto from fishy.helper import hotkey, helper +from fishy.helper.config import config from fishy.helper.hotkey import Key @@ -33,17 +34,18 @@ class Player: self.hole_complete_flag = True def start_route(self): - # file = askopenfile(mode='rb', filetypes=[('Python Files', '*.fishy')]) - # if not file: - # logging.error("file not selected") - # return + file = config.get("full_auto_rec_file") - file = open(r"C:\Users\adam_\Desktop\test3.fishy", 'rb') + if not file: + logging.error("Please select a fishy file first from config") + return + + file = open(file, 'rb') data = pickle.load(file) file.close() pprint(data) if "full_auto_path" not in data: - logging.error("incorrect file") + logging.error("invalid file") return self.timeline = data["full_auto_path"] diff --git a/fishy/gui/config_top.py b/fishy/gui/config_top.py index 469fe15..9c1ff09 100644 --- a/fishy/gui/config_top.py +++ b/fishy/gui/config_top.py @@ -1,4 +1,6 @@ +import logging import typing +from tkinter.filedialog import askopenfilename from fishy.helper import helper @@ -20,7 +22,16 @@ def start_fullfisher_config(gui: 'GUI'): controls_frame = Frame(top) top.title("Config") - Label(controls_frame, text="Use semi-fisher engine config").grid(row=0, column=0) + def select_file(): + file = askopenfilename(filetypes=[('Python Files', '*.fishy')]) + if not file: + logging.error("file not selected") + else: + config.set("full_auto_rec_file", file) + logging.info(f"loaded {file}") + + Button(controls_frame, text="Select fishy file", command=select_file).grid(row=0, column=0) + Label(controls_frame, text="Use semi-fisher config for rest").grid(row=2, column=0) controls_frame.pack(padx=(5, 5), pady=(5, 5)) top.start()