close dialogs on klippy restart

This commit is contained in:
alfrix 2022-07-27 16:52:58 -03:00 committed by Alfredo Monclus
parent e8e4555d46
commit d5bc271788
2 changed files with 6 additions and 0 deletions

View File

@ -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):

View File

@ -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: