Move existNetworkInstances into discover action

This commit is contained in:
Jaime van Kessel 2019-04-05 17:49:29 +02:00
parent 5b818d203a
commit fe14024620
2 changed files with 3 additions and 8 deletions

View File

@ -1455,13 +1455,6 @@ class MachineManager(QObject):
if self.hasUserSettings and self._application.getPreferences().getValue("cura/active_mode") == 1: if self.hasUserSettings and self._application.getPreferences().getValue("cura/active_mode") == 1:
self._application.discardOrKeepProfileChanges() self._application.discardOrKeepProfileChanges()
## This method checks if there is an instance connected to the given network_key
def existNetworkInstances(self, network_key: str) -> bool:
metadata_filter = {"um_network_key": network_key}
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
return bool(containers)
@pyqtSlot("QVariant") @pyqtSlot("QVariant")
def setGlobalVariant(self, container_node: "ContainerNode") -> None: def setGlobalVariant(self, container_node: "ContainerNode") -> None:
self.blurSettings.emit() self.blurSettings.emit()

View File

@ -157,7 +157,9 @@ class DiscoverUM3Action(MachineAction):
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def existsKey(self, key: str) -> bool: def existsKey(self, key: str) -> bool:
return CuraApplication.getInstance().getMachineManager().existNetworkInstances(network_key = key) metadata_filter = {"um_network_key": key}
containers = CuraContainerRegistry.getInstance().findContainerStacks(type="machine", **metadata_filter)
return bool(containers)
@pyqtSlot() @pyqtSlot()
def loadConfigurationFromPrinter(self) -> None: def loadConfigurationFromPrinter(self) -> None: