Printer can now actually be linked

CURA-336
This commit is contained in:
Jaime van Kessel 2016-06-23 16:15:56 +02:00
parent 3b51c31772
commit bb9d3a47ef
3 changed files with 34 additions and 2 deletions

View file

@ -30,3 +30,12 @@ class DiscoverUM3Action(MachineAction):
return [printers[printer] for printer in printers] return [printers[printer] for printer in printers]
else: else:
return [] 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)

View file

@ -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()
}
}
} }

View file

@ -8,8 +8,8 @@ from UM.Message import Message
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager
from PyQt5.QtCore import QUrl, QTimer, pyqtSignal, pyqtProperty from PyQt5.QtCore import QUrl, QTimer, pyqtSignal, pyqtProperty, pyqtSlot
from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtGui import QImage
import json import json
@ -89,6 +89,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
## Get the unique key of this machine ## Get the unique key of this machine
# \return key String containing the key of the machine. # \return key String containing the key of the machine.
@pyqtSlot(result = str)
def getKey(self): def getKey(self):
return self._key return self._key