mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 21:27:50 -06:00
Add default if group_name is not set.
Otherwise we get a crash. CURA-6153
This commit is contained in:
parent
4aaeb8c2d5
commit
5600d5407c
2 changed files with 3 additions and 3 deletions
|
@ -52,14 +52,14 @@ class MachineManagementModel(ListModel):
|
||||||
"um_network_key": "*",
|
"um_network_key": "*",
|
||||||
"hidden": "False"}
|
"hidden": "False"}
|
||||||
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
|
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
|
||||||
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("group_name"))
|
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("group_name", ""))
|
||||||
|
|
||||||
for container in self._network_container_stacks:
|
for container in self._network_container_stacks:
|
||||||
metadata = container.getMetaData().copy()
|
metadata = container.getMetaData().copy()
|
||||||
if container.getBottom():
|
if container.getBottom():
|
||||||
metadata["definition_name"] = container.getBottom().getName()
|
metadata["definition_name"] = container.getBottom().getName()
|
||||||
|
|
||||||
items.append({"name": metadata["group_name"],
|
items.append({"name": metadata.get("group_name", ""),
|
||||||
"id": container.getId(),
|
"id": container.getId(),
|
||||||
"metadata": metadata,
|
"metadata": metadata,
|
||||||
"group": catalog.i18nc("@info:title", "Network enabled printers")})
|
"group": catalog.i18nc("@info:title", "Network enabled printers")})
|
||||||
|
|
|
@ -1456,7 +1456,7 @@ class MachineManager(QObject):
|
||||||
# then all the container stacks are updated, both the current and the hidden ones.
|
# then all the container stacks are updated, both the current and the hidden ones.
|
||||||
def checkCorrectGroupName(self, device_id: str, group_name: str) -> None:
|
def checkCorrectGroupName(self, device_id: str, group_name: str) -> None:
|
||||||
if self._global_container_stack and device_id == self.activeMachineNetworkKey():
|
if self._global_container_stack and device_id == self.activeMachineNetworkKey():
|
||||||
# Check if the connect_group_name is correct. If not, update all the containers connected to the same printer
|
# Check if the group_name is correct. If not, update all the containers connected to the same printer
|
||||||
if self.activeMachineNetworkGroupName != group_name:
|
if self.activeMachineNetworkGroupName != group_name:
|
||||||
metadata_filter = {"um_network_key": self.activeMachineNetworkKey()}
|
metadata_filter = {"um_network_key": self.activeMachineNetworkKey()}
|
||||||
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue