From 115dba8c88ac5f0d08229682279da54da9949a84 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Thu, 4 Jul 2024 15:27:37 -0300 Subject: [PATCH] feat(notifications): klipper config warnings --- ks_includes/printer.py | 9 +++++++-- screen.py | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ks_includes/printer.py b/ks_includes/printer.py index c50c1938..55ac106b 100644 --- a/ks_includes/printer.py +++ b/ks_includes/printer.py @@ -28,6 +28,7 @@ class Printer: self.spoolman = False self.temp_devices = self.sensors = None self.system_info = {} + self.warnings = [] def reinit(self, printer_info, data): self.config = data['configfile']['config'] @@ -45,6 +46,7 @@ class Printer: self.temp_devices = self.sensors = None self.stop_tempstore_updates() self.system_info.clear() + self.warnings = [] for x in self.config.keys(): # Support for hiding devices by name @@ -111,8 +113,11 @@ class Printer: return for x in data: - if x == "configfile" and 'config' in data[x]: - self.config.update(data[x]['config']) + if x == "configfile": + if 'config' in data[x]: + self.config.update(data[x]['config']) + if 'warnings' in data[x]: + self.warnings = data[x]['warnings'] if x not in self.data: self.data[x] = {} self.data[x].update(data[x]) diff --git a/screen.py b/screen.py index d5613028..a9ea56ab 100755 --- a/screen.py +++ b/screen.py @@ -176,6 +176,8 @@ class KlipperScreen(Gtk.Window): self.set_screenblanking_timeout(self._config.get_main_config().get('screen_blanking_printing')) else: self.set_screenblanking_timeout(self._config.get_main_config().get('screen_blanking')) + for warning in self.printer.warnings: + self.show_popup_message(f"Klipper:\n{warning['message']}", level=2) callback() return False @@ -257,7 +259,7 @@ class KlipperScreen(Gtk.Window): requested_updates = { "objects": { "bed_mesh": ["profile_name", "mesh_max", "mesh_min", "probed_matrix", "profiles"], - "configfile": ["config"], + "configfile": ["config", "warnings"], "display_status": ["progress", "message"], "fan": ["speed"], "gcode_move": ["extrude_factor", "gcode_position", "homing_origin", "speed_factor", "speed"],