diff --git a/fishy/__init__.py b/fishy/__init__.py index 7527ba7..0c51c5b 100644 --- a/fishy/__init__.py +++ b/fishy/__init__.py @@ -1,2 +1,2 @@ from fishy.__main__ import main -__version__ = "0.4.5" +__version__ = "0.4.6" diff --git a/fishy/__main__.py b/fishy/__main__.py index 8c80208..d3a7da1 100644 --- a/fishy/__main__.py +++ b/fishy/__main__.py @@ -62,8 +62,6 @@ def initialize(window_to_hide): if not config.get("addoninstalled", 0) or helper.get_addonversion(chalutier[0]) < chalutier[2]: helper.install_addon(*chalutier) helper.install_addon(*lam2) - helper.remove_addon("ProvisionsChalutier") #TODO delete with fishy 0.4.6 - helper.remove_addon("FooAddon") #TODO delete with fishy 0.4.6 config.set("addoninstalled", helper.get_addonversion(chalutier[0])) diff --git a/fishy/engine/semifisher/engine.py b/fishy/engine/semifisher/engine.py index e29a56c..0113083 100644 --- a/fishy/engine/semifisher/engine.py +++ b/fishy/engine/semifisher/engine.py @@ -67,7 +67,7 @@ class SemiFisherEngine(IEngine): t = 0 while t < 10.0: t += freq - logging.debug(str(FishingMode.CurrentMode.label) + ":" + str(self.fishPixWindow.get_capture()[0][0])) + logging.debug(str(FishingMode.CurrentMode) + ":" + str(self.fishPixWindow.get_capture()[0][0])) time.sleep(freq) logging.debug("Will display pixel values for 10 seconds") diff --git a/fishy/engine/semifisher/fishing_event.py b/fishy/engine/semifisher/fishing_event.py index a21f5e4..9aff60c 100644 --- a/fishy/engine/semifisher/fishing_event.py +++ b/fishy/engine/semifisher/fishing_event.py @@ -33,7 +33,6 @@ class FishEvent: # initialize these action_key = 'e' collect_key = 'r' - collect_allow_auto = False sound = False @@ -59,7 +58,6 @@ def init(): FishEvent.jitter = config.get("jitter", False) FishEvent.action_key = config.get("action_key", 'e') FishEvent.collect_key = config.get("collect_key", 'r') - FishEvent.collect_allow_auto = config.get("collect_allow_auto", False) FishEvent.uid = config.get("uid") FishEvent.sound = config.get("sound_notification", False) @@ -161,10 +159,9 @@ def on_reelin(): def on_loot(): - if FishEvent.collect_allow_auto: - _fishing_sleep(0.15) - keyboard.press_and_release(FishEvent.collect_key) - _fishing_sleep(0.3) + _fishing_sleep(0) + keyboard.press_and_release(FishEvent.collect_key) + _fishing_sleep(0) def on_invfull(): diff --git a/fishy/engine/semifisher/fishing_mode.py b/fishy/engine/semifisher/fishing_mode.py index ecec986..7846fc7 100644 --- a/fishy/engine/semifisher/fishing_mode.py +++ b/fishy/engine/semifisher/fishing_mode.py @@ -39,10 +39,7 @@ def loop(hsv): if all(hsv == s.value): FishingMode.CurrentMode = s - if FishingMode.CurrentMode == State.LOOKING: - _notify(FishingMode.CurrentMode) - time.sleep(1) - elif FishingMode.CurrentMode != FishingMode.PrevMode: + if FishingMode.CurrentMode != FishingMode.PrevMode: _notify(FishingMode.CurrentMode) FishingMode.PrevMode = FishingMode.CurrentMode diff --git a/fishy/gui/config_top.py b/fishy/gui/config_top.py index c5ebcbf..5001347 100644 --- a/fishy/gui/config_top.py +++ b/fishy/gui/config_top.py @@ -51,7 +51,6 @@ def start_semifisher_config(gui: 'GUI'): def save(): gui.config.set("action_key", action_key_entry.get(), False) gui.config.set("collect_key", collect_key_entry.get(), False) - gui.config.set("collect_allow_auto", collect_allow_auto.instate(['selected']), False) gui.config.set("borderless", borderless.instate(['selected']), False) gui.config.set("jitter", jitter.instate(['selected']), False) gui.config.set("sound_notification", sound.instate(['selected']), False) @@ -65,10 +64,6 @@ def start_semifisher_config(gui: 'GUI'): if web.sub(): gui._notify.set(1) - def toggle_collect(): - gui.config.set("collect_allow_auto", collect_allow_auto.instate(['selected']), False) - collect_key_entry['state'] = NORMAL if config.get("collect_allow_auto") else DISABLED - def del_entry_key(event): event.widget.delete(0,"end") event.widget.insert(0, str(event.char)) @@ -98,15 +93,10 @@ def start_semifisher_config(gui: 'GUI'): action_key_entry.insert(0, config.get("action_key", "e")) action_key_entry.bind("", del_entry_key) - Label(controls_frame, text="Auto-Looting: ").grid(row=3, column=0, pady=(15, 0)) - collect_allow_auto = Checkbutton(controls_frame, command=toggle_collect, var=BooleanVar(value=config.get("collect_allow_auto"))) - collect_allow_auto.grid(row=3, column=1, pady=(15, 0)) - - Label(controls_frame, text="Looting Key:").grid(row=4, column=0, pady=(0, 15)) + Label(controls_frame, text="Looting Key:").grid(row=4, column=0, pady=(5, 5)) collect_key_entry = Entry(controls_frame, justify=CENTER) - collect_key_entry.grid(row=4, column=1, pady=(0, 15)) + collect_key_entry.grid(row=4, column=1, pady=(5, 5)) collect_key_entry.insert(0, config.get("collect_key", "r")) - collect_key_entry['state'] = NORMAL if config.get("collect_allow_auto") else DISABLED collect_key_entry.bind("", del_entry_key) Label(controls_frame, text="Sound Notification: ").grid(row=5, column=0, pady=(5, 5)) diff --git a/fishy/gui/gui.py b/fishy/gui/gui.py index fbdc8ab..79d8821 100644 --- a/fishy/gui/gui.py +++ b/fishy/gui/gui.py @@ -2,6 +2,7 @@ import logging import uuid from tkinter import OptionMenu, Button, IntVar from typing import List, Callable, Optional, Dict, Any +import queue import threading from fishy.web import web @@ -25,8 +26,8 @@ class GUI: self._start_restart = False self._destroyed = True self._log_strings = [] - self._function_queue: Dict[str, Callable] = {} - self._result_queue: Dict[str, Any] = {} + self._function_queue = queue.Queue() + self._result_dict: Dict[str, Any] = {} self._bot_running = False # UI items @@ -72,21 +73,21 @@ class GUI: self._thread.start() def _clear_function_queue(self): - while len(self._function_queue) > 0: - _id, func = self._function_queue.popitem() + while not self._function_queue.empty(): + _id, func = self._function_queue.get() result = func() - self._result_queue[_id] = result + self._result_dict[_id] = result def call_in_thread(self, func: Callable, block=False): _id = str(uuid.uuid4()) - self._function_queue[_id] = func + self._function_queue.put((_id, func)) if not block: return None - wait_until(lambda: _id in self._result_queue) + wait_until(lambda: _id in self._result_dict) - return self._result_queue.pop(_id) + return self._result_dict.pop(_id) def _get_start_stop_text(self): return "STOP (F9)" if self._bot_running else "START (F9)" diff --git a/fishy/web/web.py b/fishy/web/web.py index 086eaf0..e714842 100644 --- a/fishy/web/web.py +++ b/fishy/web/web.py @@ -63,9 +63,6 @@ def send_notification(message): @uses_session @fallback(None) def send_hole_deplete(fish_caught, hole_time, fish_times): - if not is_subbed()[0]: - return False - hole_data = { "fish_caught": fish_caught, "hole_time": hole_time,