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)
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)
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.PrinterOutput.PrinterOutputDevice import ConnectionType
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.i18n import i18nCatalog

View file

@ -165,16 +165,16 @@ Item
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
height: troubleshoortingLinkIcon.height
width: troubleshoortingLinkIcon.width + troubleshoortingLabel.width + UM.Theme.getSize("default_margin").width
height: troubleshootingLinkIcon.height
width: troubleshootingLinkIcon.width + troubleshootingLabel.width + UM.Theme.getSize("default_margin").width
UM.RecolorImage
{
id: troubleshoortingLinkIcon
anchors.right: troubleshoortingLabel.left
id: troubleshootingLinkIcon
anchors.right: troubleshootingLabel.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
height: troubleshoortingLabel.height
height: troubleshootingLabel.height
width: height
sourceSize.height: width
color: UM.Theme.getColor("text_link")
@ -183,7 +183,7 @@ Item
Label
{
id: troubleshoortingLabel
id: troubleshootingLabel
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: catalog.i18nc("@label", "Troubleshooting")
@ -199,17 +199,17 @@ Item
hoverEnabled: true
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
Qt.openUrlExternally(url)
}
onEntered:
{
troubleshoortingLabel.font.underline = true
troubleshootingLabel.font.underline = true
}
onExited:
{
troubleshoortingLabel.font.underline = false
troubleshootingLabel.font.underline = false
}
}
}

View file

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