diff --git a/DiscoverUM3Action.py b/DiscoverUM3Action.py index aade48e806..55afcd35fa 100644 --- a/DiscoverUM3Action.py +++ b/DiscoverUM3Action.py @@ -30,3 +30,12 @@ class DiscoverUM3Action(MachineAction): return [printers[printer] for printer in printers] else: return [] + + @pyqtSlot(str) + def setKey(self, key): + global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack: + if "key" in global_container_stack.getMetaData(): + global_container_stack.setMetaDataEntry("key", key) + else: + global_container_stack.addMetaDataEntry("key", key) diff --git a/DiscoverUM3Action.qml b/DiscoverUM3Action.qml index fcb529536e..704dcc7851 100644 --- a/DiscoverUM3Action.qml +++ b/DiscoverUM3Action.qml @@ -145,4 +145,26 @@ Cura.MachineAction } } } + Button + { + text: catalog.i18nc("@action:button", "Ok") + anchors.right: cancelButton.left + anchors.bottom: parent.bottom + onClicked: + { + manager.setKey(base.selectedPrinter.getKey()) + completed() + } + } + Button + { + id: cancelButton + text: catalog.i18nc("@action:button", "Cancel") + anchors.right: discoverUM3Action.right + anchors.bottom: parent.bottom + onClicked: + { + completed() + } + } } \ No newline at end of file diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index d243d62dcc..2d5b2f1b19 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -8,8 +8,8 @@ from UM.Message import Message from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager -from PyQt5.QtCore import QUrl, QTimer, pyqtSignal, pyqtProperty -from PyQt5.QtGui import QPixmap, QImage +from PyQt5.QtCore import QUrl, QTimer, pyqtSignal, pyqtProperty, pyqtSlot +from PyQt5.QtGui import QImage import json @@ -89,6 +89,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## Get the unique key of this machine # \return key String containing the key of the machine. + @pyqtSlot(result = str) def getKey(self): return self._key