2020-06-01 12:58:18 +00:00
|
|
|
import logging
|
2020-10-18 00:43:59 +00:00
|
|
|
import time
|
|
|
|
|
2020-06-01 12:58:18 +00:00
|
|
|
from fishy.engine import SemiFisherEngine
|
|
|
|
from fishy.engine.fullautofisher.engine import FullAuto
|
|
|
|
|
|
|
|
|
|
|
|
class EngineEventHandler:
|
2020-10-17 19:06:07 +00:00
|
|
|
def __init__(self, gui_ref):
|
2020-06-01 12:58:18 +00:00
|
|
|
self.event_handler_running = True
|
|
|
|
self.event = []
|
|
|
|
|
2020-10-17 19:06:07 +00:00
|
|
|
self.semi_fisher_engine = SemiFisherEngine(gui_ref)
|
|
|
|
self.full_fisher_engine = FullAuto(gui_ref)
|
2020-06-01 12:58:18 +00:00
|
|
|
|
|
|
|
def start_event_handler(self):
|
|
|
|
while self.event_handler_running:
|
|
|
|
while len(self.event) > 0:
|
|
|
|
event = self.event.pop(0)
|
|
|
|
event()
|
2020-10-18 00:43:59 +00:00
|
|
|
time.sleep(0.1)
|
2020-06-01 12:58:18 +00:00
|
|
|
|
|
|
|
def toggle_semifisher(self):
|
|
|
|
self.event.append(self.semi_fisher_engine.toggle_start)
|
|
|
|
|
|
|
|
def toggle_fullfisher(self):
|
|
|
|
self.event.append(self.full_fisher_engine.toggle_start)
|
|
|
|
|
|
|
|
def check_pixel_val(self):
|
|
|
|
def func():
|
|
|
|
if self.semi_fisher_engine.start:
|
|
|
|
self.semi_fisher_engine.show_pixel_vals()
|
|
|
|
else:
|
|
|
|
logging.debug("Start the engine first before running this command")
|
|
|
|
|
|
|
|
self.event.append(func)
|
|
|
|
|
|
|
|
def quit(self):
|
|
|
|
def func():
|
|
|
|
self.semi_fisher_engine.start = False
|
|
|
|
self.event_handler_running = False
|
|
|
|
|
|
|
|
self.event.append(func)
|