diff --git a/pyclashbot/__main__.py b/pyclashbot/__main__.py index 20db8a1be..f326436cd 100644 --- a/pyclashbot/__main__.py +++ b/pyclashbot/__main__.py @@ -177,10 +177,13 @@ def main_gui(): # enable the start button and configuration after the thread is stopped for key in disable_keys: window[key].update(disabled=False) - # reset the communication queue and logger - statistics_q = Queue() - logger = Logger(statistics_q, console_log=console_log, timed=False) - thread = None + if thread.logger.errored: + window["Stop"].update(disabled=True) + else: + # reset the communication queue and logger + statistics_q = Queue() + logger = Logger(statistics_q, console_log=console_log, timed=False) + thread = None update_layout(window, logger) diff --git a/pyclashbot/utils/logger.py b/pyclashbot/utils/logger.py index b3bdd29af..4e674bb32 100644 --- a/pyclashbot/utils/logger.py +++ b/pyclashbot/utils/logger.py @@ -65,6 +65,9 @@ def __init__( self.war_battles_fought = 0 self.current_status = "Idle" + # track errored logger + self.errored = False + # write initial values to queue self._update_queue() @@ -243,6 +246,7 @@ def error(self, message: str): Args: message (str): error message """ + self.errored = True self.current_status = f"Error: {message}" @_updates_log