From 954fdb20ad0eddef7b216642924b5f47471ab09d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 31 Jan 2019 20:21:42 +0100 Subject: [PATCH] Rename 'connect_group_name' to 'group_name'. [CURA-6153] --- cura/GlobalStacksModel.py | 2 +- cura/Machines/Models/MachineManagementModel.py | 4 ++-- cura/Settings/MachineManager.py | 8 ++++---- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 +- plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py | 10 +++++----- resources/qml/Menus/NetworkPrinterMenu.qml | 4 ++-- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cura/GlobalStacksModel.py b/cura/GlobalStacksModel.py index 406e7b6bb3..72144140b2 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/GlobalStacksModel.py @@ -54,7 +54,7 @@ class GlobalStacksModel(ListModel): continue # TODO: Remove reference to connect group name. - items.append({"name": container_stack.getMetaDataEntry("connect_group_name", container_stack.getName()), + items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()), "id": container_stack.getId(), "hasRemoteConnection": has_remote_connection, "metadata": container_stack.getMetaData().copy()}) diff --git a/cura/Machines/Models/MachineManagementModel.py b/cura/Machines/Models/MachineManagementModel.py index 7dc51f07f7..36f324dab7 100644 --- a/cura/Machines/Models/MachineManagementModel.py +++ b/cura/Machines/Models/MachineManagementModel.py @@ -52,14 +52,14 @@ class MachineManagementModel(ListModel): "um_network_key": "*", "hidden": "False"} self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers) - self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name")) + self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("group_name")) for container in self._network_container_stacks: metadata = container.getMetaData().copy() if container.getBottom(): metadata["definition_name"] = container.getBottom().getName() - items.append({"name": metadata["connect_group_name"], + items.append({"name": metadata["group_name"], "id": container.getId(), "metadata": metadata, "group": catalog.i18nc("@info:title", "Network enabled printers")}) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 5684e8d847..b3bf3982e4 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -512,7 +512,7 @@ class MachineManager(QObject): @pyqtProperty(str, notify = globalContainerChanged) def activeMachineName(self) -> str: if self._global_container_stack: - return self._global_container_stack.getMetaDataEntry("connect_group_name", self._global_container_stack.getName()) + return self._global_container_stack.getMetaDataEntry("group_name", self._global_container_stack.getName()) return "" @pyqtProperty(str, notify = globalContainerChanged) @@ -558,7 +558,7 @@ class MachineManager(QObject): @pyqtProperty(str, notify = printerConnectedStatusChanged) def activeMachineNetworkGroupName(self) -> str: if self._global_container_stack: - return self._global_container_stack.getMetaDataEntry("connect_group_name", "") + return self._global_container_stack.getMetaDataEntry("group_name", "") return "" @pyqtProperty(QObject, notify = globalContainerChanged) @@ -1350,7 +1350,7 @@ class MachineManager(QObject): if not new_machine: return new_machine.setMetaDataEntry("um_network_key", self.activeMachineNetworkKey()) - new_machine.setMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName) + new_machine.setMetaDataEntry("group_name", self.activeMachineNetworkGroupName) new_machine.setMetaDataEntry("hidden", False) new_machine.setMetaDataEntry("connection_type", self._global_container_stack.getMetaDataEntry("connection_type")) else: @@ -1420,7 +1420,7 @@ class MachineManager(QObject): metadata_filter = {"um_network_key": self.activeMachineNetworkKey()} containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter) for container in containers: - container.setMetaDataEntry("connect_group_name", group_name) + container.setMetaDataEntry("group_name", group_name) ## This method checks if there is an instance connected to the given network_key def existNetworkInstances(self, network_key: str) -> bool: diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 55296979b5..bf190f7e39 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -500,7 +500,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): is_printer_group = False if machine_conflict: - group_name = existing_global_stack.getMetaDataEntry("connect_group_name") + group_name = existing_global_stack.getMetaDataEntry("group_name") if group_name is not None: is_printer_group = True machine_name = group_name diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index 7072aef4cc..ecc89b3948 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -106,13 +106,13 @@ class DiscoverUM3Action(MachineAction): global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() if global_container_stack: meta_data = global_container_stack.getMetaData() - if "connect_group_name" in meta_data: - previous_connect_group_name = meta_data["connect_group_name"] - global_container_stack.setMetaDataEntry("connect_group_name", group_name) + if "group_name" in meta_data: + previous_connect_group_name = meta_data["group_name"] + global_container_stack.setMetaDataEntry("group_name", group_name) # Find all the places where there is the same group name and change it accordingly - CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connect_group_name", value = previous_connect_group_name, new_value = group_name) + CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "group_name", value = previous_connect_group_name, new_value = group_name) else: - global_container_stack.setMetaDataEntry("connect_group_name", group_name) + global_container_stack.setMetaDataEntry("group_name", group_name) # Set the default value for "hidden", which is used when you have a group with multiple types of printers global_container_stack.setMetaDataEntry("hidden", False) diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml index 41f3054e92..845159f3b2 100644 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ b/resources/qml/Menus/NetworkPrinterMenu.qml @@ -14,9 +14,9 @@ Instantiator { property string connectGroupName: { - if("connect_group_name" in model.metadata) + if("group_name" in model.metadata) { - return model.metadata["connect_group_name"] + return model.metadata["group_name"] } return "" } diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 5fd3515cd3..49d9d31f2b 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -38,7 +38,7 @@ ListView var result = Cura.MachineManager.activeMachineId == model.id if (Cura.MachineManager.activeMachineHasRemoteConnection) { - result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["group_name"] } return result }