From 02ea32506be553d72ca87026df481a98b0f1cdcf Mon Sep 17 00:00:00 2001 From: Jordan Ruthe Date: Thu, 8 Apr 2021 22:25:56 -0400 Subject: [PATCH] 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) --- ks_includes/printer.py | 5 +++++ screen.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ks_includes/printer.py b/ks_includes/printer.py index d088c8de..e978794e 100644 --- a/ks_includes/printer.py +++ b/ks_includes/printer.py @@ -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 diff --git a/screen.py b/screen.py index 949c3c51..1fda9e0d 100644 --- a/screen.py +++ b/screen.py @@ -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()