diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9ae43d4ee9..1192455312 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -114,7 +114,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.ObjectsModel import ObjectsModel -from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrinterModel +from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage @@ -212,7 +212,7 @@ class CuraApplication(QtApplication): self._cura_scene_controller = None self._machine_error_checker = None - self._discovered_printer_model = DiscoveredPrinterModel(self) + self._discovered_printer_model = DiscoveredPrintersModel(self) self._welcome_pages_model = WelcomePagesModel(self) @@ -851,7 +851,7 @@ class CuraApplication(QtApplication): self.closeSplash() @pyqtSlot(result = QObject) - def getDiscoveredPrinterModel(self, *args) -> "DiscoveredPrinterModel": + def getDiscoveredPrintersModel(self, *args) -> "DiscoveredPrintersModel": return self._discovered_printer_model @pyqtSlot(result = QObject) @@ -1011,7 +1011,7 @@ class CuraApplication(QtApplication): qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel") qmlRegisterType(MachineManagementModel, "Cura", 1, 0, "MachineManagementModel") - qmlRegisterType(DiscoveredPrinterModel, "Cura", 1, 0, "DiscoveredPrinterModel") + qmlRegisterType(DiscoveredPrintersModel, "Cura", 1, 0, "DiscoveredPrintersModel") qmlRegisterSingletonType(QualityProfilesDropDownMenuModel, "Cura", 1, 0, "QualityProfilesDropDownMenuModel", self.getQualityProfilesDropDownMenuModel) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index bb99f9badd..7897556f5b 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -72,7 +72,7 @@ class DiscoveredPrinter(QObject): # to add networked printers (Plugin finds a bunch of printers, user can select one from the list, plugin can then # add that printer to Cura as the active one). # -class DiscoveredPrinterModel(QObject): +class DiscoveredPrintersModel(QObject): def __init__(self, parent: Optional["QObject"]) -> None: super().__init__(parent) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 06632a17ae..1d97127637 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -632,9 +632,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateName(data["friendly_name"]) printer.updateKey(data["uuid"]) printer.updateType(data["machine_variant"]) - self._application.getDiscoveredPrinterModel().updateDiscoveredPrinter(data["ip_address"], - name = data["friendly_name"], - machine_type = data["machine_variant"]) + self._application.getDiscoveredPrintersModel().updateDiscoveredPrinter(data["ip_address"], + name = data["friendly_name"], + machine_type = data["machine_variant"]) # Do not store the build plate information that comes from connect if the current printer has not build plate information if "build_plate" in data and machine_definition.getMetaDataEntry("has_variant_buildplates", False): diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 5c2ed27543..2abd2f15c3 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -315,7 +315,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): except TypeError: # Disconnect already happened. pass - self._application.getDiscoveredPrinterModel().removeDiscoveredPrinter(device.getId()) + self._application.getDiscoveredPrintersModel().removeDiscoveredPrinter(device.address) self.discoveredDevicesChanged.emit() def _onAddDevice(self, name, address, properties): @@ -340,7 +340,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties) else: device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties) - self._application.getDiscoveredPrinterModel().addDiscoveredPrinter(address, device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8"), device) + self._application.getDiscoveredPrintersModel().addDiscoveredPrinter(address, device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8"), device) self._discovered_devices[device.getId()] = device self.discoveredDevicesChanged.emit() diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 9066c4f5fc..a9530d9a43 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -69,7 +69,7 @@ Item { id: networkPrinterListView anchors.fill: parent - model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + model: CuraApplication.getDiscoveredPrintersModel().discovered_printers //visible: base.visible && model.length > 0 delegate: MachineSelectorButton diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index b038be93e2..3282b219c9 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -62,7 +62,7 @@ Item onRefreshButtonClicked: { - UM.OutputDeviceManager.refreshConnections() + UM.OutputDeviceManager.startDiscovery() } onAddByIpButtonClicked: @@ -136,7 +136,7 @@ Item { // Create a network printer const networkPrinterItem = addNetworkPrinterDropDown.contentItem.currentItem - CuraApplication.getDiscoveredPrinterModel().createMachineFromDiscoveredPrinter(networkPrinterItem) + CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinter(networkPrinterItem) } else {