added player file in config

This commit is contained in:
Adam Saudagar 2020-10-18 19:23:46 +05:30
parent aecb3a0af7
commit 50083edd8a
2 changed files with 20 additions and 7 deletions

View File

@ -7,6 +7,7 @@ from fishy.engine.semifisher import fishing_event, fishing_mode
from fishy.engine.fullautofisher.engine import FullAuto from fishy.engine.fullautofisher.engine import FullAuto
from fishy.helper import hotkey, helper from fishy.helper import hotkey, helper
from fishy.helper.config import config
from fishy.helper.hotkey import Key from fishy.helper.hotkey import Key
@ -33,17 +34,18 @@ class Player:
self.hole_complete_flag = True self.hole_complete_flag = True
def start_route(self): def start_route(self):
# file = askopenfile(mode='rb', filetypes=[('Python Files', '*.fishy')]) file = config.get("full_auto_rec_file")
# if not file:
# logging.error("file not selected")
# return
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) data = pickle.load(file)
file.close() file.close()
pprint(data) pprint(data)
if "full_auto_path" not in data: if "full_auto_path" not in data:
logging.error("incorrect file") logging.error("invalid file")
return return
self.timeline = data["full_auto_path"] self.timeline = data["full_auto_path"]

View File

@ -1,4 +1,6 @@
import logging
import typing import typing
from tkinter.filedialog import askopenfilename
from fishy.helper import helper from fishy.helper import helper
@ -20,7 +22,16 @@ def start_fullfisher_config(gui: 'GUI'):
controls_frame = Frame(top) controls_frame = Frame(top)
top.title("Config") 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)) controls_frame.pack(padx=(5, 5), pady=(5, 5))
top.start() top.start()