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: # Either:
# Something went wrong with checking the firmware version! # - Something went wrong with checking the firmware version!
return # - 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
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
{ {
@ -174,9 +199,18 @@ Item
target: UM.OutputDeviceManager target: UM.OutputDeviceManager
onManualDeviceChanged: onManualDeviceChanged:
{ {
typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type") if (UM.OutputDeviceManager.hasManualDevice)
firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version") {
addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address") typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type")
firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version")
addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address")
}
else
{
typeText.text = ""
firmwareText.text = ""
addressText.text = ""
}
} }
} }
} }
@ -186,8 +220,17 @@ Item
target: UM.OutputDeviceManager target: UM.OutputDeviceManager
onManualDeviceChanged: onManualDeviceChanged:
{ {
printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") if (UM.OutputDeviceManager.hasManualDevice)
addPrinterByIpScreen.haveConnection = true {
printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name")
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 {
onClicked: Cura.API.account.login() anchors.fill: parent
hoverEnabled: true
onClicked: Cura.API.account.login()
onEntered: parent.font.underline = true
onExited: parent.font.underline = false
}
} }
} }

View file

@ -28,30 +28,39 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
Column // Area where the cloud contents can be put. Pictures, texts and such.
Item
{ {
id: contentsArea
anchors.top: titleLabel.bottom anchors.top: titleLabel.bottom
anchors.topMargin: 80 anchors.bottom: getStartedButton.top
anchors.horizontalCenter: parent.horizontalCenter anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
spacing: 60 Column
Image
{ {
id: curaImage anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
source: UM.Theme.getImage("first_run_share_data")
}
Label spacing: UM.Theme.getSize("welcome_pages_default_margin").height
{
id: textLabel Image
anchors.horizontalCenter: parent.horizontalCenter {
horizontalAlignment: Text.AlignHCenter id: curaImage
text: catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality<br/>and user experience. <a href=\"TODO\">More information</a>") anchors.horizontalCenter: parent.horizontalCenter
textFormat: Text.RichText source: UM.Theme.getImage("first_run_share_data")
font: UM.Theme.getFont("medium") }
renderType: Text.NativeRendering
Label
{
id: textLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality<br/>and user experience. <a href=\"TODO\">More information</a>")
textFormat: Text.RichText
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}
} }
} }

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,36 +12,37 @@ import Cura 1.1 as Cura
// //
Item Item
{ {
Column UM.I18nCatalog { id: catalog; name: "cura" }
Label
{ {
id: titleLabel
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "User Agreement")
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
Item // Area for pictures and texts
{
anchors.top: titleLabel.bottom
anchors.bottom: agreeButton.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 20 anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 40
// Placeholder
Label { text: " " }
Label Label
{ {
id: titleLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "User Agreement")
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
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,30 +11,28 @@ 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: " " }
Label
{ {
id: titleLabel anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter width: parent.width
horizontalAlignment: Text.AlignHCenter spacing: UM.Theme.getSize("welcome_pages_default_margin").height
text: catalog.i18nc("@label", "Welcome to Ultimaker Cura")
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
Column Label
{ {
anchors.horizontalCenter: parent.horizontalCenter id: titleLabel
spacing: 40 anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "Welcome to Ultimaker Cura")
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
Image Image
{ {
@ -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
text: catalog.i18nc("@button", "Get started") anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
width: UM.Theme.getSize("welcome_pages_button").width text: catalog.i18nc("@button", "Get started")
fixedWidthMode: true width: UM.Theme.getSize("welcome_pages_button").width
onClicked: base.showNextPage() fixedWidthMode: true
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