Add busy state, and disable buttons that usually take time during the state
This commit is contained in:
@@ -39,18 +39,18 @@ class ExtrudePanel(ScreenPanel):
|
||||
|
||||
self.distance = int(self.distances[1])
|
||||
self.speed = int(self.speeds[1])
|
||||
self.labels['extrude'] = self._gtk.Button("extrude", _("Extrude"), "color4")
|
||||
self.labels['extrude'].connect("clicked", self.extrude, "+")
|
||||
self.labels['load'] = self._gtk.Button("arrow-down", _("Load"), "color3")
|
||||
|
||||
self.labels['load'].connect("clicked", self.load_unload, "+")
|
||||
self.labels['unload'] = self._gtk.Button("arrow-up", _("Unload"), "color2")
|
||||
|
||||
self.labels['unload'].connect("clicked", self.load_unload, "-")
|
||||
self.labels['retract'] = self._gtk.Button("retract", _("Retract"), "color1")
|
||||
self.labels['retract'].connect("clicked", self.extrude, "-")
|
||||
self.labels['temperature'] = self._gtk.Button("heat-up", _("Temperature"), "color4")
|
||||
self.labels['temperature'].connect("clicked", self.menu_item_clicked, "temperature", {
|
||||
self.buttons = {
|
||||
'extrude': self._gtk.Button("extrude", _("Extrude"), "color4"),
|
||||
'load': self._gtk.Button("arrow-down", _("Load"), "color3"),
|
||||
'unload': self._gtk.Button("arrow-up", _("Unload"), "color2"),
|
||||
'retract': self._gtk.Button("retract", _("Retract"), "color1"),
|
||||
'temperature': self._gtk.Button("heat-up", _("Temperature"), "color4"),
|
||||
}
|
||||
self.buttons['extrude'].connect("clicked", self.extrude, "+")
|
||||
self.buttons['load'].connect("clicked", self.load_unload, "+")
|
||||
self.buttons['unload'].connect("clicked", self.load_unload, "-")
|
||||
self.buttons['retract'].connect("clicked", self.extrude, "-")
|
||||
self.buttons['temperature'].connect("clicked", self.menu_item_clicked, "temperature", {
|
||||
"name": "Temperature",
|
||||
"panel": "temperature"
|
||||
})
|
||||
@@ -70,7 +70,7 @@ class ExtrudePanel(ScreenPanel):
|
||||
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
|
||||
i += 1
|
||||
if i < (limit - 1):
|
||||
extgrid.attach(self.labels['temperature'], i + 1, 0, 1, 1)
|
||||
extgrid.attach(self.buttons['temperature'], i + 1, 0, 1, 1)
|
||||
|
||||
distgrid = Gtk.Grid()
|
||||
for j, i in enumerate(self.distances):
|
||||
@@ -152,28 +152,39 @@ class ExtrudePanel(ScreenPanel):
|
||||
grid.attach(extgrid, 0, 0, 4, 1)
|
||||
|
||||
if self._screen.vertical_mode:
|
||||
grid.attach(self.labels['extrude'], 0, 1, 2, 1)
|
||||
grid.attach(self.labels['retract'], 2, 1, 2, 1)
|
||||
grid.attach(self.labels['load'], 0, 2, 2, 1)
|
||||
grid.attach(self.labels['unload'], 2, 2, 2, 1)
|
||||
grid.attach(self.buttons['extrude'], 0, 1, 2, 1)
|
||||
grid.attach(self.buttons['retract'], 2, 1, 2, 1)
|
||||
grid.attach(self.buttons['load'], 0, 2, 2, 1)
|
||||
grid.attach(self.buttons['unload'], 2, 2, 2, 1)
|
||||
grid.attach(distbox, 0, 3, 4, 1)
|
||||
grid.attach(speedbox, 0, 4, 4, 1)
|
||||
grid.attach(sensors, 0, 5, 4, 1)
|
||||
else:
|
||||
grid.attach(self.labels['extrude'], 0, 2, 1, 1)
|
||||
grid.attach(self.labels['load'], 1, 2, 1, 1)
|
||||
grid.attach(self.labels['unload'], 2, 2, 1, 1)
|
||||
grid.attach(self.labels['retract'], 3, 2, 1, 1)
|
||||
grid.attach(self.buttons['extrude'], 0, 2, 1, 1)
|
||||
grid.attach(self.buttons['load'], 1, 2, 1, 1)
|
||||
grid.attach(self.buttons['unload'], 2, 2, 1, 1)
|
||||
grid.attach(self.buttons['retract'], 3, 2, 1, 1)
|
||||
grid.attach(distbox, 0, 3, 2, 1)
|
||||
grid.attach(speedbox, 2, 3, 2, 1)
|
||||
grid.attach(sensors, 0, 4, 4, 1)
|
||||
|
||||
self.content.add(grid)
|
||||
|
||||
def activate(self):
|
||||
self.process_busy(self._printer.busy)
|
||||
|
||||
def process_busy(self, busy):
|
||||
for button in self.buttons:
|
||||
if button == "temperature":
|
||||
continue
|
||||
self.buttons[button].set_sensitive((not busy))
|
||||
|
||||
def process_update(self, action, data):
|
||||
if action == "notify_busy":
|
||||
self.process_busy(data)
|
||||
return
|
||||
if action != "notify_status_update":
|
||||
return
|
||||
|
||||
for x in self._printer.get_tools():
|
||||
self.update_temp(
|
||||
x,
|
||||
|
Reference in New Issue
Block a user