Change how panel subscriptions work
This commit is contained in:
parent
62b65ba4d2
commit
54c47554d2
@ -168,5 +168,4 @@ class BedLevelPanel(ScreenPanel):
|
||||
|
||||
def screws_tilt_calculate(self, widget):
|
||||
self.response_count = 0
|
||||
self._screen.add_subscription(self.panel_name)
|
||||
self._screen._ws.klippy.gcode_script("SCREWS_TILT_CALCULATE")
|
||||
|
@ -56,7 +56,6 @@ class BedMeshPanel(ScreenPanel):
|
||||
|
||||
self.labels['main_box'] = box
|
||||
self.content.add(self.labels['main_box'])
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def activate(self):
|
||||
for child in self.content.get_children():
|
||||
|
@ -69,7 +69,6 @@ class ConsolePanel(ScreenPanel):
|
||||
vbox.add(sw)
|
||||
vbox.pack_end(ebox, False, 0, 0)
|
||||
self.content.add(vbox)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def add_gcode(self, type, time, message):
|
||||
if type == "command":
|
||||
|
@ -112,7 +112,6 @@ class ExtrudePanel(ScreenPanel):
|
||||
grid.attach(speedbox, 2, 2, 2, 1)
|
||||
|
||||
self.content.add(grid)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
|
@ -38,8 +38,6 @@ class FanPanel(ScreenPanel):
|
||||
|
||||
self.content.add(box)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, action, data):
|
||||
if (action != "notify_status_update"):
|
||||
return
|
||||
|
@ -118,7 +118,6 @@ class FineTunePanel(ScreenPanel):
|
||||
|
||||
# self.panel = grid
|
||||
self.content.add(grid)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, action, data):
|
||||
_ = self.lang.gettext
|
||||
|
@ -203,8 +203,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
|
||||
self.grid = grid
|
||||
self.content.add(grid)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
self._screen.wake_screen()
|
||||
|
||||
def on_draw(self, da, ctx):
|
||||
|
@ -68,8 +68,6 @@ class MainPanel(MenuPanel):
|
||||
self.content.add(self.grid)
|
||||
self.layout.show_all()
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def activate(self):
|
||||
return
|
||||
|
||||
|
@ -89,7 +89,6 @@ class MovePanel(ScreenPanel):
|
||||
grid.attach(box, 0, 2, 4, 1)
|
||||
|
||||
self.content.add(grid)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
|
@ -33,8 +33,6 @@ class PowerPanel(ScreenPanel):
|
||||
|
||||
self.content.add(box)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def add_device(self, device):
|
||||
frame = Gtk.Frame()
|
||||
frame.set_property("shadow-type", Gtk.ShadowType.NONE)
|
||||
|
@ -82,8 +82,6 @@ class PreheatPanel(ScreenPanel):
|
||||
|
||||
self.content.add(grid)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def activate(self):
|
||||
for x in self._printer.get_tools():
|
||||
if x not in self.active_heaters:
|
||||
|
@ -105,7 +105,6 @@ class SystemPanel(ScreenPanel):
|
||||
grid.attach(shutdown, 3, 2, 1, 1)
|
||||
|
||||
self.content.add(grid)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def activate(self):
|
||||
self.get_updates()
|
||||
|
@ -98,8 +98,6 @@ class TemperaturePanel(ScreenPanel):
|
||||
self.grid = grid
|
||||
self.content.add(grid)
|
||||
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
self.update_temp("heater_bed", 35, 40)
|
||||
|
||||
def change_temp_delta(self, widget, tempdelta):
|
||||
|
@ -80,7 +80,6 @@ class ZCalibratePanel(ScreenPanel):
|
||||
|
||||
|
||||
self.content.add(grid)
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def activate(self):
|
||||
if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz":
|
||||
|
@ -329,6 +329,7 @@ class KlipperScreen(Gtk.Window):
|
||||
|
||||
if hasattr(self.panels[panel_name], "process_update"):
|
||||
self.panels[panel_name].process_update("notify_status_update", self.printer.get_updates())
|
||||
self.add_subscription(panel_name)
|
||||
if hasattr(self.panels[panel_name], "activate"):
|
||||
self.panels[panel_name].activate()
|
||||
self.show_all()
|
||||
@ -498,6 +499,7 @@ class KlipperScreen(Gtk.Window):
|
||||
def _remove_current_panel(self, pop=True, show=True):
|
||||
if len(self._cur_panels) > 0:
|
||||
self.base_panel.remove(self.panels[self._cur_panels[-1]].get_content())
|
||||
self.remove_subscription(self._cur_panels[-1])
|
||||
if pop is True:
|
||||
self._cur_panels.pop()
|
||||
if len(self._cur_panels) > 0:
|
||||
@ -506,6 +508,7 @@ class KlipperScreen(Gtk.Window):
|
||||
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())
|
||||
self.add_subscription(self._cur_panels[-1])
|
||||
if show is True:
|
||||
self.show_all()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user