From 9265a0de4a6e8b45d3b6b99a822c02820e91896f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:41:12 +0100 Subject: [PATCH 01/22] Fix typing --- cura/UI/MachineModels/DiscoveredPrintersModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/UI/MachineModels/DiscoveredPrintersModel.py b/cura/UI/MachineModels/DiscoveredPrintersModel.py index 15d002298c..1fc31f4bcc 100644 --- a/cura/UI/MachineModels/DiscoveredPrintersModel.py +++ b/cura/UI/MachineModels/DiscoveredPrintersModel.py @@ -88,7 +88,7 @@ class DiscoveredPrintersModel(QObject): discoveredPrintersChanged = pyqtSignal() @pyqtProperty(list, notify = discoveredPrintersChanged) - def discovered_printers(self) -> "List[DiscoveredPrinter]": + def discovered_printers(self) -> List["DiscoveredPrinter"]: item_list = list(x for x in self._discovered_printer_by_ip_dict.values()) item_list.sort(key = lambda x: x.name) return item_list From d3ea50616725d11d4a882245b68da15843950095 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:47:13 +0100 Subject: [PATCH 02/22] Add docs for createMachineFromDiscoveredPrinter --- cura/UI/MachineModels/DiscoveredPrintersModel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/UI/MachineModels/DiscoveredPrintersModel.py b/cura/UI/MachineModels/DiscoveredPrintersModel.py index 1fc31f4bcc..e127ba48af 100644 --- a/cura/UI/MachineModels/DiscoveredPrintersModel.py +++ b/cura/UI/MachineModels/DiscoveredPrintersModel.py @@ -125,6 +125,8 @@ class DiscoveredPrintersModel(QObject): del self._discovered_printer_by_ip_dict[ip_address] self.discoveredPrintersChanged.emit() + # A convenience function for QML to create a machine (GlobalStack) out of the given discovered printer. + # This function invokes the given discovered printer's "create_callback" to do this. @pyqtSlot("QVariant") def createMachineFromDiscoveredPrinter(self, discovered_printer: "DiscoveredPrinter") -> None: discovered_printer.create_callback(discovered_printer.getKey()) From b1620f19126c5834be0042cab308fe918f9e5cde Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:49:40 +0100 Subject: [PATCH 03/22] Fix typing --- .../UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 9bcbf38b77..ef3ab4eb41 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -1,25 +1,25 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import json +import os from queue import Queue from threading import Event, Thread from time import time -import os +from typing import Optional, TYPE_CHECKING, Dict from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo + from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager from PyQt5.QtCore import QUrl from PyQt5.QtGui import QDesktopServices from cura.CuraApplication import CuraApplication from cura.PrinterOutput.PrinterOutputDevice import ConnectionType -from cura.Settings.GlobalStack import GlobalStack # typing -from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin -from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.i18n import i18nCatalog from UM.Logger import Logger from UM.Message import Message +from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from UM.PluginRegistry import PluginRegistry from UM.Signal import Signal, signalemitter @@ -28,9 +28,9 @@ from UM.Version import Version from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager -from typing import Optional, TYPE_CHECKING if TYPE_CHECKING: + from PyQt5.QtNetwork import QNetworkReply from cura.Settings.GlobalStack import GlobalStack @@ -255,7 +255,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): name_request = QNetworkRequest(url) self._network_manager.get(name_request) - def _onNetworkRequestFinished(self, reply): + def _onNetworkRequestFinished(self, reply: "QNetworkReply") -> None: reply_url = reply.url().toString() address = "" From f90fd8aee89b7b67832fc1702c9b9ab7f0052395 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:50:32 +0100 Subject: [PATCH 04/22] Add typing --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index ef3ab4eb41..d4516d1805 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -325,7 +325,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self.getOutputDeviceManager().addOutputDevice(device) self.addManualDeviceSignal.emit(self.getPluginId(), device.getId(), address, properties) - def _onRemoveDevice(self, device_id): + def _onRemoveDevice(self, device_id: str) -> None: device = self._discovered_devices.pop(device_id, None) if device: if device.isConnected(): From 47d74950dc8f9f47985eabc423176095c9f0d76c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:59:07 +0100 Subject: [PATCH 05/22] Add docs for properties in AddLocalPrinterScrollView.qml --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 7ad0f5c96c..f8db8b297e 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -16,10 +16,13 @@ ScrollView { id: base + // The currently selected machine item in the local machine list. property var currentItem: (machineList.currentIndex >= 0) ? machineList.model.getItem(machineList.currentIndex) : null + // The currently active (expanded) section/category, where section/category is the grouping of local machine items. property string currentSection: preferredCategory + // By default (when this list shows up) we always expand the "Ultimaker" section. property string preferredCategory: "Ultimaker" ScrollBar.horizontal.policy: ScrollBar.AlwaysOff From 528a6b651d89a57e3ab45ea4f1c13e34f789a25f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:06:47 +0100 Subject: [PATCH 06/22] Fix code style --- resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 575ec9c126..8233425c30 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -76,7 +76,6 @@ Item // select the first one that's not "unknown" by default. for (var i = 0; i < count; i++) { - if (!model[i].is_unknown_machine_type) { currentIndex = i From c4d2cb26a0cc66bd85ae2703aea06cbc87d163d6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:07:26 +0100 Subject: [PATCH 07/22] Fix comments --- resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 8233425c30..0d37b2092b 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -73,7 +73,7 @@ Item Component.onCompleted: { - // select the first one that's not "unknown" by default. + // Select the first one that's not "unknown" by default. for (var i = 0; i < count; i++) { if (!model[i].is_unknown_machine_type) From 0c8afbfa45001d6380bde3dfaa3858a49ab72ef4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:14:34 +0100 Subject: [PATCH 08/22] Use Item instead of Rectangle --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index f3ed58200b..e843416b8b 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -116,7 +116,7 @@ Item } } - Rectangle + Item { width: parent.width anchors.top: userInputFields.bottom @@ -133,7 +133,7 @@ Item text: catalog.i18nc("@label", "The printer at this address has not responded yet.") } - Rectangle + Item { id: printerInfoLabels anchors.top: parent.top @@ -203,8 +203,6 @@ Item width: UM.Theme.getSize("action_button").width fixedWidthMode: true onClicked: base.gotoPage("add_printer_by_selection") - - enabled: true } Cura.PrimaryButton From a8e2fcf5f5efe19632ba1b841cc185b518bf701e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:19:38 +0100 Subject: [PATCH 09/22] Add comments for properties in AddPrinterByIpContent --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index e843416b8b..01d12a654b 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -18,7 +18,9 @@ Item id: addPrinterByIpScreen + // Whether an IP address is currently being resolved. property bool hasSentRequest: false + // Whether the IP address user entered can be resolved as a recognizable printer. property bool haveConnection: false Label From 2b0e2d84bbc45b2a46bbb45a8d4d069926483ba2 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:21:17 +0100 Subject: [PATCH 10/22] Rename gotoPage to goToPage --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 +- resources/qml/WelcomePages/AddPrinterBySelectionContent.qml | 4 ++-- resources/qml/WelcomePages/StepPanel.qml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 01d12a654b..e71efb09aa 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -204,7 +204,7 @@ Item text: catalog.i18nc("@button", "Cancel") width: UM.Theme.getSize("action_button").width fixedWidthMode: true - onClicked: base.gotoPage("add_printer_by_selection") + onClicked: base.goToPage("add_printer_by_selection") } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 3282b219c9..4f09b055eb 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -67,7 +67,7 @@ Item onAddByIpButtonClicked: { - base.gotoPage("add_printer_by_ip") + base.goToPage("add_printer_by_ip") } } } @@ -148,7 +148,7 @@ Item // TODO: implement machine actions // If we have created a machine, go to the last page, which is the "cloud" page. - base.gotoPage("cloud") + base.goToPage("cloud") } } } diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index bc99320e02..157fc8e568 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -33,7 +33,7 @@ Item signal showNextPage() signal showPreviousPage() signal passLastPage() // Emitted when there is no more page to show - signal gotoPage(string page_id) // Go to a specific page by the given page_id. + signal goToPage(string page_id) // Go to a specific page by the given page_id. onShowNextPage: { @@ -54,7 +54,7 @@ Item } } - onGotoPage: + onGoToPage: { // find the page index var page_index = -1 From 4573733bb70a2da0d4cc1546ad7d21b7b32a92b9 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:22:19 +0100 Subject: [PATCH 11/22] Remove unnecessary "visible: true" --- resources/qml/WelcomePages/StepPanel.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 157fc8e568..7e0c00a987 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -110,7 +110,6 @@ Item source: parent horizontalOffset: base.shadowOffset verticalOffset: base.shadowOffset - visible: true color: UM.Theme.getColor("monitor_shadow") transparentBorder: true // Should always be drawn behind the background. From ab062649503e695b92b6c3f01ccdb0d956a3f4cf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:28:17 +0100 Subject: [PATCH 12/22] Rename to AddNetworkOrLocalPrinterContent --- cura/UI/WelcomePagesModel.py | 4 ++-- ...lectionContent.qml => AddNetworkOrLocalPrinterContent.qml} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename resources/qml/WelcomePages/{AddPrinterBySelectionContent.qml => AddNetworkOrLocalPrinterContent.qml} (100%) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index d72071fd7f..2b58218cd6 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -49,8 +49,8 @@ class WelcomePagesModel(ListModel): self._pages.append({"id": "data_collections", "page_url": self._getBuiltinWelcomePagePath("DataCollectionsContent.qml"), }) - self._pages.append({"id": "add_printer_by_selection", - "page_url": self._getBuiltinWelcomePagePath("AddPrinterBySelectionContent.qml"), + self._pages.append({"id": "add_network_or_local_printer", + "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), }) self._pages.append({"id": "add_printer_by_ip", "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml similarity index 100% rename from resources/qml/WelcomePages/AddPrinterBySelectionContent.qml rename to resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml From 639c4ba9f6953b402c3720578143a7079711c5d4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:35:41 +0100 Subject: [PATCH 13/22] Remove unneeded property assignment --- resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 4f09b055eb..0eebb61b91 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -101,8 +101,6 @@ Item AddLocalPrinterScrollView { id: localPrinterView - - maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. } } } From 1e3945810f21c44397adf454503a937614afe7d7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:49:59 +0100 Subject: [PATCH 14/22] Remove text_light_blue and use primary --- resources/qml/WelcomePages/CloudContent.qml | 4 ++-- resources/themes/cura-light/theme.json | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 09e52c17dd..7bdacb8d7d 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -56,7 +56,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@text", "The next generation 3D printing workflow") textFormat: Text.RichText - color: UM.Theme.getColor("text_light_blue") + color: UM.Theme.getColor("primary") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering } @@ -112,7 +112,7 @@ Item shadowEnabled: false color: "transparent" hoverColor: "transparent" - textHoverColor: UM.Theme.getColor("text_light_blue") + textHoverColor: UM.Theme.getColor("primary") fixedWidthMode: true onClicked: Cura.API.account.login() } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 83edda6486..b14c432b17 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -193,8 +193,6 @@ "window_disabled_background": [0, 0, 0, 255], - "text_light_blue": [50, 130, 255, 255], - "text": [25, 25, 25, 255], "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], From 090e176969ff3e9b3e5d37feed17e32ec67c4aa5 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 11:15:43 +0100 Subject: [PATCH 15/22] Arrange CloudContent.qml differently --- resources/qml/WelcomePages/CloudContent.qml | 60 +++++++++++++-------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 7bdacb8d7d..d5c4d2c03a 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -28,28 +28,34 @@ Item renderType: Text.NativeRendering } - Column + // Area where the cloud contents can be put. Pictures, texts and such. + Item { + id: cloudContentsArea anchors.top: titleLabel.bottom - anchors.topMargin: 80 - anchors.horizontalCenter: parent.horizontalCenter - - spacing: 60 - - Image - { - id: cloudImage - anchors.horizontalCenter: parent.horizontalCenter - source: UM.Theme.getImage("first_run_ultimaker_cloud") - } + anchors.bottom: finishButton.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width + // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in + // the cloud contents area. Column { - anchors.horizontalCenter: parent.horizontalCenter + anchors.centerIn: parent + width: childrenRect.width + height: childrenRect.height - spacing: 30 + spacing: 20 * screenScaleFactor - Label + Image // Cloud image + { + id: cloudImage + anchors.horizontalCenter: parent.horizontalCenter + source: UM.Theme.getImage("first_run_ultimaker_cloud") + } + + Label // A title-ish text { id: highlightTextLabel anchors.horizontalCenter: parent.horizontalCenter @@ -61,15 +67,26 @@ Item renderType: Text.NativeRendering } - Label + Label // A number of text items { id: textLabel anchors.horizontalCenter: parent.horizontalCenter - text: { - var t = "

- Send print jobs to Ultimaker printers outside your local network

" - t += "

- Store your Ultimaker Cura settings in the cloud for use anywhere

" - t += "

- Get exclusive access to material profiles from leading brands

" - catalog.i18nc("@text", t) + text: + { + // There are 3 text items, each of which is translated separately as a single piece of text. + var full_text = "" + var t = "" + + t = catalog.i18nc("@text", "- Send print jobs to Ultimaker printers outside your local network") + full_text += "

" + t + "

" + + t = catalog.i18nc("@text", "- Store your Ultimaker Cura settings in the cloud for use anywhere") + full_text += "

" + t + "

" + + t = catalog.i18nc("@text", "- Get exclusive access to material profiles from leading brands") + full_text += "

" + t + "

" + + return full_text } textFormat: Text.RichText font: UM.Theme.getFont("medium") @@ -78,6 +95,7 @@ Item } } + // Bottom buttons go here Cura.PrimaryButton { id: finishButton From 92dea8a52f94f5fd09e485309f8fc01d174d2adf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 11:49:36 +0100 Subject: [PATCH 16/22] Add welcome_pages_default_margin --- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 4 ++-- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 6 +++--- resources/qml/WelcomePages/CloudContent.qml | 6 +++--- resources/qml/WelcomePages/DataCollectionsContent.qml | 4 ++-- resources/qml/WelcomePages/UserAgreementContent.qml | 4 ++-- resources/qml/WelcomePages/WhatsNewContent.qml | 4 ++-- resources/themes/cura-light/theme.json | 2 ++ 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 0eebb61b91..3004a563f4 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -19,7 +19,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: 40 + anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add a printer") @@ -110,7 +110,7 @@ Item id: nextButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width enabled: { // If the network printer dropdown is expanded, make sure that there is a selected item diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index e71efb09aa..e7236a6155 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -27,7 +27,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add printer by IP address") @@ -200,7 +200,7 @@ Item id: backButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Cancel") width: UM.Theme.getSize("action_button").width fixedWidthMode: true @@ -212,7 +212,7 @@ Item id: connectButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Connect") width: UM.Theme.getSize("action_button").width fixedWidthMode: true diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index d5c4d2c03a..07881553ef 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -19,7 +19,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: 40 + anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Ultimaker Cloud") @@ -101,7 +101,7 @@ Item id: finishButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Finish") width: 140 fixedWidthMode: true @@ -113,7 +113,7 @@ Item id: createAccountButton anchors.left: parent.left anchors.verticalCenter: finishButton.verticalCenter - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Create an account") width: 140 fixedWidthMode: true diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 93426d2c2c..a9af056288 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -19,7 +19,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: 40 + anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") @@ -60,7 +60,7 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Next") width: 140 fixedWidthMode: true diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 82b16ba2ee..dfec088ad6 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -58,7 +58,7 @@ Item id: agreeButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Agree") width: 140 fixedWidthMode: true @@ -75,7 +75,7 @@ Item id: declineButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Decline and close") width: 140 fixedWidthMode: true diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index b083c99e32..2c51fdd1cd 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -19,7 +19,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: 40 + anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "What's new in Ultimaker Cura") @@ -76,7 +76,7 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 40 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Next") width: 140 fixedWidthMode: true diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index b14c432b17..2363ed28fe 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -507,6 +507,8 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], + "welcome_pages_default_margin": [2.5, 2.5], + "action_button": [15.0, 2.5], "action_button_icon": [1.0, 1.0], "action_button_radius": [0.15, 0.15], From 2f33beff36b1524a66143f41b02e25f7ca283256 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 11:57:33 +0100 Subject: [PATCH 17/22] Fix cloud image filename --- ...irst_run_Ultimaker_cloud.svg => first_run_ultimaker_cloud.svg} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/themes/cura-light/images/{first_run_Ultimaker_cloud.svg => first_run_ultimaker_cloud.svg} (100%) diff --git a/resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg similarity index 100% rename from resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg rename to resources/themes/cura-light/images/first_run_ultimaker_cloud.svg From a2c2424d6927a4ba8306e7c46786bba2aaff0048 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 12:24:11 +0100 Subject: [PATCH 18/22] Use Label for SignIn button --- resources/qml/WelcomePages/CloudContent.qml | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 07881553ef..84b8232a3f 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -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: 80 - shadowEnabled: false - color: "transparent" - hoverColor: "transparent" - textHoverColor: UM.Theme.getColor("primary") - fixedWidthMode: true - onClicked: Cura.API.account.login() + 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 + } } } From 26acad3dbcecaf61baca13a575045e43ac352d22 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 12:55:25 +0100 Subject: [PATCH 19/22] Cleanup unnecessary hard-coded numbers in styling --- resources/qml/WelcomePages/DropDownWidget.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index cff9cf8ac1..43f92218fc 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -21,14 +21,14 @@ Item id: base - implicitWidth: 200 - height: header.contentShown ? (header.height + contentRectangle.height + 30) : header.height + implicitWidth: 200 * screenScaleFactor + height: header.contentShown ? (header.height + contentRectangle.height) : header.height property var contentComponent: null property alias contentItem: contentLoader.item property alias title: header.title - property bool contentShown: false + property bool contentShown: false // indicates if this dropdown widget is expanded to show its content signal clicked() @@ -59,7 +59,7 @@ Item anchors.top: header.bottom anchors.left: header.left anchors.right: header.right - height: contentLoader.height + 2 + height: contentLoader.height border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") From 2074bf913311c85a165e85b0b5c899ab4a6db617 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 13:06:35 +0100 Subject: [PATCH 20/22] Use theme --- resources/qml/WelcomePages/DropDownWidget.qml | 4 +++- resources/qml/WelcomePages/StepPanel.qml | 3 ++- resources/qml/WelcomePages/WhatsNewContent.qml | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index 43f92218fc..9f413769e0 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -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 } diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 7e0c00a987..1ec44571b5 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -41,7 +41,8 @@ Item { currentStep++ } - else { + else + { passLastPage() } } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 2c51fdd1cd..d9d3648d6a 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -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 From 457eb93758d570fc44141bc4fd7ff66eb51f5d60 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 13:08:51 +0100 Subject: [PATCH 21/22] Remove debug code --- resources/qml/WelcomePages/StepPanel.qml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 1ec44571b5..551a01687a 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -72,10 +72,6 @@ Item { currentStep = page_index } - else - { - console.log("Error: cannot find page with page_id = [", page_id, "]") - } } onVisibleChanged: From eb02b302f53ecd359c8f3d9a83b701c34ef0a042 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 13:18:33 +0100 Subject: [PATCH 22/22] Rearrange items in DataCollectionsContent.qml --- .../WelcomePages/DataCollectionsContent.qml | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index a9af056288..b17c24300a 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -28,30 +28,39 @@ Item renderType: Text.NativeRendering } - Column + // Area where the cloud contents can be put. Pictures, texts and such. + Item { + id: cloudContentsArea anchors.top: titleLabel.bottom - anchors.topMargin: 80 - anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: getStartedButton.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width - spacing: 60 - - Image + Column { - id: curaImage - anchors.horizontalCenter: parent.horizontalCenter - source: UM.Theme.getImage("first_run_share_data") - } + anchors.centerIn: parent - Label - { - id: textLabel - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - text: catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality
and user experience. More information") - textFormat: Text.RichText - font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering + spacing: UM.Theme.getSize("welcome_pages_default_margin").height + + Image + { + id: curaImage + anchors.horizontalCenter: parent.horizontalCenter + source: UM.Theme.getImage("first_run_share_data") + } + + Label + { + id: textLabel + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality
and user experience. More information") + textFormat: Text.RichText + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } } }