Fix merge conflicts

This commit is contained in:
Lipu Fei 2019-03-22 14:28:23 +01:00
commit ec0b197b6e
9 changed files with 159 additions and 102 deletions

View file

@ -259,22 +259,26 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
def _onNetworkRequestFinished(self, reply: "QNetworkReply") -> None: def _onNetworkRequestFinished(self, reply: "QNetworkReply") -> None:
reply_url = reply.url().toString() reply_url = reply.url().toString()
address = "" address = reply.url().host()
device = None device = None
properties = {} # type: Dict[bytes, bytes] properties = {} # type: Dict[bytes, bytes]
if "system" in reply_url:
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200: if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
# Something went wrong with checking the firmware version! # Either:
# - Something went wrong with checking the firmware version!
# - Something went wrong with checking the amount of printers the cluster has!
# - Couldn't find printer at the address when trying to add it manually.
if address in self._manual_instances:
self.removeManualDeviceSignal.emit(self.getPluginId(), "", address)
return return
if "system" in reply_url:
try: try:
system_info = json.loads(bytes(reply.readAll()).decode("utf-8")) system_info = json.loads(bytes(reply.readAll()).decode("utf-8"))
except: except:
Logger.log("e", "Something went wrong converting the JSON.") Logger.log("e", "Something went wrong converting the JSON.")
return return
address = reply.url().host()
has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version
instance_name = "manual:%s" % address instance_name = "manual:%s" % address
properties = { properties = {
@ -302,16 +306,12 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._network_manager.get(cluster_request) self._network_manager.get(cluster_request)
elif "printers" in reply_url: elif "printers" in reply_url:
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
# Something went wrong with checking the amount of printers the cluster has!
return
# So we confirmed that the device is in fact a cluster printer, and we should now know how big it is. # So we confirmed that the device is in fact a cluster printer, and we should now know how big it is.
try: try:
cluster_printers_list = json.loads(bytes(reply.readAll()).decode("utf-8")) cluster_printers_list = json.loads(bytes(reply.readAll()).decode("utf-8"))
except: except:
Logger.log("e", "Something went wrong converting the JSON.") Logger.log("e", "Something went wrong converting the JSON.")
return return
address = reply.url().host()
instance_name = "manual:%s" % address instance_name = "manual:%s" % address
if instance_name in self._discovered_devices: if instance_name in self._discovered_devices:
device = self._discovered_devices[instance_name] device = self._discovered_devices[instance_name]

View file

@ -22,6 +22,8 @@ Item
property bool hasSentRequest: false property bool hasSentRequest: false
// Whether the IP address user entered can be resolved as a recognizable printer. // Whether the IP address user entered can be resolved as a recognizable printer.
property bool haveConnection: false property bool haveConnection: false
// True when a request comes back, but the device hasn't responded.
property bool deviceUnresponsive: false
Label Label
{ {
@ -77,12 +79,14 @@ Item
anchors.right: addPrinterButton.left anchors.right: addPrinterButton.left
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
selectByMouse: true
validator: RegExpValidator validator: RegExpValidator
{ {
regExp: /[a-fA-F0-9\.\:]*/ regExp: /[a-fA-F0-9\.\:]*/
} }
enabled: { ! (addPrinterByIpScreen.hasSentRequest || addPrinterByIpScreen.haveConnection) }
onAccepted: addPrinterButton.clicked() onAccepted: addPrinterButton.clicked()
} }
@ -101,6 +105,7 @@ Item
if (hostnameField.text.trim() != "") if (hostnameField.text.trim() != "")
{ {
enabled = false; enabled = false;
addPrinterByIpScreen.deviceUnresponsive = false;
UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text); UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text);
} }
} }
@ -115,6 +120,12 @@ Item
! addPrinterByIpScreen.haveConnection ! addPrinterByIpScreen.haveConnection
} }
} }
Connections
{
target: UM.OutputDeviceManager
onManualDeviceChanged: { addPrinterButton.enabled = ! UM.OutputDeviceManager.hasManualDevice }
}
} }
} }
@ -131,8 +142,22 @@ Item
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection } visible:
text: catalog.i18nc("@label", "The printer at this address has not responded yet.") {
(addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection)
|| addPrinterByIpScreen.deviceUnresponsive
}
text:
{
if (addPrinterByIpScreen.deviceUnresponsive)
{
catalog.i18nc("@label", "Could not connect to device.")
}
else
{
catalog.i18nc("@label", "The printer at this address has not responded yet.")
}
}
} }
Item Item
@ -141,7 +166,7 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
visible: addPrinterByIpScreen.haveConnection visible: addPrinterByIpScreen.haveConnection && ! addPrinterByIpScreen.deviceUnresponsive
Label Label
{ {
@ -173,11 +198,20 @@ Item
{ {
target: UM.OutputDeviceManager target: UM.OutputDeviceManager
onManualDeviceChanged: onManualDeviceChanged:
{
if (UM.OutputDeviceManager.hasManualDevice)
{ {
typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type") typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type")
firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version") firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version")
addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address") addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address")
} }
else
{
typeText.text = ""
firmwareText.text = ""
addressText.text = ""
}
}
} }
} }
@ -185,10 +219,19 @@ Item
{ {
target: UM.OutputDeviceManager target: UM.OutputDeviceManager
onManualDeviceChanged: onManualDeviceChanged:
{
if (UM.OutputDeviceManager.hasManualDevice)
{ {
printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name")
addPrinterByIpScreen.haveConnection = true addPrinterByIpScreen.haveConnection = true
} }
else
{
addPrinterByIpScreen.hasSentRequest = false
addPrinterByIpScreen.haveConnection = false
addPrinterByIpScreen.deviceUnresponsive = true
}
}
} }
} }
} }

View file

@ -120,18 +120,24 @@ Item
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
} }
Cura.SecondaryButton Label
{ {
id: signInButton id: signInButton
anchors.left: createAccountButton.right anchors.left: createAccountButton.right
anchors.verticalCenter: finishButton.verticalCenter anchors.verticalCenter: finishButton.verticalCenter
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
text: catalog.i18nc("@button", "Sign in") text: catalog.i18nc("@button", "Sign in")
width: UM.Theme.getSize("welcome_pages_button").width color: UM.Theme.getColor("secondary_button_text")
shadowEnabled: false font: UM.Theme.getFont("medium")
color: "transparent" renderType: Text.NativeRendering
hoverColor: "transparent"
textHoverColor: UM.Theme.getColor("primary") MouseArea
fixedWidthMode: true {
anchors.fill: parent
hoverEnabled: true
onClicked: Cura.API.account.login() onClicked: Cura.API.account.login()
onEntered: parent.font.underline = true
onExited: parent.font.underline = false
}
} }
} }

View file

@ -28,13 +28,21 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
// Area where the cloud contents can be put. Pictures, texts and such.
Item
{
id: contentsArea
anchors.top: titleLabel.bottom
anchors.bottom: getStartedButton.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
Column Column
{ {
anchors.top: titleLabel.bottom anchors.centerIn: parent
anchors.topMargin: 80
anchors.horizontalCenter: parent.horizontalCenter
spacing: 60 spacing: UM.Theme.getSize("welcome_pages_default_margin").height
Image Image
{ {
@ -54,6 +62,7 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
} }
}
Cura.PrimaryButton Cura.PrimaryButton
{ {

View file

@ -74,7 +74,9 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 1 // Keep a small margin with the Rectangle container so its content will not overlap with the Rectangle
// border.
anchors.margins: UM.Theme.getSize("default_lining").width
sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent
} }

View file

@ -39,7 +39,8 @@ Item
{ {
currentStep++ currentStep++
} }
else { else
{
passLastPage() passLastPage()
} }
} }
@ -69,10 +70,6 @@ Item
{ {
currentStep = page_index currentStep = page_index
} }
else
{
console.log("Error: cannot find page with page_id = [", page_id, "]")
}
} }
onVisibleChanged: onVisibleChanged:

View file

@ -12,23 +12,13 @@ import Cura 1.1 as Cura
// //
Item Item
{ {
Column
{
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 20
UM.I18nCatalog { id: catalog; name: "cura" } UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 40
// Placeholder
Label { text: " " }
Label Label
{ {
id: titleLabel id: titleLabel
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "User Agreement") text: catalog.i18nc("@label", "User Agreement")
@ -37,11 +27,22 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
Item // Area for pictures and texts
{
anchors.top: titleLabel.bottom
anchors.bottom: agreeButton.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
Label Label
{ {
width: parent.width * 2 / 3
id: disclaimerLineLabel id: disclaimerLineLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.centerIn: parent
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
width: (parent.width * 2 / 3) | 0
text: "<p><b>Disclaimer by Ultimaker</b></p>" text: "<p><b>Disclaimer by Ultimaker</b></p>"
+ "<p>Please read this disclaimer carefully.</p>" + "<p>Please read this disclaimer carefully.</p>"
+ "<p>Except when otherwise stated in writing, Ultimaker provides any Ultimaker software or third party software \"As is\" without warranty of any kind. The entire risk as to the quality and perfoemance of Ultimaker software is with you.</p>" + "<p>Except when otherwise stated in writing, Ultimaker provides any Ultimaker software or third party software \"As is\" without warranty of any kind. The entire risk as to the quality and perfoemance of Ultimaker software is with you.</p>"

View file

@ -11,14 +11,17 @@ import Cura 1.1 as Cura
// //
// This component contains the content for the "Welcome" page of the welcome on-boarding process. // This component contains the content for the "Welcome" page of the welcome on-boarding process.
// //
Column Item
{ {
UM.I18nCatalog { id: catalog; name: "cura" } UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 60 anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
// Placeholder Column // Arrange the items vertically and put everything in the center
Label { text: " " } {
anchors.centerIn: parent
width: parent.width
spacing: UM.Theme.getSize("welcome_pages_default_margin").height
Label Label
{ {
@ -31,11 +34,6 @@ Column
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
Column
{
anchors.horizontalCenter: parent.horizontalCenter
spacing: 40
Image Image
{ {
id: curaImage id: curaImage
@ -52,15 +50,16 @@ Column
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
}
Cura.PrimaryButton Cura.PrimaryButton
{ {
id: getStartedButton id: getStartedButton
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
text: catalog.i18nc("@button", "Get started") text: catalog.i18nc("@button", "Get started")
width: UM.Theme.getSize("welcome_pages_button").width width: UM.Theme.getSize("welcome_pages_button").width
fixedWidthMode: true fixedWidthMode: true
onClicked: base.showNextPage() onClicked: base.showNextPage()
} }
} }
}

View file

@ -32,8 +32,8 @@ Item
{ {
anchors.top: titleLabel.bottom anchors.top: titleLabel.bottom
anchors.bottom: getStartedButton.top anchors.bottom: getStartedButton.top
anchors.topMargin: 40 anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height
anchors.bottomMargin: 40 anchors.bottomMargin: UM.Theme.getSize("welcome_pages_default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * 3 / 4 width: parent.width * 3 / 4