From 49d910af2b61d2291882d571d7adae12506b365a Mon Sep 17 00:00:00 2001 From: alfrix Date: Tue, 9 May 2023 07:51:09 -0600 Subject: [PATCH] fix popup timer close #946 --- screen.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/screen.py b/screen.py index 4fd75cd53..5150e3a8d 100755 --- a/screen.py +++ b/screen.py @@ -90,6 +90,7 @@ class KlipperScreen(Gtk.Window): reinit_count = 0 max_retries = 4 initialized = False + popup_timeout = None def __init__(self, args, version): try: @@ -336,7 +337,9 @@ def show_popup_message(self, message, level=3): self.popup_message.show_all() if self._config.get_main_config().getboolean('autoclose_popups', True): - GLib.timeout_add_seconds(10, self.close_popup_message) + if self.popup_timeout: + GLib.source_remove(self.popup_timeout) + self.popup_timeout = GLib.timeout_add_seconds(10, self.close_popup_message) return False @@ -344,7 +347,8 @@ def close_popup_message(self, widget=None): if self.popup_message is None: return self.popup_message.popdown() - self.popup_message = None + GLib.source_remove(self.popup_timeout) + self.popup_message = self.popup_timeout = None def show_error_modal(self, err, e=""): logging.error(f"Showing error modal: {err} {e}")