mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
fixed situations where app doesnt shut down without crash
- when bot is closed while engine is running - when start is pressed when the game is minimized, then app is closed
This commit is contained in:
parent
db5299004b
commit
80c2a5e900
@ -29,7 +29,8 @@ class WindowClient:
|
|||||||
WindowClient.clients.append(self)
|
WindowClient.clients.append(self)
|
||||||
|
|
||||||
def destory(self):
|
def destory(self):
|
||||||
WindowClient.clients.remove(self)
|
if self in WindowClient.clients:
|
||||||
|
WindowClient.clients.remove(self)
|
||||||
if len(WindowClient.clients) == 0:
|
if len(WindowClient.clients) == 0:
|
||||||
window_server.stop()
|
window_server.stop()
|
||||||
logging.info("window server stopped")
|
logging.info("window server stopped")
|
||||||
|
@ -24,6 +24,7 @@ def _apply_theme(gui: 'GUI'):
|
|||||||
gui._console["fg"] = "#ffffff" if dark else "#000000"
|
gui._console["fg"] = "#ffffff" if dark else "#000000"
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyProtectedMember
|
||||||
def _create(gui: 'GUI'):
|
def _create(gui: 'GUI'):
|
||||||
engines = gui.engines
|
engines = gui.engines
|
||||||
|
|
||||||
@ -105,8 +106,12 @@ def _create(gui: 'GUI'):
|
|||||||
|
|
||||||
hotkey.set_hotkey(Key.F9, gui.funcs.start_engine)
|
hotkey.set_hotkey(Key.F9, gui.funcs.start_engine)
|
||||||
|
|
||||||
|
# noinspection PyProtectedMember
|
||||||
def set_destroy():
|
def set_destroy():
|
||||||
gui._destroyed = True
|
if gui._bot_running:
|
||||||
|
logging.info("Turn off the bot engine first")
|
||||||
|
else:
|
||||||
|
gui._destroyed = True
|
||||||
|
|
||||||
gui._root.protocol("WM_DELETE_WINDOW", set_destroy)
|
gui._root.protocol("WM_DELETE_WINDOW", set_destroy)
|
||||||
gui._destroyed = False
|
gui._destroyed = False
|
||||||
|
Loading…
Reference in New Issue
Block a user