extrude: show during printing but disable buttons during printing, this allows disabling and checking the filament sensor

This commit is contained in:
alfrix authored and Alfredo Monclus committed 2023-08-18 11:48:37 -03:00
1 parent 1c06e55442
commit e3cbc1ea8c
2 files changed
+13 -6

No files matched your search

+2 -2
View File
@@ -208,9 +208,9 @@ enable: {{ (printer.pause_resume.is_paused == True) }}
[menu __print extrude]
name: {{ gettext('Extrude') }}
icon: filament
icon: extrude
panel: extrude
enable: {{ (printer.pause_resume.is_paused == True) and (printer.extruders.count > 0) }}
enable: {{ printer.extruders.count > 0 }}
[menu __print power]
name: {{ gettext('Power') }}
+11 -4
View File
@@ -161,15 +161,22 @@ class Panel(ScreenPanel):
self.content.add(grid)
def process_busy(self, busy):
def enable_buttons(self, enable):
for button in self.buttons:
if button == "temperature":
continue
self.buttons[button].set_sensitive((not busy))
self.buttons[button].set_sensitive(enable)
def activate(self):
if self._printer.state == "printing":
self.enable_buttons(False)
def process_update(self, action, data):
if action == "notify_busy":
self.process_busy(data)
if action == "notify_gcode_response":
if "action:cancel" in data or "action:paused" in data:
self.enable_buttons(True)
elif "action:resumed" in data:
self.enable_buttons(False)
return
if action != "notify_status_update":
return