Merge WIP_onboarding_by_ip

This commit is contained in:
Lipu Fei 2019-03-20 13:42:15 +01:00
commit a17642a5a1
4 changed files with 30 additions and 33 deletions

View file

@ -129,8 +129,8 @@ class DiscoveredPrintersModel(QObject):
@pyqtSlot(str) @pyqtSlot(str)
def createMachineFromDiscoveredPrinterAddress(self, ip_address: str) -> None: def createMachineFromDiscoveredPrinterAddress(self, ip_address: str) -> None:
if ip_address not in self._discovered_printer_dict: if ip_address not in self._discovered_printer_by_ip_dict:
Logger.log("i", "Key [%s] does not exist in the discovered printers list.", ip_address) Logger.log("i", "Key [%s] does not exist in the discovered printers list.", ip_address)
return return
self.createMachineFromDiscoveredPrinter(self._discovered_printer_dict[ip_address]) self.createMachineFromDiscoveredPrinter(self._discovered_printer_by_ip_dict[ip_address])

View file

@ -14,7 +14,6 @@ from PyQt5.QtGui import QDesktopServices
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog

View file

@ -165,16 +165,16 @@ Item
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
height: troubleshoortingLinkIcon.height height: troubleshootingLinkIcon.height
width: troubleshoortingLinkIcon.width + troubleshoortingLabel.width + UM.Theme.getSize("default_margin").width width: troubleshootingLinkIcon.width + troubleshootingLabel.width + UM.Theme.getSize("default_margin").width
UM.RecolorImage UM.RecolorImage
{ {
id: troubleshoortingLinkIcon id: troubleshootingLinkIcon
anchors.right: troubleshoortingLabel.left anchors.right: troubleshootingLabel.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
height: troubleshoortingLabel.height height: troubleshootingLabel.height
width: height width: height
sourceSize.height: width sourceSize.height: width
color: UM.Theme.getColor("text_link") color: UM.Theme.getColor("text_link")
@ -183,7 +183,7 @@ Item
Label Label
{ {
id: troubleshoortingLabel id: troubleshootingLabel
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: catalog.i18nc("@label", "Troubleshooting") text: catalog.i18nc("@label", "Troubleshooting")
@ -199,17 +199,17 @@ Item
hoverEnabled: true hoverEnabled: true
onClicked: onClicked:
{ {
// open the throubleshooting URL with web browser // open the troubleshooting URL with web browser
var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO
Qt.openUrlExternally(url) Qt.openUrlExternally(url)
} }
onEntered: onEntered:
{ {
troubleshoortingLabel.font.underline = true troubleshootingLabel.font.underline = true
} }
onExited: onExited:
{ {
troubleshoortingLabel.font.underline = false troubleshootingLabel.font.underline = false
} }
} }
} }

View file

@ -26,7 +26,7 @@ Item
{ {
id: titleLabel id: titleLabel
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 40 anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "Add printer by IP address") text: catalog.i18nc("@label", "Add printer by IP address")
@ -35,14 +35,14 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
Rectangle Item
{ {
anchors.top: titleLabel.bottom anchors.top: titleLabel.bottom
anchors.bottom: connectButton.top anchors.bottom: connectButton.top
anchors.topMargin: 40 anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.bottomMargin: 40 anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * 3 / 4 width: (parent.width * 3 / 4) | 0
Item Item
{ {
@ -54,7 +54,7 @@ Item
height: contentHeight height: contentHeight
width: parent.width width: parent.width
anchors.top: parent.top anchors.top: parent.top
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.")
@ -74,14 +74,12 @@ Item
anchors.left: parent.left anchors.left: parent.left
height: addPrinterButton.height height: addPrinterButton.height
anchors.right: addPrinterButton.left anchors.right: addPrinterButton.left
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
text: ""
validator: RegExpValidator validator: RegExpValidator
{ {
regExp: /[a-zA-Z0-9\.\-\_]*/ regExp: /[0-9\.\-\_]*/
} }
onAccepted: addPrinterButton.clicked() onAccepted: addPrinterButton.clicked()
@ -92,8 +90,8 @@ Item
id: addPrinterButton id: addPrinterButton
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
width: 140 width: UM.Theme.getSize("action_button").width
fixedWidthMode: true fixedWidthMode: true
text: catalog.i18nc("@button", "Add") text: catalog.i18nc("@button", "Add")
@ -124,13 +122,13 @@ Item
{ {
width: parent.width width: parent.width
anchors.top: userInputFields.bottom anchors.top: userInputFields.bottom
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
Label Label
{ {
id: waitResponseLabel id: waitResponseLabel
anchors.top: parent.top anchors.top: parent.top
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection } visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection }
@ -141,7 +139,7 @@ Item
{ {
id: printerInfoLabels id: printerInfoLabels
anchors.top: parent.top anchors.top: parent.top
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
visible: addPrinterByIpScreen.haveConnection visible: addPrinterByIpScreen.haveConnection
@ -158,9 +156,9 @@ Item
{ {
id: printerInfoGrid id: printerInfoGrid
anchors.top: printerNameLabel.bottom anchors.top: printerNameLabel.bottom
anchors.margins: 20 anchors.margins: UM.Theme.getSize("default_margin").width
columns: 2 columns: 2
columnSpacing: 20 columnSpacing: UM.Theme.getSize("default_margin").width
Label { 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: "?" } Label { id: typeText; font: UM.Theme.getFont("default"); text: "?" }
@ -202,9 +200,9 @@ Item
id: backButton id: backButton
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 40 anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Cancel") text: catalog.i18nc("@button", "Cancel")
width: 140 width: UM.Theme.getSize("action_button").width
fixedWidthMode: true fixedWidthMode: true
onClicked: base.gotoPage("add_printer_by_selection") onClicked: base.gotoPage("add_printer_by_selection")
@ -216,9 +214,9 @@ Item
id: connectButton id: connectButton
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 40 anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Connect") text: catalog.i18nc("@button", "Connect")
width: 140 width: UM.Theme.getSize("action_button").width
fixedWidthMode: true fixedWidthMode: true
onClicked: onClicked:
{ {