From fda5589531c0ff7bb4920771ae9a7bb1b5c61ec0 Mon Sep 17 00:00:00 2001 From: alfrix Date: Thu, 14 Jul 2022 13:55:16 -0300 Subject: [PATCH] screen: Always ask to save config if we detect it on responses --- panels/bed_mesh.py | 4 ++-- screen.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/panels/bed_mesh.py b/panels/bed_mesh.py index 6f07be96..5a6afb7e 100644 --- a/panels/bed_mesh.py +++ b/panels/bed_mesh.py @@ -37,7 +37,7 @@ class BedMeshPanel(ScreenPanel): self.labels['profiles'] = Gtk.Grid() scroll.add(self.labels['profiles']) - addprofile = self._gtk.ButtonImage("increase", _("Add bed mesh profile"), + addprofile = self._gtk.ButtonImage("increase", " " + _("Add bed mesh profile"), "color1", .5, Gtk.PositionType.LEFT, False) addprofile.connect("clicked", self.show_create_profile) addprofile.set_size_request(60, 0) @@ -68,7 +68,7 @@ class BedMeshPanel(ScreenPanel): def activate_mesh(self, profile): if profile == "": - profile = "default" + profile = "current" logging.debug(f"Activating profile: {self.active_mesh} {profile}") if profile != self.active_mesh: diff --git a/screen.py b/screen.py index 13442bd0..d0775b19 100644 --- a/screen.py +++ b/screen.py @@ -841,9 +841,17 @@ class KlipperScreen(Gtk.Window): re.search(r'B:[0-9\.]+\s/[0-9\.]+\sT[0-9]+:[0-9\.]+', data)): if data.startswith("echo: "): self.show_popup_message(data[6:], 1) - if data.startswith("!! "): + elif data.startswith("!! "): self.show_popup_message(data[3:], 3) - logging.debug(json.dumps([action, data], indent=2)) + logging.debug(json.dumps([action, data], indent=2)) + if "SAVE_CONFIG" in data: + script = {"script": "SAVE_CONFIG"} + self._confirm_send_action( + None, + _("Save configuration?") + "\n\n" + _("Klipper will reboot"), + "printer.gcode.script", + script + ) self.base_panel.process_update(action, data) if self._cur_panels[-1] in self.subscriptions: