mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
When an printer gets added / removed, this is now correctly shown
CL-541
This commit is contained in:
parent
339d7ca4c9
commit
1c1c195b93
3 changed files with 23 additions and 3 deletions
|
@ -268,6 +268,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
return
|
return
|
||||||
printer_list_changed = False
|
printer_list_changed = False
|
||||||
# TODO: Ensure that printers that have been removed are also removed locally.
|
# TODO: Ensure that printers that have been removed are also removed locally.
|
||||||
|
|
||||||
|
printers_seen = []
|
||||||
|
|
||||||
for printer_data in result:
|
for printer_data in result:
|
||||||
uuid = printer_data["uuid"]
|
uuid = printer_data["uuid"]
|
||||||
|
|
||||||
|
@ -282,6 +285,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
self._printers.append(printer)
|
self._printers.append(printer)
|
||||||
printer_list_changed = True
|
printer_list_changed = True
|
||||||
|
|
||||||
|
printers_seen.append(printer)
|
||||||
|
|
||||||
printer.updateName(printer_data["friendly_name"])
|
printer.updateName(printer_data["friendly_name"])
|
||||||
printer.updateKey(uuid)
|
printer.updateKey(uuid)
|
||||||
printer.updateType(printer_data["machine_variant"])
|
printer.updateType(printer_data["machine_variant"])
|
||||||
|
@ -292,7 +297,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
for index in range(0, self._number_of_extruders):
|
for index in range(0, self._number_of_extruders):
|
||||||
extruder = printer.extruders[index]
|
extruder = printer.extruders[index]
|
||||||
extruder_data = printer_data["configuration"][index]
|
try:
|
||||||
|
extruder_data = printer_data["configuration"][index]
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
hotend_id = extruder_data["print_core_id"]
|
hotend_id = extruder_data["print_core_id"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -322,6 +331,14 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
color = color,
|
color = color,
|
||||||
name = name)
|
name = name)
|
||||||
extruder.updateActiveMaterial(material)
|
extruder.updateActiveMaterial(material)
|
||||||
|
removed_printers = [printer for printer in self._printers if printer not in printers_seen]
|
||||||
|
|
||||||
|
for removed_printer in removed_printers:
|
||||||
|
self._printers.remove(removed_printer)
|
||||||
|
printer_list_changed = True
|
||||||
|
if self._active_printer == removed_printer:
|
||||||
|
self._active_printer = None
|
||||||
|
self.activePrinterChanged.emit()
|
||||||
|
|
||||||
if printer_list_changed:
|
if printer_list_changed:
|
||||||
self.printersChanged.emit()
|
self.printersChanged.emit()
|
||||||
|
|
|
@ -15,7 +15,7 @@ Item
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: materialLabel
|
id: materialLabel
|
||||||
text: printCoreConfiguration.activeMaterial.name
|
text: printCoreConfiguration.activeMaterial != null ? printCoreConfiguration.activeMaterial.name : ""
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
font: UM.Theme.getFont("very_small")
|
font: UM.Theme.getFont("very_small")
|
||||||
|
|
|
@ -82,7 +82,10 @@ Item
|
||||||
case "error":
|
case "error":
|
||||||
return UM.Theme.getColor("status_stopped");
|
return UM.Theme.getColor("status_stopped");
|
||||||
}
|
}
|
||||||
|
if(base.activePrintJob == null)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("text");
|
||||||
|
}
|
||||||
switch(base.activePrintJob.state)
|
switch(base.activePrintJob.state)
|
||||||
{
|
{
|
||||||
case "printing":
|
case "printing":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue