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:
reply_url = reply.url().toString()
address = ""
address = reply.url().host()
device = None
properties = {} # type: Dict[bytes, bytes]
if "system" in reply_url:
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
if "system" in reply_url:
try:
system_info = json.loads(bytes(reply.readAll()).decode("utf-8"))
except:
Logger.log("e", "Something went wrong converting the JSON.")
return
address = reply.url().host()
has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version
instance_name = "manual:%s" % address
properties = {
@ -302,16 +306,12 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._network_manager.get(cluster_request)
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.
try:
cluster_printers_list = json.loads(bytes(reply.readAll()).decode("utf-8"))
except:
Logger.log("e", "Something went wrong converting the JSON.")
return
address = reply.url().host()
instance_name = "manual:%s" % address
if instance_name in self._discovered_devices:
device = self._discovered_devices[instance_name]

View file

@ -22,6 +22,8 @@ Item
property bool hasSentRequest: false
// Whether the IP address user entered can be resolved as a recognizable printer.
property bool haveConnection: false
// True when a request comes back, but the device hasn't responded.
property bool deviceUnresponsive: false
Label
{
@ -77,12 +79,14 @@ Item
anchors.right: addPrinterButton.left
anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default")
selectByMouse: true
validator: RegExpValidator
{
regExp: /[a-fA-F0-9\.\:]*/
}
enabled: { ! (addPrinterByIpScreen.hasSentRequest || addPrinterByIpScreen.haveConnection) }
onAccepted: addPrinterButton.clicked()
}
@ -101,6 +105,7 @@ Item
if (hostnameField.text.trim() != "")
{
enabled = false;
addPrinterByIpScreen.deviceUnresponsive = false;
UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text);
}
}
@ -115,6 +120,12 @@ Item
! 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
font: UM.Theme.getFont("default")
visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection }
text: catalog.i18nc("@label", "The printer at this address has not responded yet.")
visible:
{
(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
@ -141,7 +166,7 @@ Item
anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width
visible: addPrinterByIpScreen.haveConnection
visible: addPrinterByIpScreen.haveConnection && ! addPrinterByIpScreen.deviceUnresponsive
Label
{
@ -173,11 +198,20 @@ Item
{
target: UM.OutputDeviceManager
onManualDeviceChanged:
{
if (UM.OutputDeviceManager.hasManualDevice)
{
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 = ""
}
}
}
}
@ -185,10 +219,19 @@ Item
{
target: UM.OutputDeviceManager
onManualDeviceChanged:
{
if (UM.OutputDeviceManager.hasManualDevice)
{
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")
}
Cura.SecondaryButton
Label
{
id: signInButton
anchors.left: createAccountButton.right
anchors.verticalCenter: finishButton.verticalCenter
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
text: catalog.i18nc("@button", "Sign in")
width: UM.Theme.getSize("welcome_pages_button").width
shadowEnabled: false
color: "transparent"
hoverColor: "transparent"
textHoverColor: UM.Theme.getColor("primary")
fixedWidthMode: true
color: UM.Theme.getColor("secondary_button_text")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
MouseArea
{
anchors.fill: parent
hoverEnabled: true
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
}
// 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
{
anchors.top: titleLabel.bottom
anchors.topMargin: 80
anchors.horizontalCenter: parent.horizontalCenter
anchors.centerIn: parent
spacing: 60
spacing: UM.Theme.getSize("welcome_pages_default_margin").height
Image
{
@ -54,6 +62,7 @@ Item
renderType: Text.NativeRendering
}
}
}
Cura.PrimaryButton
{

View file

@ -74,7 +74,9 @@ Item
anchors.top: parent.top
anchors.left: parent.left
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
}

View file

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

View file

@ -12,23 +12,13 @@ import Cura 1.1 as Cura
//
Item
{
Column
{
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 20
UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 40
// Placeholder
Label { text: " " }
Label
{
id: titleLabel
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")
@ -37,11 +27,22 @@ Item
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
{
width: parent.width * 2 / 3
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>"
+ "<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>"

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.
//
Column
Item
{
UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 60
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
// Placeholder
Label { text: " " }
Column // Arrange the items vertically and put everything in the center
{
anchors.centerIn: parent
width: parent.width
spacing: UM.Theme.getSize("welcome_pages_default_margin").height
Label
{
@ -31,11 +34,6 @@ Column
renderType: Text.NativeRendering
}
Column
{
anchors.horizontalCenter: parent.horizontalCenter
spacing: 40
Image
{
id: curaImage
@ -52,15 +50,16 @@ Column
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}
}
Cura.PrimaryButton
{
id: getStartedButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
text: catalog.i18nc("@button", "Get started")
width: UM.Theme.getSize("welcome_pages_button").width
fixedWidthMode: true
onClicked: base.showNextPage()
}
}
}

View file

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