From d5bc271788462948c99d05af6651c892d897ea77 Mon Sep 17 00:00:00 2001 From: alfrix Date: Wed, 27 Jul 2022 16:52:58 -0300 Subject: [PATCH] close dialogs on klippy restart --- ks_includes/KlippyGtk.py | 1 + screen.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ks_includes/KlippyGtk.py b/ks_includes/KlippyGtk.py index 59a5f4ba..3633f3bc 100644 --- a/ks_includes/KlippyGtk.py +++ b/ks_includes/KlippyGtk.py @@ -218,6 +218,7 @@ class KlippyGtk: else: dialog.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.BLANK_CURSOR)) + self.screen.dialogs.append(dialog) return dialog def ToggleButtonImage(self, image_name, label, style=None, scale=1.38): diff --git a/screen.py b/screen.py index e27c4a8d..9d683825 100644 --- a/screen.py +++ b/screen.py @@ -88,6 +88,7 @@ class KlipperScreen(Gtk.Window): self.use_dpms = True self.apiclient = None self.version = version + self.dialogs = [] configfile = os.path.normpath(os.path.expanduser(args.configfile)) @@ -213,6 +214,8 @@ class KlipperScreen(Gtk.Window): for panel in list(self.panels): if panel not in ["printer_select", "splash_screen"]: del self.panels[panel] + for dialog in self.dialogs: + dialog.destroy() self.base_panel.show_printer_select(True) self.printer_initializing(_("Connecting to %s") % name) @@ -757,6 +760,8 @@ class KlipperScreen(Gtk.Window): for panel in list(self.panels): if panel not in ["printer_select", "splash_screen"]: del self.panels[panel] + if dialog in self.dialogs: + dialog.destroy() def state_paused(self, prev_state): if "job_status" not in self._cur_panels: