feat(notifications): klipper config warnings

This commit is contained in:
Alfredo Monclus committed 2024-07-06 11:15:50 -03:00
1 parent 2036512064
commit 115dba8c88
2 files changed
+10 -3

No files matched your search

+7 -2
View File
@@ -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])
+3 -1
View File
@@ -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"],