diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 0a94a228c7..0b0b4a5bf0 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -301,7 +301,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._onRemoveDevice(instance_name) self._onAddDevice(instance_name, address, properties) - if device: + if device and address in self._manual_instances: + self.getOutputDeviceManager().addOutputDevice(device) self.addManualDeviceSignal.emit(self.getPluginId(), device.getId(), address, properties) def _onRemoveDevice(self, device_id): diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index cd13743cd7..c09abac863 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -22,47 +22,6 @@ Item property bool hasSentRequest: false property bool haveConnection: false - Timer - { - id: tempTimerButton - - interval: 1200 - running: false - repeat: false - onTriggered: - { - hasPushedAdd = true - tempTimerRequest.running = true - } - } - // TODO: Remove timers after review interface! - - Timer - { - id: tempTimerRequest - - interval: 1200 - running: false - repeat: false - onTriggered: - { - hasSentRequest = true - tempTimerConnection.running = true - } - } - // TODO: Remove timers after review interface! - - Timer - { - id: tempTimerConnection - - interval: 1200 - running: false - repeat: false - onTriggered: haveConnection = true - } - // TODO: Remove timers after review interface! - Label { id: titleLabel @@ -141,14 +100,9 @@ Item text: catalog.i18nc("@button", "Add") onClicked: { - // TEMP: Simulate successfull connection to printer with 127.0.0.1 or unsuccessful with anything else - // TODO, alter after review interface, now it just starts the timers. - if (hostnameField.text.trim() != "") { addPrinterByIpScreen.hasPushedAdd = true - tempTimerRequest.running = true - UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text) } } @@ -203,13 +157,13 @@ Item columns: 2 columnSpacing: 20 - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } Label { id: typeText; font: UM.Theme.getFont("default"); text: "?" } - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } Connections @@ -230,6 +184,7 @@ Item onManualDeviceChanged: { printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") + addPrinterByIpScreen.haveConnection = true } } } @@ -260,7 +215,15 @@ Item text: catalog.i18nc("@button", "Connect") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() + onClicked: + { + Cura.MachineManager.addMachine( + UM.OutputDeviceManager.manualDeviceProperty("printer_type"), + UM.OutputDeviceManager.manualDeviceProperty("name") + ) + UM.OutputDeviceManager.setActiveDevice(UM.OutputDeviceManager.manualDeviceProperty("device_id")) + base.showNextPage() + } enabled: addPrinterByIpScreen.haveConnection }