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

This commit is contained in:
alfrix 2023-08-12 02:07:38 -03:00 committed by Alfredo Monclus
parent 1c06e55442
commit e3cbc1ea8c
2 changed files with 13 additions and 6 deletions

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') }}

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