screen: Fix problem where job_status does not update

Fixes a problem where a panel does not refresh data (such as extrusion 
rate, speed rate)
This commit is contained in:
Jordan Ruthe committed 2021-04-08 22:25:56 -04:00
1 parent bac2d9f23e
commit 02ea32506b
2 files changed
+11

No files matched your search

+5
View File
@@ -102,6 +102,11 @@ class Printer:
if "webhooks" in data or "idle_timeout" in data or "print_stats" in data:
self.evaluate_state()
def get_updates(self):
updates = self.data.copy()
updates.update(self.devices)
return updates
def evaluate_state(self):
wh_state = self.data['webhooks']['state'].lower() # possible values: startup, ready, shutdown, error
idle_state = self.data['idle_timeout']['state'].lower() # possible values: Idle, printing, ready
+6
View File
@@ -300,6 +300,9 @@ class KlipperScreen(Gtk.Window):
self.add(self.panels[panel_name].get())
self.show_all()
if hasattr(self.panels[panel_name],"process_update"):
logging.info("Debug: %s" % self.printer.get_updates())
self.panels[panel_name].process_update("notify_status_update", self.printer.get_updates())
if hasattr(self.panels[panel_name],"activate"):
self.panels[panel_name].activate()
self.show_all()
@@ -432,6 +435,9 @@ class KlipperScreen(Gtk.Window):
self._cur_panels.pop()
if len(self._cur_panels) > 0:
self.add(self.panels[self._cur_panels[-1]].get())
if hasattr(self.panels[self._cur_panels[-1]], "process_update"):
self.panels[self._cur_panels[-1]].process_update("notify_status_update",
self.printer.get_updates())
if show == True:
self.show_all()