screen/panels: add action to process update
This commit is contained in:
parent
1c0e4fbf86
commit
728f9cfa0f
@ -101,7 +101,7 @@ class ExtrudePanel(ScreenPanel):
|
||||
self.panel = grid
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
for x in self._printer.get_tools():
|
||||
self.update_temp(x,
|
||||
self._printer.get_dev_stat(x,"temperature"),
|
||||
|
@ -59,8 +59,9 @@ class FanPanel(ScreenPanel):
|
||||
self.panel = grid
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, data):
|
||||
if "fan" in data and "speed" in data["fan"] and self.user_selecting == False:
|
||||
def process_update(self, action, data):
|
||||
if (action == "notify_status_update" and "fan" in data and "speed" in data["fan"] and
|
||||
self.user_selecting == False):
|
||||
self.labels["scale"].disconnect_by_func(self.select_fan_speed)
|
||||
self.labels["scale"].set_value(float(int(float(data["fan"]["speed"]) * 100)))
|
||||
self.labels["scale"].connect("value-changed", self.select_fan_speed)
|
||||
|
@ -126,9 +126,12 @@ class FineTunePanel(ScreenPanel):
|
||||
self.panel = grid
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
_ = self.lang.gettext
|
||||
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
if "gcode_move" in data:
|
||||
if "homing_origin" in data["gcode_move"]:
|
||||
self.labels['zoffset'].set_text(_("Z Offset") + ": %.2fmm" % data["gcode_move"]["homing_origin"][2])
|
||||
|
@ -145,7 +145,10 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.labels[arg].set_sensitive(False)
|
||||
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
self.update_temp("heater_bed",
|
||||
self._printer.get_dev_stat("heater_bed","temperature"),
|
||||
self._printer.get_dev_stat("heater_bed","target")
|
||||
|
@ -53,7 +53,10 @@ class MainPanel(MenuPanel):
|
||||
if dev in self.labels:
|
||||
self.labels[dev].set_label(KlippyGtk.formatTemperatureString(temp, target))
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
self.update_temp("heater_bed",
|
||||
self._printer.get_dev_stat("heater_bed","temperature"),
|
||||
self._printer.get_dev_stat("heater_bed","target")
|
||||
|
@ -103,7 +103,10 @@ class MovePanel(ScreenPanel):
|
||||
self.panel = grid
|
||||
self._screen.add_subscription(panel_name)
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
if "toolhead" in data and "position" in data["toolhead"]:
|
||||
self.labels['pos_x'].set_text("X: %.2f" % (data["toolhead"]["position"][0]))
|
||||
self.labels['pos_y'].set_text("Y: %.2f" % (data["toolhead"]["position"][1]))
|
||||
|
@ -109,7 +109,10 @@ class PreheatPanel(ScreenPanel):
|
||||
self.preheat_options[setting]["extruder"])
|
||||
self._printer.set_dev_stat(heater,"target", int(self.preheat_options[setting]["extruder"]))
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
self.update_temp("heater_bed",
|
||||
self._printer.get_dev_stat("heater_bed","temperature"),
|
||||
self._printer.get_dev_stat("heater_bed","target")
|
||||
|
@ -182,7 +182,10 @@ class TemperaturePanel(ScreenPanel):
|
||||
self.labels['entry'].set_text("")
|
||||
logging.info("### Active heater " + self.active_heater)
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
self.update_temp("heater_bed",
|
||||
self._printer.get_dev_stat("heater_bed","temperature"),
|
||||
self._printer.get_dev_stat("heater_bed","target")
|
||||
|
@ -88,7 +88,10 @@ class ZCalibratePanel(ScreenPanel):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_CALIBRATE)
|
||||
|
||||
def process_update(self, data):
|
||||
def process_update(self, action, data):
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
if "toolhead" in data and "position" in data['toolhead']:
|
||||
self.updatePosition(data['toolhead']['position'])
|
||||
|
||||
|
@ -165,7 +165,7 @@ class KlipperScreen(Gtk.Window):
|
||||
return
|
||||
|
||||
if hasattr(self.panels[panel_name],"process_update"):
|
||||
self.panels[panel_name].process_update(self.printer.get_data())
|
||||
self.panels[panel_name].process_update("notify_status_update", self.printer.get_data())
|
||||
|
||||
if hasattr(self.panels[panel_name],"activate"):
|
||||
self.panels[panel_name].activate()
|
||||
@ -330,7 +330,7 @@ class KlipperScreen(Gtk.Window):
|
||||
logger.debug(json.dumps([action, data], indent=2))
|
||||
|
||||
for sub in self.subscriptions:
|
||||
self.panels[sub].process_update(data)
|
||||
self.panels[sub].process_update(action, data)
|
||||
|
||||
def _confirm_send_action(self, widget, text, method, params):
|
||||
_ = self.lang.gettext
|
||||
|
Loading…
x
Reference in New Issue
Block a user