From 5c354eb6a36b77fb3fcb850fd8439a62f93f436f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 26 Feb 2019 10:45:18 +0100 Subject: [PATCH 001/211] Switch the order of name & id in addMachine call This makes it possible for the name to not be set, in which case it will default to the name provided by the definition CURA-6179 --- cura/Settings/MachineManager.py | 8 +++++++- resources/qml/Dialogs/AddMachineDialog.qml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 3416f0a321..a96a2c9443 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -386,8 +386,14 @@ class MachineManager(QObject): return machine return None + @pyqtSlot(str) @pyqtSlot(str, str) - def addMachine(self, name: str, definition_id: str) -> None: + def addMachine(self, definition_id: str, name: Optional[str] = None) -> None: + if name is None: + definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(id = definition_id) + if definitions: + name = definitions[0].getName() + new_stack = CuraStackBuilder.createMachine(name, definition_id) if new_stack: # Instead of setting the global container stack here, we set the active machine and so the signals are emitted diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index f00359869c..dafe12693f 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -303,7 +303,7 @@ UM.Dialog { base.visible = false var item = machineList.model.getItem(machineList.currentIndex); - Cura.MachineManager.addMachine(machineName.text, item.id) + Cura.MachineManager.addMachine(item.id, machineName.text) base.machineAdded(item.id) // Emit signal that the user added a machine. } From 21c6bba1ce2eb18ed3ba055858eb1237305c5012 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Feb 2019 11:05:54 +0100 Subject: [PATCH 002/211] Add the discovered printer functionality This can be used in the add machine wizard to short circuit the creation of a printer. So instead of first selecting a printer and then connecting it, it will be possible to have a list that contains all network discovered printers (from all plugins that can do this). This means we can select one of those printers and directly add it (thus no longer needing that step) CURA-6179 --- cura/CuraApplication.py | 2 ++ cura/Settings/MachineManager.py | 26 +++++++++++++++++-- .../src/UM3OutputDevicePlugin.py | 9 +++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4d3d2434ff..cb3a37ee69 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -745,6 +745,8 @@ class CuraApplication(QtApplication): # Initialize Cura API self._cura_API.initialize() + self._output_device_manager.start() + # Detect in which mode to run and execute that mode if self._is_headless: self.runWithoutGUI() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index a96a2c9443..29a39fc461 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -4,7 +4,7 @@ import time import re import unicodedata -from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast +from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast, NamedTuple, Callable from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator @@ -49,6 +49,8 @@ if TYPE_CHECKING: from cura.Machines.QualityChangesGroup import QualityChangesGroup from cura.Machines.QualityGroup import QualityGroup +DiscoveredPrinter = NamedTuple("DiscoveredPrinter", [("key", str), ("name", str), ("create_callback", Callable[[str], None]), ("machine_type", "str")]) + class MachineManager(QObject): def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None: @@ -134,6 +136,9 @@ class MachineManager(QObject): self.globalContainerChanged.connect(self.printerConnectedStatusChanged) self.outputDevicesChanged.connect(self.printerConnectedStatusChanged) + # This will contain all discovered network printers + self._discovered_printers = {} # type: Dict[str, DiscoveredPrinter] + activeQualityGroupChanged = pyqtSignal() activeQualityChangesGroupChanged = pyqtSignal() @@ -171,7 +176,24 @@ class MachineManager(QObject): self._printer_output_devices.append(printer_output_device) self.outputDevicesChanged.emit() - self.printerConnectedStatusChanged.emit() + + # Discovered printers are all the printers that were found on the network, which provide a more convenient way + # to add networked printers (Plugin finds a bunch of printers, user can select one from the list, plugin can then + # add that printer to Cura as the active one). + def addDiscoveredPrinter(self, key: str, name: str, create_callback: Callable[[str], None], machine_type: str) -> None: + if key not in self._discovered_printers: + self._discovered_printers[key] = DiscoveredPrinter(key, name, create_callback, machine_type) + else: + Logger.log("e", "Printer with the key %s was already in the discovered printer list", key) + + def removeDiscoveredPrinter(self, key: str) -> None: + if key in self._discovered_printers: + del self._discovered_printers[key] + + @pyqtSlot(str) + def addMachineFromDiscoveredPrinter(self, key: str) -> None: + if key in self._discovered_printers: + self._discovered_printers[key].create_callback(key) @pyqtProperty(QObject, notify = currentConfigurationChanged) def currentConfiguration(self) -> ConfigurationModel: diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 723bcf2b7c..4529b31c45 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -213,6 +213,11 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._checkManualDevice(address) + def _createMachineFromDiscoveredPrinter(self, key: str) -> None: + # TODO: This needs to be implemented. It's supposed to create a machine given a unique key as already discovered + # by this plugin. + pass + def _checkManualDevice(self, address): # Check if a UM3 family device exists at this address. # If a printer responds, it will replace the preliminary printer created above @@ -293,7 +298,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): except TypeError: # Disconnect already happened. pass - + self._application.getMachineManager().removeDiscoveredPrinter(device.getId()) self.discoveredDevicesChanged.emit() def _onAddDevice(self, name, address, properties): @@ -318,7 +323,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties) else: device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties) - + self._application.getMachineManager().addDiscoveredPrinter(device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8")) self._discovered_devices[device.getId()] = device self.discoveredDevicesChanged.emit() From 17fdc86e500bf4547f7708a887c7236350f711e5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Feb 2019 11:59:50 +0100 Subject: [PATCH 003/211] Fix typing CURA-6179 --- cura/Settings/MachineManager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 29a39fc461..7a06e8753c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -415,8 +415,10 @@ class MachineManager(QObject): definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(id = definition_id) if definitions: name = definitions[0].getName() + else: + name = definition_id - new_stack = CuraStackBuilder.createMachine(name, definition_id) + new_stack = CuraStackBuilder.createMachine(cast(str, name), definition_id) if new_stack: # Instead of setting the global container stack here, we set the active machine and so the signals are emitted self.setActiveMachine(new_stack.getId()) From 3b63f92d55a9398053bb87932d43cb4396bddb46 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Feb 2019 11:50:14 +0100 Subject: [PATCH 004/211] WIP: Add base QMLs for WelcomeDialog --- resources/qml/Actions.qml | 5 +- .../qml/WelcomePages/StepIndicatorBar.qml | 34 ++++++ resources/qml/WelcomePages/StepPanel.qml | 105 ++++++++++++++++++ .../qml/WelcomePages/UserAgreementContent.qml | 41 +++++++ resources/qml/WelcomePages/WelcomeContent.qml | 65 +++++++++++ resources/qml/WelcomePages/WelcomeDialog.qml | 30 +++++ .../images/first_run_Ultimaker_cloud.svg | 16 +++ .../images/first_run_share_data.svg | 71 ++++++++++++ .../images/first_run_welcome_cura.svg | 15 +++ 9 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 resources/qml/WelcomePages/StepIndicatorBar.qml create mode 100644 resources/qml/WelcomePages/StepPanel.qml create mode 100644 resources/qml/WelcomePages/UserAgreementContent.qml create mode 100644 resources/qml/WelcomePages/WelcomeContent.qml create mode 100644 resources/qml/WelcomePages/WelcomeDialog.qml create mode 100644 resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg create mode 100644 resources/themes/cura-light/images/first_run_share_data.svg create mode 100644 resources/themes/cura-light/images/first_run_welcome_cura.svg diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 1389801bca..368f1aa0cf 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -3,8 +3,9 @@ pragma Singleton -import QtQuick 2.2 +import QtQuick 2.10 import QtQuick.Controls 1.1 +import QtQuick.Controls 2.3 as Controls2 import UM 1.1 as UM import Cura 1.0 as Cura @@ -71,7 +72,7 @@ Item UM.I18nCatalog{id: catalog; name: "cura"} - Action + Controls2.Action { id: showTroubleShootingAction onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting") diff --git a/resources/qml/WelcomePages/StepIndicatorBar.qml b/resources/qml/WelcomePages/StepIndicatorBar.qml new file mode 100644 index 0000000000..8c453c6e5d --- /dev/null +++ b/resources/qml/WelcomePages/StepIndicatorBar.qml @@ -0,0 +1,34 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + + +Item +{ + id: base + + property int totalSteps: 10 + property int currentStep: 6 + property int radius: 2 + + Rectangle + { + id: background + anchors.fill: parent + color: "#f0f0f0" + radius: base.radius + } + + Rectangle + { + id: progress + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + width: (currentStep * 1.0 / totalSteps) * background.width + color: "#3282ff" + radius: base.radius + } +} diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml new file mode 100644 index 0000000000..e72ba949e9 --- /dev/null +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -0,0 +1,105 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.0 // For the dropshadow + +import Cura 1.1 as Cura +Item +{ + id: base + + anchors.fill: parent + clip: true + + property int roundCornerRadius: 4 + property int shadowOffset: 2 + property int stepBarHeight: 12 + property int contentMargins: 4 + + property int totalSteps: 0 + property int currentStep: -1 + + property var currentItem: null + property var model: null + + onVisibleChanged: + { + if (visible) + { + base.currentStep = 0 + base.currentItem = base.model.getItem(base.currentStep) + } + } + + onCurrentStepChanged: + { + base.currentItem = base.model.getItem(base.currentStep) + } + + onModelChanged: + { + base.totalSteps = base.model.count + base.currentStep = 0 + base.currentItem = base.model.getItem(base.currentStep) + } + + // Panel background + Rectangle + { + id: panelBackground + anchors.fill: parent + anchors.margins: 10 + color: "white" // TODO + radius: base.roundCornerRadius // TODO + } + + // Drop shadow around the panel + DropShadow + { + id: shadow + // Don't blur the shadow + radius: base.roundCornerRadius + 2 + anchors.fill: parent + source: parent + horizontalOffset: base.shadowOffset + verticalOffset: base.shadowOffset + visible: true + color: UM.Theme.getColor("action_button_shadow") + // Should always be drawn behind the background. + z: panelBackground.z - 1 + } + + StepIndicatorBar + { + id: stepIndicatorBar + //anchors.margins: 10 + + totalSteps: base.totalSteps + currentStep: base.currentStep + radius: base.roundCornerRadius + + anchors + { + left: panelBackground.left + right: panelBackground.right + top: panelBackground.top + } + height: base.stepBarHeight + } + + Loader + { + id: contentLoader + anchors + { + margins: base.contentMargins + top: stepIndicatorBar.bottom + bottom: parent.bottom + left: parent.left + right: parent.right + } + source: base.currentItem.page_url + } +} diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml new file mode 100644 index 0000000000..771f9ff1ed --- /dev/null +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -0,0 +1,41 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + + +Component +{ + Column + { + spacing: 20 + + Label + { + id: titleLabel + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: "User Agreement" // TODO + color: "blue" // TODO + //font: + renderType: NativeRendering + } + + Image { + id: curaImage + anchors.horizontalCenter: parent.horizontalCenter + source: "TODO" + } + + Label + { + id: textLabel + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: "Please fllow these steps to set up\nUltimaker Cura. This will only take a few moments." + //font: + renderType: NativeRendering + } + } +} diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml new file mode 100644 index 0000000000..e7e7300c12 --- /dev/null +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -0,0 +1,65 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the first page of the welcome on-boarding process. +// +Column +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + spacing: 60 + + // Placeholder + Label { text: " " } + + Label + { + id: titleLabel + 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 + } + + Column + { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 40 + + Image + { + id: curaImage + anchors.horizontalCenter: parent.horizontalCenter + source: UM.Theme.getImage("first_run_welcome_cura") + } + + Label + { + id: textLabel + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@text", "Please follow these steps to set up\nUltimaker Cura. This will only take a few moments.") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + } + + Cura.PrimaryButton + { + id: getStartedButton + anchors.horizontalCenter: parent.horizontalCenter + text: catalog.i18nc("@button", "Get started") + width: 140 + fixedWidthMode: true + } +} diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml new file mode 100644 index 0000000000..ee296bb371 --- /dev/null +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -0,0 +1,30 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Window 2.2 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +Window +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") + modality: Qt.ApplicationModal + flags: Qt.Window | Qt.FramelessWindowHint + + width: 580 // TODO + height: 600 // TODO + color: "transparent" + + StepPanel + { + id: stepPanel + currentStep: 0 + model: CuraApplication.getWelcomePagesModel() + } +} diff --git a/resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg b/resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg new file mode 100644 index 0000000000..f5e52ebee9 --- /dev/null +++ b/resources/themes/cura-light/images/first_run_Ultimaker_cloud.svg @@ -0,0 +1,16 @@ + + + + Group-cloud + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/images/first_run_share_data.svg b/resources/themes/cura-light/images/first_run_share_data.svg new file mode 100644 index 0000000000..0d6f8998e5 --- /dev/null +++ b/resources/themes/cura-light/images/first_run_share_data.svg @@ -0,0 +1,71 @@ + + + + Group 2 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/images/first_run_welcome_cura.svg b/resources/themes/cura-light/images/first_run_welcome_cura.svg new file mode 100644 index 0000000000..76a812d2c0 --- /dev/null +++ b/resources/themes/cura-light/images/first_run_welcome_cura.svg @@ -0,0 +1,15 @@ + + + + cura + Created with Sketch. + + + + + + + + + + \ No newline at end of file From ac012e8f0992c35691b18b013cb902b71dbc46de Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Feb 2019 11:51:28 +0100 Subject: [PATCH 005/211] WIP: Add Welcome Page and use CTRL+Alt+D to trigger --- cura/CuraApplication.py | 12 ++++++++++ cura/UI/WelcomePagesModel.py | 45 ++++++++++++++++++++++++++++++++++++ cura/UI/__init__.py | 0 resources/qml/Actions.qml | 9 ++++++++ resources/qml/Cura.qml | 25 ++++++++++++++++++++ 5 files changed, 91 insertions(+) create mode 100644 cura/UI/WelcomePagesModel.py create mode 100644 cura/UI/__init__.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4d3d2434ff..5d85763fea 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -59,6 +59,8 @@ from cura.Scene.CuraSceneNode import CuraSceneNode from cura.Scene.CuraSceneController import CuraSceneController +from cura.UI.WelcomePagesModel import WelcomePagesModel + from UM.Settings.SettingDefinition import SettingDefinition, DefinitionPropertyType from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.SettingFunction import SettingFunction @@ -208,6 +210,8 @@ class CuraApplication(QtApplication): self._cura_scene_controller = None self._machine_error_checker = None + self._welcome_pages_model = WelcomePagesModel(self) + self._quality_profile_drop_down_menu_model = None self._custom_quality_profile_drop_down_menu_model = None self._cura_API = CuraAPI(self) @@ -745,6 +749,8 @@ class CuraApplication(QtApplication): # Initialize Cura API self._cura_API.initialize() + self._welcome_pages_model.initialize() + # Detect in which mode to run and execute that mode if self._is_headless: self.runWithoutGUI() @@ -843,6 +849,10 @@ class CuraApplication(QtApplication): def getSettingVisibilityPresetsModel(self, *args) -> SettingVisibilityPresetsModel: return self._setting_visibility_presets_model + @pyqtSlot(result = QObject) + def getWelcomePagesModel(self, *args) -> "WelcomePagesModel": + return self._welcome_pages_model + def getCuraFormulaFunctions(self, *args) -> "CuraFormulaFunctions": if self._cura_formula_functions is None: self._cura_formula_functions = CuraFormulaFunctions(self) @@ -975,6 +985,8 @@ class CuraApplication(QtApplication): qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, "SimpleModeSettingsManager", self.getSimpleModeSettingsManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) + qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePageModel") + qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") qmlRegisterSingletonType(ObjectsModel, "Cura", 1, 0, "ObjectsModel", self.getObjectsModel) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py new file mode 100644 index 0000000000..6365ed1c0b --- /dev/null +++ b/cura/UI/WelcomePagesModel.py @@ -0,0 +1,45 @@ + + +import os +from typing import TYPE_CHECKING, Optional + +from PyQt5.QtCore import QUrl, Qt + +from UM.Qt.ListModel import ListModel +from UM.Resources import Resources + +if TYPE_CHECKING: + from PyQt5.QtCore import QObject + + +class WelcomePagesModel(ListModel): + + IdRole = Qt.UserRole + 1 # Page ID + PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file + NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to + + def __init__(self, parent: Optional["QObject"] = None) -> None: + super().__init__(parent) + + self.addRoleName(self.IdRole, "id") + self.addRoleName(self.PageUrlRole, "page_url") + self.addRoleName(self.NextPageIdRole, "next_page_id") + + self._pages = [] + + def initialize(self) -> None: + from cura.CuraApplication import CuraApplication + # Add default welcome pages + self._pages.append({"id": "welcome", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", "WelcomeContent.qml"))), + } + ) + + self.setItems(self._pages) + + def addPage(self): + pass + + +__all__ = ["WelcomePagesModel"] diff --git a/cura/UI/__init__.py b/cura/UI/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 368f1aa0cf..206f99af00 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -69,10 +69,19 @@ Item property alias browsePackages: browsePackagesAction + property alias showOnBoarding: showOnBoarding + UM.I18nCatalog{id: catalog; name: "cura"} Controls2.Action + { + id: showOnBoarding + text: catalog.i18nc("@action:inmenu", "Show On boarding") + shortcut: "Ctrl+Alt+D" + } + + Action { id: showTroubleShootingAction onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting") diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 44ff31ef31..25678a34ab 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -14,6 +14,7 @@ import Cura 1.1 as Cura import "Dialogs" import "Menus" import "MainWindow" +import "WelcomePages" UM.MainWindow { @@ -41,6 +42,30 @@ UM.MainWindow tooltip.hide(); } + WelcomeDialog + { + id: welcomeDialog + visible: false + } + + Rectangle + { + id: greyOutBackground + anchors.fill: parent + visible: welcomeDialog.visible + color: "black" + opacity: 0.7 + z: stageMenu.z + 1 + } + + Connections + { + target: Cura.Actions.showOnBoarding + onTriggered: + { + welcomeDialog.show() + } + } Component.onCompleted: { From 14fdf6887134b003ab12d45e45ec90171b6cebf4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Feb 2019 15:28:39 +0100 Subject: [PATCH 006/211] WIP: Add User Agreement page and fixes --- cura/UI/WelcomePagesModel.py | 8 ++- resources/qml/Cura.qml | 1 + .../qml/WelcomePages/StepIndicatorBar.qml | 2 +- resources/qml/WelcomePages/StepPanel.qml | 36 ++++++++-- .../qml/WelcomePages/UserAgreementContent.qml | 65 ++++++++++++++----- resources/qml/WelcomePages/WelcomeContent.qml | 1 + resources/qml/WelcomePages/WelcomeDialog.qml | 9 +++ 7 files changed, 97 insertions(+), 25 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 6365ed1c0b..da069b0d32 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -33,8 +33,12 @@ class WelcomePagesModel(ListModel): self._pages.append({"id": "welcome", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", "WelcomeContent.qml"))), - } - ) + }) + self._pages.append({"id": "user_agreement", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "UserAgreementContent.qml"))), + }) self.setItems(self._pages) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 25678a34ab..47f712e21a 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -63,6 +63,7 @@ UM.MainWindow target: Cura.Actions.showOnBoarding onTriggered: { + welcomeDialog.currentStep = 0 welcomeDialog.show() } } diff --git a/resources/qml/WelcomePages/StepIndicatorBar.qml b/resources/qml/WelcomePages/StepIndicatorBar.qml index 8c453c6e5d..273d1949d2 100644 --- a/resources/qml/WelcomePages/StepIndicatorBar.qml +++ b/resources/qml/WelcomePages/StepIndicatorBar.qml @@ -27,7 +27,7 @@ Item anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom - width: (currentStep * 1.0 / totalSteps) * background.width + width: (currentStep + 1) * 1.0 / totalSteps * background.width color: "#3282ff" radius: base.radius } diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index e72ba949e9..779797721b 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -14,9 +14,9 @@ Item clip: true property int roundCornerRadius: 4 - property int shadowOffset: 2 + property int shadowOffset: 1 property int stepBarHeight: 12 - property int contentMargins: 4 + property int contentMargins: 1 property int totalSteps: 0 property int currentStep: -1 @@ -24,6 +24,29 @@ Item property var currentItem: null property var model: null + signal showNextPage() + signal showPreviousPage() + signal passLastPage() // Emitted when there is no more page to show + + onShowNextPage: + { + if (currentStep < totalSteps - 1) + { + currentStep++ + } + else { + passLastPage() + } + } + + onShowPreviousPage: + { + if (currentStep > 0) + { + currentStep-- + } + } + onVisibleChanged: { if (visible) @@ -50,7 +73,7 @@ Item { id: panelBackground anchors.fill: parent - anchors.margins: 10 + anchors.margins: 2 color: "white" // TODO radius: base.roundCornerRadius // TODO } @@ -59,14 +82,14 @@ Item DropShadow { id: shadow - // Don't blur the shadow - radius: base.roundCornerRadius + 2 + radius: UM.Theme.getSize("monitor_shadow_radius").width anchors.fill: parent source: parent horizontalOffset: base.shadowOffset verticalOffset: base.shadowOffset visible: true - color: UM.Theme.getColor("action_button_shadow") + color: UM.Theme.getColor("monitor_shadow") + transparentBorder: true // Should always be drawn behind the background. z: panelBackground.z - 1 } @@ -74,7 +97,6 @@ Item StepIndicatorBar { id: stepIndicatorBar - //anchors.margins: 10 totalSteps: base.totalSteps currentStep: base.currentStep diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 771f9ff1ed..7adabeb75b 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -4,38 +4,73 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import UM 1.3 as UM +import Cura 1.1 as Cura -Component +Item { Column { - spacing: 20 + 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.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter - text: "User Agreement" // TODO - color: "blue" // TODO - //font: + text: catalog.i18nc("@label", "User Agreement") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") renderType: NativeRendering } - Image { - id: curaImage - anchors.horizontalCenter: parent.horizontalCenter - source: "TODO" - } - Label { - id: textLabel + width: parent.width * 2 / 3 + id: disclaimerLineLabel anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - text: "Please fllow these steps to set up\nUltimaker Cura. This will only take a few moments." - //font: + text: "

Disclaimer by Ultimaker

" + + "

Please read this disclaimer carefully.

" + + "

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.

" + + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" + textFormat: Text.RichText + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") renderType: NativeRendering } } + + Cura.PrimaryButton + { + id: agreeButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Agree") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } + + Cura.SecondaryButton + { + id: declineButton + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Decline") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index e7e7300c12..c7da56cdd4 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -61,5 +61,6 @@ Column text: catalog.i18nc("@button", "Get started") width: 140 fixedWidthMode: true + onClicked: base.showNextPage() } } diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index ee296bb371..0ac160f064 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -21,10 +21,19 @@ Window height: 600 // TODO color: "transparent" + property alias currentStep: stepPanel.currentStep + StepPanel { id: stepPanel currentStep: 0 model: CuraApplication.getWelcomePagesModel() } + + // Close this dialog when there's no more page to show + Connections + { + target: stepPanel + onPassLastPage: close() + } } From 72866683e65974d3c7c54fd5f86d53100ea2429a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Feb 2019 16:00:45 +0100 Subject: [PATCH 007/211] WIP: Add Whats new page --- cura/UI/WelcomePagesModel.py | 8 +- .../qml/WelcomePages/UserAgreementContent.qml | 2 +- .../qml/WelcomePages/WhatsNewContent.qml | 87 +++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 resources/qml/WelcomePages/WhatsNewContent.qml diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index da069b0d32..b42c46d619 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -32,13 +32,19 @@ class WelcomePagesModel(ListModel): # Add default welcome pages self._pages.append({"id": "welcome", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", "WelcomeContent.qml"))), + os.path.join("WelcomePages", + "WelcomeContent.qml"))), }) self._pages.append({"id": "user_agreement", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", "UserAgreementContent.qml"))), }) + self._pages.append({"id": "whats_new", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "WhatsNewContent.qml"))), + }) self.setItems(self._pages) diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 7adabeb75b..74c11d21d8 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -68,7 +68,7 @@ Item anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: 40 - text: catalog.i18nc("@button", "Decline") + text: catalog.i18nc("@button", "Decline and close") width: 140 fixedWidthMode: true onClicked: base.showNextPage() diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml new file mode 100644 index 0000000000..0ddd02ee36 --- /dev/null +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -0,0 +1,87 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "What's new in Ultimaker Cura") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors.top: titleLabel.bottom + anchors.bottom: getStartedButton.top + anchors.topMargin: 40 + anchors.bottomMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 3 / 4 + + border.color: "#dfdfdf" + border.width: 1 + + + ScrollView + { + anchors.fill: parent + anchors.margins: 1 + + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + + TextArea + { + id: whatsNewTextArea + width: parent.width + text: catalog.i18nc("@text", "

Ultimaker Cura 4.0

+ +

New features

+ +

Brand new user interface. Ultimaker Cura is a very powerful tool with many features to support users’ needs. In the new UI, we present these features in a better, more intuitive way based on the workflow of our users. The Marketplace and user account control have been integrated into the main interface to easily access material profiles and plugins. Within the UI, three stages are shown in the header to give a clear guidance of the flow. The stage menu is populated with collapsible panels that allow users to focus on the 3D view when needed, while still showing important information at the same time, such as slicing configuration and settings. Users can now easily go to the preview stage to examine the layer view after slicing the model, which previously was less obvious or hidden. The new UI also creates more distinction between recommended and custom mode. Novice users or users who are not interested in all the settings can easily prepare a file without diving into details. Expert users can use custom mode with a resizable settings panel to make more settings visible, and the set position will persist between sessions.

+ +

Cloud printing. Pair your Ultimaker printer with an Ultimaker account so you can send and monitor print jobs from outside your local network.

+ +

Redesigned "Add Printer" dialog. Updated one of the first dialogs a new user is presented with. The layout is loosely modeled on the layout of the Ultimaker 3/Ultimaker S5 "Connect to Network" dialog, and adds some instructions and intention to the dialog. Contributed by fieldOfView.

+ +

Integrated backups. Cura backups has been integrated into Ultimaker Cura and can be found in the 'extensions' menu. With this feature, users can backup their Ultimaker Cura configurations to the cloud.

+ ") + textFormat: Text.RichText + wrapMode: Text.WordWrap + readOnly: true + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + } + } + } + + Cura.PrimaryButton + { + id: getStartedButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } +} From 92730a09a2e8a09f3b0a4e269f909b13decb7c25 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Feb 2019 07:48:05 +0100 Subject: [PATCH 008/211] WIP: Add data collections page --- cura/UI/WelcomePagesModel.py | 5 ++ .../WelcomePages/DataCollectionsContent.qml | 69 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 resources/qml/WelcomePages/DataCollectionsContent.qml diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b42c46d619..b0a9a94b0d 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -45,6 +45,11 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", "WhatsNewContent.qml"))), }) + self._pages.append({"id": "data_collections", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "DataCollectionsContent.qml"))), + }) self.setItems(self._pages) diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml new file mode 100644 index 0000000000..6dc1657bc5 --- /dev/null +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -0,0 +1,69 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Column + { + anchors.top: titleLabel.bottom + anchors.topMargin: 80 + anchors.horizontalCenter: parent.horizontalCenter + + spacing: 60 + + 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 + } + } + + Cura.PrimaryButton + { + id: getStartedButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } +} From 51c773fd807200b74c3fe6f2e35719de84074b01 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Feb 2019 08:06:28 +0100 Subject: [PATCH 009/211] WIP: Make reusable widget CuraProgressBar --- .../qml/ActionPanel/SliceProcessWidget.qml | 23 ++--------- .../qml/WelcomePages/StepIndicatorBar.qml | 34 ----------------- resources/qml/WelcomePages/StepPanel.qml | 30 +++++++-------- resources/qml/Widgets/CuraProgressBar.qml | 38 +++++++++++++++++++ 4 files changed, 54 insertions(+), 71 deletions(-) delete mode 100644 resources/qml/WelcomePages/StepIndicatorBar.qml create mode 100644 resources/qml/Widgets/CuraProgressBar.qml diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 21d6fac2d8..f9ff706183 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -9,6 +9,8 @@ import QtQuick.Controls 1.4 as Controls1 import UM 1.1 as UM import Cura 1.0 as Cura +import "../Widgets" + // This element contains all the elements the user needs to create a printjob from the // model(s) that is(are) on the buildplate. Mainly the button to start/stop the slicing @@ -64,7 +66,7 @@ Column } // Progress bar, only visible when the backend is in the process of slice the printjob - ProgressBar + CuraProgressBar { id: progressBar width: parent.width @@ -72,25 +74,6 @@ Column value: progress indeterminate: widget.backendState == UM.Backend.NotStarted visible: (widget.backendState == UM.Backend.Processing || (prepareButtons.autoSlice && widget.backendState == UM.Backend.NotStarted)) - - background: Rectangle - { - anchors.fill: parent - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - } - - contentItem: Item - { - anchors.fill: parent - Rectangle - { - width: progressBar.visualPosition * parent.width - height: parent.height - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_control") - } - } } Item diff --git a/resources/qml/WelcomePages/StepIndicatorBar.qml b/resources/qml/WelcomePages/StepIndicatorBar.qml deleted file mode 100644 index 273d1949d2..0000000000 --- a/resources/qml/WelcomePages/StepIndicatorBar.qml +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 - - -Item -{ - id: base - - property int totalSteps: 10 - property int currentStep: 6 - property int radius: 2 - - Rectangle - { - id: background - anchors.fill: parent - color: "#f0f0f0" - radius: base.radius - } - - Rectangle - { - id: progress - anchors.left: parent.left - anchors.top: parent.top - anchors.bottom: parent.bottom - width: (currentStep + 1) * 1.0 / totalSteps * background.width - color: "#3282ff" - radius: base.radius - } -} diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 779797721b..78ce53dbd3 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -6,6 +6,10 @@ import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 // For the dropshadow import Cura 1.1 as Cura + +import "../Widgets" + + Item { id: base @@ -18,10 +22,11 @@ Item property int stepBarHeight: 12 property int contentMargins: 1 - property int totalSteps: 0 - property int currentStep: -1 + property int currentStep: 0 + property int totalStepCount: (model == null) ? 0 : model.count + property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount) - property var currentItem: null + property var currentItem: (model == null) ? null : model.getItem(currentStep) property var model: null signal showNextPage() @@ -30,7 +35,7 @@ Item onShowNextPage: { - if (currentStep < totalSteps - 1) + if (currentStep < totalStepCount - 1) { currentStep++ } @@ -56,16 +61,9 @@ Item } } - onCurrentStepChanged: - { - base.currentItem = base.model.getItem(base.currentStep) - } - onModelChanged: { - base.totalSteps = base.model.count base.currentStep = 0 - base.currentItem = base.model.getItem(base.currentStep) } // Panel background @@ -94,13 +92,11 @@ Item z: panelBackground.z - 1 } - StepIndicatorBar + CuraProgressBar { - id: stepIndicatorBar + id: progressBar - totalSteps: base.totalSteps - currentStep: base.currentStep - radius: base.roundCornerRadius + value: base.progressValue anchors { @@ -117,7 +113,7 @@ Item anchors { margins: base.contentMargins - top: stepIndicatorBar.bottom + top: progressBar.bottom bottom: parent.bottom left: parent.left right: parent.right diff --git a/resources/qml/Widgets/CuraProgressBar.qml b/resources/qml/Widgets/CuraProgressBar.qml new file mode 100644 index 0000000000..a08c02ebc4 --- /dev/null +++ b/resources/qml/Widgets/CuraProgressBar.qml @@ -0,0 +1,38 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.0 as Cura + +// +// Cura-style progress bar, with a grey background and a blue indication bar. +// +ProgressBar +{ + id: progressBar + width: parent.width + height: UM.Theme.getSize("progressbar").height + + background: Rectangle + { + anchors.fill: parent + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_background") + } + + contentItem: Item + { + anchors.fill: parent + + Rectangle + { + width: progressBar.visualPosition * parent.width + height: parent.height + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_control") + } + } +} From 9c66921538b15bd95475e8dee69090208e07f659 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Feb 2019 08:07:16 +0100 Subject: [PATCH 010/211] WIP: dos2unix new files --- cura/UI/WelcomePagesModel.py | 120 ++++++------ .../WelcomePages/DataCollectionsContent.qml | 138 +++++++------- resources/qml/WelcomePages/WelcomeDialog.qml | 78 ++++---- .../qml/WelcomePages/WhatsNewContent.qml | 174 +++++++++--------- 4 files changed, 255 insertions(+), 255 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b0a9a94b0d..00a52a5a5c 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -1,60 +1,60 @@ - - -import os -from typing import TYPE_CHECKING, Optional - -from PyQt5.QtCore import QUrl, Qt - -from UM.Qt.ListModel import ListModel -from UM.Resources import Resources - -if TYPE_CHECKING: - from PyQt5.QtCore import QObject - - -class WelcomePagesModel(ListModel): - - IdRole = Qt.UserRole + 1 # Page ID - PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file - NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to - - def __init__(self, parent: Optional["QObject"] = None) -> None: - super().__init__(parent) - - self.addRoleName(self.IdRole, "id") - self.addRoleName(self.PageUrlRole, "page_url") - self.addRoleName(self.NextPageIdRole, "next_page_id") - - self._pages = [] - - def initialize(self) -> None: - from cura.CuraApplication import CuraApplication - # Add default welcome pages - self._pages.append({"id": "welcome", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "WelcomeContent.qml"))), - }) - self._pages.append({"id": "user_agreement", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "UserAgreementContent.qml"))), - }) - self._pages.append({"id": "whats_new", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "WhatsNewContent.qml"))), - }) - self._pages.append({"id": "data_collections", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "DataCollectionsContent.qml"))), - }) - - self.setItems(self._pages) - - def addPage(self): - pass - - -__all__ = ["WelcomePagesModel"] + + +import os +from typing import TYPE_CHECKING, Optional + +from PyQt5.QtCore import QUrl, Qt + +from UM.Qt.ListModel import ListModel +from UM.Resources import Resources + +if TYPE_CHECKING: + from PyQt5.QtCore import QObject + + +class WelcomePagesModel(ListModel): + + IdRole = Qt.UserRole + 1 # Page ID + PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file + NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to + + def __init__(self, parent: Optional["QObject"] = None) -> None: + super().__init__(parent) + + self.addRoleName(self.IdRole, "id") + self.addRoleName(self.PageUrlRole, "page_url") + self.addRoleName(self.NextPageIdRole, "next_page_id") + + self._pages = [] + + def initialize(self) -> None: + from cura.CuraApplication import CuraApplication + # Add default welcome pages + self._pages.append({"id": "welcome", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "WelcomeContent.qml"))), + }) + self._pages.append({"id": "user_agreement", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "UserAgreementContent.qml"))), + }) + self._pages.append({"id": "whats_new", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "WhatsNewContent.qml"))), + }) + self._pages.append({"id": "data_collections", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "DataCollectionsContent.qml"))), + }) + + self.setItems(self._pages) + + def addPage(self): + pass + + +__all__ = ["WelcomePagesModel"] diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 6dc1657bc5..2120c03360 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -1,69 +1,69 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 - -import UM 1.3 as UM -import Cura 1.1 as Cura - - -// -// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. -// -Item -{ - UM.I18nCatalog { id: catalog; name: "cura" } - - Label - { - id: titleLabel - anchors.top: parent.top - anchors.topMargin: 40 - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") - color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") - renderType: Text.NativeRendering - } - - Column - { - anchors.top: titleLabel.bottom - anchors.topMargin: 80 - anchors.horizontalCenter: parent.horizontalCenter - - spacing: 60 - - 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 - } - } - - Cura.PrimaryButton - { - id: getStartedButton - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 40 - text: catalog.i18nc("@button", "Next") - width: 140 - fixedWidthMode: true - onClicked: base.showNextPage() - } -} +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Column + { + anchors.top: titleLabel.bottom + anchors.topMargin: 80 + anchors.horizontalCenter: parent.horizontalCenter + + spacing: 60 + + 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 + } + } + + Cura.PrimaryButton + { + id: getStartedButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } +} diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 0ac160f064..626b6b6877 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -1,39 +1,39 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Window 2.2 - -import UM 1.3 as UM -import Cura 1.1 as Cura - - -Window -{ - UM.I18nCatalog { id: catalog; name: "cura" } - - title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") - modality: Qt.ApplicationModal - flags: Qt.Window | Qt.FramelessWindowHint - - width: 580 // TODO - height: 600 // TODO - color: "transparent" - - property alias currentStep: stepPanel.currentStep - - StepPanel - { - id: stepPanel - currentStep: 0 - model: CuraApplication.getWelcomePagesModel() - } - - // Close this dialog when there's no more page to show - Connections - { - target: stepPanel - onPassLastPage: close() - } -} +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Window 2.2 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +Window +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") + modality: Qt.ApplicationModal + flags: Qt.Window | Qt.FramelessWindowHint + + width: 580 // TODO + height: 600 // TODO + color: "transparent" + + property alias currentStep: stepPanel.currentStep + + StepPanel + { + id: stepPanel + currentStep: 0 + model: CuraApplication.getWelcomePagesModel() + } + + // Close this dialog when there's no more page to show + Connections + { + target: stepPanel + onPassLastPage: close() + } +} diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 0ddd02ee36..4668a6cd36 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -1,87 +1,87 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 - -import UM 1.3 as UM -import Cura 1.1 as Cura - - -// -// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. -// -Item -{ - UM.I18nCatalog { id: catalog; name: "cura" } - - Label - { - id: titleLabel - anchors.top: parent.top - anchors.topMargin: 40 - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - text: catalog.i18nc("@label", "What's new in Ultimaker Cura") - color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") - renderType: Text.NativeRendering - } - - Rectangle - { - anchors.top: titleLabel.bottom - anchors.bottom: getStartedButton.top - anchors.topMargin: 40 - anchors.bottomMargin: 40 - anchors.horizontalCenter: parent.horizontalCenter - width: parent.width * 3 / 4 - - border.color: "#dfdfdf" - border.width: 1 - - - ScrollView - { - anchors.fill: parent - anchors.margins: 1 - - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - TextArea - { - id: whatsNewTextArea - width: parent.width - text: catalog.i18nc("@text", "

Ultimaker Cura 4.0

- -

New features

- -

Brand new user interface. Ultimaker Cura is a very powerful tool with many features to support users’ needs. In the new UI, we present these features in a better, more intuitive way based on the workflow of our users. The Marketplace and user account control have been integrated into the main interface to easily access material profiles and plugins. Within the UI, three stages are shown in the header to give a clear guidance of the flow. The stage menu is populated with collapsible panels that allow users to focus on the 3D view when needed, while still showing important information at the same time, such as slicing configuration and settings. Users can now easily go to the preview stage to examine the layer view after slicing the model, which previously was less obvious or hidden. The new UI also creates more distinction between recommended and custom mode. Novice users or users who are not interested in all the settings can easily prepare a file without diving into details. Expert users can use custom mode with a resizable settings panel to make more settings visible, and the set position will persist between sessions.

- -

Cloud printing. Pair your Ultimaker printer with an Ultimaker account so you can send and monitor print jobs from outside your local network.

- -

Redesigned "Add Printer" dialog. Updated one of the first dialogs a new user is presented with. The layout is loosely modeled on the layout of the Ultimaker 3/Ultimaker S5 "Connect to Network" dialog, and adds some instructions and intention to the dialog. Contributed by fieldOfView.

- -

Integrated backups. Cura backups has been integrated into Ultimaker Cura and can be found in the 'extensions' menu. With this feature, users can backup their Ultimaker Cura configurations to the cloud.

- ") - textFormat: Text.RichText - wrapMode: Text.WordWrap - readOnly: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - } - } - } - - Cura.PrimaryButton - { - id: getStartedButton - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 40 - text: catalog.i18nc("@button", "Next") - width: 140 - fixedWidthMode: true - onClicked: base.showNextPage() - } -} +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "What's new in Ultimaker Cura") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors.top: titleLabel.bottom + anchors.bottom: getStartedButton.top + anchors.topMargin: 40 + anchors.bottomMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 3 / 4 + + border.color: "#dfdfdf" + border.width: 1 + + + ScrollView + { + anchors.fill: parent + anchors.margins: 1 + + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + + TextArea + { + id: whatsNewTextArea + width: parent.width + text: catalog.i18nc("@text", "

Ultimaker Cura 4.0

+ +

New features

+ +

Brand new user interface. Ultimaker Cura is a very powerful tool with many features to support users’ needs. In the new UI, we present these features in a better, more intuitive way based on the workflow of our users. The Marketplace and user account control have been integrated into the main interface to easily access material profiles and plugins. Within the UI, three stages are shown in the header to give a clear guidance of the flow. The stage menu is populated with collapsible panels that allow users to focus on the 3D view when needed, while still showing important information at the same time, such as slicing configuration and settings. Users can now easily go to the preview stage to examine the layer view after slicing the model, which previously was less obvious or hidden. The new UI also creates more distinction between recommended and custom mode. Novice users or users who are not interested in all the settings can easily prepare a file without diving into details. Expert users can use custom mode with a resizable settings panel to make more settings visible, and the set position will persist between sessions.

+ +

Cloud printing. Pair your Ultimaker printer with an Ultimaker account so you can send and monitor print jobs from outside your local network.

+ +

Redesigned "Add Printer" dialog. Updated one of the first dialogs a new user is presented with. The layout is loosely modeled on the layout of the Ultimaker 3/Ultimaker S5 "Connect to Network" dialog, and adds some instructions and intention to the dialog. Contributed by fieldOfView.

+ +

Integrated backups. Cura backups has been integrated into Ultimaker Cura and can be found in the 'extensions' menu. With this feature, users can backup their Ultimaker Cura configurations to the cloud.

+ ") + textFormat: Text.RichText + wrapMode: Text.WordWrap + readOnly: true + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + } + } + } + + Cura.PrimaryButton + { + id: getStartedButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } +} From 6ebfaff61e1b215953099055b3b865edad776866 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Feb 2019 08:33:28 +0100 Subject: [PATCH 011/211] WIP: Fixes and add cloud page --- cura/UI/WelcomePagesModel.py | 5 + resources/qml/WelcomePages/CloudContent.qml | 120 ++++++++++++++++++ .../WelcomePages/DataCollectionsContent.qml | 2 +- .../qml/WelcomePages/UserAgreementContent.qml | 9 +- resources/qml/WelcomePages/WelcomeContent.qml | 2 +- .../qml/WelcomePages/WhatsNewContent.qml | 4 +- resources/themes/cura-light/theme.json | 2 + 7 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 resources/qml/WelcomePages/CloudContent.qml diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 00a52a5a5c..e85cb53a4a 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -50,6 +50,11 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", "DataCollectionsContent.qml"))), }) + self._pages.append({"id": "cloud", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "CloudContent.qml"))), + }) self.setItems(self._pages) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml new file mode 100644 index 0000000000..31f9037b4b --- /dev/null +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -0,0 +1,120 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the "Ultimaker Cloud" page of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "Ultimaker Cloud") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Column + { + 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") + } + + Column + { + anchors.horizontalCenter: parent.horizontalCenter + + spacing: 30 + + Label + { + id: highlightTextLabel + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@text", "The next generation 3D printing workflow") + textFormat: Text.RichText + color: UM.Theme.getColor("text_light_blue") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + + Label + { + 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) + } + textFormat: Text.RichText + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + } + } + + Cura.PrimaryButton + { + id: finishButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Finish") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } + + Cura.SecondaryButton + { + id: createAccountButton + anchors.left: parent.left + anchors.verticalCenter: finishButton.verticalCenter + anchors.margins: 40 + text: catalog.i18nc("@button", "Create an account") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() // TODO: create account + } + + Cura.SecondaryButton + { + id: signInButton + anchors.left: createAccountButton.right + //anchors.leftMargin: 10 + anchors.verticalCenter: finishButton.verticalCenter + text: catalog.i18nc("@button", "Sign in") + width: 80 + shadowEnabled: false + color: "transparent" + hoverColor: "transparent" + textHoverColor: UM.Theme.getColor("text_light_blue") + fixedWidthMode: true + onClicked: base.showNextPage() // TODO: sign in + } +} diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 2120c03360..93426d2c2c 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -9,7 +9,7 @@ import Cura 1.1 as Cura // -// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// This component contains the content for the "Help us to improve Ultimaker Cura" page of the welcome on-boarding process. // Item { diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 74c11d21d8..871dea4602 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -7,6 +7,9 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura +// +// This component contains the content for the "User Agreement" page of the welcome on-boarding process. +// Item { Column @@ -31,7 +34,7 @@ Item text: catalog.i18nc("@label", "User Agreement") color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("large_bold") - renderType: NativeRendering + renderType: Text.NativeRendering } Label @@ -46,7 +49,7 @@ Item textFormat: Text.RichText wrapMode: Text.WordWrap font: UM.Theme.getFont("default") - renderType: NativeRendering + renderType: Text.NativeRendering } } @@ -71,6 +74,6 @@ Item text: catalog.i18nc("@button", "Decline and close") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() + onClicked: base.showNextPage() // TODO: quit } } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index c7da56cdd4..fe47567da6 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -9,7 +9,7 @@ import Cura 1.1 as Cura // -// This component contains the content for the first page of the welcome on-boarding process. +// This component contains the content for the "Welcome" page of the welcome on-boarding process. // Column { diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 4668a6cd36..b083c99e32 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -9,7 +9,7 @@ import Cura 1.1 as Cura // -// This component contains the content for the page "What's new in Ultimaker Cura" of the welcome on-boarding process. +// This component contains the content for the "What's new in Ultimaker Cura" page of the welcome on-boarding process. // Item { @@ -40,7 +40,6 @@ Item border.color: "#dfdfdf" border.width: 1 - ScrollView { anchors.fill: parent @@ -51,7 +50,6 @@ Item TextArea { id: whatsNewTextArea - width: parent.width text: catalog.i18nc("@text", "

Ultimaker Cura 4.0

New features

diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index acf2bbd3e9..2f11df11f4 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -191,6 +191,8 @@ "printer_type_label_background": [228, 228, 242, 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 bbe1b1590ac610254cecd57e7b6585369fc70e8d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Feb 2019 09:35:16 +0100 Subject: [PATCH 012/211] Added test for adding & creating machine with discovered printer CURA-6179 --- tests/TestMachineManager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/TestMachineManager.py b/tests/TestMachineManager.py index b989a6ee79..ca0e203c8b 100644 --- a/tests/TestMachineManager.py +++ b/tests/TestMachineManager.py @@ -15,7 +15,10 @@ def container_registry() -> ContainerRegistry: def extruder_manager(application, container_registry) -> ExtruderManager: with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)): with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value=container_registry)): + manager = ExtruderManager.getInstance() + if manager is None: manager = ExtruderManager() + return manager @pytest.fixture() @@ -41,3 +44,9 @@ def test_setActiveMachine(machine_manager): # Although we mocked the application away, we still want to know if it was notified about the attempted change. machine_manager._application.setGlobalContainerStack.assert_called_with(mocked_global_stack) + +def test_discoveredMachine(machine_manager): + mocked_callback = MagicMock() + machine_manager.addDiscoveredPrinter("test", "zomg", mocked_callback, "derp") + machine_manager.addMachineFromDiscoveredPrinter("test") + mocked_callback.assert_called_with("test") \ No newline at end of file From 1c7e047a3848851d14915037d5b0f59dfba56354 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Feb 2019 09:47:25 +0100 Subject: [PATCH 013/211] Added tests for adding & removing discovered devices CURA-6179 --- cura/Settings/MachineManager.py | 7 +++++++ tests/TestMachineManager.py | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 7a06e8753c..d19932a7a0 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -162,6 +162,7 @@ class MachineManager(QObject): printerConnectedStatusChanged = pyqtSignal() # Emitted every time the active machine change or the outputdevices change rootMaterialChanged = pyqtSignal() + discoveredPrintersChanged = pyqtSignal() def setInitialActiveMachine(self) -> None: active_machine_id = self._application.getPreferences().getValue("cura/active_machine") @@ -183,12 +184,18 @@ class MachineManager(QObject): def addDiscoveredPrinter(self, key: str, name: str, create_callback: Callable[[str], None], machine_type: str) -> None: if key not in self._discovered_printers: self._discovered_printers[key] = DiscoveredPrinter(key, name, create_callback, machine_type) + self.discoveredPrintersChanged.emit() else: Logger.log("e", "Printer with the key %s was already in the discovered printer list", key) def removeDiscoveredPrinter(self, key: str) -> None: if key in self._discovered_printers: del self._discovered_printers[key] + self.discoveredPrintersChanged.emit() + + @pyqtProperty("QVariantList", notify = discoveredPrintersChanged) + def discoveredPrinters(self): + return list(self._discovered_printers.values()) @pyqtSlot(str) def addMachineFromDiscoveredPrinter(self, key: str) -> None: diff --git a/tests/TestMachineManager.py b/tests/TestMachineManager.py index ca0e203c8b..34a0bbc35c 100644 --- a/tests/TestMachineManager.py +++ b/tests/TestMachineManager.py @@ -11,6 +11,7 @@ from cura.Settings.MachineManager import MachineManager def container_registry() -> ContainerRegistry: return MagicMock() + @pytest.fixture() def extruder_manager(application, container_registry) -> ExtruderManager: with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)): @@ -21,6 +22,7 @@ def extruder_manager(application, container_registry) -> ExtruderManager: return manager + @pytest.fixture() def machine_manager(application, extruder_manager, container_registry) -> MachineManager: application.getExtruderManager = MagicMock(return_value = extruder_manager) @@ -49,4 +51,14 @@ def test_discoveredMachine(machine_manager): mocked_callback = MagicMock() machine_manager.addDiscoveredPrinter("test", "zomg", mocked_callback, "derp") machine_manager.addMachineFromDiscoveredPrinter("test") - mocked_callback.assert_called_with("test") \ No newline at end of file + mocked_callback.assert_called_with("test") + + assert len(machine_manager.discoveredPrinters) == 1 + + # Test if removing it works + machine_manager.removeDiscoveredPrinter("test") + assert len(machine_manager.discoveredPrinters) == 0 + + # Just in case, nothing should happen. + machine_manager.addMachineFromDiscoveredPrinter("test") + assert mocked_callback.call_count == 1 \ No newline at end of file From 113c37f555a40ab42f90c2fae644e33f9fd09561 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 1 Mar 2019 13:17:15 +0100 Subject: [PATCH 014/211] Start work on 'AddPrinterByIp' for WelcomePages. [CURA-6057] --- cura/UI/WelcomePagesModel.py | 8 +- .../resources/qml/DiscoverUM3Action.qml | 2 +- .../WelcomePages/AddPrinterByIpContent.qml | 169 ++++++++++++++++++ 3 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 resources/qml/WelcomePages/AddPrinterByIpContent.qml diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index e85cb53a4a..a1b5c6b602 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -11,7 +11,6 @@ from UM.Resources import Resources if TYPE_CHECKING: from PyQt5.QtCore import QObject - class WelcomePagesModel(ListModel): IdRole = Qt.UserRole + 1 # Page ID @@ -50,16 +49,19 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", "DataCollectionsContent.qml"))), }) + self._pages.append({"id": "add_printer_by_ip", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "AddPrinterByIpContent.qml"))), + }) self._pages.append({"id": "cloud", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", "CloudContent.qml"))), }) - self.setItems(self._pages) def addPage(self): pass - __all__ = ["WelcomePagesModel"] diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 3883a7e285..2788a35173 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -371,7 +371,7 @@ Cura.MachineAction Label { - text: catalog.i18nc("@alabel", "Enter the IP address or hostname of your printer on the network.") + text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") width: parent.width wrapMode: Text.WordWrap renderType: Text.NativeRendering diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml new file mode 100644 index 0000000000..7cb98c5dde --- /dev/null +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -0,0 +1,169 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the 'by IP' page of the "Add New Printer" flow of the on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "Add printer by IP adress") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors.top: titleLabel.bottom + anchors.bottom: connectButton.top + anchors.topMargin: 40 + anchors.bottomMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 3 / 4 + + border.color: "#dfdfdf" + border.width: 1 + + Item + { + width: parent.width + //anchors.top: parent.top + //anchors.topMargin: 20 + //anchors.bottomMargin: 20 + + Label + { + id: explainLabel + height: contentHeight + width: parent.width + anchors.top: parent.top + anchors.margins: 20 + //anchors.bottomMargin: 20 + + text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") + } + + Item + { + id: userInputFields + height: childrenRect.height + width: parent.width + anchors.top: explainLabel.bottom + + TextField + { + id: hostnameField + anchors.top: parent.top + anchors.left: parent.left + //anchors.bottom: parent.bottom + anchors.right: addPrinterButton.left + anchors.margins: 20 + //width: parent.width / 2 + //horizontalAlignment: Text.AlignLeft + + //editable: true + text: "" + + //validator: RegExpValidator + //{ + // regExp: /[a-zA-Z0-9\.\-\_]*/ + //} + + onAccepted: addPrinterButton.clicked() + } + + Cura.PrimaryButton + { + id: addPrinterButton + anchors.top: parent.top + anchors.right: parent.right + //anchors.bottom: parent.bottom + anchors.margins: 20 + width: 140 + fixedWidthMode: true + + text: catalog.i18nc("@button", "Add") + onClicked: + { + // fire off method, then wait for event + + + // manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) // manager not defined + // manualPrinterDialog.hide() + } + //enabled: hostnameField.trim() != "" + } + } + + Rectangle + { + width: parent.width + anchors.top: userInputFields.bottom + + Label + { + id: visTestA + anchors.top: parent.top + anchors.margins: 20 + + visible: false + text: catalog.i18nc("@label", "The printer at this address has not responded yet.") + } + + Label + { + id: visTestB + anchors.top: parent.top + anchors.margins: 20 + + visible: true + text: "PLACEHOLDER" + } + } + } + } + + Cura.PrimaryButton + { + id: backButton + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Back") + width: 140 + fixedWidthMode: true + onClicked: base.showPreviousPage() // TODO? + + enabled: true // TODO + } + + Cura.PrimaryButton + { + id: connectButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Connect") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + + enabled: false // TODO + } +} From 56060b1e64c4c08c1376056ac3b76f8fd484cc61 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 5 Mar 2019 08:39:03 +0100 Subject: [PATCH 015/211] WIP: Add add printer page, network part --- .../PrinterSelector/MachineSelectorButton.qml | 5 +- .../qml/WelcomePages/AddPrinterNetwork.qml | 106 ++++++++++++++++++ resources/qml/WelcomePages/DropDownHeader.qml | 71 ++++++++++++ resources/qml/WelcomePages/DropDownWidget.qml | 78 +++++++++++++ resources/qml/WelcomePages/StepPanel.qml | 1 + 5 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 resources/qml/WelcomePages/AddPrinterNetwork.qml create mode 100644 resources/qml/WelcomePages/DropDownHeader.qml create mode 100644 resources/qml/WelcomePages/DropDownWidget.qml diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 39e63d27c3..ec99dff6c9 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -1,12 +1,13 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 -import QtQuick.Controls 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 import UM 1.1 as UM import Cura 1.0 as Cura + Button { id: machineSelectorButton diff --git a/resources/qml/WelcomePages/AddPrinterNetwork.qml b/resources/qml/WelcomePages/AddPrinterNetwork.qml new file mode 100644 index 0000000000..a9ce982f80 --- /dev/null +++ b/resources/qml/WelcomePages/AddPrinterNetwork.qml @@ -0,0 +1,106 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../PrinterSelector" + +// +// This component contains the content for the "Add a printer" (network) page of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: catalog.i18nc("@label", "Add a printer") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + DropDownWidget + { + id: addNetworkPrinterDropDown + + anchors.top: titleLabel.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + + title: catalog.i18nc("@label", "Add a network printer") + + contentComponent: networkPrinterListComponent + + Component + { + id: networkPrinterListComponent + + ScrollView + { + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + property int maxItemCountAtOnce: 5 // show at max 10 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) + + clip: true + + ListView + { + id: listView + anchors.fill: parent + model: Cura.GlobalStacksModel {} // TODO: change this to the network printers + + delegate: MachineSelectorButton + { + text: model.name + width: listView.width - UM.Theme.getSize("default_margin").width + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + + checked: ListView.view.currentIndex == index + onClicked: + { + ListView.view.currentIndex = index + } + } + } + } + } + } + + DropDownWidget + { + id: addLocalPrinterDropDown + + anchors.top: addNetworkPrinterDropDown.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + + title: catalog.i18nc("@label", "Add a non-network printer") + } + + Cura.PrimaryButton + { + id: nextButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + enabled: true // TODO + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } +} diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml new file mode 100644 index 0000000000..b115efe3d2 --- /dev/null +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -0,0 +1,71 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import ".." + + +// +// This is DropDown Header bar of the expandable drop down list. +// +Cura.RoundedRectangle +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + id: base + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: hovered ? UM.Theme.getColor("secondary_button_hover") : UM.Theme.getColor("secondary_button") + radius: UM.Theme.getSize("default_radius").width + + cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All + + property string title: "" + property url rightIconSource: UM.Theme.getIcon("arrow_bottom") + + // If the tab is under hovering state + property bool hovered: false + // If the content is shown + property bool contentShown: false + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + onEntered: base.hovered = true + onExited: base.hovered = false + + onClicked: base.contentShown = !base.contentShown + } + + Label + { + id: title + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + text: base.title + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") + } + + UM.RecolorImage + { + id: rightIcon + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("message_close").width + height: UM.Theme.getSize("message_close").height + color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") + source: base.rightIconSource + } +} diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml new file mode 100644 index 0000000000..5addac13ed --- /dev/null +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -0,0 +1,78 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + id: base + + implicitWidth: 200 + height: header.contentShown ? childrenRect.height : header.height + + property var contentComponent: null + + property alias title: header.title + property alias contentShown: header.contentShown + + DropDownHeader + { + id: header + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: UM.Theme.getSize("expandable_component_content_header").height + rightIconSource: contentShown ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") + } + + Cura.RoundedRectangle + { + id: contentRectangle + anchors.top: header.bottom + anchors.horizontalCenter: header.horizontalCenter + width: header.width + height: childrenRect.height + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: "white" + radius: UM.Theme.getSize("default_radius").width + visible: base.contentShown + cornerSide: Cura.RoundedRectangle.Direction.Down + + Loader + { + id: contentLoader + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height + anchors.margins: 1 + sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent + } + + // This is the empty component/placeholder that will be shown when the widget gets expanded. + // It contains a text line "Empty" + Component + { + id: emptyComponent + + Label + { + text: catalog.i18nc("@label", "Empty") + height: UM.Theme.getSize("action_button").height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + } + } +} diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 78ce53dbd3..40569fe39b 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -5,6 +5,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 // For the dropshadow +import UM 1.3 as UM import Cura 1.1 as Cura import "../Widgets" From 3c0583bef08e8bf91dd0664dd89502498e76f23b Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 6 Mar 2019 14:05:42 +0100 Subject: [PATCH 016/211] [AddPrinterByIp] Finish GUI as a facade first for review. [CURA-6057] --- cura/UI/WelcomePagesModel.py | 6 +- .../WelcomePages/AddPrinterByIpContent.qml | 135 ++++++++++++++---- 2 files changed, 109 insertions(+), 32 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index a1b5c6b602..b22fc31408 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -1,5 +1,5 @@ - - +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. import os from typing import TYPE_CHECKING, Optional @@ -60,6 +60,8 @@ class WelcomePagesModel(ListModel): "CloudContent.qml"))), }) + self.setItems(self._pages) + def addPage(self): pass diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 7cb98c5dde..25a6d532ce 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -3,6 +3,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura @@ -15,6 +16,53 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } + id: addPrinterByIpScreen + + property bool hasPushedAdd: false + property bool hasSentRequest: false + property bool haveConnection: false + + Timer + { + id: tempTimerButton + + interval: 1200 + running: false + repeat: false + onTriggered: + { + hasPushedAdd = true + tempTimerRequest.running = true + } + } + // TODO: Remove timers after review interface! + + Timer + { + id: tempTimerRequest + + interval: 1200 + running: false + repeat: false + onTriggered: + { + hasSentRequest = true + tempTimerConnection.running = true + } + } + // TODO: Remove timers after review interface! + + Timer + { + id: tempTimerConnection + + interval: 1200 + running: false + repeat: false + onTriggered: haveConnection = true + } + // TODO: Remove timers after review interface! + Label { id: titleLabel @@ -37,15 +85,9 @@ Item anchors.horizontalCenter: parent.horizontalCenter width: parent.width * 3 / 4 - border.color: "#dfdfdf" - border.width: 1 - Item { width: parent.width - //anchors.top: parent.top - //anchors.topMargin: 20 - //anchors.bottomMargin: 20 Label { @@ -55,6 +97,7 @@ Item anchors.top: parent.top anchors.margins: 20 //anchors.bottomMargin: 20 + font: UM.Theme.getFont("default") text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") } @@ -69,21 +112,19 @@ Item TextField { id: hostnameField - anchors.top: parent.top + anchors.verticalCenter: addPrinterButton.verticalCenter anchors.left: parent.left - //anchors.bottom: parent.bottom + height: addPrinterButton.height anchors.right: addPrinterButton.left anchors.margins: 20 - //width: parent.width / 2 - //horizontalAlignment: Text.AlignLeft + font: UM.Theme.getFont("default") - //editable: true text: "" - //validator: RegExpValidator - //{ - // regExp: /[a-zA-Z0-9\.\-\_]*/ - //} + validator: RegExpValidator + { + regExp: /[a-zA-Z0-9\.\-\_]*/ + } onAccepted: addPrinterButton.clicked() } @@ -93,7 +134,6 @@ Item id: addPrinterButton anchors.top: parent.top anchors.right: parent.right - //anchors.bottom: parent.bottom anchors.margins: 20 width: 140 fixedWidthMode: true @@ -101,13 +141,22 @@ Item text: catalog.i18nc("@button", "Add") onClicked: { - // fire off method, then wait for event + // TEMP: Simulate successfull connection to printer with 127.0.0.1 or unsuccessful with anything else + // TODO, alter after review interface, now it just starts the timers. - - // manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) // manager not defined - // manualPrinterDialog.hide() + if (hostnameField.text.trim() != "") + { + addPrinterByIpScreen.hasPushedAdd = true + tempTimerRequest.running = true + } + } + + enabled: ! addPrinterByIpScreen.hasPushedAdd + BusyIndicator + { + anchors.fill: parent + running: { ! parent.enabled && ! addPrinterByIpScreen.hasSentRequest } } - //enabled: hostnameField.trim() != "" } } @@ -115,25 +164,51 @@ Item { width: parent.width anchors.top: userInputFields.bottom + anchors.margins: 20 Label { - id: visTestA + id: waitResponseLabel anchors.top: parent.top anchors.margins: 20 + font: UM.Theme.getFont("default") - visible: false + visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection } text: catalog.i18nc("@label", "The printer at this address has not responded yet.") } - Label + Rectangle { - id: visTestB + id: printerInfoLabels anchors.top: parent.top anchors.margins: 20 - visible: true - text: "PLACEHOLDER" + visible: addPrinterByIpScreen.haveConnection + + Label + { + id: printerNameLabel + anchors.top: parent.top + font: UM.Theme.getFont("large") + + text: "Davids-desktop" // TODO: placeholder, alter after interface review. + } + + GridLayout + { + anchors.top: printerNameLabel.bottom + columns: 2 + columnSpacing: 20 + + Text { font: UM.Theme.getFont("default"); text: "Type" } + Text { font: UM.Theme.getFont("default"); text: "Ultimaker S5" } // TODO: placeholder, alter after interface review. + + Text { font: UM.Theme.getFont("default"); text: "Firmware version" } + Text { font: UM.Theme.getFont("default"); text: "4.3.3.20180529" } // TODO: placeholder, alter after interface review. + + Text { font: UM.Theme.getFont("default"); text: "Address" } + Text { font: UM.Theme.getFont("default"); text: "10.183.1.115" } // TODO: placeholder, alter after interface review. + } } } } @@ -148,9 +223,9 @@ Item text: catalog.i18nc("@button", "Back") width: 140 fixedWidthMode: true - onClicked: base.showPreviousPage() // TODO? + onClicked: base.showPreviousPage() - enabled: true // TODO + enabled: true } Cura.PrimaryButton @@ -164,6 +239,6 @@ Item fixedWidthMode: true onClicked: base.showNextPage() - enabled: false // TODO + enabled: addPrinterByIpScreen.haveConnection } } From 28eaea84269e4f44a7edef4dde2d4aadff877519 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 6 Mar 2019 15:12:05 +0100 Subject: [PATCH 017/211] WIP: Make dropdown exclusive from each other --- .../qml/WelcomePages/AddPrinterNetwork.qml | 45 ++++- .../qml/WelcomePages/AddPrinterScrollView.qml | 170 ++++++++++++++++++ resources/qml/WelcomePages/DropDownHeader.qml | 7 +- resources/qml/WelcomePages/DropDownWidget.qml | 15 +- 4 files changed, 230 insertions(+), 7 deletions(-) create mode 100644 resources/qml/WelcomePages/AddPrinterScrollView.qml diff --git a/resources/qml/WelcomePages/AddPrinterNetwork.qml b/resources/qml/WelcomePages/AddPrinterNetwork.qml index a9ce982f80..3e1c23ee8f 100644 --- a/resources/qml/WelcomePages/AddPrinterNetwork.qml +++ b/resources/qml/WelcomePages/AddPrinterNetwork.qml @@ -9,6 +9,7 @@ import Cura 1.1 as Cura import "../PrinterSelector" + // // This component contains the content for the "Add a printer" (network) page of the welcome on-boarding process. // @@ -40,6 +41,14 @@ Item title: catalog.i18nc("@label", "Add a network printer") + onClicked: + { + if (contentShown) + { + addLocalPrinterDropDown.contentShown = false + } + } + contentComponent: networkPrinterListComponent Component @@ -51,21 +60,23 @@ Item ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.vertical.policy: ScrollBar.AlwaysOn - property int maxItemCountAtOnce: 5 // show at max 10 items at once, otherwise you need to scroll. + property int maxItemCountAtOnce: 5 // show at max 5 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) clip: true ListView { - id: listView + id: networkPrinterListView anchors.fill: parent model: Cura.GlobalStacksModel {} // TODO: change this to the network printers delegate: MachineSelectorButton { text: model.name - width: listView.width - UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 10 outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null checked: ListView.view.currentIndex == index @@ -89,6 +100,34 @@ Item anchors.margins: 20 title: catalog.i18nc("@label", "Add a non-network printer") + + onClicked: + { + if (contentShown) + { + addNetworkPrinterDropDown.contentShown = false + } + } + + contentComponent: localPrinterListComponent + + Component + { + id: localPrinterListComponent + + AddPrinterScrollView + { + id: localPrinterView + + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) + + clip: true + } + } } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/AddPrinterScrollView.qml b/resources/qml/WelcomePages/AddPrinterScrollView.qml new file mode 100644 index 0000000000..2c2a5a50fa --- /dev/null +++ b/resources/qml/WelcomePages/AddPrinterScrollView.qml @@ -0,0 +1,170 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.0 as Cura + + +ScrollView +{ + id: base + + property var currentItem: null + property string currentSection: preferredCategory + property string preferredCategory: "Ultimaker" + + background: Rectangle + { + anchors.fill: parent + color: "white" + } + + ListView + { + id: machineList + + model: UM.DefinitionContainersModel + { + id: machineDefinitionsModel + filter: { "visible": true } + sectionProperty: "category" + preferredSectionValue: preferredCategory + } + + section.property: "section" + section.delegate: sectionHeader + delegate: machineButton + } + + Component + { + id: sectionHeader + + Button + { + id: button + width: ListView.view.width + height: UM.Theme.getSize("action_button").height + text: section + + property bool isActive: base.currentSection == section + + background: Rectangle + { + anchors.fill: parent + color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent" + } + + contentItem: Item + { + width: childrenRect.width + height: UM.Theme.getSize("action_button").height + + UM.RecolorImage + { + id: arrow + anchors.left: parent.left + //anchors.verticalCenter: label.verticalCenter + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + sourceSize.height: height + color: UM.Theme.getColor("text") + source: base.currentSection == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") + } + + Label + { + id: label + anchors.left: arrow.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + verticalAlignment: Text.AlignVCenter + text: button.text + font.bold: true + renderType: Text.NativeRendering + } + } + + onClicked: + { + if (base.currentSection != section) + { + // Find the first machine from this section + for (var i = 0; i < ListView.view.count; i++) + { + var item = ListView.view.model.getItem(i) + if (item.section == section) + { + base.currentItem = item + base.currentSection = item.section + ListView.view.currentIndex = i + break + } + } + } + } + } + } + + Component + { + id: machineButton + + RadioButton + { + id: radioButton + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("standard_list_lineheight").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 + + checked: ListView.view.currentIndex == index + text: name + font: UM.Theme.getFont("default") + visible: base.currentSection == section + + background: Rectangle + { + anchors.fill: parent + color: "transparent" + } + + indicator: Rectangle + { + implicitWidth: 16 + implicitHeight: 16 + anchors.verticalCenter: parent.verticalCenter + radius: width / 2 + border.width: UM.Theme.getSize("default_lining").width + border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") + + Rectangle { + width: parent.width / 2 + height: width + anchors.centerIn: parent + radius: width / 2 + color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") + visible: radioButton.checked + } + } + + contentItem: Label + { + verticalAlignment: Text.AlignVCenter + leftPadding: radioButton.indicator.width + radioButton.spacing + text: radioButton.text + font: radioButton.font + renderType: Text.NativeRendering + } + + onClicked: + { + ListView.view.currentIndex = index + } + } + } +} diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml index b115efe3d2..dacb017405 100644 --- a/resources/qml/WelcomePages/DropDownHeader.qml +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -34,6 +34,8 @@ Cura.RoundedRectangle // If the content is shown property bool contentShown: false + signal clicked() + MouseArea { anchors.fill: parent @@ -41,7 +43,10 @@ Cura.RoundedRectangle onEntered: base.hovered = true onExited: base.hovered = false - onClicked: base.contentShown = !base.contentShown + onClicked: { + base.contentShown = !base.contentShown + base.clicked() + } } Label diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index 5addac13ed..d55fa363c8 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -22,6 +22,14 @@ Item property alias title: header.title property alias contentShown: header.contentShown + signal clicked() + + Connections + { + target: header + onClicked: base.clicked() + } + DropDownHeader { id: header @@ -30,14 +38,15 @@ Item anchors.right: parent.right height: UM.Theme.getSize("expandable_component_content_header").height rightIconSource: contentShown ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") + } Cura.RoundedRectangle { id: contentRectangle anchors.top: header.bottom - anchors.horizontalCenter: header.horizontalCenter - width: header.width + anchors.left: header.left + anchors.right: header.right height: childrenRect.height border.width: UM.Theme.getSize("default_lining").width @@ -53,7 +62,7 @@ Item anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - height: childrenRect.height + height: childrenRect.height + 2 anchors.margins: 1 sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent } From a55808b24a308ac9ffe1eb7f86fbf8280abe9206 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 6 Mar 2019 15:15:21 +0100 Subject: [PATCH 018/211] WIP: Rename files --- cura/UI/WelcomePagesModel.py | 5 +++++ ...ddPrinterNetwork.qml => AddPrinterBySelectionContent.qml} | 0 2 files changed, 5 insertions(+) rename resources/qml/WelcomePages/{AddPrinterNetwork.qml => AddPrinterBySelectionContent.qml} (100%) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b22fc31408..68c91a5e8e 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -49,6 +49,11 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", "DataCollectionsContent.qml"))), }) + self._pages.append({"id": "add_printer_by_selection", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "AddPrinterBySelectionContent.qml"))), + }) self._pages.append({"id": "add_printer_by_ip", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", diff --git a/resources/qml/WelcomePages/AddPrinterNetwork.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml similarity index 100% rename from resources/qml/WelcomePages/AddPrinterNetwork.qml rename to resources/qml/WelcomePages/AddPrinterBySelectionContent.qml From 7a7e710b2a4fa3751fefe4d0f7029cceb93b237c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 6 Mar 2019 17:50:40 +0100 Subject: [PATCH 019/211] Support for manual device addition for plugins (WIP). [CURA-6294] --- cura/UI/WelcomePagesModel.py | 7 ++++--- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 5 +++++ resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b22fc31408..afcbee5f01 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -7,6 +7,7 @@ from PyQt5.QtCore import QUrl, Qt from UM.Qt.ListModel import ListModel from UM.Resources import Resources +from logging import Logger if TYPE_CHECKING: from PyQt5.QtCore import QObject @@ -17,6 +18,7 @@ class WelcomePagesModel(ListModel): PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to + def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__(parent) @@ -28,6 +30,7 @@ class WelcomePagesModel(ListModel): def initialize(self) -> None: from cura.CuraApplication import CuraApplication + # Add default welcome pages self._pages.append({"id": "welcome", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, @@ -51,9 +54,7 @@ class WelcomePagesModel(ListModel): }) self._pages.append({"id": "add_printer_by_ip", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "AddPrinterByIpContent.qml"))), - }) + os.path.join("WelcomePages", "AddPrinterByIpContent.qml")))}) self._pages.append({"id": "cloud", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 4529b31c45..b49113b538 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -15,6 +15,7 @@ from cura.CuraApplication import CuraApplication from cura.PrinterOutputDevice import ConnectionType from cura.Settings.GlobalStack import GlobalStack # typing from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin +from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.Logger import Logger from UM.Signal import Signal, signalemitter from UM.Version import Version @@ -181,6 +182,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._zero_conf.close() self._cloud_output_device_manager.stop() + def canAddManualDevice(self, address: str) -> ManualDeviceAdditionAttempt: + return ManualDeviceAdditionAttempt.POSSIBLE + # TODO?: Check if address is a valid IP (by regexp?). + def removeManualDevice(self, key, address = None): if key in self._discovered_devices: if not address: diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 25a6d532ce..465e02e1ff 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -148,6 +148,8 @@ Item { addPrinterByIpScreen.hasPushedAdd = true tempTimerRequest.running = true + + UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text) } } From 6d34a2abd0a9fbb6c94decfe89816b7e92f75285 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 8 Mar 2019 13:08:44 +0100 Subject: [PATCH 020/211] Start to connect/handle new signals for manual device addition. [CURA-6294] --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index b49113b538..8d8bcef4da 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -34,8 +34,6 @@ i18n_catalog = i18nCatalog("cura") # If we discover a printer that has the same key as the active machine instance a connection is made. @signalemitter class UM3OutputDevicePlugin(OutputDevicePlugin): - addDeviceSignal = Signal() - removeDeviceSignal = Signal() discoveredDevicesChanged = Signal() cloudFlowIsPossible = Signal() From 940a833e734c533045858908b09973c0525b3f87 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 8 Mar 2019 11:02:30 +0100 Subject: [PATCH 021/211] WIP: Add printers via network --- cura/CuraApplication.py | 10 ++ .../Models/DiscoveredPrintersModel.py | 104 ++++++++++++++++++ cura/Settings/MachineManager.py | 31 +----- .../src/ClusterUM3OutputDevice.py | 3 + .../src/UM3OutputDevicePlugin.py | 4 +- .../PrinterSelector/MachineSelectorButton.qml | 8 +- .../PrinterSelector/MachineSelectorList.qml | 6 + .../AddPrinterBySelectionContent.qml | 23 +++- tests/TestMachineManager.py | 2 +- 9 files changed, 145 insertions(+), 46 deletions(-) create mode 100644 cura/Machines/Models/DiscoveredPrintersModel.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f8b081bdcc..9ae43d4ee9 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -114,6 +114,8 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.ObjectsModel import ObjectsModel +from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrinterModel + from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage @@ -210,6 +212,8 @@ class CuraApplication(QtApplication): self._cura_scene_controller = None self._machine_error_checker = None + self._discovered_printer_model = DiscoveredPrinterModel(self) + self._welcome_pages_model = WelcomePagesModel(self) self._quality_profile_drop_down_menu_model = None @@ -846,6 +850,10 @@ class CuraApplication(QtApplication): # Hide the splash screen self.closeSplash() + @pyqtSlot(result = QObject) + def getDiscoveredPrinterModel(self, *args) -> "DiscoveredPrinterModel": + return self._discovered_printer_model + @pyqtSlot(result = QObject) def getSettingVisibilityPresetsModel(self, *args) -> SettingVisibilityPresetsModel: return self._setting_visibility_presets_model @@ -1003,6 +1011,8 @@ class CuraApplication(QtApplication): qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel") qmlRegisterType(MachineManagementModel, "Cura", 1, 0, "MachineManagementModel") + qmlRegisterType(DiscoveredPrinterModel, "Cura", 1, 0, "DiscoveredPrinterModel") + qmlRegisterSingletonType(QualityProfilesDropDownMenuModel, "Cura", 1, 0, "QualityProfilesDropDownMenuModel", self.getQualityProfilesDropDownMenuModel) qmlRegisterSingletonType(CustomQualityProfilesDropDownMenuModel, "Cura", 1, 0, diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py new file mode 100644 index 0000000000..d7e852629a --- /dev/null +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -0,0 +1,104 @@ +from typing import Callable, Optional, TYPE_CHECKING + +from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject + +from UM.Logger import Logger + +if TYPE_CHECKING: + from PyQt5.QtCore import QObject + + +class DiscoveredPrinter(QObject): + + def __init__(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, + device, parent = None) -> None: + super().__init__(parent) + self._ip_address = ip_address + self._key = key + self._name = name + self._create_callback = create_callback + self._machine_type = machine_type + self._device = device + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify = nameChanged) + def name(self) -> str: + return self._name + + def setName(self, name: str) -> None: + if self._name != name: + self._name = name + self.nameChanged.emit() + + machineTypeChanged = pyqtSignal() + + @pyqtProperty(str, notify = machineTypeChanged) + def machine_type(self) -> str: + return self._machine_type + + def setMachineType(self, machine_type: str) -> None: + if self._machine_type != machine_type: + self._machine_type = machine_type + self.machineTypeChanged.emit() + + @pyqtProperty(QObject, constant = True) + def device(self): + return self._device + + +# +# Discovered printers are all the printers that were found on the network, which provide a more convenient way +# to add networked printers (Plugin finds a bunch of printers, user can select one from the list, plugin can then +# add that printer to Cura as the active one). +# +class DiscoveredPrinterModel(QObject): + + def __init__(self, parent: Optional["QObject"]) -> None: + super().__init__(parent) + + self._discovered_printer_dict = dict() + + discoveredPrintersChanged = pyqtSignal() + + @pyqtProperty(list, notify = discoveredPrintersChanged) + def discovered_printers(self) -> "list": + item_list = list(x for x in self._discovered_printer_dict.values()) + item_list.sort(key = lambda x: x.name) + return item_list + + def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], + machine_type: str, device) -> None: + if ip_address in self._discovered_printer_dict: + Logger.log("e", "+++++++++++++ printer with ip [%s] has already been added", ip_address) + return + + discovered_printer = DiscoveredPrinter(ip_address, key, name, create_callback, machine_type, device, parent = self) + self._discovered_printer_dict[ip_address] = discovered_printer + self.discoveredPrintersChanged.emit() + + def updateDiscoveredPrinter(self, ip_address: str, + name: Optional[str] = None, + machine_type: Optional[str] = None) -> None: + if ip_address not in self._discovered_printer_dict: + Logger.log("e", "+++++++++++++ printer with ip [%s] is not known", ip_address) + return + + item = self._discovered_printer_dict[ip_address] + + if name is not None: + item.setName(name) + if machine_type is not None: + item.setMachineType(machine_type) + + def removeDiscoveredPrinter(self, ip_address: str) -> None: + if ip_address not in self._discovered_printer_dict: + Logger.log("i", "Key [%s] does not exist in the discovered printers list.", ip_address) + return + + del self._discovered_printer_dict[ip_address] + self.discoveredPrintersChanged.emit() + + @pyqtSlot("QVariant") + def createMachineFromDiscoveredPrinter(self, discovered_printer: "DiscoveredPrinter") -> None: + discovered_printer.create_callback() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index d19932a7a0..f2a50e3097 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -4,7 +4,7 @@ import time import re import unicodedata -from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast, NamedTuple, Callable +from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator @@ -49,8 +49,6 @@ if TYPE_CHECKING: from cura.Machines.QualityChangesGroup import QualityChangesGroup from cura.Machines.QualityGroup import QualityGroup -DiscoveredPrinter = NamedTuple("DiscoveredPrinter", [("key", str), ("name", str), ("create_callback", Callable[[str], None]), ("machine_type", "str")]) - class MachineManager(QObject): def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None: @@ -136,9 +134,6 @@ class MachineManager(QObject): self.globalContainerChanged.connect(self.printerConnectedStatusChanged) self.outputDevicesChanged.connect(self.printerConnectedStatusChanged) - # This will contain all discovered network printers - self._discovered_printers = {} # type: Dict[str, DiscoveredPrinter] - activeQualityGroupChanged = pyqtSignal() activeQualityChangesGroupChanged = pyqtSignal() @@ -178,30 +173,6 @@ class MachineManager(QObject): self.outputDevicesChanged.emit() - # Discovered printers are all the printers that were found on the network, which provide a more convenient way - # to add networked printers (Plugin finds a bunch of printers, user can select one from the list, plugin can then - # add that printer to Cura as the active one). - def addDiscoveredPrinter(self, key: str, name: str, create_callback: Callable[[str], None], machine_type: str) -> None: - if key not in self._discovered_printers: - self._discovered_printers[key] = DiscoveredPrinter(key, name, create_callback, machine_type) - self.discoveredPrintersChanged.emit() - else: - Logger.log("e", "Printer with the key %s was already in the discovered printer list", key) - - def removeDiscoveredPrinter(self, key: str) -> None: - if key in self._discovered_printers: - del self._discovered_printers[key] - self.discoveredPrintersChanged.emit() - - @pyqtProperty("QVariantList", notify = discoveredPrintersChanged) - def discoveredPrinters(self): - return list(self._discovered_printers.values()) - - @pyqtSlot(str) - def addMachineFromDiscoveredPrinter(self, key: str) -> None: - if key in self._discovered_printers: - self._discovered_printers[key].create_callback(key) - @pyqtProperty(QObject, notify = currentConfigurationChanged) def currentConfiguration(self) -> ConfigurationModel: return self._current_printer_configuration diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index c1a6362455..4b30514de1 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -624,6 +624,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateName(data["friendly_name"]) printer.updateKey(data["uuid"]) printer.updateType(data["machine_variant"]) + self._application.getDiscoveredPrinterModel().updateDiscoveredPrinter(data["ip_address"], + name = data["friendly_name"], + machine_type = data["machine_variant"]) # Do not store the build plate information that comes from connect if the current printer has not build plate information if "build_plate" in data and machine_definition.getMetaDataEntry("has_variant_buildplates", False): diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 4529b31c45..332af54abc 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -298,7 +298,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): except TypeError: # Disconnect already happened. pass - self._application.getMachineManager().removeDiscoveredPrinter(device.getId()) + self._application.getDiscoveredPrinterModel().removeDiscoveredPrinter(device.getId()) self.discoveredDevicesChanged.emit() def _onAddDevice(self, name, address, properties): @@ -323,7 +323,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties) else: device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties) - self._application.getMachineManager().addDiscoveredPrinter(device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8")) + self._application.getDiscoveredPrinterModel().addDiscoveredPrinter(address, device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8"), device) self._discovered_devices[device.getId()] = device self.discoveredDevicesChanged.emit() diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index ec99dff6c9..abd9eea9e9 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -24,7 +24,7 @@ Button function updatePrinterTypesList() { - printerTypesList = (checked && (outputDevice != null)) ? outputDevice.uniquePrinterTypes : [] + printerTypesList = (outputDevice != null) ? outputDevice.uniquePrinterTypes : [] } contentItem: Item @@ -82,12 +82,6 @@ Button border.color: machineSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent" } - onClicked: - { - toggleContent() - Cura.MachineManager.setActiveMachine(model.id) - } - Connections { target: outputDevice diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 49d9d31f2b..1043339ae6 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -42,5 +42,11 @@ ListView } return result } + + onClicked: + { + toggleContent() + Cura.MachineManager.setActiveMachine(model.id) + } } } diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 3e1c23ee8f..8ff058c615 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -57,10 +57,11 @@ Item ScrollView { - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + id: networkPrinterScrollView + ScrollBar.horizontal.policy: ScrollBar.AsNeeded ScrollBar.vertical.policy: ScrollBar.AlwaysOn - property int maxItemCountAtOnce: 5 // show at max 5 items at once, otherwise you need to scroll. + property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) clip: true @@ -69,15 +70,17 @@ Item { id: networkPrinterListView anchors.fill: parent - model: Cura.GlobalStacksModel {} // TODO: change this to the network printers + model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + visible: len(model) > 0 delegate: MachineSelectorButton { - text: model.name + text: modelData.device.name + anchors.left: parent.left anchors.right: parent.right anchors.rightMargin: 10 - outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + outputDevice: modelData.device checked: ListView.view.currentIndex == index onClicked: @@ -86,6 +89,14 @@ Item } } } + + Label + { + id: noNetworkPrinterLabel + text: catalog.i18nc("@label", "There is no printer found over your network.") + renderType: Text.NativeRendering + visible: !networkPrinterListView.visible + } } } } @@ -109,7 +120,7 @@ Item } } - contentComponent: localPrinterListComponent + //contentComponent: localPrinterListComponent Component { diff --git a/tests/TestMachineManager.py b/tests/TestMachineManager.py index 34a0bbc35c..36ffe01b96 100644 --- a/tests/TestMachineManager.py +++ b/tests/TestMachineManager.py @@ -61,4 +61,4 @@ def test_discoveredMachine(machine_manager): # Just in case, nothing should happen. machine_manager.addMachineFromDiscoveredPrinter("test") - assert mocked_callback.call_count == 1 \ No newline at end of file + assert mocked_callback.call_count == 1 From e821179d7f22eb728bd40fe3fbb2e58002980233 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 08:33:30 +0100 Subject: [PATCH 022/211] WIP: Fix binding loops --- resources/qml/WelcomePages/DropDownWidget.qml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index d55fa363c8..16e0f6d282 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -15,7 +15,7 @@ Item id: base implicitWidth: 200 - height: header.contentShown ? childrenRect.height : header.height + height: header.contentShown ? (header.height + contentRectangle.height) : header.height property var contentComponent: null @@ -47,7 +47,7 @@ Item anchors.top: header.bottom anchors.left: header.left anchors.right: header.right - height: childrenRect.height + height: contentLoader.height + 2 border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") @@ -62,7 +62,6 @@ Item anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - height: childrenRect.height + 2 anchors.margins: 1 sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent } From 69ca6f02a3c64ac8470d1edf45984f5df8de8e29 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 09:04:38 +0100 Subject: [PATCH 023/211] WIP: Add bottom buttons for add network printer dropdown --- .../AddPrinterBySelectionContent.qml | 158 ++++++++++++++---- 1 file changed, 128 insertions(+), 30 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 8ff058c615..3936e48728 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -55,47 +55,145 @@ Item { id: networkPrinterListComponent - ScrollView + Item { - id: networkPrinterScrollView - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AlwaysOn + height: networkPrinterScrollView.height + controlsRectangle.height - property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. - height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) - - clip: true - - ListView + ScrollView { - id: networkPrinterListView - anchors.fill: parent - model: CuraApplication.getDiscoveredPrinterModel().discovered_printers - visible: len(model) > 0 + id: networkPrinterScrollView + ScrollBar.horizontal.policy: ScrollBar.AsNeeded + ScrollBar.vertical.policy: ScrollBar.AlwaysOn - delegate: MachineSelectorButton + property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) + + clip: true + + ListView { - text: modelData.device.name + id: networkPrinterListView + anchors.fill: parent + model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + visible: model.count > 0 - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: 10 - outputDevice: modelData.device - - checked: ListView.view.currentIndex == index - onClicked: + delegate: MachineSelectorButton { - ListView.view.currentIndex = index + text: modelData.device.name + + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 10 + outputDevice: modelData.device + + checked: ListView.view.currentIndex == index + onClicked: + { + ListView.view.currentIndex = index + } } } + + Label + { + id: noNetworkPrinterLabel + text: catalog.i18nc("@label", "There is no printer found over your network.") + renderType: Text.NativeRendering + visible: !networkPrinterListView.visible + } } - Label + Cura.RoundedRectangle { - id: noNetworkPrinterLabel - text: catalog.i18nc("@label", "There is no printer found over your network.") - renderType: Text.NativeRendering - visible: !networkPrinterListView.visible + id: controlsRectangle + anchors.left: parent.left + anchors.right: parent.right + anchors.top: networkPrinterScrollView.bottom + anchors.bottomMargin: -border.width + anchors.leftMargin: -border.width + anchors.rightMargin: -border.width + + height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: "white" + cornerSide: Cura.RoundedRectangle.Direction.Down + + Cura.SecondaryButton + { + id: refreshButton + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Refresh") + height: UM.Theme.getSize("message_action_button").height + } + + Cura.SecondaryButton + { + id: addPrinterByIpButton + anchors.left: refreshButton.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Add printer by IP") + height: UM.Theme.getSize("message_action_button").height + } + + Item + { + id: troubleshootingButton + + 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 + + UM.RecolorImage + { + id: troubleshoortingLinkIcon + anchors.right: troubleshoortingLabel.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + height: troubleshoortingLabel.height + width: height + sourceSize.height: width + color: UM.Theme.getColor("text_link") + source: UM.Theme.getIcon("external_link") + } + + Label + { + id: troubleshoortingLabel + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Troubleshooting") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_link") + linkColor: UM.Theme.getColor("text_link") + renderType: Text.NativeRendering + } + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + onClicked: + { + // open the material URL with web browser + var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO + Qt.openUrlExternally(url) + } + onEntered: + { + troubleshoortingLabel.font.underline = true + } + onExited: + { + troubleshoortingLabel.font.underline = false + } + } + } } } } @@ -120,7 +218,7 @@ Item } } - //contentComponent: localPrinterListComponent + contentComponent: localPrinterListComponent Component { From 6f6e54fb060acd9b6e89cc79a3f1b1c99501a75b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 09:22:41 +0100 Subject: [PATCH 024/211] WIP: Add comments --- resources/qml/WelcomePages/AddPrinterBySelectionContent.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 3936e48728..77b3fe8122 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -109,6 +109,8 @@ Item anchors.left: parent.left anchors.right: parent.right anchors.top: networkPrinterScrollView.bottom + // Make sure that the left, right, and bottom borders do not show up, otherwise you see double + // borders. anchors.bottomMargin: -border.width anchors.leftMargin: -border.width anchors.rightMargin: -border.width From 0c94ded93d12b0a6f010312301dfc6526ceeb273 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 14:19:21 +0100 Subject: [PATCH 025/211] WIP: Refactor and fix network printer list --- .../Models/DiscoveredPrintersModel.py | 8 +- .../AddNetworkPrinterScrollView.qml | 153 ++++++++++++++++++ .../AddPrinterBySelectionContent.qml | 153 +----------------- .../qml/WelcomePages/AddPrinterScrollView.qml | 45 ++++-- resources/qml/WelcomePages/DropDownWidget.qml | 2 +- 5 files changed, 192 insertions(+), 169 deletions(-) create mode 100644 resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index d7e852629a..7746972e2f 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -1,4 +1,4 @@ -from typing import Callable, Optional, TYPE_CHECKING +from typing import Callable, List, Optional, TYPE_CHECKING from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject @@ -62,7 +62,7 @@ class DiscoveredPrinterModel(QObject): discoveredPrintersChanged = pyqtSignal() @pyqtProperty(list, notify = discoveredPrintersChanged) - def discovered_printers(self) -> "list": + def discovered_printers(self) -> "List[DiscoveredPrinter]": item_list = list(x for x in self._discovered_printer_dict.values()) item_list.sort(key = lambda x: x.name) return item_list @@ -70,7 +70,7 @@ class DiscoveredPrinterModel(QObject): def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, device) -> None: if ip_address in self._discovered_printer_dict: - Logger.log("e", "+++++++++++++ printer with ip [%s] has already been added", ip_address) + Logger.log("e", "Printer with ip [%s] has already been added", ip_address) return discovered_printer = DiscoveredPrinter(ip_address, key, name, create_callback, machine_type, device, parent = self) @@ -81,7 +81,7 @@ class DiscoveredPrinterModel(QObject): name: Optional[str] = None, machine_type: Optional[str] = None) -> None: if ip_address not in self._discovered_printer_dict: - Logger.log("e", "+++++++++++++ printer with ip [%s] is not known", ip_address) + Logger.log("e", "Printer with ip [%s] is not known", ip_address) return item = self._discovered_printer_dict[ip_address] diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml new file mode 100644 index 0000000000..acedeafdf9 --- /dev/null +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -0,0 +1,153 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../PrinterSelector" + + +Item +{ + id: base + height: networkPrinterScrollView.height + controlsRectangle.height + + property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce + property var selectedItem: networkPrinterListView.model[networkPrinterListView.currentIndex] + + ScrollView + { + id: networkPrinterScrollView + anchors.fill: parent + + ScrollBar.horizontal.policy: ScrollBar.AsNeeded + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height + + clip: true + + ListView + { + id: networkPrinterListView + anchors.fill: parent + model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + visible: model.length > 0 + + delegate: MachineSelectorButton + { + text: modelData.device.name + + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 10 + outputDevice: modelData.device + + checked: ListView.view.currentIndex == index + onClicked: + { + ListView.view.currentIndex = index + } + } + } + } + + Cura.RoundedRectangle + { + id: controlsRectangle + anchors.left: parent.left + anchors.right: parent.right + anchors.top: networkPrinterScrollView.bottom + // Make sure that the left, right, and bottom borders do not show up, otherwise you see double + // borders. + anchors.bottomMargin: -border.width + anchors.leftMargin: -border.width + anchors.rightMargin: -border.width + + height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: "white" + cornerSide: Cura.RoundedRectangle.Direction.Down + + Cura.SecondaryButton + { + id: refreshButton + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Refresh") + height: UM.Theme.getSize("message_action_button").height + } + + Cura.SecondaryButton + { + id: addPrinterByIpButton + anchors.left: refreshButton.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Add printer by IP") + height: UM.Theme.getSize("message_action_button").height + } + + Item + { + id: troubleshootingButton + + 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 + + UM.RecolorImage + { + id: troubleshoortingLinkIcon + anchors.right: troubleshoortingLabel.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + height: troubleshoortingLabel.height + width: height + sourceSize.height: width + color: UM.Theme.getColor("text_link") + source: UM.Theme.getIcon("external_link") + } + + Label + { + id: troubleshoortingLabel + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: catalog.i18nc("@label", "Troubleshooting") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_link") + linkColor: UM.Theme.getColor("text_link") + renderType: Text.NativeRendering + } + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + onClicked: + { + // open the material URL with web browser + var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO + Qt.openUrlExternally(url) + } + onEntered: + { + troubleshoortingLabel.font.underline = true + } + onExited: + { + troubleshoortingLabel.font.underline = false + } + } + } + } +} diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 77b3fe8122..a2d5312dde 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -7,8 +7,6 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura -import "../PrinterSelector" - // // This component contains the content for the "Add a printer" (network) page of the welcome on-boarding process. @@ -55,148 +53,11 @@ Item { id: networkPrinterListComponent - Item + AddNetworkPrinterScrollView { - height: networkPrinterScrollView.height + controlsRectangle.height + id: networkPrinterScrollView - ScrollView - { - id: networkPrinterScrollView - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - - property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. - height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) - - clip: true - - ListView - { - id: networkPrinterListView - anchors.fill: parent - model: CuraApplication.getDiscoveredPrinterModel().discovered_printers - visible: model.count > 0 - - delegate: MachineSelectorButton - { - text: modelData.device.name - - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: 10 - outputDevice: modelData.device - - checked: ListView.view.currentIndex == index - onClicked: - { - ListView.view.currentIndex = index - } - } - } - - Label - { - id: noNetworkPrinterLabel - text: catalog.i18nc("@label", "There is no printer found over your network.") - renderType: Text.NativeRendering - visible: !networkPrinterListView.visible - } - } - - Cura.RoundedRectangle - { - id: controlsRectangle - anchors.left: parent.left - anchors.right: parent.right - anchors.top: networkPrinterScrollView.bottom - // Make sure that the left, right, and bottom borders do not show up, otherwise you see double - // borders. - anchors.bottomMargin: -border.width - anchors.leftMargin: -border.width - anchors.rightMargin: -border.width - - height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - color: "white" - cornerSide: Cura.RoundedRectangle.Direction.Down - - Cura.SecondaryButton - { - id: refreshButton - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - text: catalog.i18nc("@label", "Refresh") - height: UM.Theme.getSize("message_action_button").height - } - - Cura.SecondaryButton - { - id: addPrinterByIpButton - anchors.left: refreshButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - text: catalog.i18nc("@label", "Add printer by IP") - height: UM.Theme.getSize("message_action_button").height - } - - Item - { - id: troubleshootingButton - - 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 - - UM.RecolorImage - { - id: troubleshoortingLinkIcon - anchors.right: troubleshoortingLabel.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - height: troubleshoortingLabel.height - width: height - sourceSize.height: width - color: UM.Theme.getColor("text_link") - source: UM.Theme.getIcon("external_link") - } - - Label - { - id: troubleshoortingLabel - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - text: catalog.i18nc("@label", "Troubleshooting") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text_link") - linkColor: UM.Theme.getColor("text_link") - renderType: Text.NativeRendering - } - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - onClicked: - { - // open the material URL with web browser - var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO - Qt.openUrlExternally(url) - } - onEntered: - { - troubleshoortingLabel.font.underline = true - } - onExited: - { - troubleshoortingLabel.font.underline = false - } - } - } - } + maxItemCountAtOnce: 6 // show at max 6 items at once, otherwise you need to scroll. } } } @@ -230,13 +91,7 @@ Item { id: localPrinterView - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - - property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. - height: maxItemCountAtOnce * (UM.Theme.getSize("action_button").height) - - clip: true + maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. } } } diff --git a/resources/qml/WelcomePages/AddPrinterScrollView.qml b/resources/qml/WelcomePages/AddPrinterScrollView.qml index 2c2a5a50fa..22dddb016e 100644 --- a/resources/qml/WelcomePages/AddPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddPrinterScrollView.qml @@ -16,6 +16,34 @@ ScrollView property string currentSection: preferredCategory property string preferredCategory: "Ultimaker" + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height + + clip: true + + function updateCurrentItemUponSectionChange() + { + // Find the first machine from this section + for (var i = 0; i < machineList.count; i++) + { + var item = machineList.model.getItem(i) + if (item.section == base.currentSection) + { + base.currentItem = item + machineList.currentIndex = i + break + } + } + } + + Component.onCompleted: + { + updateCurrentItemUponSectionChange() + } + background: Rectangle { anchors.fill: parent @@ -90,21 +118,8 @@ ScrollView onClicked: { - if (base.currentSection != section) - { - // Find the first machine from this section - for (var i = 0; i < ListView.view.count; i++) - { - var item = ListView.view.model.getItem(i) - if (item.section == section) - { - base.currentItem = item - base.currentSection = item.section - ListView.view.currentIndex = i - break - } - } - } + base.currentSection = section + base.updateCurrentItemUponSectionChange() } } } diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index 16e0f6d282..cef6ed0de1 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -15,7 +15,7 @@ Item id: base implicitWidth: 200 - height: header.contentShown ? (header.height + contentRectangle.height) : header.height + height: header.contentShown ? (header.height + contentRectangle.height + 30) : header.height property var contentComponent: null From 53ea944da1aad6284c21e5be37b6952377512309 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 15:04:09 +0100 Subject: [PATCH 026/211] WIP: Add comments --- resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 5 +++++ resources/qml/WelcomePages/AddPrinterScrollView.qml | 4 ++++ resources/qml/WelcomePages/DropDownHeader.qml | 2 +- resources/qml/WelcomePages/DropDownWidget.qml | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index acedeafdf9..d0a16cb71d 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -10,6 +10,11 @@ import Cura 1.1 as Cura import "../PrinterSelector" +// +// This is the widget for adding a network printer. There are 2 parts in this widget. One is a scroll view of a list +// of discovered network printers. Beneath the scroll view is a container with 3 buttons: "Refresh", "Add by IP", and +// "Troubleshooting". +// Item { id: base diff --git a/resources/qml/WelcomePages/AddPrinterScrollView.qml b/resources/qml/WelcomePages/AddPrinterScrollView.qml index 22dddb016e..b56a0ea0c2 100644 --- a/resources/qml/WelcomePages/AddPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddPrinterScrollView.qml @@ -8,6 +8,10 @@ import UM 1.3 as UM import Cura 1.0 as Cura +// +// This is the scroll view widget for adding a (local) printer. This scroll view shows a list view with printers +// categorized into 3 categories: "Ultimaker", "Custom", and "Other". +// ScrollView { id: base diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml index dacb017405..910efdefcd 100644 --- a/resources/qml/WelcomePages/DropDownHeader.qml +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -11,7 +11,7 @@ import ".." // -// This is DropDown Header bar of the expandable drop down list. +// This is DropDown Header bar of the expandable drop down list. See comments in DropDownWidget for details. // Cura.RoundedRectangle { diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index cef6ed0de1..b075666314 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -8,6 +8,13 @@ import UM 1.3 as UM import Cura 1.1 as Cura +// +// This is the dropdown list widget in the welcome wizard. The dropdown list has a header bar which is always present, +// and its content whose visibility can be toggled by clicking on the header bar. The content is displayed as an +// expandable dropdown box that will appear below the header bar. +// +// The content is configurable via the property "contentComponent", which will be loaded by a Loader when set. +// Item { UM.I18nCatalog { id: catalog; name: "cura" } From cc35eb0195be04ea198a1e6fa506231c533fcfec Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 11 Mar 2019 15:34:53 +0100 Subject: [PATCH 027/211] WIP: Add gotoPage --- cura/UI/WelcomePagesModel.py | 3 ++- .../AddNetworkPrinterScrollView.qml | 5 ++++ .../WelcomePages/AddPrinterByIpContent.qml | 2 +- .../AddPrinterBySelectionContent.qml | 10 ++++++++ resources/qml/WelcomePages/StepPanel.qml | 24 +++++++++++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 68c91a5e8e..b4fd199a28 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -3,7 +3,7 @@ import os from typing import TYPE_CHECKING, Optional -from PyQt5.QtCore import QUrl, Qt +from PyQt5.QtCore import QUrl, Qt, pyqtSlot from UM.Qt.ListModel import ListModel from UM.Resources import Resources @@ -11,6 +11,7 @@ from UM.Resources import Resources if TYPE_CHECKING: from PyQt5.QtCore import QObject + class WelcomePagesModel(ListModel): IdRole = Qt.UserRole + 1 # Page ID diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index d0a16cb71d..68105b9a37 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -23,6 +23,9 @@ Item property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce property var selectedItem: networkPrinterListView.model[networkPrinterListView.currentIndex] + signal refreshButtonClicked() + signal addByIpButtonClicked() + ScrollView { id: networkPrinterScrollView @@ -87,6 +90,7 @@ Item anchors.verticalCenter: parent.verticalCenter text: catalog.i18nc("@label", "Refresh") height: UM.Theme.getSize("message_action_button").height + onClicked: base.refreshButtonClicked() } Cura.SecondaryButton @@ -97,6 +101,7 @@ Item anchors.verticalCenter: parent.verticalCenter text: catalog.i18nc("@label", "Add printer by IP") height: UM.Theme.getSize("message_action_button").height + onClicked: base.addByIpButtonClicked() } Item diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 25a6d532ce..31d2cb4257 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -223,7 +223,7 @@ Item text: catalog.i18nc("@button", "Back") width: 140 fixedWidthMode: true - onClicked: base.showPreviousPage() + onClicked: base.gotoPage("add_printer_by_selection") enabled: true } diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index a2d5312dde..5d02cb1099 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -58,6 +58,16 @@ Item id: networkPrinterScrollView maxItemCountAtOnce: 6 // show at max 6 items at once, otherwise you need to scroll. + + onRefreshButtonClicked: + { + // TODO: implement refresh + } + + onAddByIpButtonClicked: + { + base.gotoPage("add_printer_by_ip") + } } } } diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 40569fe39b..bc99320e02 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -33,6 +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. onShowNextPage: { @@ -53,6 +54,29 @@ Item } } + onGotoPage: + { + // find the page index + var page_index = -1 + for (var i = 0; i < base.model.count; i++) + { + const item = base.model.getItem(i) + if (item.id == page_id) + { + page_index = i + break + } + } + if (page_index > 0) + { + currentStep = page_index + } + else + { + console.log("Error: cannot find page with page_id = [", page_id, "]") + } + } + onVisibleChanged: { if (visible) From 5fa2c72b0dcbdfd17b5c873250778d5e61955eb0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 10:21:01 +0100 Subject: [PATCH 028/211] WIP: Complete add network and local printer flow --- ...View.qml => AddLocalPrinterScrollView.qml} | 5 ++- .../AddNetworkPrinterScrollView.qml | 4 +- .../AddPrinterBySelectionContent.qml | 39 +++++++++++++++++-- resources/qml/WelcomePages/DropDownHeader.qml | 5 +-- resources/qml/WelcomePages/DropDownWidget.qml | 11 ++++-- 5 files changed, 51 insertions(+), 13 deletions(-) rename resources/qml/WelcomePages/{AddPrinterScrollView.qml => AddLocalPrinterScrollView.qml} (96%) diff --git a/resources/qml/WelcomePages/AddPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml similarity index 96% rename from resources/qml/WelcomePages/AddPrinterScrollView.qml rename to resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index b56a0ea0c2..2e85117d5c 100644 --- a/resources/qml/WelcomePages/AddPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -16,7 +16,9 @@ ScrollView { id: base - property var currentItem: null + property var currentItem: (machineList.currentIndex >= 0) + ? machineList.model.getItem(machineList.currentIndex) + : null property string currentSection: preferredCategory property string preferredCategory: "Ultimaker" @@ -36,7 +38,6 @@ ScrollView var item = machineList.model.getItem(i) if (item.section == base.currentSection) { - base.currentItem = item machineList.currentIndex = i break } diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 68105b9a37..9fe1571dd2 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -21,7 +21,9 @@ Item height: networkPrinterScrollView.height + controlsRectangle.height property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce - property var selectedItem: networkPrinterListView.model[networkPrinterListView.currentIndex] + property var currentItem: (networkPrinterListView.currentIndex >= 0) + ? networkPrinterListView.model[networkPrinterListView.currentIndex] + : null signal refreshButtonClicked() signal addByIpButtonClicked() diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 5d02cb1099..6440ed39c0 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -38,6 +38,7 @@ Item anchors.margins: 20 title: catalog.i18nc("@label", "Add a network printer") + contentShown: true // by default expand the network printer list onClicked: { @@ -97,7 +98,7 @@ Item { id: localPrinterListComponent - AddPrinterScrollView + AddLocalPrinterScrollView { id: localPrinterView @@ -112,10 +113,42 @@ Item anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: 40 - enabled: true // TODO + enabled: + { + // If the network printer dropdown is expanded, make sure that there is a selected item + if (addNetworkPrinterDropDown.contentShown) + { + return addNetworkPrinterDropDown.contentItem.currentItem != null + } + else + { + return addLocalPrinterDropDown.contentItem.currentItem != null + } + } + text: catalog.i18nc("@button", "Next") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() + onClicked: + { + // Create a network printer or a local printer according to the selection + if (addNetworkPrinterDropDown.contentShown) + { + // Create a network printer + const networkPrinterItem = addNetworkPrinterDropDown.contentItem.currentItem + CuraApplication.getDiscoveredPrinterModel().createMachineFromDiscoveredPrinter(networkPrinterItem) + } + else + { + // Create a local printer + const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem + Cura.MachineManager.addMachine(localPrinterItem.id) + } + + // TODO: implement machine actions + + // If we have created a machine, go to the last page, which is the "cloud" page. + base.gotoPage("cloud") + } } } diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml index 910efdefcd..a712382850 100644 --- a/resources/qml/WelcomePages/DropDownHeader.qml +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -43,10 +43,7 @@ Cura.RoundedRectangle onEntered: base.hovered = true onExited: base.hovered = false - onClicked: { - base.contentShown = !base.contentShown - base.clicked() - } + onClicked: base.clicked() } Label diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index b075666314..cff9cf8ac1 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -25,16 +25,21 @@ Item height: header.contentShown ? (header.height + contentRectangle.height + 30) : header.height property var contentComponent: null + property alias contentItem: contentLoader.item property alias title: header.title - property alias contentShown: header.contentShown + property bool contentShown: false signal clicked() Connections { target: header - onClicked: base.clicked() + onClicked: + { + base.contentShown = !base.contentShown + clicked() + } } DropDownHeader @@ -45,7 +50,7 @@ Item anchors.right: parent.right height: UM.Theme.getSize("expandable_component_content_header").height rightIconSource: contentShown ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") - + contentShown: base.contentShown } Cura.RoundedRectangle From 60f6d881a3a4ede63c94c919aa4d9c7745ba10b5 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 10:37:41 +0100 Subject: [PATCH 029/211] WIP: Fixes and add cloud logic to cloud welcome page --- cura/Machines/Models/DiscoveredPrintersModel.py | 2 +- resources/qml/WelcomePages/CloudContent.qml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 7746972e2f..3bdbe7063d 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -16,7 +16,7 @@ class DiscoveredPrinter(QObject): self._ip_address = ip_address self._key = key self._name = name - self._create_callback = create_callback + self.create_callback = create_callback self._machine_type = machine_type self._device = device diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 31f9037b4b..09e52c17dd 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -99,14 +99,13 @@ Item text: catalog.i18nc("@button", "Create an account") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() // TODO: create account + onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") } Cura.SecondaryButton { id: signInButton anchors.left: createAccountButton.right - //anchors.leftMargin: 10 anchors.verticalCenter: finishButton.verticalCenter text: catalog.i18nc("@button", "Sign in") width: 80 @@ -115,6 +114,6 @@ Item hoverColor: "transparent" textHoverColor: UM.Theme.getColor("text_light_blue") fixedWidthMode: true - onClicked: base.showNextPage() // TODO: sign in + onClicked: Cura.API.account.login() } } From f7f5123feab838cfeff76b56f6f52c0cadf0a577 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 11:03:23 +0100 Subject: [PATCH 030/211] WIP: Fix highlighting of selected network printer --- cura/Machines/Models/DiscoveredPrintersModel.py | 5 ++++- resources/qml/PrinterSelector/MachineSelectorButton.qml | 4 +++- resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 3bdbe7063d..0bacdc804b 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -22,6 +22,9 @@ class DiscoveredPrinter(QObject): nameChanged = pyqtSignal() + def getKey(self) -> str: + return self._key + @pyqtProperty(str, notify = nameChanged) def name(self) -> str: return self._name @@ -101,4 +104,4 @@ class DiscoveredPrinterModel(QObject): @pyqtSlot("QVariant") def createMachineFromDiscoveredPrinter(self, discovered_printer: "DiscoveredPrinter") -> None: - discovered_printer.create_callback() + discovered_printer.create_callback(discovered_printer.getKey()) diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index abd9eea9e9..285ab4b599 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -19,6 +19,8 @@ Button checkable: true hoverEnabled: true + property bool selected: checked + property var outputDevice: null property var printerTypesList: [] @@ -79,7 +81,7 @@ Button color: machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent" radius: UM.Theme.getSize("action_button_radius").width border.width: UM.Theme.getSize("default_lining").width - border.color: machineSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent" + border.color: machineSelectorButton.selected ? UM.Theme.getColor("primary") : "transparent" } Connections diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 9fe1571dd2..79e1cafe2e 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -57,7 +57,8 @@ Item anchors.rightMargin: 10 outputDevice: modelData.device - checked: ListView.view.currentIndex == index + checkable: false + selected: ListView.view.currentIndex == model.index onClicked: { ListView.view.currentIndex = index From de9f6f47bdef386e3ae75923e2db4d1797fabd8f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 12:04:52 +0100 Subject: [PATCH 031/211] WIP: Implement add machine from network device --- .../Models/DiscoveredPrintersModel.py | 12 +++-- cura/Settings/MachineManager.py | 44 +++++++++++++++++++ .../src/UM3OutputDevicePlugin.py | 17 ++++++- .../PrinterSelector/MachineSelectorButton.qml | 8 ++-- .../AddNetworkPrinterScrollView.qml | 7 +++ 5 files changed, 80 insertions(+), 8 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 0bacdc804b..c36af1afe0 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -1,3 +1,5 @@ + + from typing import Callable, List, Optional, TYPE_CHECKING from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject @@ -13,6 +15,7 @@ class DiscoveredPrinter(QObject): def __init__(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, device, parent = None) -> None: super().__init__(parent) + self._ip_address = ip_address self._key = key self._name = name @@ -40,10 +43,11 @@ class DiscoveredPrinter(QObject): def machine_type(self) -> str: return self._machine_type - def setMachineType(self, machine_type: str) -> None: - if self._machine_type != machine_type: - self._machine_type = machine_type - self.machineTypeChanged.emit() + # Machine type string with underscores "_" replaced with spaces " " + @pyqtProperty(str, notify = machineTypeChanged) + def machine_type_with_spaces(self) -> str: + from cura.CuraApplication import CuraApplication + return CuraApplication.getInstance().getMachineManager().getMachineTypeNameFromId(self._machine_type) @pyqtProperty(QObject, constant = True) def device(self): diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index aac18799f6..c910b67d0c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1657,3 +1657,47 @@ class MachineManager(QObject): abbr_machine += stripped_word return abbr_machine + + def getMachineTypeNameFromId(self, machine_type_id: str) -> str: + machine_type_name = "" + results = self._container_registry.findDefinitionContainersMetadata(id = machine_type_id) + if results: + machine_type_name = results[0]["name"] + return machine_type_name + + @pyqtSlot(QObject) + def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None: + if not printer_device: + return + + Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) + + global_stack = self._global_container_stack + if not global_stack: + return + + meta_data = global_stack.getMetaData() + + if "um_network_key" in meta_data: # Global stack already had a connection, but it's changed. + old_network_key = meta_data["um_network_key"] + # Since we might have a bunch of hidden stacks, we also need to change it there. + metadata_filter = {"um_network_key": old_network_key} + containers = self._container_registry.findContainerStacks(type = "machine", **metadata_filter) + + for container in containers: + container.setMetaDataEntry("um_network_key", printer_device.key) + + # Delete old authentication data. + Logger.log("d", "Removing old authentication id %s for device %s", + global_stack.getMetaDataEntry("network_authentication_id", None), + printer_device.key) + + container.removeMetaDataEntry("network_authentication_id") + container.removeMetaDataEntry("network_authentication_key") + + # Ensure that these containers do know that they are configured for network connection + container.addConfiguredConnectionType(printer_device.connectionType.value) + + else: # Global stack didn't have a connection yet, configure it. + global_stack.setMetaDataEntry("um_network_key", printer_device.key) + global_stack.addConfiguredConnectionType(printer_device.connectionType.value) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index ea2142d033..2729b5466e 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -218,7 +218,22 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): def _createMachineFromDiscoveredPrinter(self, key: str) -> None: # TODO: This needs to be implemented. It's supposed to create a machine given a unique key as already discovered # by this plugin. - pass + discovered_device = self._discovered_devices.get(key) + if discovered_device is None: + Logger.log("e", "Could not find discovered device with key [%s]", key) + return + + group_name = discovered_device.getProperty("name") + machine_type_id = discovered_device.getProperty("printer_type") + + Logger.log("i", "Creating machine from network device with key = [%s], group name = [%s], printer type = [%s]", + key, group_name, machine_type_id) + + self._application.getMachineManager().addMachine(machine_type_id, group_name) + # connect the new machine to that network printer + self._application.getMachineManager().associateActiveMachineWithPrinterDevice(discovered_device) + # ensure that the connection states are refreshed. + self.reCheckConnections() def _checkManualDevice(self, address): # Check if a UM3 family device exists at this address. diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 285ab4b599..3c421262e5 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -24,6 +24,8 @@ Button property var outputDevice: null property var printerTypesList: [] + property var updatePrinterTypesFunction: updatePrinterTypesList + function updatePrinterTypesList() { printerTypesList = (outputDevice != null) ? outputDevice.uniquePrinterTypes : [] @@ -87,14 +89,14 @@ Button Connections { target: outputDevice - onUniqueConfigurationsChanged: updatePrinterTypesList() + onUniqueConfigurationsChanged: updatePrinterTypesFunction() } Connections { target: Cura.MachineManager - onOutputDevicesChanged: updatePrinterTypesList() + onOutputDevicesChanged: updatePrinterTypesFunction() } - Component.onCompleted: updatePrinterTypesList() + Component.onCompleted: updatePrinterTypesFunction() } diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 79e1cafe2e..fa3b87c07f 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -57,6 +57,13 @@ Item anchors.rightMargin: 10 outputDevice: modelData.device + updatePrinterTypesFunction: updateMachineTypes + + function updateMachineTypes() + { + printerTypesList = [ modelData.machine_type_with_spaces ] + } + checkable: false selected: ListView.view.currentIndex == model.index onClicked: From 764f7281c2692bfa1c814ddfc6b144c277e75c04 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 13:03:41 +0100 Subject: [PATCH 032/211] WIP: Show full name of network printer types --- .../Models/DiscoveredPrintersModel.py | 21 +++++++++++++++---- .../PrinterSelector/MachineSelectorButton.qml | 6 +++++- resources/qml/PrinterTypeLabel.qml | 4 +++- .../AddNetworkPrinterScrollView.qml | 6 +++++- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index c36af1afe0..bb99f9badd 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -1,15 +1,20 @@ - +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. from typing import Callable, List, Optional, TYPE_CHECKING from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject +from UM.i18n import i18nCatalog from UM.Logger import Logger if TYPE_CHECKING: from PyQt5.QtCore import QObject +catalog = i18nCatalog("cura") + + class DiscoveredPrinter(QObject): def __init__(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, @@ -43,11 +48,19 @@ class DiscoveredPrinter(QObject): def machine_type(self) -> str: return self._machine_type - # Machine type string with underscores "_" replaced with spaces " " + def setMachineType(self, machine_type: str) -> None: + if self._machine_type != machine_type: + self._machine_type = machine_type + self.machineTypeChanged.emit() + + # Human readable machine type string @pyqtProperty(str, notify = machineTypeChanged) - def machine_type_with_spaces(self) -> str: + def readable_machine_type(self) -> str: from cura.CuraApplication import CuraApplication - return CuraApplication.getInstance().getMachineManager().getMachineTypeNameFromId(self._machine_type) + readable_type = CuraApplication.getInstance().getMachineManager().getMachineTypeNameFromId(self._machine_type) + if not readable_type: + readable_type = catalog.i18nc("@label", "Unknown") + return readable_type @pyqtProperty(QObject, constant = True) def device(self): diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 3c421262e5..ae9ca3ec7e 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -20,11 +20,14 @@ Button hoverEnabled: true property bool selected: checked + property bool printerTypeLabelAutoFit: false property var outputDevice: null property var printerTypesList: [] property var updatePrinterTypesFunction: updatePrinterTypesList + // This function converts the printer type string to another string. + property var printerTypeLabelConversionFunction: Cura.MachineManager.getAbbreviatedMachineName function updatePrinterTypesList() { @@ -71,7 +74,8 @@ Button model: printerTypesList delegate: Cura.PrinterTypeLabel { - text: Cura.MachineManager.getAbbreviatedMachineName(modelData) + autoFit: printerTypeLabelAutoFit + text: printerTypeLabelConversionFunction(modelData) } } } diff --git a/resources/qml/PrinterTypeLabel.qml b/resources/qml/PrinterTypeLabel.qml index cfc9e56513..f2e8dc6f48 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -12,7 +12,9 @@ Item { property alias text: printerTypeLabel.text - width: UM.Theme.getSize("printer_type_label").width + property bool autoFit: false + + width: autoFit ? (printerTypeLabel.width + UM.Theme.getSize("default_margin").width) : UM.Theme.getSize("printer_type_label").width height: UM.Theme.getSize("printer_type_label").height Rectangle diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index fa3b87c07f..6a1d5f0e0a 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -57,11 +57,15 @@ Item anchors.rightMargin: 10 outputDevice: modelData.device + printerTypeLabelAutoFit: true + updatePrinterTypesFunction: updateMachineTypes + // show printer type as it is + printerTypeLabelConversionFunction: function(value) { return value } function updateMachineTypes() { - printerTypesList = [ modelData.machine_type_with_spaces ] + printerTypesList = [ modelData.readable_machine_type ] } checkable: false From 20933e8bef71cd148fc1315df744eec6dcfad21e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 14:12:02 +0100 Subject: [PATCH 033/211] WIP: Add label for no discovered network printer --- .../AddNetworkPrinterScrollView.qml | 105 +++++++++++------- .../AddPrinterBySelectionContent.qml | 4 +- 2 files changed, 67 insertions(+), 42 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 6a1d5f0e0a..9066c4f5fc 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -18,7 +18,7 @@ import "../PrinterSelector" Item { id: base - height: networkPrinterScrollView.height + controlsRectangle.height + height: networkPrinterInfo.height + controlsRectangle.height property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce property var currentItem: (networkPrinterListView.currentIndex >= 0) @@ -28,51 +28,76 @@ Item signal refreshButtonClicked() signal addByIpButtonClicked() - ScrollView + Item { - id: networkPrinterScrollView - anchors.fill: parent + id: networkPrinterInfo + height: networkPrinterScrollView.visible ? networkPrinterScrollView.height : noPrinterLabel.height + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - - property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. - height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height - - clip: true - - ListView + Label { - id: networkPrinterListView - anchors.fill: parent - model: CuraApplication.getDiscoveredPrinterModel().discovered_printers - visible: model.length > 0 + id: noPrinterLabel + height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@label", "There is no printer found over your network.") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + visible: !networkPrinterScrollView.visible + } - delegate: MachineSelectorButton + ScrollView + { + id: networkPrinterScrollView + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + ScrollBar.horizontal.policy: ScrollBar.AsNeeded + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. + height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height + + visible: networkPrinterListView.model.length > 0 + + clip: true + + ListView { - text: modelData.device.name + id: networkPrinterListView + anchors.fill: parent + model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + //visible: base.visible && model.length > 0 - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: 10 - outputDevice: modelData.device - - printerTypeLabelAutoFit: true - - updatePrinterTypesFunction: updateMachineTypes - // show printer type as it is - printerTypeLabelConversionFunction: function(value) { return value } - - function updateMachineTypes() + delegate: MachineSelectorButton { - printerTypesList = [ modelData.readable_machine_type ] - } + text: modelData.device.name - checkable: false - selected: ListView.view.currentIndex == model.index - onClicked: - { - ListView.view.currentIndex = index + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 10 + outputDevice: modelData.device + + printerTypeLabelAutoFit: true + + updatePrinterTypesFunction: updateMachineTypes + // show printer type as it is + printerTypeLabelConversionFunction: function(value) { return value } + + function updateMachineTypes() + { + printerTypesList = [ modelData.readable_machine_type ] + } + + checkable: false + selected: ListView.view.currentIndex == model.index + onClicked: + { + ListView.view.currentIndex = index + } } } } @@ -83,7 +108,7 @@ Item id: controlsRectangle anchors.left: parent.left anchors.right: parent.right - anchors.top: networkPrinterScrollView.bottom + anchors.top: networkPrinterInfo.bottom // Make sure that the left, right, and bottom borders do not show up, otherwise you see double // borders. anchors.bottomMargin: -border.width @@ -159,7 +184,7 @@ Item hoverEnabled: true onClicked: { - // open the material URL with web browser + // open the throubleshooting URL with web browser var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO Qt.openUrlExternally(url) } diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 6440ed39c0..6075e03eb3 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -37,7 +37,7 @@ Item anchors.right: parent.right anchors.margins: 20 - title: catalog.i18nc("@label", "Add a network printer") + title: catalog.i18nc("@label", "Add a networked printer") contentShown: true // by default expand the network printer list onClicked: @@ -82,7 +82,7 @@ Item anchors.right: parent.right anchors.margins: 20 - title: catalog.i18nc("@label", "Add a non-network printer") + title: catalog.i18nc("@label", "Add a non-networked printer") onClicked: { From e5b51c8edf09a608bbab99a94d489c1bae7aad1f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 13 Mar 2019 15:34:18 +0100 Subject: [PATCH 034/211] WIP: Implement refreshConnections() --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 6 +++--- resources/qml/WelcomePages/AddPrinterBySelectionContent.qml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 2729b5466e..5c2ed27543 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -55,7 +55,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self.addDeviceSignal.connect(self._onAddDevice) self.removeDeviceSignal.connect(self._onRemoveDevice) - self._application.globalContainerStackChanged.connect(self.reCheckConnections) + self._application.globalContainerStackChanged.connect(self.refreshConnections) self._discovered_devices = {} @@ -142,7 +142,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self.addManualDevice(address) self.resetLastManualDevice() - def reCheckConnections(self): + def refreshConnections(self): active_machine = CuraApplication.getInstance().getGlobalContainerStack() if not active_machine: return @@ -233,7 +233,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): # connect the new machine to that network printer self._application.getMachineManager().associateActiveMachineWithPrinterDevice(discovered_device) # ensure that the connection states are refreshed. - self.reCheckConnections() + self.refreshConnections() def _checkManualDevice(self, address): # Check if a UM3 family device exists at this address. diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 6075e03eb3..b038be93e2 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -62,7 +62,7 @@ Item onRefreshButtonClicked: { - // TODO: implement refresh + UM.OutputDeviceManager.refreshConnections() } onAddByIpButtonClicked: From bb17ab14da5c0b9ba19651f1d39d47f14b5e7a74 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 13 Mar 2019 15:46:02 +0100 Subject: [PATCH 035/211] (WIP) Connect manual-device-added signals to AddPrinterByIP-page. [CURA-6294] --- .../src/UM3OutputDevicePlugin.py | 13 +++++++ .../WelcomePages/AddPrinterByIpContent.qml | 39 ++++++++++++++----- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 8d8bcef4da..0a94a228c7 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -34,6 +34,8 @@ i18n_catalog = i18nCatalog("cura") # If we discover a printer that has the same key as the active machine instance a connection is made. @signalemitter class UM3OutputDevicePlugin(OutputDevicePlugin): + addDeviceSignal = Signal() + removeDeviceSignal = Signal() discoveredDevicesChanged = Signal() cloudFlowIsPossible = Signal() @@ -173,6 +175,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self.checkCloudFlowIsPossible() else: self.getOutputDeviceManager().removeOutputDevice(key) + if key.startswith("manual:"): + self.removeManualDeviceSignal.emit(self.getPluginId(), key, self._discovered_devices[key].address()) # TODO? def stop(self): if self._zero_conf is not None: @@ -195,6 +199,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._manual_instances.remove(address) self._preferences.setValue("um3networkprinting/manual_instances", ",".join(self._manual_instances)) + self.removeManualDeviceSignal.emit(self.getPluginId(), key, address) # TODO? + def addManualDevice(self, address): if address not in self._manual_instances: self._manual_instances.append(address) @@ -232,6 +238,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): def _onNetworkRequestFinished(self, reply): reply_url = reply.url().toString() + address = "" + 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! @@ -291,6 +301,9 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._onRemoveDevice(instance_name) self._onAddDevice(instance_name, address, properties) + if device: + self.addManualDeviceSignal.emit(self.getPluginId(), device.getId(), address, properties) + def _onRemoveDevice(self, device_id): device = self._discovered_devices.pop(device_id, None) if device: diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 465e02e1ff..cd13743cd7 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -70,7 +70,7 @@ Item anchors.topMargin: 40 anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter - text: catalog.i18nc("@label", "Add printer by IP adress") + text: catalog.i18nc("@label", "Add printer by IP address") color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("large_bold") renderType: Text.NativeRendering @@ -193,23 +193,44 @@ Item anchors.top: parent.top font: UM.Theme.getFont("large") - text: "Davids-desktop" // TODO: placeholder, alter after interface review. + text: "???" } GridLayout { + id: printerInfoGrid anchors.top: printerNameLabel.bottom columns: 2 columnSpacing: 20 - Text { font: UM.Theme.getFont("default"); text: "Type" } - Text { font: UM.Theme.getFont("default"); text: "Ultimaker S5" } // TODO: placeholder, alter after interface review. + Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } + Label { id: typeText; font: UM.Theme.getFont("default"); text: "?" } - Text { font: UM.Theme.getFont("default"); text: "Firmware version" } - Text { font: UM.Theme.getFont("default"); text: "4.3.3.20180529" } // TODO: placeholder, alter after interface review. + Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } + Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } - Text { font: UM.Theme.getFont("default"); text: "Address" } - Text { font: UM.Theme.getFont("default"); text: "10.183.1.115" } // TODO: placeholder, alter after interface review. + Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } + Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } + + Connections + { + target: UM.OutputDeviceManager + onManualDeviceChanged: + { + typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type") + firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version") + addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address") + } + } + } + + Connections + { + target: UM.OutputDeviceManager + onManualDeviceChanged: + { + printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") + } } } } @@ -222,7 +243,7 @@ Item anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: 40 - text: catalog.i18nc("@button", "Back") + text: catalog.i18nc("@button", "Cancel") width: 140 fixedWidthMode: true onClicked: base.showPreviousPage() From b12b6892caddcb0f4341a3e9824f50c2c4d2614d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 13 Mar 2019 17:36:03 +0100 Subject: [PATCH 036/211] Add-by-IP onboarding: Create (and set active) new device. [CURA-6294] --- .../src/UM3OutputDevicePlugin.py | 3 +- .../WelcomePages/AddPrinterByIpContent.qml | 63 ++++--------------- 2 files changed, 15 insertions(+), 51 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 0a94a228c7..0b0b4a5bf0 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -301,7 +301,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._onRemoveDevice(instance_name) self._onAddDevice(instance_name, address, properties) - if device: + if device and address in self._manual_instances: + self.getOutputDeviceManager().addOutputDevice(device) self.addManualDeviceSignal.emit(self.getPluginId(), device.getId(), address, properties) def _onRemoveDevice(self, device_id): diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index cd13743cd7..c09abac863 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -22,47 +22,6 @@ Item property bool hasSentRequest: false property bool haveConnection: false - Timer - { - id: tempTimerButton - - interval: 1200 - running: false - repeat: false - onTriggered: - { - hasPushedAdd = true - tempTimerRequest.running = true - } - } - // TODO: Remove timers after review interface! - - Timer - { - id: tempTimerRequest - - interval: 1200 - running: false - repeat: false - onTriggered: - { - hasSentRequest = true - tempTimerConnection.running = true - } - } - // TODO: Remove timers after review interface! - - Timer - { - id: tempTimerConnection - - interval: 1200 - running: false - repeat: false - onTriggered: haveConnection = true - } - // TODO: Remove timers after review interface! - Label { id: titleLabel @@ -141,14 +100,9 @@ Item text: catalog.i18nc("@button", "Add") onClicked: { - // TEMP: Simulate successfull connection to printer with 127.0.0.1 or unsuccessful with anything else - // TODO, alter after review interface, now it just starts the timers. - if (hostnameField.text.trim() != "") { addPrinterByIpScreen.hasPushedAdd = true - tempTimerRequest.running = true - UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text) } } @@ -203,13 +157,13 @@ Item columns: 2 columnSpacing: 20 - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } Label { id: typeText; font: UM.Theme.getFont("default"); text: "?" } - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } - Text { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } Connections @@ -230,6 +184,7 @@ Item onManualDeviceChanged: { printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") + addPrinterByIpScreen.haveConnection = true } } } @@ -260,7 +215,15 @@ Item text: catalog.i18nc("@button", "Connect") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() + onClicked: + { + Cura.MachineManager.addMachine( + UM.OutputDeviceManager.manualDeviceProperty("printer_type"), + UM.OutputDeviceManager.manualDeviceProperty("name") + ) + UM.OutputDeviceManager.setActiveDevice(UM.OutputDeviceManager.manualDeviceProperty("device_id")) + base.showNextPage() + } enabled: addPrinterByIpScreen.haveConnection } From 2b0e9ea4390d184519af0faa53594cb430544288 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 14 Mar 2019 08:56:31 +0100 Subject: [PATCH 037/211] WIP: Fix refresh and naming --- cura/CuraApplication.py | 8 ++++---- cura/Machines/Models/DiscoveredPrintersModel.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 6 +++--- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 4 ++-- .../qml/WelcomePages/AddNetworkPrinterScrollView.qml | 2 +- .../qml/WelcomePages/AddPrinterBySelectionContent.qml | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9ae43d4ee9..1192455312 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -114,7 +114,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.ObjectsModel import ObjectsModel -from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrinterModel +from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage @@ -212,7 +212,7 @@ class CuraApplication(QtApplication): self._cura_scene_controller = None self._machine_error_checker = None - self._discovered_printer_model = DiscoveredPrinterModel(self) + self._discovered_printer_model = DiscoveredPrintersModel(self) self._welcome_pages_model = WelcomePagesModel(self) @@ -851,7 +851,7 @@ class CuraApplication(QtApplication): self.closeSplash() @pyqtSlot(result = QObject) - def getDiscoveredPrinterModel(self, *args) -> "DiscoveredPrinterModel": + def getDiscoveredPrintersModel(self, *args) -> "DiscoveredPrintersModel": return self._discovered_printer_model @pyqtSlot(result = QObject) @@ -1011,7 +1011,7 @@ class CuraApplication(QtApplication): qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel") qmlRegisterType(MachineManagementModel, "Cura", 1, 0, "MachineManagementModel") - qmlRegisterType(DiscoveredPrinterModel, "Cura", 1, 0, "DiscoveredPrinterModel") + qmlRegisterType(DiscoveredPrintersModel, "Cura", 1, 0, "DiscoveredPrintersModel") qmlRegisterSingletonType(QualityProfilesDropDownMenuModel, "Cura", 1, 0, "QualityProfilesDropDownMenuModel", self.getQualityProfilesDropDownMenuModel) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index bb99f9badd..7897556f5b 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -72,7 +72,7 @@ class DiscoveredPrinter(QObject): # to add networked printers (Plugin finds a bunch of printers, user can select one from the list, plugin can then # add that printer to Cura as the active one). # -class DiscoveredPrinterModel(QObject): +class DiscoveredPrintersModel(QObject): def __init__(self, parent: Optional["QObject"]) -> None: super().__init__(parent) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 06632a17ae..1d97127637 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -632,9 +632,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateName(data["friendly_name"]) printer.updateKey(data["uuid"]) printer.updateType(data["machine_variant"]) - self._application.getDiscoveredPrinterModel().updateDiscoveredPrinter(data["ip_address"], - name = data["friendly_name"], - machine_type = data["machine_variant"]) + self._application.getDiscoveredPrintersModel().updateDiscoveredPrinter(data["ip_address"], + name = data["friendly_name"], + machine_type = data["machine_variant"]) # Do not store the build plate information that comes from connect if the current printer has not build plate information if "build_plate" in data and machine_definition.getMetaDataEntry("has_variant_buildplates", False): diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 5c2ed27543..2abd2f15c3 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -315,7 +315,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): except TypeError: # Disconnect already happened. pass - self._application.getDiscoveredPrinterModel().removeDiscoveredPrinter(device.getId()) + self._application.getDiscoveredPrintersModel().removeDiscoveredPrinter(device.address) self.discoveredDevicesChanged.emit() def _onAddDevice(self, name, address, properties): @@ -340,7 +340,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties) else: device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties) - self._application.getDiscoveredPrinterModel().addDiscoveredPrinter(address, device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8"), device) + self._application.getDiscoveredPrintersModel().addDiscoveredPrinter(address, device.getId(), name, self._createMachineFromDiscoveredPrinter, properties[b"printer_type"].decode("utf-8"), device) self._discovered_devices[device.getId()] = device self.discoveredDevicesChanged.emit() diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 9066c4f5fc..a9530d9a43 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -69,7 +69,7 @@ Item { id: networkPrinterListView anchors.fill: parent - model: CuraApplication.getDiscoveredPrinterModel().discovered_printers + model: CuraApplication.getDiscoveredPrintersModel().discovered_printers //visible: base.visible && model.length > 0 delegate: MachineSelectorButton diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index b038be93e2..3282b219c9 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -62,7 +62,7 @@ Item onRefreshButtonClicked: { - UM.OutputDeviceManager.refreshConnections() + UM.OutputDeviceManager.startDiscovery() } onAddByIpButtonClicked: @@ -136,7 +136,7 @@ Item { // Create a network printer const networkPrinterItem = addNetworkPrinterDropDown.contentItem.currentItem - CuraApplication.getDiscoveredPrinterModel().createMachineFromDiscoveredPrinter(networkPrinterItem) + CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinter(networkPrinterItem) } else { From b3621bae842e99028fe2649cb28404185b3d482c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 14 Mar 2019 11:16:31 +0100 Subject: [PATCH 038/211] WIP: Disable unknown printer type buttons --- cura/Machines/Models/DiscoveredPrintersModel.py | 4 ++++ .../UM3NetworkPrinting/src/DiscoverUM3Action.py | 4 ++-- .../PrinterSelector/MachineSelectorButton.qml | 9 ++++++++- .../AddNetworkPrinterScrollView.qml | 17 ++++++++++++++++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 7897556f5b..0dd07eb9ce 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -62,6 +62,10 @@ class DiscoveredPrinter(QObject): readable_type = catalog.i18nc("@label", "Unknown") return readable_type + @pyqtProperty(bool, notify = machineTypeChanged) + def is_unknown_machine_type(self) -> bool: + return self.readable_machine_type.lower() == "unknown" + @pyqtProperty(QObject, constant = True) def device(self): return self._device diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index ecc89b3948..51c234650b 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -118,7 +118,7 @@ class DiscoverUM3Action(MachineAction): if self._network_plugin: # Ensure that the connection states are refreshed. - self._network_plugin.reCheckConnections() + self._network_plugin.refreshConnections() # Associates the currently active machine with the given printer device. The network connection information will be # stored into the metadata of the currently active machine. @@ -160,7 +160,7 @@ class DiscoverUM3Action(MachineAction): if self._network_plugin: # Ensure that the connection states are refreshed. - self._network_plugin.reCheckConnections() + self._network_plugin.refreshConnections() @pyqtSlot(result = str) def getStoredKey(self) -> str: diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index ae9ca3ec7e..33d7958340 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -84,7 +84,14 @@ Button background: Rectangle { id: backgroundRect - color: machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent" + color: + { + if (!machineSelectorButton.enabled) + { + return UM.Theme.getColor("action_button_disabled") + } + return machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent" + } radius: UM.Theme.getSize("action_button_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: machineSelectorButton.selected ? UM.Theme.getColor("primary") : "transparent" diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index a9530d9a43..bee0c49e92 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -70,7 +70,20 @@ Item id: networkPrinterListView anchors.fill: parent model: CuraApplication.getDiscoveredPrintersModel().discovered_printers - //visible: base.visible && model.length > 0 + + Component.onCompleted: + { + // 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 + break + } + } + } delegate: MachineSelectorButton { @@ -81,6 +94,8 @@ Item anchors.rightMargin: 10 outputDevice: modelData.device + enabled: !modelData.is_unknown_machine_type + printerTypeLabelAutoFit: true updatePrinterTypesFunction: updateMachineTypes From 4f05a2ab5fc2af2091358ca008e669ef83706821 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 14 Mar 2019 11:21:06 +0100 Subject: [PATCH 039/211] WIP: Use GlobalStackModel for Machine management page --- resources/qml/Preferences/MachinesPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 6f214a7efb..1adb541cc0 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -14,7 +14,7 @@ UM.ManagementPage id: base; title: catalog.i18nc("@title:tab", "Printers"); - model: Cura.MachineManagementModel { } + model: Cura.GlobalStacksModel { } activeId: Cura.MachineManager.activeMachineId activeIndex: activeMachineIndex() From 2693eecd33313264aaadaf3b3f930fdd89a25605 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 14 Mar 2019 13:33:24 +0100 Subject: [PATCH 040/211] (Add-by-IP/onboard) Cleanup and use discovered-printer instead of machine-manager. [CURA-6294] --- cura/Machines/Models/DiscoveredPrintersModel.py | 8 ++++++++ .../src/UM3OutputDevicePlugin.py | 8 +++----- .../qml/WelcomePages/AddPrinterByIpContent.qml | 15 +++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 0dd07eb9ce..e31b8133a8 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -126,3 +126,11 @@ class DiscoveredPrintersModel(QObject): @pyqtSlot("QVariant") def createMachineFromDiscoveredPrinter(self, discovered_printer: "DiscoveredPrinter") -> None: discovered_printer.create_callback(discovered_printer.getKey()) + + @pyqtSlot(str) + def createMachineFromDiscoveredPrinterAddress(self, ip_address: str) -> None: + if ip_address not in self._discovered_printer_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]) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index c99b12de55..4c775572f3 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -179,7 +179,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): else: self.getOutputDeviceManager().removeOutputDevice(key) if key.startswith("manual:"): - self.removeManualDeviceSignal.emit(self.getPluginId(), key, self._discovered_devices[key].address()) # TODO? + self.removeManualDeviceSignal.emit(self.getPluginId(), key, self._discovered_devices[key].address) def stop(self): if self._zero_conf is not None: @@ -188,8 +188,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._cloud_output_device_manager.stop() def canAddManualDevice(self, address: str) -> ManualDeviceAdditionAttempt: + # This plugin should always be the fallback option (at least try it): return ManualDeviceAdditionAttempt.POSSIBLE - # TODO?: Check if address is a valid IP (by regexp?). def removeManualDevice(self, key, address = None): if key in self._discovered_devices: @@ -202,7 +202,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._manual_instances.remove(address) self._preferences.setValue("um3networkprinting/manual_instances", ",".join(self._manual_instances)) - self.removeManualDeviceSignal.emit(self.getPluginId(), key, address) # TODO? + self.removeManualDeviceSignal.emit(self.getPluginId(), key, address) def addManualDevice(self, address): if address not in self._manual_instances: @@ -226,8 +226,6 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._checkManualDevice(address) def _createMachineFromDiscoveredPrinter(self, key: str) -> None: - # TODO: This needs to be implemented. It's supposed to create a machine given a unique key as already discovered - # by this plugin. discovered_device = self._discovered_devices.get(key) if discovered_device is None: Logger.log("e", "Could not find discovered device with key [%s]", key) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 47e45cda8a..3aa3e8dc2b 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -55,7 +55,6 @@ Item width: parent.width anchors.top: parent.top anchors.margins: 20 - //anchors.bottomMargin: 20 font: UM.Theme.getFont("default") text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") @@ -111,7 +110,12 @@ Item BusyIndicator { anchors.fill: parent - running: { ! parent.enabled && ! addPrinterByIpScreen.hasSentRequest } + running: + { + ! parent.enabled && + ! addPrinterByIpScreen.hasSentRequest && + ! addPrinterByIpScreen.haveConnection + } } } } @@ -154,6 +158,7 @@ Item { id: printerInfoGrid anchors.top: printerNameLabel.bottom + anchors.margins: 20 columns: 2 columnSpacing: 20 @@ -217,10 +222,8 @@ Item fixedWidthMode: true onClicked: { - Cura.MachineManager.addMachine( - UM.OutputDeviceManager.manualDeviceProperty("printer_type"), - UM.OutputDeviceManager.manualDeviceProperty("name") - ) + CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinterAddress( + UM.OutputDeviceManager.manualDeviceProperty("address")) UM.OutputDeviceManager.setActiveDevice(UM.OutputDeviceManager.manualDeviceProperty("device_id")) base.showNextPage() } From 49233216ec0ed9df395b2d628d7f07f249827b35 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 14 Mar 2019 13:43:24 +0100 Subject: [PATCH 041/211] Fix machine management page section --- cura/GlobalStacksModel.py | 16 ++++++++++++---- resources/qml/Preferences/MachinesPage.qml | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cura/GlobalStacksModel.py b/cura/GlobalStacksModel.py index 3c3321e5ca..a6d64cfc02 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/GlobalStacksModel.py @@ -1,14 +1,13 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from PyQt5.QtCore import pyqtProperty, Qt, QTimer from UM.Qt.ListModel import ListModel - -from PyQt5.QtCore import pyqtProperty, Qt, QTimer +from UM.i18n import i18nCatalog from cura.PrinterOutputDevice import ConnectionType from cura.Settings.CuraContainerRegistry import CuraContainerRegistry - from cura.Settings.GlobalStack import GlobalStack @@ -18,13 +17,18 @@ class GlobalStacksModel(ListModel): HasRemoteConnectionRole = Qt.UserRole + 3 ConnectionTypeRole = Qt.UserRole + 4 MetaDataRole = Qt.UserRole + 5 + SectionNameRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page def __init__(self, parent = None): super().__init__(parent) + + self._catalog = i18nCatalog("cura") + self.addRoleName(self.NameRole, "name") self.addRoleName(self.IdRole, "id") self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.MetaDataRole, "metadata") + self.addRoleName(self.SectionNameRole, "sectionName") self._container_stacks = [] self._change_timer = QTimer() @@ -62,9 +66,13 @@ class GlobalStacksModel(ListModel): if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue + section_name = "Network enabled printers" if has_remote_connection else "Local printers" + section_name = self._catalog.i18nc("@info:title", section_name) + items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()), "id": container_stack.getId(), "hasRemoteConnection": has_remote_connection, - "metadata": container_stack.getMetaData().copy()}) + "metadata": container_stack.getMetaData().copy(), + "sectionName": section_name}) items.sort(key=lambda i: not i["hasRemoteConnection"]) self.setItems(items) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 1adb541cc0..98958360a8 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -16,6 +16,8 @@ UM.ManagementPage title: catalog.i18nc("@title:tab", "Printers"); model: Cura.GlobalStacksModel { } + sectionRole: "sectionName" + activeId: Cura.MachineManager.activeMachineId activeIndex: activeMachineIndex() From 6c2e80d2a1a07389fefd7e01078074531db8fce4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 12 Mar 2019 09:54:07 +0100 Subject: [PATCH 042/211] WIP: Create new Machine Settings dialog widgets --- .../MachineSettings/ComboBoxWithOptions.qml | 105 +++++++ .../qml/MachineSettings/GcodeTextArea.qml | 55 ++++ .../MachineSettingsContent.qml | 55 ++++ .../NumericTextFieldWithUnit.qml | 123 ++++++++ .../qml/MachineSettings/PolygonTextField.qml | 120 ++++++++ .../qml/MachineSettings/PrintSetupContent.qml | 272 ++++++++++++++++++ .../qml/MachineSettings/SimpleCheckBox.qml | 53 ++++ 7 files changed, 783 insertions(+) create mode 100644 resources/qml/MachineSettings/ComboBoxWithOptions.qml create mode 100644 resources/qml/MachineSettings/GcodeTextArea.qml create mode 100644 resources/qml/MachineSettings/MachineSettingsContent.qml create mode 100644 resources/qml/MachineSettings/NumericTextFieldWithUnit.qml create mode 100644 resources/qml/MachineSettings/PolygonTextField.qml create mode 100644 resources/qml/MachineSettings/PrintSetupContent.qml create mode 100644 resources/qml/MachineSettings/SimpleCheckBox.qml diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml new file mode 100644 index 0000000000..1a8f208bd6 --- /dev/null +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -0,0 +1,105 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// ComboBox with dropdown options in the Machine Settings dialog. +// +UM.TooltipArea +{ + id: comboBoxWithOptions + + UM.I18nCatalog { id: catalog; name: "cura"; } + + height: childrenRect.height + width: childrenRect.width + text: tooltip + + property alias containerStackId: propertyProvider.containerStackId + property alias settingKey: propertyProvider.key + property alias settingStoreIndex: propertyProvider.storeIndex + + property alias labelText: fieldLabel.text + property alias labelWidth: fieldLabel.width + + property string tooltip: propertyProvider.properties.description + + // callback functions + property var afterOnActivateFunction: dummy_func + property var forceUpdateOnChangeFunction: dummy_func + + // a dummy function for default property values + function dummy_func() {} + + UM.SettingPropertyProvider + { + id: propertyProvider + watchedProperties: [ "value", "options", "description" ] + } + + Row + { + spacing: UM.Theme.getSize("default_margin").width + + Label + { + id: fieldLabel + anchors.verticalCenter: comboBox.verticalCenter + visible: text != "" + elide: Text.ElideRight + //width: Math.max(0, settingsTabs.labelColumnWidth) + } + ComboBox + { + id: comboBox + model: ListModel + { + id: optionsModel + Component.onCompleted: + { + // Options come in as a string-representation of an OrderedDict + var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) + if (options) + { + options = options[1].split("), (") + for (var i = 0; i < options.length; i++) + { + var option = options[i].substring(1, options[i].length - 1).split("', '") + optionsModel.append({text: option[1], value: option[0]}); + } + } + } + } + currentIndex: + { + var currentValue = propertyProvider.properties.value + var index = 0 + for (var i = 0; i < optionsModel.count; i++) + { + if (optionsModel.get(i).value == currentValue) + { + index = i + break + } + } + return index + } + onActivated: + { + if(propertyProvider.properties.value != optionsModel.get(index).value) + { + propertyProvider.setPropertyValue("value", optionsModel.get(index).value); + forceUpdateOnChangeFunction() + afterOnActivateFunction() + } + } + } + } +} diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml new file mode 100644 index 0000000000..748111a8e2 --- /dev/null +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -0,0 +1,55 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// TextArea widget for editing Gcode in the Machine Settings dialog. +// +UM.TooltipArea +{ + id: gcodeTextArea + + UM.I18nCatalog { id: catalog; name: "cura"; } + + height: childrenRect.height + width: childrenRect.width + text: tooltip + + property alias containerStackId: propertyProvider.containerStackId + property alias settingKey: propertyProvider.key + property alias settingStoreIndex: propertyProvider.storeIndex + + property string tooltip: propertyProvider.properties.description + + UM.SettingPropertyProvider + { + id: propertyProvider + watchedProperties: [ "value", "description" ] + } + + // TODO: put label here + + TextArea + { + id: gcodeArea + width: areaWidth + height: areaHeight + font: UM.Theme.getFont("fixed") + text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" + wrapMode: TextEdit.NoWrap + onActiveFocusChanged: + { + if (!activeFocus) + { + propertyProvider.setPropertyValue("value", text) + } + } + } +} diff --git a/resources/qml/MachineSettings/MachineSettingsContent.qml b/resources/qml/MachineSettings/MachineSettingsContent.qml new file mode 100644 index 0000000000..daa41d4c5d --- /dev/null +++ b/resources/qml/MachineSettings/MachineSettingsContent.qml @@ -0,0 +1,55 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + + +Item +{ + id: base + anchors.fill: parent + + TabBar + { + id: bar + width: parent.width + TabButton + { + text: "Printer" + } + + Repeater + { + id: extrudersTabsRepeater + model: ["Extruder 1", "Extruder 2", "Extruder 3"] + + TabButton + { + text: modelData + } + } + } + + StackLayout + { + width: parent.width + currentIndex: bar.currentIndex + Item + { + id: printerTab + } + Repeater + { + model: ["Extruder 1", "Extruder 2", "Extruder 3"] + Item + { + anchors.centerIn: parent + + Label // TODO: this is a dummy + { + anchors.centerIn: parent + text: modelData + } + } + } + } +} diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml new file mode 100644 index 0000000000..f8b476d6f4 --- /dev/null +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -0,0 +1,123 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// TextField widget with validation for editing numeric data in the Machine Settings dialog. +// +UM.TooltipArea +{ + id: numericTextFieldWithUnit + + UM.I18nCatalog { id: catalog; name: "cura"; } + + height: childrenRect.height + width: childrenRect.width + text: tooltip + + property alias containerStackId: propertyProvider.containerStackId + property alias settingKey: propertyProvider.key + property alias settingStoreIndex: propertyProvider.storeIndex + + property alias labelText: fieldLabel.text + property alias labelWidth: fieldLabel.width + property alias unitText: unitLabel.text + + property string tooltip: propertyProvider.properties.description + + // whether negative value is allowed. This affects the validation of the input field. + property bool allowNegativeValue: false + + // callback functions + property var afterOnEditingFinishedFunction: dummy_func + property var forceUpdateOnChangeFunction: dummy_func + property var setValueFunction: null + + // a dummy function for default property values + function dummy_func() {} + + UM.SettingPropertyProvider + { + id: propertyProvider + watchedProperties: [ "value", "description" ] + } + + Row + { + id: itemRow + spacing: UM.Theme.getSize("default_margin").width + + Label + { + id: fieldLabel + anchors.verticalCenter: textFieldWithUnit.verticalCenter + visible: text != "" + elide: Text.ElideRight + renderType: Text.NativeRendering + //width: Math.max(0, settingsTabs.labelColumnWidth) + } + + Item + { + id: textFieldWithUnit + + width: textField.width + height: textField.height + + TextField + { + id: textField + text: + { + const value = propertyProvider.properties.value + return value ? value : "" + } + validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } + onEditingFinished: + { + if (propertyProvider && text != propertyProvider.properties.value) + { + // For some properties like the extruder-compatible material diameter, they need to + // trigger many updates, such as the available materials, the current material may + // need to be switched, etc. Although setting the diameter can be done directly via + // the provider, all the updates that need to be triggered then need to depend on + // the metadata update, a signal that can be fired way too often. The update functions + // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary + // overhead. + // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", + // and it triggers the diameter update signals only when it is needed. Here it is optionally + // choose to use setCompatibleMaterialDiameter() or other more specific functions that + // are available. + if (setValueFunction !== null) + { + setValueFunction(text) + } + else + { + propertyProvider.setPropertyValue("value", text) + } + forceUpdateOnChangeFunction() + afterOnEditingFinished() + } + } + } + + Label + { + id: unitLabel + anchors.right: textField.right + anchors.rightMargin: y - textField.y + anchors.verticalCenter: textField.verticalCenter + text: unitText + renderType: Text.NativeRendering + } + } + } +} diff --git a/resources/qml/MachineSettings/PolygonTextField.qml b/resources/qml/MachineSettings/PolygonTextField.qml new file mode 100644 index 0000000000..59664b9f23 --- /dev/null +++ b/resources/qml/MachineSettings/PolygonTextField.qml @@ -0,0 +1,120 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// TextField for editing polygon data in the Machine Settings dialog. +// +UM.TooltipArea +{ + UM.I18nCatalog { id: catalog; name: "cura"; } + + height: textField.height + width: textField.width + text: tooltip + + property alias containerStackId: propertyProvider.containerStackId + property alias settingKey: propertyProvider.key + property alias settingStoreIndex: propertyProvider.storeIndex + + property alias labelText: fieldLabel.text + property alias labelWidth: fieldLabel.width + property string unitText: catalog.i18nc("@label", "mm") + + // callback functions + property var forceUpdateOnChangeFunction: dummy_func + + // a dummy function for default property values + function dummy_func() {} + + property var printHeadPolygon: + { + "x": { + "min": 0, + "max": 0, + }, + "y": { + "min": 0, + "max": 0, + }, + } + + UM.SettingPropertyProvider + { + id: propertyProvider + watchedProperties: [ "value" ] + } + + Row + { + spacing: UM.Theme.getSize("default_margin").width + + Label + { + id: fieldLabel + anchors.verticalCenter: textFieldWithUnit.verticalCenter + visible: text != "" + elide: Text.ElideRight + //width: Math.max(0, settingsTabs.labelColumnWidth) + } + + Item + { + id: textFieldWithUnit + width: textField.width + height: textField.height + + TextField + { + id: textField + text: + { + var polygon = JSON.parse(propertyProvider.properties.value) + var item = (axis == "x") ? 0 : 1 + var result = polygon[0][item] + for (var i = 1; i < polygon.length; i++) { + result = (side == "min") + ? Math.min(result, polygon[i][item]) + : Math.max(result, polygon[i][item]) + } + result = Math.abs(result) + printHeadPolygon[axis][side] = result + return result + } + validator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ } + onEditingFinished: + { + printHeadPolygon[axis][side] = parseFloat(textField.text.replace(',','.')) + var polygon = [ + [-printHeadPolygon["x"]["min"], printHeadPolygon["y"]["max"]], + [-printHeadPolygon["x"]["min"], -printHeadPolygon["y"]["min"]], + [ printHeadPolygon["x"]["max"], printHeadPolygon["y"]["max"]], + [ printHeadPolygon["x"]["max"], -printHeadPolygon["y"]["min"]] + ] + var polygon_string = JSON.stringify(polygon) + if (polygon_string != propertyProvider.properties.value) + { + propertyProvider.setPropertyValue("value", polygon_string) + forceUpdateOnChangeFunction() + } + } + } + + Label + { + id: unitLabel + text: unitText + anchors.right: textField.right + anchors.rightMargin: y - textField.y + anchors.verticalCenter: textField.verticalCenter + } + } + } +} diff --git a/resources/qml/MachineSettings/PrintSetupContent.qml b/resources/qml/MachineSettings/PrintSetupContent.qml new file mode 100644 index 0000000000..d2469ff71d --- /dev/null +++ b/resources/qml/MachineSettings/PrintSetupContent.qml @@ -0,0 +1,272 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + + +Column +{ + spacing: UM.Theme.getSize("default_margin").height + + Row + { + width: parent.width + spacing: UM.Theme.getSize("default_margin").height + + Column + { + width: settingsTabs.columnWidth + spacing: UM.Theme.getSize("default_lining").height + + Label + { + text: catalog.i18nc("@label", "Printer Settings") + font.bold: true + renderType: Text.NativeRendering + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + Loader + { + id: buildAreaWidthField + sourceComponent: numericTextFieldWithUnit + property string settingKey: "machine_width" + property string label: catalog.i18nc("@label", "X (Width)") + property string unit: catalog.i18nc("@label", "mm") + property bool forceUpdateOnChange: true + } + + Loader + { + id: buildAreaDepthField + sourceComponent: numericTextFieldWithUnit + property string settingKey: "machine_depth" + property string label: catalog.i18nc("@label", "Y (Depth)") + property string unit: catalog.i18nc("@label", "mm") + property bool forceUpdateOnChange: true + } + + Loader + { + id: buildAreaHeightField + sourceComponent: numericTextFieldWithUnit + property string settingKey: "machine_height" + property string label: catalog.i18nc("@label", "Z (Height)") + property string unit: catalog.i18nc("@label", "mm") + property bool forceUpdateOnChange: true + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + Loader + { + id: shapeComboBox + sourceComponent: comboBoxWithOptions + property string settingKey: "machine_shape" + property string label: catalog.i18nc("@label", "Build plate shape") + property bool forceUpdateOnChange: true + } + + Loader + { + id: centerIsZeroCheckBox + sourceComponent: simpleCheckBox + property string settingKey: "machine_center_is_zero" + property string label: catalog.i18nc("@option:check", "Origin at center") + property bool forceUpdateOnChange: true + } + Loader + { + id: heatedBedCheckBox + sourceComponent: simpleCheckBox + property var settingKey: "machine_heated_bed" + property string label: catalog.i18nc("@option:check", "Heated bed") + property bool forceUpdateOnChange: true + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + Loader + { + id: gcodeFlavorComboBox + sourceComponent: comboBoxWithOptions + property string settingKey: "machine_gcode_flavor" + property string label: catalog.i18nc("@label", "G-code flavor") + property bool forceUpdateOnChange: true + property var afterOnActivate: manager.updateHasMaterialsMetadata + } + } + + Column + { + width: settingsTabs.columnWidth + spacing: UM.Theme.getSize("default_lining").height + + Label + { + text: catalog.i18nc("@label", "Printhead Settings") + font.bold: true + renderType: Text.NativeRendering + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + Loader + { + id: printheadXMinField + sourceComponent: headPolygonTextField + property string label: catalog.i18nc("@label", "X min") + property string tooltip: catalog.i18nc("@tooltip", "Distance from the left of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") + property string axis: "x" + property string side: "min" + } + + Loader + { + id: printheadYMinField + sourceComponent: headPolygonTextField + property string label: catalog.i18nc("@label", "Y min") + property string tooltip: catalog.i18nc("@tooltip", "Distance from the front of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") + property string axis: "y" + property string side: "min" + } + + Loader + { + id: printheadXMaxField + sourceComponent: headPolygonTextField + property string label: catalog.i18nc("@label", "X max") + property string tooltip: catalog.i18nc("@tooltip", "Distance from the right of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") + property string axis: "x" + property string side: "max" + } + + Loader + { + id: printheadYMaxField + sourceComponent: headPolygonTextField + property string label: catalog.i18nc("@label", "Y max") + property string tooltip: catalog.i18nc("@tooltip", "Distance from the rear of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") + property string axis: "y" + property string side: "max" + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + Loader + { + id: gantryHeightField + sourceComponent: numericTextFieldWithUnit + property string settingKey: "gantry_height" + property string label: catalog.i18nc("@label", "Gantry height") + property string unit: catalog.i18nc("@label", "mm") + property string tooltip: catalog.i18nc("@tooltip", "The height difference between the tip of the nozzle and the gantry system (X and Y axes). Used to prevent collisions between previous prints and the gantry when printing \"One at a Time\".") + property bool forceUpdateOnChange: true + } + + Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } + + UM.TooltipArea + { + height: childrenRect.height + width: childrenRect.width + text: machineExtruderCountProvider.properties.description + visible: extruderCountModel.count >= 2 + + Row + { + spacing: UM.Theme.getSize("default_margin").width + + Label + { + anchors.verticalCenter: extruderCountComboBox.verticalCenter + width: Math.max(0, settingsTabs.labelColumnWidth) + text: catalog.i18nc("@label", "Number of Extruders") + elide: Text.ElideRight + renderType: Text.NativeRendering + } + ComboBox + { + id: extruderCountComboBox + model: ListModel + { + id: extruderCountModel + Component.onCompleted: + { + for(var i = 0; i < manager.definedExtruderCount; i++) + { + extruderCountModel.append({text: String(i + 1), value: i}) + } + } + } + + Connections + { + target: manager + onDefinedExtruderCountChanged: + { + extruderCountModel.clear(); + for(var i = 0; i < manager.definedExtruderCount; ++i) + { + extruderCountModel.append({text: String(i + 1), value: i}); + } + } + } + + currentIndex: machineExtruderCountProvider.properties.value - 1 + onActivated: + { + manager.setMachineExtruderCount(index + 1); + } + } + } + } + } + } + + Row + { + spacing: UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.right: parent.right + height: parent.height - y + Column + { + height: parent.height + width: settingsTabs.columnWidth + Label + { + text: catalog.i18nc("@label", "Start G-code") + font.bold: true + } + Loader + { + id: machineStartGcodeField + sourceComponent: gcodeTextArea + property int areaWidth: parent.width + property int areaHeight: parent.height - y + property string settingKey: "machine_start_gcode" + property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very start.") + } + } + + Column { + height: parent.height + width: settingsTabs.columnWidth + Label + { + text: catalog.i18nc("@label", "End G-code") + font.bold: true + } + Loader + { + id: machineEndGcodeField + sourceComponent: gcodeTextArea + property int areaWidth: parent.width + property int areaHeight: parent.height - y + property string settingKey: "machine_end_gcode" + property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very end.") + } + } + } +} diff --git a/resources/qml/MachineSettings/SimpleCheckBox.qml b/resources/qml/MachineSettings/SimpleCheckBox.qml new file mode 100644 index 0000000000..ab8877f935 --- /dev/null +++ b/resources/qml/MachineSettings/SimpleCheckBox.qml @@ -0,0 +1,53 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// CheckBox widget for the on/off or true/false settings in the Machine Settings Dialog. +// +UM.TooltipArea +{ + UM.I18nCatalog { id: catalog; name: "cura"; } + + height: childrenRect.height + width: childrenRect.width + text: tooltip + + property alias containerStackId: propertyProvider.containerStackId + property alias settingKey: propertyProvider.key + property alias settingStoreIndex: propertyProvider.storeIndex + + property alias labelText: checkBox.text + + property string tooltip: propertyProvider.properties.description + + // callback functions + property var forceUpdateOnChangeFunction: dummy_func + + // a dummy function for default property values + function dummy_func() {} + + UM.SettingPropertyProvider + { + id: propertyProvider + watchedProperties: [ "value", "description" ] + } + + CheckBox + { + id: checkBox + checked: String(propertyProvider.properties.value).toLowerCase() != 'false' + onClicked: + { + propertyProvider.setPropertyValue("value", checked) + forceUpdateOnChangeFunction() + } + } +} From 3e4624774ac7b4f35d28db4e76f3ad1e19a00e9b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 12 Mar 2019 13:07:21 +0100 Subject: [PATCH 043/211] WIP: Create new machine settings page --- cura/UI/WelcomePagesModel.py | 12 +- .../MachineSettings/ComboBoxWithOptions.qml | 46 ++++--- .../NumericTextFieldWithUnit.qml | 6 +- resources/qml/WelcomePages/TestContent.qml | 126 ++++++++++++++++++ 4 files changed, 166 insertions(+), 24 deletions(-) create mode 100644 resources/qml/WelcomePages/TestContent.qml diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b4fd199a28..87158b35c3 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -3,7 +3,7 @@ import os from typing import TYPE_CHECKING, Optional -from PyQt5.QtCore import QUrl, Qt, pyqtSlot +from PyQt5.QtCore import QUrl, Qt from UM.Qt.ListModel import ListModel from UM.Resources import Resources @@ -29,6 +29,14 @@ class WelcomePagesModel(ListModel): def initialize(self) -> None: from cura.CuraApplication import CuraApplication + + self._pages.append({"id": "test", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "TestContent.qml"))), + }) + + # Add default welcome pages self._pages.append({"id": "welcome", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, @@ -68,8 +76,8 @@ class WelcomePagesModel(ListModel): self.setItems(self._pages) - def addPage(self): pass + __all__ = ["WelcomePagesModel"] diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 1a8f208bd6..289e4398fe 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -20,7 +20,7 @@ UM.TooltipArea height: childrenRect.height width: childrenRect.width - text: tooltip + text: tooltipText property alias containerStackId: propertyProvider.containerStackId property alias settingKey: propertyProvider.key @@ -29,7 +29,7 @@ UM.TooltipArea property alias labelText: fieldLabel.text property alias labelWidth: fieldLabel.width - property string tooltip: propertyProvider.properties.description + property string tooltipText: propertyProvider.properties.description // callback functions property var afterOnActivateFunction: dummy_func @@ -56,34 +56,40 @@ UM.TooltipArea elide: Text.ElideRight //width: Math.max(0, settingsTabs.labelColumnWidth) } - ComboBox + + ListModel { - id: comboBox - model: ListModel + id: optionsModel + Component.onCompleted: { - id: optionsModel - Component.onCompleted: + // Options come in as a string-representation of an OrderedDict + var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) + if (options) { - // Options come in as a string-representation of an OrderedDict - var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) - if (options) + options = options[1].split("), (") + for (var i = 0; i < options.length; i++) { - options = options[1].split("), (") - for (var i = 0; i < options.length; i++) - { - var option = options[i].substring(1, options[i].length - 1).split("', '") - optionsModel.append({text: option[1], value: option[0]}); - } + var option = options[i].substring(1, options[i].length - 1).split("', '") + optionsModel.append({text: option[1], value: option[0]}) } } } + } + + ComboBox + { + id: comboBox + model: optionsModel + + textRole: "text" + currentIndex: { var currentValue = propertyProvider.properties.value var index = 0 - for (var i = 0; i < optionsModel.count; i++) + for (var i = 0; i < model.count; i++) { - if (optionsModel.get(i).value == currentValue) + if (model.get(i).value == currentValue) { index = i break @@ -93,9 +99,9 @@ UM.TooltipArea } onActivated: { - if(propertyProvider.properties.value != optionsModel.get(index).value) + if(propertyProvider.properties.value != model.get(index).value) { - propertyProvider.setPropertyValue("value", optionsModel.get(index).value); + propertyProvider.setPropertyValue("value", model.get(index).value) forceUpdateOnChangeFunction() afterOnActivateFunction() } diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index f8b476d6f4..bb431cb6ad 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -20,7 +20,8 @@ UM.TooltipArea height: childrenRect.height width: childrenRect.width - text: tooltip + + text: tooltipText property alias containerStackId: propertyProvider.containerStackId property alias settingKey: propertyProvider.key @@ -30,7 +31,7 @@ UM.TooltipArea property alias labelWidth: fieldLabel.width property alias unitText: unitLabel.text - property string tooltip: propertyProvider.properties.description + property string tooltipText: propertyProvider.properties.description // whether negative value is allowed. This affects the validation of the input field. property bool allowNegativeValue: false @@ -43,6 +44,7 @@ UM.TooltipArea // a dummy function for default property values function dummy_func() {} + UM.SettingPropertyProvider { id: propertyProvider diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml new file mode 100644 index 0000000000..31506b8285 --- /dev/null +++ b/resources/qml/WelcomePages/TestContent.qml @@ -0,0 +1,126 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../MachineSettings" + + +// +// This component contains the content for the "Welcome" page of the welcome on-boarding process. +// + +Row +{ + id: base + UM.I18nCatalog { id: catalog; name: "cura" } + + property int labelWidth: 100 + + // Left-side column for "Printer Settings" + Column + { + spacing: 10 + + Label + { + text: catalog.i18nc("@title:label", "Printer Settings") + font: UM.Theme.getFont("medium_bold") + } + + NumericTextFieldWithUnit // "X (Width)" + { + id: machineXWidthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_width" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "X (Width)") + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Y (Depth)" + { + id: machineYDepthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_depth" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "Y (Depth)") + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Z (Height)" + { + id: machineZHeightField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_height" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "Z (Height)") + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "Build plate shape" + { + id: buildPlateShapeComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_shape" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "Build plate shape") + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Origin at center" + { + id: originAtCenterCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_center_is_zero" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "Origin at center") + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Heated bed" + { + id: heatedBedCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_heated_bed" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "Heated bed") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "G-code flavor" + { + id: gcodeFlavorComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_gcode_flavor" + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "G-code flavor") + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + } + } + + // Right-side column for "Printhead Settings" + Column + { + spacing: 10 + + Label + { + text: catalog.i18nc("@title:label", "Printhead Settings") + font: UM.Theme.getFont("medium_bold") + } + } +} From 752a48cacd65a221df6a6f8a3a3b3c8283c6a8ea Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 12 Mar 2019 14:36:08 +0100 Subject: [PATCH 044/211] WIP: Refactor and create reusable CuraComboBox --- .../MachineSettings/ComboBoxWithOptions.qml | 9 +- resources/qml/Settings/SettingComboBox.qml | 144 ++--------------- resources/qml/WelcomePages/TestContent.qml | 3 + resources/qml/Widgets/CuraComboBox.qml | 152 ++++++++++++++++++ 4 files changed, 175 insertions(+), 133 deletions(-) create mode 100644 resources/qml/Widgets/CuraComboBox.qml diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 289e4398fe..de69ba3478 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -8,6 +8,8 @@ import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura +import "../Widgets" + // // ComboBox with dropdown options in the Machine Settings dialog. @@ -54,7 +56,6 @@ UM.TooltipArea anchors.verticalCenter: comboBox.verticalCenter visible: text != "" elide: Text.ElideRight - //width: Math.max(0, settingsTabs.labelColumnWidth) } ListModel @@ -76,11 +77,12 @@ UM.TooltipArea } } - ComboBox + CuraComboBox { id: comboBox + width: 100 + height: UM.Theme.getSize("action_button").height model: optionsModel - textRole: "text" currentIndex: @@ -97,6 +99,7 @@ UM.TooltipArea } return index } + onActivated: { if(propertyProvider.properties.value != model.get(index).value) diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 768872d2f7..d9ea47ac4d 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -1,17 +1,20 @@ // Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 -import QtQuick.Controls 2.0 +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM + +import "../Widgets" as Widgets -import UM 1.1 as UM SettingItem { id: base property var focusItem: control - contents: ComboBox + contents: Widgets.CuraComboBox { id: control @@ -20,125 +23,6 @@ SettingItem anchors.fill: parent - background: Rectangle - { - color: - { - if (!enabled) - { - return UM.Theme.getColor("setting_control_disabled") - } - - if (control.hovered || control.activeFocus) - { - return UM.Theme.getColor("setting_control_highlight") - } - - return UM.Theme.getColor("setting_control") - } - - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if (!enabled) - { - return UM.Theme.getColor("setting_control_disabled_border") - } - - if (control.hovered || control.activeFocus) - { - return UM.Theme.getColor("setting_control_border_highlight") - } - - return UM.Theme.getColor("setting_control_border") - } - } - - indicator: UM.RecolorImage - { - id: downArrow - x: control.width - width - control.rightPadding - y: control.topPadding + Math.round((control.availableHeight - height) / 2) - - source: UM.Theme.getIcon("arrow_bottom") - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width + 5 * screenScaleFactor - sourceSize.height: width + 5 * screenScaleFactor - - color: UM.Theme.getColor("setting_control_button") - } - - contentItem: Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.verticalCenter: parent.verticalCenter - anchors.right: downArrow.left - - text: control.currentText - textFormat: Text.PlainText - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - popup: Popup - { - y: control.height - UM.Theme.getSize("default_lining").height - width: control.width - implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width - padding: UM.Theme.getSize("default_lining").width - - contentItem: ListView - { - clip: true - implicitHeight: contentHeight - model: control.popup.visible ? control.delegateModel : null - currentIndex: control.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle - { - color: UM.Theme.getColor("setting_control") - border.color: UM.Theme.getColor("setting_control_border") - } - } - - delegate: ItemDelegate - { - width: control.width - 2 * UM.Theme.getSize("default_lining").width - height: control.height - highlighted: control.highlightedIndex == index - - contentItem: Label - { - // FIXME: Somehow the top/bottom anchoring is not correct on Linux and it results in invisible texts. - anchors.fill: parent - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width - - text: modelData.value - textFormat: Text.PlainText - renderType: Text.NativeRendering - color: control.contentItem.color - font: UM.Theme.getFont("default") - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - background: Rectangle - { - color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" - border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" - } - } - onActivated: { forceActiveFocus() @@ -170,29 +54,29 @@ SettingItem value: { // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. - var value = undefined; + var value = undefined if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) { // We have a resolve function. Indicates that the setting is not settable per extruder and that // we have to choose between the resolved value (default) and the global value // (if user has explicitly set this). - value = base.resolve; + value = base.resolve } if (value == undefined) { - value = propertyProvider.properties.value; + value = propertyProvider.properties.value } - for(var i = 0; i < control.model.length; ++i) + for (var i = 0; i < control.model.length; i++) { - if(control.model[i].key == value) + if (control.model[i].key == value) { - return i; + return i } } - return -1; + return -1 } } } diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index 31506b8285..b7a3da3d71 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -122,5 +122,8 @@ Row text: catalog.i18nc("@title:label", "Printhead Settings") font: UM.Theme.getFont("medium_bold") } + + + } } diff --git a/resources/qml/Widgets/CuraComboBox.qml b/resources/qml/Widgets/CuraComboBox.qml new file mode 100644 index 0000000000..6ce7c6da45 --- /dev/null +++ b/resources/qml/Widgets/CuraComboBox.qml @@ -0,0 +1,152 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// ComboBox with Cura styling. +// +ComboBox +{ + id: control + + background: Rectangle + { + color: + { + if (!enabled) + { + return UM.Theme.getColor("setting_control_disabled") + } + + if (control.hovered || control.activeFocus) + { + return UM.Theme.getColor("setting_control_highlight") + } + + return UM.Theme.getColor("setting_control") + } + + radius: UM.Theme.getSize("setting_control_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if (!enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + + if (control.hovered || control.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + + return UM.Theme.getColor("setting_control_border") + } + } + + indicator: UM.RecolorImage + { + id: downArrow + x: control.width - width - control.rightPadding + y: control.topPadding + Math.round((control.availableHeight - height) / 2) + + source: UM.Theme.getIcon("arrow_bottom") + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + 5 * screenScaleFactor + sourceSize.height: width + 5 * screenScaleFactor + + color: UM.Theme.getColor("setting_control_button") + } + + contentItem: Label + { + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.verticalCenter: parent.verticalCenter + anchors.right: downArrow.left + + text: control.currentText + textFormat: Text.PlainText + renderType: Text.NativeRendering + font: UM.Theme.getFont("default") + color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + + popup: Popup + { + y: control.height - UM.Theme.getSize("default_lining").height + width: control.width + implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width + padding: UM.Theme.getSize("default_lining").width + + contentItem: ListView + { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle + { + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + } + + delegate: ItemDelegate + { + id: delegateItem + width: control.width - 2 * UM.Theme.getSize("default_lining").width + height: control.height + highlighted: control.highlightedIndex == index + text: + // FIXME: Maybe there is a better way to do this. Check model and modelData doc page: + // https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html + { + var _val = undefined + if (typeof _val === 'undefined') // try to get textRole from "model". + { + _val = model[textRole] + } + if (typeof _val === 'undefined') // try to get textRole from "modelData" if it's still undefined. + { + _val = modelData[textRole] + } + return (typeof _val !== 'undefined') ? _val : "" + } + + contentItem: Label + { + // FIXME: Somehow the top/bottom anchoring is not correct on Linux and it results in invisible texts. + anchors.fill: parent + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width + + text: delegateItem.text + textFormat: Text.PlainText + renderType: Text.NativeRendering + color: control.contentItem.color + font: UM.Theme.getFont("default") + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle + { + color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" + border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" + } + } +} From 0f116fa3f47e563bea69f3497d32b9fac3c114f0 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 14 Mar 2019 14:59:04 +0100 Subject: [PATCH 045/211] Replace old User-Agreement-page with new Welcome-Pages. [CURA-6057] --- cura/CuraApplication.py | 7 +++++++ plugins/UserAgreement/UserAgreement.py | 9 +++++---- resources/qml/Cura.qml | 2 +- .../qml/WelcomePages/UserAgreementContent.qml | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1192455312..d02e630911 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -555,11 +555,18 @@ class CuraApplication(QtApplication): def needToShowUserAgreement(self) -> bool: return self._need_to_show_user_agreement + @pyqtSlot(bool) def setNeedToShowUserAgreement(self, set_value = True) -> None: self._need_to_show_user_agreement = set_value + @pyqtSlot(str, str) + def writeToLog(self, severity: str, message: str) -> None: + Logger.log(severity, message) + # DO NOT call this function to close the application, use checkAndExitApplication() instead which will perform # pre-exit checks such as checking for in-progress USB printing, etc. + # Except for the 'Decline and close' in the 'User Agreement'-step in the Welcome-pages, that should be a hard exit. + @pyqtSlot() def closeApplication(self) -> None: Logger.log("i", "Close application") main_window = self.getMainWindow() diff --git a/plugins/UserAgreement/UserAgreement.py b/plugins/UserAgreement/UserAgreement.py index 4ea1ccf9bb..92d23ce725 100644 --- a/plugins/UserAgreement/UserAgreement.py +++ b/plugins/UserAgreement/UserAgreement.py @@ -24,10 +24,11 @@ class UserAgreement(QObject, Extension): self.showUserAgreement() def showUserAgreement(self): - if not self._user_agreement_window: - self.createUserAgreementWindow() - - self._user_agreement_window.show() + # if not self._user_agreement_window: + # self.createUserAgreementWindow() + # + # self._user_agreement_window.show() + pass @pyqtSlot(bool) def didAgree(self, user_choice): diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 47f712e21a..9d1a3e1201 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -45,7 +45,7 @@ UM.MainWindow WelcomeDialog { id: welcomeDialog - visible: false + visible: CuraApplication.needToShowUserAgreement } Rectangle diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 871dea4602..82b16ba2ee 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -62,7 +62,12 @@ Item text: catalog.i18nc("@button", "Agree") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() + onClicked: + { + CuraApplication.writeToLog("i", "User accepted the User-Agreement.") + CuraApplication.setNeedToShowUserAgreement(false) + base.showNextPage() + } } Cura.SecondaryButton @@ -74,6 +79,11 @@ Item text: catalog.i18nc("@button", "Decline and close") width: 140 fixedWidthMode: true - onClicked: base.showNextPage() // TODO: quit + onClicked: + { + CuraApplication.writeToLog("i", "User declined the User Agreement.") + base.passLastPage() + CuraApplication.closeApplication() // NOTE: Hard exit, don't use if anything needs to be saved! + } } } From 4a95564277395d8ec8ad9a7d4617b601ffcd7d15 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 15 Mar 2019 11:30:07 +0100 Subject: [PATCH 046/211] Only show Welcome-Pages when needed. [CURA-6057] --- cura/CuraApplication.py | 8 ++------ resources/qml/Cura.qml | 9 ++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index d02e630911..2b6546ba1e 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -245,8 +245,6 @@ class CuraApplication(QtApplication): self._update_platform_activity_timer = None - self._need_to_show_user_agreement = True - self._sidebar_custom_menu_items = [] # type: list # Keeps list of custom menu items for the side bar self._plugins_loaded = False @@ -530,8 +528,6 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/expanded_brands", "") preferences.addPreference("cura/expanded_types", "") - self._need_to_show_user_agreement = not preferences.getValue("general/accepted_user_agreement") - for key in [ "dialog_load_path", # dialog_save_path is in LocalFileOutputDevicePlugin "dialog_profile_path", @@ -553,11 +549,11 @@ class CuraApplication(QtApplication): @pyqtProperty(bool) def needToShowUserAgreement(self) -> bool: - return self._need_to_show_user_agreement + return not self.getPreferences().getValue("general/accepted_user_agreement") @pyqtSlot(bool) def setNeedToShowUserAgreement(self, set_value = True) -> None: - self._need_to_show_user_agreement = set_value + self.getPreferences().setValue("general/accepted_user_agreement", not set_value) @pyqtSlot(str, str) def writeToLog(self, severity: str, message: str) -> None: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 9d1a3e1201..72d3c77838 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -45,7 +45,7 @@ UM.MainWindow WelcomeDialog { id: welcomeDialog - visible: CuraApplication.needToShowUserAgreement + visible: true // True, so if somehow no preferences are found/loaded, it's shown anyway. } Rectangle @@ -83,6 +83,13 @@ UM.MainWindow // This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property. Cura.Actions.parent = backgroundItem CuraApplication.purgeWindows() + + if (CuraApplication.needToShowUserAgreement) + { + welcomeDialog.visible = true; + welcomeDialog.currentStep = 0; + welcomeDialog.show(); + } } Item From 5b31feebba4df36481392f4c1f45fc016fd2a9f3 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 15 Mar 2019 13:58:36 +0100 Subject: [PATCH 047/211] Remove UserAgreement-plugin in favour of Welcome-Pages. [CURA-6057] --- cura/CuraApplication.py | 4 +- plugins/UserAgreement/UserAgreement.py | 47 ------------------ plugins/UserAgreement/UserAgreement.qml | 63 ------------------------- plugins/UserAgreement/__init__.py | 10 ---- plugins/UserAgreement/plugin.json | 8 ---- resources/bundled_packages/cura.json | 17 ------- resources/qml/Cura.qml | 15 ++---- 7 files changed, 8 insertions(+), 156 deletions(-) delete mode 100644 plugins/UserAgreement/UserAgreement.py delete mode 100644 plugins/UserAgreement/UserAgreement.qml delete mode 100644 plugins/UserAgreement/__init__.py delete mode 100644 plugins/UserAgreement/plugin.json diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2b6546ba1e..5f13d50b98 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -456,7 +456,7 @@ class CuraApplication(QtApplication): # Misc.: "ConsoleLogger", #You want to be able to read the log if something goes wrong. "CuraEngineBackend", #Cura is useless without this one since you can't slice. - "UserAgreement", #Our lawyers want every user to see this at least once. + # NOTE: User-Agreement is part of the 'onboarding flow' now (See Welcome Pages). "FileLogger", #You want to be able to read the log if something goes wrong. "XmlMaterialProfile", #Cura crashes without this one. "Toolbox", #This contains the interface to enable/disable plug-ins, so if you disable it you can't enable it back. @@ -528,6 +528,8 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/expanded_brands", "") preferences.addPreference("cura/expanded_types", "") + preferences.addPreference("general/accepted_user_agreement", False) + for key in [ "dialog_load_path", # dialog_save_path is in LocalFileOutputDevicePlugin "dialog_profile_path", diff --git a/plugins/UserAgreement/UserAgreement.py b/plugins/UserAgreement/UserAgreement.py deleted file mode 100644 index 92d23ce725..0000000000 --- a/plugins/UserAgreement/UserAgreement.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2017 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -import os - -from PyQt5.QtCore import QObject, pyqtSlot - -from UM.Extension import Extension -from UM.Logger import Logger - - -class UserAgreement(QObject, Extension): - def __init__(self, application): - super(UserAgreement, self).__init__() - self._application = application - self._user_agreement_window = None - self._user_agreement_context = None - self._application.engineCreatedSignal.connect(self._onEngineCreated) - - self._application.getPreferences().addPreference("general/accepted_user_agreement", False) - - def _onEngineCreated(self): - if not self._application.getPreferences().getValue("general/accepted_user_agreement"): - self.showUserAgreement() - - def showUserAgreement(self): - # if not self._user_agreement_window: - # self.createUserAgreementWindow() - # - # self._user_agreement_window.show() - pass - - @pyqtSlot(bool) - def didAgree(self, user_choice): - if user_choice: - Logger.log("i", "User agreed to the user agreement") - self._application.getPreferences().setValue("general/accepted_user_agreement", True) - self._user_agreement_window.hide() - else: - Logger.log("i", "User did NOT agree to the user agreement") - self._application.getPreferences().setValue("general/accepted_user_agreement", False) - self._application.quit() - self._application.setNeedToShowUserAgreement(False) - - def createUserAgreementWindow(self): - path = os.path.join(self._application.getPluginRegistry().getPluginPath(self.getPluginId()), "UserAgreement.qml") - self._user_agreement_window = self._application.createQmlComponent(path, {"manager": self}) diff --git a/plugins/UserAgreement/UserAgreement.qml b/plugins/UserAgreement/UserAgreement.qml deleted file mode 100644 index 2e5893fc41..0000000000 --- a/plugins/UserAgreement/UserAgreement.qml +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.4 - -import UM 1.3 as UM - -UM.Dialog -{ - id: baseDialog - minimumWidth: Math.round(UM.Theme.getSize("modal_window_minimum").width * 0.75) - minimumHeight: Math.round(UM.Theme.getSize("modal_window_minimum").height * 0.5) - width: minimumWidth - height: minimumHeight - title: catalog.i18nc("@title:window", "User Agreement") - - TextArea - { - anchors.top: parent.top - width: parent.width - anchors.bottom: buttonRow.top - text: '

DISCLAIMER BY ULTIMAKER

-

PLEASE READ THIS DISCLAIMER CAREFULLY.

-

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 PERFORMANCE OF ULTIMAKER SOFTWARE IS WITH YOU.

-

UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, IN NO EVENT WILL ULTIMAKER BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE ANY ULTIMAKER SOFTWARE OR THIRD PARTY SOFTWARE.

- ' - readOnly: true; - textFormat: TextEdit.RichText - } - - Item - { - id: buttonRow - anchors.bottom: parent.bottom - width: parent.width - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - - UM.I18nCatalog { id: catalog; name: "cura" } - - Button - { - anchors.right: parent.right - text: catalog.i18nc("@action:button", "I understand and agree") - onClicked: { - baseDialog.accepted() - } - } - - Button - { - anchors.left: parent.left - text: catalog.i18nc("@action:button", "I don't agree") - onClicked: { - baseDialog.rejected() - } - } - } - - onAccepted: manager.didAgree(true) - onRejected: manager.didAgree(false) - onClosing: manager.didAgree(false) -} diff --git a/plugins/UserAgreement/__init__.py b/plugins/UserAgreement/__init__.py deleted file mode 100644 index 3cf81c64f4..0000000000 --- a/plugins/UserAgreement/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2017 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -from . import UserAgreement - -def getMetaData(): - return {} - -def register(app): - return {"extension": UserAgreement.UserAgreement(app)} diff --git a/plugins/UserAgreement/plugin.json b/plugins/UserAgreement/plugin.json deleted file mode 100644 index b172d1f9a2..0000000000 --- a/plugins/UserAgreement/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "UserAgreement", - "author": "Ultimaker B.V.", - "version": "1.0.1", - "description": "Ask the user once if he/she agrees with our license.", - "api": "6.0", - "i18n-catalog": "cura" -} diff --git a/resources/bundled_packages/cura.json b/resources/bundled_packages/cura.json index 9e126ee028..12cdf7b80a 100644 --- a/resources/bundled_packages/cura.json +++ b/resources/bundled_packages/cura.json @@ -560,23 +560,6 @@ } } }, - "UserAgreement": { - "package_info": { - "package_id": "UserAgreement", - "package_type": "plugin", - "display_name": "User Agreement", - "description": "Ask the user once if he/she agrees with our license.", - "package_version": "1.0.1", - "sdk_version": "6.0", - "website": "https://ultimaker.com", - "author": { - "author_id": "UltimakerPackages", - "display_name": "Ultimaker B.V.", - "email": "plugins@ultimaker.com", - "website": "https://ultimaker.com" - } - } - }, "VersionUpgrade21to22": { "package_info": { "package_id": "VersionUpgrade21to22", diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 72d3c77838..6af28d3e7b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -90,6 +90,11 @@ UM.MainWindow welcomeDialog.currentStep = 0; welcomeDialog.show(); } + else + { + welcomeDialog.hide() + welcomeDialog.visible = false; + } } Item @@ -845,16 +850,6 @@ UM.MainWindow { base.visible = true; } - - // check later if the user agreement dialog has been closed - if (CuraApplication.needToShowUserAgreement) - { - restart(); - } - else if(Cura.MachineManager.activeMachine == null) - { - addMachineDialog.open(); - } } } From cf0e3effc7777237a0aa7cb0bf11d66330f08006 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 08:48:29 +0100 Subject: [PATCH 048/211] WIP: Refactor NumericTextFieldWithUnit --- plugins/Toolbox/src/Toolbox.py | 1 - .../NumericTextFieldWithUnit.qml | 147 +++++++++++++----- 2 files changed, 109 insertions(+), 39 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 7d8d359831..add138b859 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -50,7 +50,6 @@ class Toolbox(QObject, Extension): self._request_headers = [] # type: List[Tuple[bytes, bytes]] self._updateRequestHeader() - self._request_urls = {} # type: Dict[str, QUrl] self._to_update = [] # type: List[str] # Package_ids that are waiting to be updated self._old_plugin_ids = set() # type: Set[str] diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index bb431cb6ad..473f90d863 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -21,6 +21,9 @@ UM.TooltipArea height: childrenRect.height width: childrenRect.width + property int controlWidth: UM.Theme.getSize("setting_control").width + property int controlHeight: UM.Theme.getSize("setting_control").height + text: tooltipText property alias containerStackId: propertyProvider.containerStackId @@ -63,62 +66,130 @@ UM.TooltipArea visible: text != "" elide: Text.ElideRight renderType: Text.NativeRendering - //width: Math.max(0, settingsTabs.labelColumnWidth) } - Item + TextField { id: textFieldWithUnit - width: textField.width - height: textField.height + width: numericTextFieldWithUnit.controlWidth + height: numericTextFieldWithUnit.controlHeight - TextField + // Background is a rounded-cornered box with filled color as state indication (normal, warning, error, etc.) + background: Rectangle { - id: textField - text: + anchors.fill: parent + anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) + radius: UM.Theme.getSize("setting_control_radius").width + + border.color: { - const value = propertyProvider.properties.value - return value ? value : "" - } - validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } - onEditingFinished: - { - if (propertyProvider && text != propertyProvider.properties.value) + if (!textFieldWithUnit.enabled) { - // For some properties like the extruder-compatible material diameter, they need to - // trigger many updates, such as the available materials, the current material may - // need to be switched, etc. Although setting the diameter can be done directly via - // the provider, all the updates that need to be triggered then need to depend on - // the metadata update, a signal that can be fired way too often. The update functions - // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary - // overhead. - // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", - // and it triggers the diameter update signals only when it is needed. Here it is optionally - // choose to use setCompatibleMaterialDiameter() or other more specific functions that - // are available. - if (setValueFunction !== null) - { - setValueFunction(text) - } - else - { - propertyProvider.setPropertyValue("value", text) - } - forceUpdateOnChangeFunction() - afterOnEditingFinished() + return UM.Theme.getColor("setting_control_disabled_border") } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error") + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning") + } + // Validation is OK. + if (textFieldWithUnit.hovered || textFieldWithUnit.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + + color: + { + if (!textFieldWithUnit.enabled) + { + return UM.Theme.getColor("setting_control_disabled") + } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error_background") + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning_background") + case "ValidatorState.Valid": + return UM.Theme.getColor("setting_validation_ok") + default: + return UM.Theme.getColor("setting_control") + } + } + } + + hoverEnabled: true + selectByMouse: true + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + + // When the textbox gets focused by TAB, select all text + onActiveFocusChanged: + { + if (activeFocus && (focusReason == Qt.TabFocusReason || focusReason == Qt.BacktabFocusReason)) + { + selectAll() + } + } + + text: + { + const value = propertyProvider.properties.value + return value ? value : "" + } + validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } + + onEditingFinished: + { + if (propertyProvider && text != propertyProvider.properties.value) + { + // For some properties like the extruder-compatible material diameter, they need to + // trigger many updates, such as the available materials, the current material may + // need to be switched, etc. Although setting the diameter can be done directly via + // the provider, all the updates that need to be triggered then need to depend on + // the metadata update, a signal that can be fired way too often. The update functions + // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary + // overhead. + // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", + // and it triggers the diameter update signals only when it is needed. Here it is optionally + // choose to use setCompatibleMaterialDiameter() or other more specific functions that + // are available. + if (setValueFunction !== null) + { + setValueFunction(text) + } + else + { + propertyProvider.setPropertyValue("value", text) + } + forceUpdateOnChangeFunction() + afterOnEditingFinished() } } Label { id: unitLabel - anchors.right: textField.right - anchors.rightMargin: y - textField.y - anchors.verticalCenter: textField.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) + anchors.verticalCenter: parent.verticalCenter text: unitText + textFormat: Text.PlainText + verticalAlignment: Text.AlignVCenter renderType: Text.NativeRendering + color: UM.Theme.getColor("setting_unit") + font: UM.Theme.getFont("default") } } } From 0fb9ee6c9a8928f36998e76535a709e975489c64 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 08:53:41 +0100 Subject: [PATCH 049/211] WIP: Add CheckBox and fix styles --- .../MachineSettings/ComboBoxWithOptions.qml | 11 ++- .../NumericTextFieldWithUnit.qml | 3 +- .../qml/MachineSettings/SimpleCheckBox.qml | 11 ++- resources/qml/WelcomePages/TestContent.qml | 7 ++ resources/qml/Widgets/CuraCheckBox.qml | 76 +++++++++++++++++++ 5 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 resources/qml/Widgets/CuraCheckBox.qml diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index de69ba3478..6d566f6c62 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -24,11 +24,15 @@ UM.TooltipArea width: childrenRect.width text: tooltipText + property int controlWidth: UM.Theme.getSize("setting_control").width + property int controlHeight: UM.Theme.getSize("setting_control").height + property alias containerStackId: propertyProvider.containerStackId property alias settingKey: propertyProvider.key property alias settingStoreIndex: propertyProvider.storeIndex property alias labelText: fieldLabel.text + property alias labelFont: fieldLabel.font property alias labelWidth: fieldLabel.width property string tooltipText: propertyProvider.properties.description @@ -55,7 +59,8 @@ UM.TooltipArea id: fieldLabel anchors.verticalCenter: comboBox.verticalCenter visible: text != "" - elide: Text.ElideRight + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } ListModel @@ -80,8 +85,8 @@ UM.TooltipArea CuraComboBox { id: comboBox - width: 100 - height: UM.Theme.getSize("action_button").height + width: comboBoxWithOptions.controlWidth + height: comboBoxWithOptions.controlHeight model: optionsModel textRole: "text" diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index 473f90d863..aacfd185a9 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -31,6 +31,7 @@ UM.TooltipArea property alias settingStoreIndex: propertyProvider.storeIndex property alias labelText: fieldLabel.text + property alias labelFont: fieldLabel.font property alias labelWidth: fieldLabel.width property alias unitText: unitLabel.text @@ -64,7 +65,7 @@ UM.TooltipArea id: fieldLabel anchors.verticalCenter: textFieldWithUnit.verticalCenter visible: text != "" - elide: Text.ElideRight + font: UM.Theme.getFont("medium") renderType: Text.NativeRendering } diff --git a/resources/qml/MachineSettings/SimpleCheckBox.qml b/resources/qml/MachineSettings/SimpleCheckBox.qml index ab8877f935..2147be9859 100644 --- a/resources/qml/MachineSettings/SimpleCheckBox.qml +++ b/resources/qml/MachineSettings/SimpleCheckBox.qml @@ -8,14 +8,20 @@ import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura +import "../Widgets" + // // CheckBox widget for the on/off or true/false settings in the Machine Settings Dialog. // UM.TooltipArea { + id: simpleCheckBox + UM.I18nCatalog { id: catalog; name: "cura"; } + property int controlHeight: UM.Theme.getSize("setting_control").height + height: childrenRect.height width: childrenRect.width text: tooltip @@ -25,6 +31,7 @@ UM.TooltipArea property alias settingStoreIndex: propertyProvider.storeIndex property alias labelText: checkBox.text + property alias labelFont: checkBox.font property string tooltip: propertyProvider.properties.description @@ -40,10 +47,12 @@ UM.TooltipArea watchedProperties: [ "value", "description" ] } - CheckBox + CuraCheckBox { id: checkBox checked: String(propertyProvider.properties.value).toLowerCase() != 'false' + height: simpleCheckBox.controlHeight + font: UM.Theme.getFont("medium") onClicked: { propertyProvider.setPropertyValue("value", checked) diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index b7a3da3d71..193a1090e3 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -20,6 +20,7 @@ Row UM.I18nCatalog { id: catalog; name: "cura" } property int labelWidth: 100 + property var labelFont: UM.Theme.getFont("medium") // Left-side column for "Printer Settings" Column @@ -39,6 +40,7 @@ Row settingKey: "machine_width" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "X (Width)") + labelFont: base.labelFont labelWidth: base.labelWidth unitText: catalog.i18nc("@label", "mm") // TODO: add forceUpdateOnChangeFunction: @@ -51,6 +53,7 @@ Row settingKey: "machine_depth" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "Y (Depth)") + labelFont: base.labelFont labelWidth: base.labelWidth unitText: catalog.i18nc("@label", "mm") // TODO: add forceUpdateOnChangeFunction: @@ -63,6 +66,7 @@ Row settingKey: "machine_height" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "Z (Height)") + labelFont: base.labelFont labelWidth: base.labelWidth unitText: catalog.i18nc("@label", "mm") // TODO: add forceUpdateOnChangeFunction: @@ -86,6 +90,7 @@ Row settingKey: "machine_center_is_zero" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "Origin at center") + labelFont: base.labelFont // TODO: add forceUpdateOnChangeFunction: } @@ -96,6 +101,7 @@ Row settingKey: "machine_heated_bed" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "Heated bed") + labelFont: base.labelFont // TODO: add forceUpdateOnChangeFunction: } @@ -106,6 +112,7 @@ Row settingKey: "machine_gcode_flavor" settingStoreIndex: 1 // TODO labelText: catalog.i18nc("@label", "G-code flavor") + labelFont: base.labelFont labelWidth: base.labelWidth // TODO: add forceUpdateOnChangeFunction: // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata diff --git a/resources/qml/Widgets/CuraCheckBox.qml b/resources/qml/Widgets/CuraCheckBox.qml new file mode 100644 index 0000000000..865d9af5a2 --- /dev/null +++ b/resources/qml/Widgets/CuraCheckBox.qml @@ -0,0 +1,76 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// ComboBox with Cura styling. +// +CheckBox +{ + id: control + + hoverEnabled: true + + indicator: Rectangle + { + width: control.height + height: control.height + + color: + { + if (!control.enabled) + { + return UM.Theme.getColor("setting_control_disabled") + } + if (control.hovered || control.activeFocus) + { + return UM.Theme.getColor("setting_control_highlight") + } + return UM.Theme.getColor("setting_control") + } + + radius: UM.Theme.getSize("setting_control_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if (!enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + if (control.hovered || control.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: Math.round(parent.width / 2.5) + height: Math.round(parent.height / 2.5) + sourceSize.height: width + color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text"); + source: UM.Theme.getIcon("check") + opacity: control.checked ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100; } } + } + } + + contentItem: Label + { + id: textLabel + leftPadding: control.indicator.width + control.spacing + text: control.text + font: control.font + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + } +} From a2f845f90eb841386078037cac84d55c6d2869d9 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 12:01:52 +0100 Subject: [PATCH 050/211] WIP: Add PrintHeadMinMaxTextField --- .../NumericTextFieldWithUnit.qml | 12 ++- .../PrintHeadMinMaxTextField.qml | 81 +++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index aacfd185a9..f3f4de6981 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura @@ -30,11 +29,16 @@ UM.TooltipArea property alias settingKey: propertyProvider.key property alias settingStoreIndex: propertyProvider.storeIndex + property alias propertyProvider: propertyProvider property alias labelText: fieldLabel.text property alias labelFont: fieldLabel.font property alias labelWidth: fieldLabel.width property alias unitText: unitLabel.text + property alias valueText: textFieldWithUnit.text + property alias valueValidator: textFieldWithUnit.validator + property alias editingFinishedFunction: textFieldWithUnit.editingFinishedFunction + property string tooltipText: propertyProvider.properties.description // whether negative value is allowed. This affects the validation of the input field. @@ -151,7 +155,11 @@ UM.TooltipArea } validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } - onEditingFinished: + onEditingFinished: editingFinishedFunction() + + property var editingFinishedFunction: defaultEditingFinishedFunction + + function defaultEditingFinishedFunction() { if (propertyProvider && text != propertyProvider.properties.value) { diff --git a/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml new file mode 100644 index 0000000000..236f9a7dd0 --- /dev/null +++ b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml @@ -0,0 +1,81 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This is the widget for editing min and max X and Y for the print head. +// The print head is internally stored as a JSON array or array, representing a polygon of the print head. +// The polygon array is stored in the format illustrated below: +// [ [ -x_min, y_max ], +// [ -x_min, -y_min ], +// [ x_max, y_max ], +// [ x_max, -y_min ], +// ] +// +// In order to modify each field, the widget is configurable via "axisName" and "axisMinOrMax", where +// - axisName is "x" or "y" +// - axisMinOrMax is "min" or "max" +// +NumericTextFieldWithUnit +{ + id: machineXMaxField + UM.I18nCatalog { id: catalog; name: "cura" } + + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_head_with_fans_polygon" + settingStoreIndex: 1 + + property string axisName: "x" + property string axisMinOrMax: "min" + property var axisValue: + { + var polygon = JSON.parse(propertyProvider.properties.value) + var item = (axisName == "x") ? 0 : 1 + var result = polygon[0][item] + var func = (axisMinOrMax == "min") ? Math.min : Math.max + for (var i = 1; i < polygon.length; i++) + { + result = func(result, polygon[i][item]) + } + result = Math.abs(result) + return result + } + + valueValidator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ } + valueText: axisValue + + editingFinishedFunction: function() + { + var polygon = JSON.parse(propertyProvider.properties.value) + + var newValue = parseFloat(valueText.replace(',', '.')) + if (axisName == "x") // x min/x max + { + var start_i1 = (axisMinOrMax == "min") ? 0 : 2 + var factor = (axisMinOrMax == "min") ? -1 : 1 + polygon[start_i1][0] = newValue * factor + polygon[start_i1 + 1][0] = newValue * factor + } + else // y min/y max + { + var start_i1 = (axisMinOrMax == "min") ? 1 : 0 + var factor = (axisMinOrMax == "min") ? -1 : 1 + polygon[start_i1][1] = newValue * factor + polygon[start_i1 + 2][1] = newValue * factor + } + var polygon_string = JSON.stringify(polygon) + if (polygon_string != propertyProvider.properties.value) + { + propertyProvider.setPropertyValue("value", polygon_string) + forceUpdateOnChangeFunction() + } + } + + // TODO: add forceUpdateOnChangeFunction: +} From 6c6ccb16b8f139a90347a9807c36d3353ed778c0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 12:02:25 +0100 Subject: [PATCH 051/211] WIP: Add X/Y min/max fields --- resources/qml/WelcomePages/TestContent.qml | 84 +++++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index 193a1090e3..6db019785e 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -19,15 +19,24 @@ Row id: base UM.I18nCatalog { id: catalog; name: "cura" } - property int labelWidth: 100 + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: UM.Theme.getSize("default_margin").width + + property int labelWidth: 110 property var labelFont: UM.Theme.getFont("medium") + spacing: 10 + + // ======================================= // Left-side column for "Printer Settings" + // ======================================= Column { spacing: 10 - Label + Label // Title Label { text: catalog.i18nc("@title:label", "Printer Settings") font: UM.Theme.getFont("medium_bold") @@ -119,18 +128,87 @@ Row } } + // ======================================= // Right-side column for "Printhead Settings" + // ======================================= Column { spacing: 10 - Label + Label // Title Label { text: catalog.i18nc("@title:label", "Printhead Settings") font: UM.Theme.getFont("medium_bold") } + PrintHeadMinMaxTextField // "X min" + { + id: machineXMinField + settingStoreIndex: 1 // TODO + labelText: catalog.i18nc("@label", "X min") + labelFont: base.labelFont + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "x" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y min" + { + id: machineYMinField + + settingStoreIndex: 1 // TODO + + labelText: catalog.i18nc("@label", "Y min") + labelFont: base.labelFont + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "X max" + { + id: machineXMaxField + + settingStoreIndex: 1 // TODO + + labelText: catalog.i18nc("@label", "X max") + labelFont: base.labelFont + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "x" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y max" + { + id: machineYMaxField + + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_head_with_fans_polygon" + settingStoreIndex: 1 // TODO + + labelText: catalog.i18nc("@label", "Y max") + labelFont: base.labelFont + labelWidth: base.labelWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } } } From 449740a6311d705320f0e38046eacda27d16103f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 13:34:02 +0100 Subject: [PATCH 052/211] WIP: MachineSettings Printer tab --- cura/Settings/GlobalStack.py | 4 + .../MachineSettings/ComboBoxWithOptions.qml | 113 +++-- .../qml/MachineSettings/GcodeTextArea.qml | 47 +- .../NumericTextFieldWithUnit.qml | 267 ++++++----- .../qml/MachineSettings/SimpleCheckBox.qml | 19 +- resources/qml/WelcomePages/TestContent.qml | 438 +++++++++++------- 6 files changed, 524 insertions(+), 364 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 3940af7ecc..17a732c4b9 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -64,6 +64,10 @@ class GlobalStack(CuraContainerStack): machine_extruder_count = self.getProperty("machine_extruder_count", "value") return result_list[:machine_extruder_count] + @pyqtProperty(int, constant = True) + def maxExtruderCount(self): + return len(self.getMetaDataEntry("machine_extruder_trains")) + @classmethod def getLoadingPriority(cls) -> int: return 2 diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 6d566f6c62..1d7f9307b6 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -34,6 +34,7 @@ UM.TooltipArea property alias labelText: fieldLabel.text property alias labelFont: fieldLabel.font property alias labelWidth: fieldLabel.width + property alias optionModel: comboBox.model property string tooltipText: propertyProvider.properties.description @@ -50,70 +51,68 @@ UM.TooltipArea watchedProperties: [ "value", "options", "description" ] } - Row + Label { - spacing: UM.Theme.getSize("default_margin").width + id: fieldLabel + anchors.left: parent.left + anchors.verticalCenter: comboBox.verticalCenter + visible: text != "" + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } - Label + ListModel + { + id: defaultOptionsModel + Component.onCompleted: { - id: fieldLabel - anchors.verticalCenter: comboBox.verticalCenter - visible: text != "" - font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - } - - ListModel - { - id: optionsModel - Component.onCompleted: + // Options come in as a string-representation of an OrderedDict + var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) + if (options) { - // Options come in as a string-representation of an OrderedDict - var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) - if (options) + options = options[1].split("), (") + for (var i = 0; i < options.length; i++) { - options = options[1].split("), (") - for (var i = 0; i < options.length; i++) - { - var option = options[i].substring(1, options[i].length - 1).split("', '") - optionsModel.append({text: option[1], value: option[0]}) - } - } - } - } - - CuraComboBox - { - id: comboBox - width: comboBoxWithOptions.controlWidth - height: comboBoxWithOptions.controlHeight - model: optionsModel - textRole: "text" - - currentIndex: - { - var currentValue = propertyProvider.properties.value - var index = 0 - for (var i = 0; i < model.count; i++) - { - if (model.get(i).value == currentValue) - { - index = i - break - } - } - return index - } - - onActivated: - { - if(propertyProvider.properties.value != model.get(index).value) - { - propertyProvider.setPropertyValue("value", model.get(index).value) - forceUpdateOnChangeFunction() - afterOnActivateFunction() + var option = options[i].substring(1, options[i].length - 1).split("', '") + defaultOptionsModel.append({text: option[1], value: option[0]}) } } } } + + CuraComboBox + { + id: comboBox + anchors.left: fieldLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + width: comboBoxWithOptions.controlWidth + height: comboBoxWithOptions.controlHeight + model: defaultOptionsModel + textRole: "text" + + currentIndex: + { + var currentValue = propertyProvider.properties.value + var index = 0 + for (var i = 0; i < model.count; i++) + { + if (model.get(i).value == currentValue) + { + index = i + break + } + } + return index + } + + onActivated: + { + if(propertyProvider.properties.value != model.get(index).value) + { + propertyProvider.setPropertyValue("value", model.get(index).value) + forceUpdateOnChangeFunction() + afterOnActivateFunction() + } + } + } } diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml index 748111a8e2..ef9540791e 100644 --- a/resources/qml/MachineSettings/GcodeTextArea.qml +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -14,12 +14,10 @@ import Cura 1.1 as Cura // UM.TooltipArea { - id: gcodeTextArea + id: control UM.I18nCatalog { id: catalog; name: "cura"; } - height: childrenRect.height - width: childrenRect.width text: tooltip property alias containerStackId: propertyProvider.containerStackId @@ -28,22 +26,57 @@ UM.TooltipArea property string tooltip: propertyProvider.properties.description + property alias labelText: titleLabel.text + property alias labelFont: titleLabel.font + UM.SettingPropertyProvider { id: propertyProvider watchedProperties: [ "value", "description" ] } - // TODO: put label here + Label // Title Label + { + id: titleLabel + anchors.top: parent.top + anchors.left: parent.left + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } TextArea { - id: gcodeArea - width: areaWidth - height: areaHeight + id: gcodeTextArea + anchors.top: titleLabel.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + hoverEnabled: true + selectByMouse: true + font: UM.Theme.getFont("fixed") + renderType: Text.NativeRendering text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" wrapMode: TextEdit.NoWrap + + background: Rectangle + { + border.color: + { + if (!gcodeTextArea.enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + if (gcodeTextArea.hovered || gcodeTextArea.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + } + onActiveFocusChanged: { if (!activeFocus) diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index f3f4de6981..a39fbba0c5 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -59,147 +59,144 @@ UM.TooltipArea watchedProperties: [ "value", "description" ] } - Row + Label { - id: itemRow - spacing: UM.Theme.getSize("default_margin").width + id: fieldLabel + anchors.left: parent.left + anchors.verticalCenter: textFieldWithUnit.verticalCenter + visible: text != "" + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + + TextField + { + id: textFieldWithUnit + anchors.left: fieldLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + width: numericTextFieldWithUnit.controlWidth + height: numericTextFieldWithUnit.controlHeight + + // Background is a rounded-cornered box with filled color as state indication (normal, warning, error, etc.) + background: Rectangle + { + anchors.fill: parent + anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) + radius: UM.Theme.getSize("setting_control_radius").width + + border.color: + { + if (!textFieldWithUnit.enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error") + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning") + } + // Validation is OK. + if (textFieldWithUnit.hovered || textFieldWithUnit.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + + color: + { + if (!textFieldWithUnit.enabled) + { + return UM.Theme.getColor("setting_control_disabled") + } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error_background") + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning_background") + case "ValidatorState.Valid": + return UM.Theme.getColor("setting_validation_ok") + default: + return UM.Theme.getColor("setting_control") + } + } + } + + hoverEnabled: true + selectByMouse: true + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + + // When the textbox gets focused by TAB, select all text + onActiveFocusChanged: + { + if (activeFocus && (focusReason == Qt.TabFocusReason || focusReason == Qt.BacktabFocusReason)) + { + selectAll() + } + } + + text: + { + const value = propertyProvider.properties.value + return value ? value : "" + } + validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } + + onEditingFinished: editingFinishedFunction() + + property var editingFinishedFunction: defaultEditingFinishedFunction + + function defaultEditingFinishedFunction() + { + if (propertyProvider && text != propertyProvider.properties.value) + { + // For some properties like the extruder-compatible material diameter, they need to + // trigger many updates, such as the available materials, the current material may + // need to be switched, etc. Although setting the diameter can be done directly via + // the provider, all the updates that need to be triggered then need to depend on + // the metadata update, a signal that can be fired way too often. The update functions + // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary + // overhead. + // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", + // and it triggers the diameter update signals only when it is needed. Here it is optionally + // choose to use setCompatibleMaterialDiameter() or other more specific functions that + // are available. + if (setValueFunction !== null) + { + setValueFunction(text) + } + else + { + propertyProvider.setPropertyValue("value", text) + } + forceUpdateOnChangeFunction() + afterOnEditingFinished() + } + } Label { - id: fieldLabel - anchors.verticalCenter: textFieldWithUnit.verticalCenter - visible: text != "" - font: UM.Theme.getFont("medium") + id: unitLabel + anchors.right: parent.right + anchors.rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) + anchors.verticalCenter: parent.verticalCenter + text: unitText + textFormat: Text.PlainText + verticalAlignment: Text.AlignVCenter renderType: Text.NativeRendering - } - - TextField - { - id: textFieldWithUnit - - width: numericTextFieldWithUnit.controlWidth - height: numericTextFieldWithUnit.controlHeight - - // Background is a rounded-cornered box with filled color as state indication (normal, warning, error, etc.) - background: Rectangle - { - anchors.fill: parent - anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) - radius: UM.Theme.getSize("setting_control_radius").width - - border.color: - { - if (!textFieldWithUnit.enabled) - { - return UM.Theme.getColor("setting_control_disabled_border") - } - switch (propertyProvider.properties.validationState) - { - case "ValidatorState.Exception": - case "ValidatorState.MinimumError": - case "ValidatorState.MaximumError": - return UM.Theme.getColor("setting_validation_error") - case "ValidatorState.MinimumWarning": - case "ValidatorState.MaximumWarning": - return UM.Theme.getColor("setting_validation_warning") - } - // Validation is OK. - if (textFieldWithUnit.hovered || textFieldWithUnit.activeFocus) - { - return UM.Theme.getColor("setting_control_border_highlight") - } - return UM.Theme.getColor("setting_control_border") - } - - color: - { - if (!textFieldWithUnit.enabled) - { - return UM.Theme.getColor("setting_control_disabled") - } - switch (propertyProvider.properties.validationState) - { - case "ValidatorState.Exception": - case "ValidatorState.MinimumError": - case "ValidatorState.MaximumError": - return UM.Theme.getColor("setting_validation_error_background") - case "ValidatorState.MinimumWarning": - case "ValidatorState.MaximumWarning": - return UM.Theme.getColor("setting_validation_warning_background") - case "ValidatorState.Valid": - return UM.Theme.getColor("setting_validation_ok") - default: - return UM.Theme.getColor("setting_control") - } - } - } - - hoverEnabled: true - selectByMouse: true + color: UM.Theme.getColor("setting_unit") font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - - // When the textbox gets focused by TAB, select all text - onActiveFocusChanged: - { - if (activeFocus && (focusReason == Qt.TabFocusReason || focusReason == Qt.BacktabFocusReason)) - { - selectAll() - } - } - - text: - { - const value = propertyProvider.properties.value - return value ? value : "" - } - validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } - - onEditingFinished: editingFinishedFunction() - - property var editingFinishedFunction: defaultEditingFinishedFunction - - function defaultEditingFinishedFunction() - { - if (propertyProvider && text != propertyProvider.properties.value) - { - // For some properties like the extruder-compatible material diameter, they need to - // trigger many updates, such as the available materials, the current material may - // need to be switched, etc. Although setting the diameter can be done directly via - // the provider, all the updates that need to be triggered then need to depend on - // the metadata update, a signal that can be fired way too often. The update functions - // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary - // overhead. - // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", - // and it triggers the diameter update signals only when it is needed. Here it is optionally - // choose to use setCompatibleMaterialDiameter() or other more specific functions that - // are available. - if (setValueFunction !== null) - { - setValueFunction(text) - } - else - { - propertyProvider.setPropertyValue("value", text) - } - forceUpdateOnChangeFunction() - afterOnEditingFinished() - } - } - - Label - { - id: unitLabel - anchors.right: parent.right - anchors.rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) - anchors.verticalCenter: parent.verticalCenter - text: unitText - textFormat: Text.PlainText - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - color: UM.Theme.getColor("setting_unit") - font: UM.Theme.getFont("default") - } } } } diff --git a/resources/qml/MachineSettings/SimpleCheckBox.qml b/resources/qml/MachineSettings/SimpleCheckBox.qml index 2147be9859..8aa65eff95 100644 --- a/resources/qml/MachineSettings/SimpleCheckBox.qml +++ b/resources/qml/MachineSettings/SimpleCheckBox.qml @@ -30,8 +30,9 @@ UM.TooltipArea property alias settingKey: propertyProvider.key property alias settingStoreIndex: propertyProvider.storeIndex - property alias labelText: checkBox.text - property alias labelFont: checkBox.font + property alias labelText: fieldLabel.text + property alias labelFont: fieldLabel.font + property alias labelWidth: fieldLabel.width property string tooltip: propertyProvider.properties.description @@ -47,12 +48,24 @@ UM.TooltipArea watchedProperties: [ "value", "description" ] } + Label + { + id: fieldLabel + anchors.left: parent.left + anchors.verticalCenter: checkBox.verticalCenter + visible: text != "" + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + CuraCheckBox { id: checkBox + anchors.left: fieldLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width checked: String(propertyProvider.properties.value).toLowerCase() != 'false' height: simpleCheckBox.controlHeight - font: UM.Theme.getFont("medium") + text: "" onClicked: { propertyProvider.setPropertyValue("value", checked) diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index 6db019785e..e0a2212998 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -14,7 +14,7 @@ import "../MachineSettings" // This component contains the content for the "Welcome" page of the welcome on-boarding process. // -Row +Item { id: base UM.I18nCatalog { id: catalog; name: "cura" } @@ -22,193 +22,307 @@ Row anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - anchors.margins: UM.Theme.getSize("default_margin").width - property int labelWidth: 110 + property int labelWidth: 130 + property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 property var labelFont: UM.Theme.getFont("medium") - spacing: 10 + property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 + property int columnSpacing: 10 + property int propertyStoreIndex: 5 // definition_changes - // ======================================= - // Left-side column for "Printer Settings" - // ======================================= - Column + Item { - spacing: 10 + id: upperBlock + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width - Label // Title Label + height: childrenRect.height + + // ======================================= + // Left-side column for "Printer Settings" + // ======================================= + Column { - text: catalog.i18nc("@title:label", "Printer Settings") - font: UM.Theme.getFont("medium_bold") + anchors.top: parent.top + anchors.left: parent.left + width: base.columnWidth + + spacing: base.columnSpacing + + Label // Title Label + { + text: catalog.i18nc("@title:label", "Printer Settings") + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } + + NumericTextFieldWithUnit // "X (Width)" + { + id: machineXWidthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_width" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "X (Width)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Y (Depth)" + { + id: machineYDepthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_depth" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Y (Depth)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Z (Height)" + { + id: machineZHeightField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_height" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Z (Height)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "Build plate shape" + { + id: buildPlateShapeComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_shape" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Build plate shape") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Origin at center" + { + id: originAtCenterCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_center_is_zero" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Origin at center") + labelFont: base.labelFont + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Heated bed" + { + id: heatedBedCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_heated_bed" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Heated bed") + labelFont: base.labelFont + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "G-code flavor" + { + id: gcodeFlavorComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_gcode_flavor" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "G-code flavor") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + } } - NumericTextFieldWithUnit // "X (Width)" + // ======================================= + // Right-side column for "Printhead Settings" + // ======================================= + Column { - id: machineXWidthField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_width" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "X (Width)") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } + anchors.top: parent.top + anchors.right: parent.right + width: base.columnWidth - NumericTextFieldWithUnit // "Y (Depth)" - { - id: machineYDepthField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_depth" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "Y (Depth)") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } + spacing: base.columnSpacing - NumericTextFieldWithUnit // "Z (Height)" - { - id: machineZHeightField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_height" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "Z (Height)") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } + Label // Title Label + { + text: catalog.i18nc("@title:label", "Printhead Settings") + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } - ComboBoxWithOptions // "Build plate shape" - { - id: buildPlateShapeComboBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_shape" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "Build plate shape") - labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: - } + PrintHeadMinMaxTextField // "X min" + { + id: machineXMinField - SimpleCheckBox // "Origin at center" - { - id: originAtCenterCheckBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_center_is_zero" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "Origin at center") - labelFont: base.labelFont - // TODO: add forceUpdateOnChangeFunction: - } + settingStoreIndex: propertyStoreIndex - SimpleCheckBox // "Heated bed" - { - id: heatedBedCheckBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_heated_bed" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "Heated bed") - labelFont: base.labelFont - // TODO: add forceUpdateOnChangeFunction: - } + labelText: catalog.i18nc("@label", "X min") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") - ComboBoxWithOptions // "G-code flavor" - { - id: gcodeFlavorComboBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_gcode_flavor" - settingStoreIndex: 1 // TODO - labelText: catalog.i18nc("@label", "G-code flavor") - labelFont: base.labelFont - labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: - // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + axisName: "x" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y min" + { + id: machineYMinField + + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "Y min") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "X max" + { + id: machineXMaxField + + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "X max") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "x" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y max" + { + id: machineYMaxField + + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_head_with_fans_polygon" + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "Y max") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Gantry Height" + { + id: machineGantryHeightField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "gantry_height" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Gantry Height") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "Number of Extruders" + { + id: numberOfExtrudersComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_extruder_count" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Number of Extruders") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + + optionModel: ListModel + { + id: extruderCountModel + Component.onCompleted: + { + extruderCountModel.clear() + for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) + { + extruderCountModel.append({text: String(i), value: i}) + } + } + } + } } } - // ======================================= - // Right-side column for "Printhead Settings" - // ======================================= - Column + Item // Start and End G-code { - spacing: 10 + id: lowerBlock + anchors.top: upperBlock.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width - Label // Title Label + GcodeTextArea // "Start G-code" { - text: catalog.i18nc("@title:label", "Printhead Settings") - font: UM.Theme.getFont("medium_bold") - } - - PrintHeadMinMaxTextField // "X min" - { - id: machineXMinField - - settingStoreIndex: 1 // TODO - - labelText: catalog.i18nc("@label", "X min") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "x" - axisMinOrMax: "min" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "Y min" - { - id: machineYMinField - - settingStoreIndex: 1 // TODO - - labelText: catalog.i18nc("@label", "Y min") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "y" - axisMinOrMax: "min" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "X max" - { - id: machineXMaxField - - settingStoreIndex: 1 // TODO - - labelText: catalog.i18nc("@label", "X max") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "x" - axisMinOrMax: "max" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "Y max" - { - id: machineYMaxField + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.left: parent.left + width: base.columnWidth - UM.Theme.getSize("default_margin").width + labelText: catalog.i18nc("@title:label", "Start G-code") containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_head_with_fans_polygon" - settingStoreIndex: 1 // TODO + settingKey: "machine_start_gcode" + settingStoreIndex: propertyStoreIndex + } - labelText: catalog.i18nc("@label", "Y max") - labelFont: base.labelFont - labelWidth: base.labelWidth - unitText: catalog.i18nc("@label", "mm") + GcodeTextArea // "End G-code" + { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + width: base.columnWidth - UM.Theme.getSize("default_margin").width - axisName: "y" - axisMinOrMax: "max" - - // TODO: add forceUpdateOnChangeFunction: + labelText: catalog.i18nc("@title:label", "End G-code") + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_end_gcode" + settingStoreIndex: propertyStoreIndex } } } From f75f8f980989fc82d4e5923c439ea3d6f8b4df1b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 15:05:19 +0100 Subject: [PATCH 053/211] WIP: Move MachineSettings Printer Tab to a separate file --- .../MachineSettingsPrinterTab.qml | 327 ++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 resources/qml/WelcomePages/MachineSettingsPrinterTab.qml diff --git a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml new file mode 100644 index 0000000000..d6f6d1f9ae --- /dev/null +++ b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml @@ -0,0 +1,327 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../MachineSettings" + + +// +// This the content in the "Printer" tab in the Machine Settings dialog. +// +Item +{ + id: base + UM.I18nCatalog { id: catalog; name: "cura" } + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + property int labelWidth: 130 + property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 + property var labelFont: UM.Theme.getFont("medium") + + property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 + property int columnSpacing: 10 + property int propertyStoreIndex: 5 // definition_changes + + Item + { + id: upperBlock + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width + + height: childrenRect.height + + // ======================================= + // Left-side column for "Printer Settings" + // ======================================= + Column + { + anchors.top: parent.top + anchors.left: parent.left + width: base.columnWidth + + spacing: base.columnSpacing + + Label // Title Label + { + text: catalog.i18nc("@title:label", "Printer Settings") + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } + + NumericTextFieldWithUnit // "X (Width)" + { + id: machineXWidthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_width" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "X (Width)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Y (Depth)" + { + id: machineYDepthField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_depth" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Y (Depth)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Z (Height)" + { + id: machineZHeightField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_height" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Z (Height)") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "Build plate shape" + { + id: buildPlateShapeComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_shape" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Build plate shape") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Origin at center" + { + id: originAtCenterCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_center_is_zero" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Origin at center") + labelFont: base.labelFont + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + } + + SimpleCheckBox // "Heated bed" + { + id: heatedBedCheckBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_heated_bed" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Heated bed") + labelFont: base.labelFont + labelWidth: base.labelWidth + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "G-code flavor" + { + id: gcodeFlavorComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_gcode_flavor" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "G-code flavor") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + } + } + + // ======================================= + // Right-side column for "Printhead Settings" + // ======================================= + Column + { + anchors.top: parent.top + anchors.right: parent.right + width: base.columnWidth + + spacing: base.columnSpacing + + Label // Title Label + { + text: catalog.i18nc("@title:label", "Printhead Settings") + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } + + PrintHeadMinMaxTextField // "X min" + { + id: machineXMinField + + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "X min") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "x" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y min" + { + id: machineYMinField + + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "Y min") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "min" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "X max" + { + id: machineXMaxField + + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "X max") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "x" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } + + PrintHeadMinMaxTextField // "Y max" + { + id: machineYMaxField + + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_head_with_fans_polygon" + settingStoreIndex: propertyStoreIndex + + labelText: catalog.i18nc("@label", "Y max") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + + axisName: "y" + axisMinOrMax: "max" + + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Gantry Height" + { + id: machineGantryHeightField + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "gantry_height" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Gantry Height") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + ComboBoxWithOptions // "Number of Extruders" + { + id: numberOfExtrudersComboBox + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_extruder_count" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Number of Extruders") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + // TODO: add forceUpdateOnChangeFunction: + // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + + optionModel: ListModel + { + id: extruderCountModel + Component.onCompleted: + { + extruderCountModel.clear() + for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) + { + extruderCountModel.append({text: String(i), value: i}) + } + } + } + } + } + } + + Item // Start and End G-code + { + id: lowerBlock + anchors.top: upperBlock.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width + + GcodeTextArea // "Start G-code" + { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.left: parent.left + width: base.columnWidth - UM.Theme.getSize("default_margin").width + + labelText: catalog.i18nc("@title:label", "Start G-code") + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_start_gcode" + settingStoreIndex: propertyStoreIndex + } + + GcodeTextArea // "End G-code" + { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + width: base.columnWidth - UM.Theme.getSize("default_margin").width + + labelText: catalog.i18nc("@title:label", "End G-code") + containerStackId: Cura.MachineManager.activeMachineId + settingKey: "machine_end_gcode" + settingStoreIndex: propertyStoreIndex + } + } +} From 42a304c049de907ba447977976e470b3cb4b64b7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 15:07:14 +0100 Subject: [PATCH 054/211] WIP: Create MachineSettings Extruder Tab --- .../MachineSettingsExtruderTab.qml | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 resources/qml/WelcomePages/MachineSettingsExtruderTab.qml diff --git a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml new file mode 100644 index 0000000000..cd3f1b1d9d --- /dev/null +++ b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml @@ -0,0 +1,174 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../MachineSettings" + + +// +// This component contains the content for the "Welcome" page of the welcome on-boarding process. +// + +Item +{ + id: base + UM.I18nCatalog { id: catalog; name: "cura" } + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + property string extruderStackId: "" + + property int labelWidth: 180 + property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 + property var labelFont: UM.Theme.getFont("medium") + + property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 + property int columnSpacing: 10 + property int propertyStoreIndex: 5 // definition_changes + + Item + { + id: upperBlock + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width + + height: childrenRect.height + + // ======================================= + // Left-side column "Nozzle Settings" + // ======================================= + Column + { + anchors.top: parent.top + anchors.left: parent.left + width: parent.width * 2 / 3 + + spacing: base.columnSpacing + + Label // Title Label + { + text: catalog.i18nc("@title:label", "Nozzle Settings") + font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering + } + + NumericTextFieldWithUnit // "Nozzle size" + { + id: extruderNozzleSizeField + visible: !Cura.MachineManager.hasVariants + containerStackId: base.extruderStackId + settingKey: "machine_nozzle_size" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Nozzle size") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Compatible material diameter" + { + id: extruderCompatibleMaterialDiameterField + containerStackId: base.extruderStackId + settingKey: "material_diameter" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Compatible material diameter") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Nozzle offset X" + { + id: extruderNozzleOffsetXField + containerStackId: base.extruderStackId + settingKey: "machine_nozzle_offset_x" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Nozzle offset X") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Nozzle offset Y" + { + id: extruderNozzleOffsetYField + containerStackId: base.extruderStackId + settingKey: "machine_nozzle_offset_y" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Nozzle offset Y") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: catalog.i18nc("@label", "mm") + // TODO: add forceUpdateOnChangeFunction: + } + + NumericTextFieldWithUnit // "Cooling Fan Number" + { + id: extruderNozzleCoolingFanNumberField + containerStackId: base.extruderStackId + settingKey: "machine_extruder_cooling_fan_number" + settingStoreIndex: propertyStoreIndex + labelText: catalog.i18nc("@label", "Cooling Fan Number") + labelFont: base.labelFont + labelWidth: base.labelWidth + controlWidth: base.controlWidth + unitText: "" + // TODO: add forceUpdateOnChangeFunction: + } + } + } + + Item // Extruder Start and End G-code + { + id: lowerBlock + anchors.top: upperBlock.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width + + GcodeTextArea // "Extruder Start G-code" + { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.left: parent.left + width: base.columnWidth - UM.Theme.getSize("default_margin").width + + labelText: catalog.i18nc("@title:label", "Extruder Start G-code") + containerStackId: base.extruderStackId + settingKey: "machine_extruder_start_code" + settingStoreIndex: propertyStoreIndex + } + + GcodeTextArea // "Extruder End G-code" + { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + width: base.columnWidth - UM.Theme.getSize("default_margin").width + + labelText: catalog.i18nc("@title:label", "Extruder End G-code") + containerStackId: base.extruderStackId + settingKey: "machine_extruder_end_code" + settingStoreIndex: propertyStoreIndex + } + } +} From 8242a3801c949ad84555956eb95eee77e237b7ea Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 18 Mar 2019 15:56:13 +0100 Subject: [PATCH 055/211] WIP: Put all MachineSettings stuff together --- .../MachineSettingsExtruderTab.qml | 2 +- .../MachineSettingsPrinterTab.qml | 2 +- resources/qml/WelcomePages/TestContent.qml | 323 +++--------------- resources/qml/Widgets/CuraTabButton.qml | 29 ++ 4 files changed, 74 insertions(+), 282 deletions(-) create mode 100644 resources/qml/Widgets/CuraTabButton.qml diff --git a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml index cd3f1b1d9d..440c4b2bab 100644 --- a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml +++ b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml @@ -30,7 +30,7 @@ Item property var labelFont: UM.Theme.getFont("medium") property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 - property int columnSpacing: 10 + property int columnSpacing: 3 property int propertyStoreIndex: 5 // definition_changes Item diff --git a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml index d6f6d1f9ae..b22f4a411b 100644 --- a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml +++ b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml @@ -27,7 +27,7 @@ Item property var labelFont: UM.Theme.getFont("medium") property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 - property int columnSpacing: 10 + property int columnSpacing: 3 property int propertyStoreIndex: 5 // definition_changes Item diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index e0a2212998..f9488665c0 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -3,11 +3,13 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura import "../MachineSettings" +import "../Widgets" // @@ -19,310 +21,71 @@ Item id: base UM.I18nCatalog { id: catalog; name: "cura" } - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width - property int labelWidth: 130 - property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 - property var labelFont: UM.Theme.getFont("medium") + property var extrudersModel: Cura.ExtrudersModel {} - property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 - property int columnSpacing: 10 - property int propertyStoreIndex: 5 // definition_changes - - Item + onVisibleChanged: { - id: upperBlock - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: UM.Theme.getSize("default_margin").width - - height: childrenRect.height - - // ======================================= - // Left-side column for "Printer Settings" - // ======================================= - Column + if (visible) { - anchors.top: parent.top - anchors.left: parent.left - width: base.columnWidth + tabBar.currentIndex = 0 + } + } - spacing: base.columnSpacing + Rectangle + { + anchors.fill: parent + border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent" + border.width: UM.Theme.getSize("default_lining").width + radius: UM.Theme.getSize("default_radius").width - Label // Title Label + UM.TabRow + { + id: tabBar + width: parent.width + + CuraTabButton { - text: catalog.i18nc("@title:label", "Printer Settings") - font: UM.Theme.getFont("medium_bold") - renderType: Text.NativeRendering + text: catalog.i18nc("@title:tab", "Printer") } - NumericTextFieldWithUnit // "X (Width)" + Repeater { - id: machineXWidthField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_width" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "X (Width)") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } - - NumericTextFieldWithUnit // "Y (Depth)" - { - id: machineYDepthField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_depth" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Y (Depth)") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } - - NumericTextFieldWithUnit // "Z (Height)" - { - id: machineZHeightField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_height" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Z (Height)") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } - - ComboBoxWithOptions // "Build plate shape" - { - id: buildPlateShapeComboBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_shape" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Build plate shape") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: - } - - SimpleCheckBox // "Origin at center" - { - id: originAtCenterCheckBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_center_is_zero" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Origin at center") - labelFont: base.labelFont - labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: - } - - SimpleCheckBox // "Heated bed" - { - id: heatedBedCheckBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_heated_bed" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Heated bed") - labelFont: base.labelFont - labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: - } - - ComboBoxWithOptions // "G-code flavor" - { - id: gcodeFlavorComboBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_gcode_flavor" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "G-code flavor") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: - // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + model: extrudersModel + delegate: CuraTabButton + { + text: model.name + } } } - // ======================================= - // Right-side column for "Printhead Settings" - // ======================================= - Column + StackLayout { - anchors.top: parent.top + id: tabStack + anchors.top: tabBar.bottom + anchors.left: parent.left anchors.right: parent.right - width: base.columnWidth + anchors.bottom: parent.bottom - spacing: base.columnSpacing + width: parent.width + currentIndex: tabBar.currentIndex - Label // Title Label + MachineSettingsPrinterTab { - text: catalog.i18nc("@title:label", "Printhead Settings") - font: UM.Theme.getFont("medium_bold") - renderType: Text.NativeRendering + id: printerTab } - PrintHeadMinMaxTextField // "X min" + Repeater { - id: machineXMinField - - settingStoreIndex: propertyStoreIndex - - labelText: catalog.i18nc("@label", "X min") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "x" - axisMinOrMax: "min" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "Y min" - { - id: machineYMinField - - settingStoreIndex: propertyStoreIndex - - labelText: catalog.i18nc("@label", "Y min") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "y" - axisMinOrMax: "min" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "X max" - { - id: machineXMaxField - - settingStoreIndex: propertyStoreIndex - - labelText: catalog.i18nc("@label", "X max") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "x" - axisMinOrMax: "max" - - // TODO: add forceUpdateOnChangeFunction: - } - - PrintHeadMinMaxTextField // "Y max" - { - id: machineYMaxField - - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_head_with_fans_polygon" - settingStoreIndex: propertyStoreIndex - - labelText: catalog.i18nc("@label", "Y max") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - - axisName: "y" - axisMinOrMax: "max" - - // TODO: add forceUpdateOnChangeFunction: - } - - NumericTextFieldWithUnit // "Gantry Height" - { - id: machineGantryHeightField - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "gantry_height" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Gantry Height") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: - } - - ComboBoxWithOptions // "Number of Extruders" - { - id: numberOfExtrudersComboBox - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_extruder_count" - settingStoreIndex: propertyStoreIndex - labelText: catalog.i18nc("@label", "Number of Extruders") - labelFont: base.labelFont - labelWidth: base.labelWidth - controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: - // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata - - optionModel: ListModel + model: extrudersModel + delegate: MachineSettingsExtruderTab { - id: extruderCountModel - Component.onCompleted: - { - extruderCountModel.clear() - for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) - { - extruderCountModel.append({text: String(i), value: i}) - } - } + id: discoverTab + extruderStackId: model.id } } } } - - Item // Start and End G-code - { - id: lowerBlock - anchors.top: upperBlock.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: UM.Theme.getSize("default_margin").width - - GcodeTextArea // "Start G-code" - { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - width: base.columnWidth - UM.Theme.getSize("default_margin").width - - labelText: catalog.i18nc("@title:label", "Start G-code") - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_start_gcode" - settingStoreIndex: propertyStoreIndex - } - - GcodeTextArea // "End G-code" - { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - anchors.right: parent.right - width: base.columnWidth - UM.Theme.getSize("default_margin").width - - labelText: catalog.i18nc("@title:label", "End G-code") - containerStackId: Cura.MachineManager.activeMachineId - settingKey: "machine_end_gcode" - settingStoreIndex: propertyStoreIndex - } - } } diff --git a/resources/qml/Widgets/CuraTabButton.qml b/resources/qml/Widgets/CuraTabButton.qml new file mode 100644 index 0000000000..40411ce0b8 --- /dev/null +++ b/resources/qml/Widgets/CuraTabButton.qml @@ -0,0 +1,29 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This is the default Cura Tab button which is a plaintext label. +// +UM.TabRowButton +{ + id: tabButton + text: model.name + + contentItem: Label + { + anchors.centerIn: tabButton + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: tabButton.text + font: tabButton.checked ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } +} From 987ebba33bc861b43e9b8276979adae70d176ba8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 08:28:45 +0100 Subject: [PATCH 056/211] WIP: Make MachineSetting panel work --- cura/CuraApplication.py | 8 ++- cura/UI/MachineSettingsManager.py | 66 +++++++++++++++++++ .../MachineSettings/ComboBoxWithOptions.qml | 21 ++++-- .../NumericTextFieldWithUnit.qml | 2 +- .../MachineSettingsExtruderTab.qml | 23 +++++-- .../MachineSettingsPrinterTab.qml | 64 ++++++++++-------- resources/qml/WelcomePages/TestContent.qml | 34 +++++++--- resources/qml/Widgets/CuraTabButton.qml | 1 - 8 files changed, 168 insertions(+), 51 deletions(-) create mode 100644 cura/UI/MachineSettingsManager.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1192455312..4729bd6a56 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -60,6 +60,7 @@ from cura.Scene.CuraSceneNode import CuraSceneNode from cura.Scene.CuraSceneController import CuraSceneController from cura.UI.WelcomePagesModel import WelcomePagesModel +from cura.UI.MachineSettingsManager import MachineSettingsManager from UM.Settings.SettingDefinition import SettingDefinition, DefinitionPropertyType from UM.Settings.ContainerRegistry import ContainerRegistry @@ -212,8 +213,9 @@ class CuraApplication(QtApplication): self._cura_scene_controller = None self._machine_error_checker = None - self._discovered_printer_model = DiscoveredPrintersModel(self) + self._machine_settings_manager = MachineSettingsManager(self) + self._discovered_printer_model = DiscoveredPrintersModel(self) self._welcome_pages_model = WelcomePagesModel(self) self._quality_profile_drop_down_menu_model = None @@ -862,6 +864,10 @@ class CuraApplication(QtApplication): def getWelcomePagesModel(self, *args) -> "WelcomePagesModel": return self._welcome_pages_model + @pyqtSlot(result = QObject) + def getMachineSettingsManager(self, *args) -> "MachineSettingsManager": + return self._machine_settings_manager + def getCuraFormulaFunctions(self, *args) -> "CuraFormulaFunctions": if self._cura_formula_functions is None: self._cura_formula_functions = CuraFormulaFunctions(self) diff --git a/cura/UI/MachineSettingsManager.py b/cura/UI/MachineSettingsManager.py new file mode 100644 index 0000000000..3232323bcb --- /dev/null +++ b/cura/UI/MachineSettingsManager.py @@ -0,0 +1,66 @@ + +from typing import Any, Dict, Optional, TYPE_CHECKING + +from PyQt5.QtCore import Qt, QObject, pyqtSlot + +from UM.i18n import i18nCatalog + + +class MachineSettingsManager(QObject): + + def __init__(self, parent: Optional["QObject"] = None) -> None: + super().__init__(parent) + self._i18n_catalog = i18nCatalog("cura") + + from cura.CuraApplication import CuraApplication + self._application = CuraApplication.getInstance() + + # Force rebuilding the build volume by reloading the global container stack. This is a bit of a hack, but it seems + # quite enough. + @pyqtSlot() + def forceUpdate(self) -> None: + self._application.getMachineManager().globalContainerChanged.emit() + + # Function for the Machine Settings panel (QML) to update the compatible material diameter after a user has changed + # an extruder's compatible material diameter. This ensures that after the modification, changes can be notified + # and updated right away. + @pyqtSlot(int) + def updateMaterialForDiameter(self, extruder_position: int): + # Updates the material container to a material that matches the material diameter set for the printer + self._application.getMachineManager().updateMaterialWithVariant(str(extruder_position)) + + # FIXME(Lipu): Better document what this function does, especially the fuzzy gcode flavor and has_materials logic + # regarding UM2 and UM2+ + # Function for the Machine Settings panel (QML) to update after the usre changes "Number of Extruders". + @pyqtSlot() + def updateHasMaterialsMetadata(self): + machine_manager = self._application.getMachineManager() + material_manager = self._application.getMaterialManager() + + global_stack = material_manager.activeMachine + + definition = global_stack.definition + if definition.getProperty("machine_gcode_flavor", "value") != "UltiGCode" or definition.getMetaDataEntry( + "has_materials", False): + # In other words: only continue for the UM2 (extended), but not for the UM2+ + return + + extruder_positions = list(global_stack.extruders.keys()) + has_materials = global_stack.getProperty("machine_gcode_flavor", "value") != "UltiGCode" + + material_node = None + if has_materials: + global_stack.setMetaDataEntry("has_materials", True) + else: + # The metadata entry is stored in an ini, and ini files are parsed as strings only. + # Because any non-empty string evaluates to a boolean True, we have to remove the entry to make it False. + if "has_materials" in global_stack.getMetaData(): + global_stack.removeMetaDataEntry("has_materials") + + # set materials + for position in extruder_positions: + if has_materials: + material_node = material_manager.getDefaultMaterial(global_stack, position, None) + machine_manager.setMaterial(position, material_node) + + self.forceUpdate() diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 1d7f9307b6..6abc2bde22 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -39,8 +39,8 @@ UM.TooltipArea property string tooltipText: propertyProvider.properties.description // callback functions - property var afterOnActivateFunction: dummy_func property var forceUpdateOnChangeFunction: dummy_func + property var afterOnEditingFinishedFunction: dummy_func // a dummy function for default property values function dummy_func() {} @@ -64,8 +64,10 @@ UM.TooltipArea ListModel { id: defaultOptionsModel - Component.onCompleted: + + function updateModel() { + clear() // Options come in as a string-representation of an OrderedDict var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/) if (options) @@ -74,10 +76,19 @@ UM.TooltipArea for (var i = 0; i < options.length; i++) { var option = options[i].substring(1, options[i].length - 1).split("', '") - defaultOptionsModel.append({text: option[1], value: option[0]}) + append({text: option[1], value: option[0]}) } } } + + Component.onCompleted: updateModel() + } + + // Remake the model when the model is bound to a different container stack + Connections + { + target: propertyProvider + onContainerStackChanged: defaultOptionsModel.updateModel() } CuraComboBox @@ -107,11 +118,11 @@ UM.TooltipArea onActivated: { - if(propertyProvider.properties.value != model.get(index).value) + if (propertyProvider.properties.value != model.get(index).value) { propertyProvider.setPropertyValue("value", model.get(index).value) forceUpdateOnChangeFunction() - afterOnActivateFunction() + afterOnEditingFinishedFunction() } } } diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index a39fbba0c5..c6872617bc 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -181,7 +181,7 @@ UM.TooltipArea propertyProvider.setPropertyValue("value", text) } forceUpdateOnChangeFunction() - afterOnEditingFinished() + afterOnEditingFinishedFunction() } } diff --git a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml index 440c4b2bab..3ed82a6dde 100644 --- a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml +++ b/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml @@ -23,8 +23,6 @@ Item anchors.right: parent.right anchors.top: parent.top - property string extruderStackId: "" - property int labelWidth: 180 property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 property var labelFont: UM.Theme.getFont("medium") @@ -33,6 +31,15 @@ Item property int columnSpacing: 3 property int propertyStoreIndex: 5 // definition_changes + property string extruderStackId: "" + property int extruderPosition: 0 + property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate + + function updateMaterialDiameter() + { + CuraApplication.getMachineSettingsManager().updateMaterialForDiameter(extruderPosition) + } + Item { id: upperBlock @@ -73,7 +80,7 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Compatible material diameter" @@ -87,7 +94,9 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction + // Other modules won't automatically respond after the user changes the value, so we need to force it. + afterOnEditingFinishedFunction: updateMaterialDiameter } NumericTextFieldWithUnit // "Nozzle offset X" @@ -101,7 +110,7 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Nozzle offset Y" @@ -115,7 +124,7 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Cooling Fan Number" @@ -129,7 +138,7 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: "" - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } } } diff --git a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml index b22f4a411b..6971ab74db 100644 --- a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml +++ b/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml @@ -30,6 +30,10 @@ Item property int columnSpacing: 3 property int propertyStoreIndex: 5 // definition_changes + property string machineStackId: Cura.MachineManager.activeMachineId + + property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate + Item { id: upperBlock @@ -61,7 +65,7 @@ Item NumericTextFieldWithUnit // "X (Width)" { id: machineXWidthField - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_width" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "X (Width)") @@ -69,13 +73,13 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Y (Depth)" { id: machineYDepthField - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_depth" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Y (Depth)") @@ -83,13 +87,13 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Z (Height)" { id: machineZHeightField - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_height" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Z (Height)") @@ -97,58 +101,61 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } ComboBoxWithOptions // "Build plate shape" { id: buildPlateShapeComboBox - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_shape" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Build plate shape") labelFont: base.labelFont labelWidth: base.labelWidth controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } SimpleCheckBox // "Origin at center" { id: originAtCenterCheckBox - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_center_is_zero" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Origin at center") labelFont: base.labelFont labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } SimpleCheckBox // "Heated bed" { id: heatedBedCheckBox - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_heated_bed" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Heated bed") labelFont: base.labelFont labelWidth: base.labelWidth - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } ComboBoxWithOptions // "G-code flavor" { id: gcodeFlavorComboBox - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_gcode_flavor" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "G-code flavor") labelFont: base.labelFont labelWidth: base.labelWidth controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: - // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + forceUpdateOnChangeFunction: forceUpdateFunction + // FIXME(Lipu): better document this. + // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings. + // I don't remember exactly what. + afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata } } @@ -185,7 +192,7 @@ Item axisName: "x" axisMinOrMax: "min" - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } PrintHeadMinMaxTextField // "Y min" @@ -203,7 +210,7 @@ Item axisName: "y" axisMinOrMax: "min" - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } PrintHeadMinMaxTextField // "X max" @@ -221,14 +228,14 @@ Item axisName: "x" axisMinOrMax: "max" - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } PrintHeadMinMaxTextField // "Y max" { id: machineYMaxField - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_head_with_fans_polygon" settingStoreIndex: propertyStoreIndex @@ -241,13 +248,13 @@ Item axisName: "y" axisMinOrMax: "max" - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } NumericTextFieldWithUnit // "Gantry Height" { id: machineGantryHeightField - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "gantry_height" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Gantry Height") @@ -255,21 +262,24 @@ Item labelWidth: base.labelWidth controlWidth: base.controlWidth unitText: catalog.i18nc("@label", "mm") - // TODO: add forceUpdateOnChangeFunction: + forceUpdateOnChangeFunction: forceUpdateFunction } ComboBoxWithOptions // "Number of Extruders" { id: numberOfExtrudersComboBox - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_extruder_count" settingStoreIndex: propertyStoreIndex labelText: catalog.i18nc("@label", "Number of Extruders") labelFont: base.labelFont labelWidth: base.labelWidth controlWidth: base.controlWidth - // TODO: add forceUpdateOnChangeFunction: - // TODO: add afterOnActivate: manager.updateHasMaterialsMetadata + forceUpdateOnChangeFunction: forceUpdateFunction + // FIXME(Lipu): better document this. + // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings. + // I don't remember exactly what. + afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata optionModel: ListModel { @@ -305,7 +315,7 @@ Item width: base.columnWidth - UM.Theme.getSize("default_margin").width labelText: catalog.i18nc("@title:label", "Start G-code") - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_start_gcode" settingStoreIndex: propertyStoreIndex } @@ -319,7 +329,7 @@ Item width: base.columnWidth - UM.Theme.getSize("default_margin").width labelText: catalog.i18nc("@title:label", "End G-code") - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: machineStackId settingKey: "machine_end_gcode" settingStoreIndex: propertyStoreIndex } diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml index f9488665c0..6071f965b2 100644 --- a/resources/qml/WelcomePages/TestContent.qml +++ b/resources/qml/WelcomePages/TestContent.qml @@ -26,11 +26,31 @@ Item property var extrudersModel: Cura.ExtrudersModel {} - onVisibleChanged: + // If we create a CuraTabButton for "Printer" and use Repeater for extruders, for some reason, once the component + // finishes it will automatically change "currentIndex = 1", and it is VERY difficult to change "currentIndex = 0" + // after that. Using a model and a Repeater to create both "Printer" and extruder CuraTabButtons seem to solve this + // problem. + Connections { - if (visible) + target: extrudersModel + onItemsChanged: tabNameModel.update() + } + + ListModel + { + id: tabNameModel + + Component.onCompleted: update() + + function update() { - tabBar.currentIndex = 0 + clear() + append({ name: catalog.i18nc("@title:tab", "Printer") }) + for (var i = 0; i < extrudersModel.count; i++) + { + const m = extrudersModel.getItem(i) + append({ name: m.name }) + } } } @@ -46,14 +66,9 @@ Item id: tabBar width: parent.width - CuraTabButton - { - text: catalog.i18nc("@title:tab", "Printer") - } - Repeater { - model: extrudersModel + model: tabNameModel delegate: CuraTabButton { text: model.name @@ -83,6 +98,7 @@ Item delegate: MachineSettingsExtruderTab { id: discoverTab + extruderPosition: model.index extruderStackId: model.id } } diff --git a/resources/qml/Widgets/CuraTabButton.qml b/resources/qml/Widgets/CuraTabButton.qml index 40411ce0b8..86d1180abf 100644 --- a/resources/qml/Widgets/CuraTabButton.qml +++ b/resources/qml/Widgets/CuraTabButton.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura From 58062cb4de628d2416448471d9611974e15a43df Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 11:06:42 +0100 Subject: [PATCH 057/211] WIP: Remove unused MachineManagementModel --- cura/CuraApplication.py | 2 - .../Machines/Models/MachineManagementModel.py | 82 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 cura/Machines/Models/MachineManagementModel.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4729bd6a56..6d22320882 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -78,7 +78,6 @@ from cura.Machines.Models.GenericMaterialsModel import GenericMaterialsModel from cura.Machines.Models.MaterialBrandsModel import MaterialBrandsModel from cura.Machines.Models.QualityManagementModel import QualityManagementModel from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel -from cura.Machines.Models.MachineManagementModel import MachineManagementModel from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel @@ -1015,7 +1014,6 @@ class CuraApplication(QtApplication): qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel") qmlRegisterType(MaterialBrandsModel, "Cura", 1, 0, "MaterialBrandsModel") qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel") - qmlRegisterType(MachineManagementModel, "Cura", 1, 0, "MachineManagementModel") qmlRegisterType(DiscoveredPrintersModel, "Cura", 1, 0, "DiscoveredPrintersModel") diff --git a/cura/Machines/Models/MachineManagementModel.py b/cura/Machines/Models/MachineManagementModel.py deleted file mode 100644 index 3297b8a467..0000000000 --- a/cura/Machines/Models/MachineManagementModel.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2018 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -from UM.Qt.ListModel import ListModel - -from PyQt5.QtCore import Qt - -from UM.Settings.ContainerRegistry import ContainerRegistry -from UM.Settings.ContainerStack import ContainerStack - -from UM.i18n import i18nCatalog -catalog = i18nCatalog("cura") - - -# -# This the QML model for the quality management page. -# -class MachineManagementModel(ListModel): - NameRole = Qt.UserRole + 1 - IdRole = Qt.UserRole + 2 - MetaDataRole = Qt.UserRole + 3 - GroupRole = Qt.UserRole + 4 - - def __init__(self, parent = None): - super().__init__(parent) - self.addRoleName(self.NameRole, "name") - self.addRoleName(self.IdRole, "id") - self.addRoleName(self.MetaDataRole, "metadata") - self.addRoleName(self.GroupRole, "group") - self._local_container_stacks = [] - self._network_container_stacks = [] - - # Listen to changes - ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged) - ContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged) - ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged) - self._filter_dict = {} - self._update() - - ## Handler for container added/removed events from registry - def _onContainerChanged(self, container): - # We only need to update when the added / removed container is a stack. - if isinstance(container, ContainerStack) and container.getMetaDataEntry("type") == "machine": - self._update() - - ## Private convenience function to reset & repopulate the model. - def _update(self): - items = [] - - # Get first the network enabled printers - network_filter_printers = {"type": "machine", - "um_network_key": "*", - "hidden": "False"} - self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers) - self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("group_name", "")) - - for container in self._network_container_stacks: - metadata = container.getMetaData().copy() - if container.getBottom(): - metadata["definition_name"] = container.getBottom().getName() - - items.append({"name": metadata.get("group_name", ""), - "id": container.getId(), - "metadata": metadata, - "group": catalog.i18nc("@info:title", "Network enabled printers")}) - - # Get now the local printers - local_filter_printers = {"type": "machine", "um_network_key": None} - self._local_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**local_filter_printers) - self._local_container_stacks.sort(key = lambda i: i.getName()) - - for container in self._local_container_stacks: - metadata = container.getMetaData().copy() - if container.getBottom(): - metadata["definition_name"] = container.getBottom().getName() - - items.append({"name": container.getName(), - "id": container.getId(), - "metadata": metadata, - "group": catalog.i18nc("@info:title", "Local printers")}) - - self.setItems(items) From d4c0104bc2d2f5cc98fd17c524868d3715b00185 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 12:07:26 +0100 Subject: [PATCH 058/211] WIP: Add FirstStartMachineActionsModel --- cura/CuraApplication.py | 9 ++++ cura/MachineActionManager.py | 2 +- .../Models/FirstStartMachineActionsModel.py | 52 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 cura/Machines/Models/FirstStartMachineActionsModel.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6d22320882..01b0e457ae 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -78,6 +78,7 @@ from cura.Machines.Models.GenericMaterialsModel import GenericMaterialsModel from cura.Machines.Models.MaterialBrandsModel import MaterialBrandsModel from cura.Machines.Models.QualityManagementModel import QualityManagementModel from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel +from cura.Machines.Models.FirstStartMachineActionsModel import FirstStartMachineActionsModel from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel @@ -215,6 +216,7 @@ class CuraApplication(QtApplication): self._machine_settings_manager = MachineSettingsManager(self) self._discovered_printer_model = DiscoveredPrintersModel(self) + self._first_start_machine_actions_model = FirstStartMachineActionsModel(self) self._welcome_pages_model = WelcomePagesModel(self) self._quality_profile_drop_down_menu_model = None @@ -751,6 +753,8 @@ class CuraApplication(QtApplication): # Initialize setting visibility presets model. self._setting_visibility_presets_model = SettingVisibilityPresetsModel(self.getPreferences(), parent = self) + self._first_start_machine_actions_model.initialize() + # Initialize Cura API self._cura_API.initialize() @@ -855,6 +859,10 @@ class CuraApplication(QtApplication): def getDiscoveredPrintersModel(self, *args) -> "DiscoveredPrintersModel": return self._discovered_printer_model + @pyqtSlot(result = QObject) + def getFirstStartMachineActionsModel(self, *args) -> "FirstStartMachineActionsModel": + return self._first_start_machine_actions_model + @pyqtSlot(result = QObject) def getSettingVisibilityPresetsModel(self, *args) -> SettingVisibilityPresetsModel: return self._setting_visibility_presets_model @@ -1026,6 +1034,7 @@ class CuraApplication(QtApplication): qmlRegisterType(MaterialSettingsVisibilityHandler, "Cura", 1, 0, "MaterialSettingsVisibilityHandler") qmlRegisterType(SettingVisibilityPresetsModel, "Cura", 1, 0, "SettingVisibilityPresetsModel") qmlRegisterType(QualitySettingsModel, "Cura", 1, 0, "QualitySettingsModel") + qmlRegisterType(FirstStartMachineActionsModel, "Cura", 1, 0, "FirstStartMachineActionsModel") qmlRegisterType(MachineNameValidator, "Cura", 1, 0, "MachineNameValidator") qmlRegisterType(UserChangesModel, "Cura", 1, 0, "UserChangesModel") qmlRegisterSingletonType(ContainerManager, "Cura", 1, 0, "ContainerManager", ContainerManager.getInstance) diff --git a/cura/MachineActionManager.py b/cura/MachineActionManager.py index db0f7bfbff..8cfde654fb 100644 --- a/cura/MachineActionManager.py +++ b/cura/MachineActionManager.py @@ -136,7 +136,7 @@ class MachineActionManager(QObject): # action multiple times). # \param definition_id The ID of the definition that you want to get the "on added" actions for. # \returns List of actions. - @pyqtSlot(str, result="QVariantList") + @pyqtSlot(str, result = "QVariantList") def getFirstStartActions(self, definition_id: str) -> List["MachineAction"]: if definition_id in self._first_start_actions: return self._first_start_actions[definition_id] diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py new file mode 100644 index 0000000000..8c2673c3a3 --- /dev/null +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -0,0 +1,52 @@ +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from typing import Optional + +from PyQt5.QtCore import QObject, Qt + +from UM.Qt.ListModel import ListModel + + +# +# This model holds all first-start machine actions for the currently active machine. It has 2 roles: +# - title : the title/name of the action +# - content : the QObject of the QML content of the action +# +class FirstStartMachineActionsModel(ListModel): + + TitleRole = Qt.UserRole + 1 + ContentRole = Qt.UserRole + 2 + + def __init__(self, parent: Optional[QObject] = None) -> None: + super().__init__(parent) + + self.addRoleName(self.TitleRole, "title") + self.addRoleName(self.ContentRole, "content") + + from cura.CuraApplication import CuraApplication + self._application = CuraApplication.getInstance() + + def initialize(self) -> None: + self._application.getMachineManager().globalContainerChanged.connect(self._update) + self._update() + + def _update(self) -> None: + global_stack = self._application.getMachineManager().activeMachine + if global_stack is None: + self.setItems([]) + return + + definition_id = global_stack.definition.getId() + first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) + + item_list = [] + for item in first_start_actions: + item_list.append({"title": item.label, + "content": item.displayItem, + }) + + self.setItems(item_list) + + +__all__ = ["FirstStartMachineActionsModel"] From 740dd095cccbc14315cd4c64b4c8db1e8e6fb149 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 19 Mar 2019 13:45:56 +0100 Subject: [PATCH 059/211] (Add-by-IP) Incorporated review comments. [CURA-6294] --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 4c775572f3..d0fc543cd6 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -37,8 +37,8 @@ i18n_catalog = i18nCatalog("cura") # If we discover a printer that has the same key as the active machine instance a connection is made. @signalemitter class UM3OutputDevicePlugin(OutputDevicePlugin): - addDeviceSignal = Signal() - removeDeviceSignal = Signal() + addDeviceSignal = Signal() # Called '...Signal' to avoid confusion with function-names. + removeDeviceSignal = Signal() # Ditto ^^^. discoveredDevicesChanged = Signal() cloudFlowIsPossible = Signal() @@ -187,7 +187,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._zero_conf.close() self._cloud_output_device_manager.stop() - def canAddManualDevice(self, address: str) -> ManualDeviceAdditionAttempt: + def canAddManualDevice(self, address: str = "") -> ManualDeviceAdditionAttempt: # This plugin should always be the fallback option (at least try it): return ManualDeviceAdditionAttempt.POSSIBLE From 8d68db9ff0169a1ce8ef3d1276932f1ebf933f99 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 12:08:42 +0100 Subject: [PATCH 060/211] WIP: Add first-start machine actions --- cura/CuraApplication.py | 2 - .../Models/FirstStartMachineActionsModel.py | 106 +- cura/UI/MachineSettingsManager.py | 10 +- cura/UI/WelcomePagesModel.py | 12 +- .../MachineSettingsAction.qml | 973 ++---------------- .../MachineSettingsExtruderTab.qml | 17 +- .../MachineSettingsPrinterTab.qml | 38 +- .../MachineSettings/ComboBoxWithOptions.qml | 15 +- .../MachineSettingsContent.qml | 55 - .../qml/MachineSettings/PolygonTextField.qml | 120 --- .../qml/MachineSettings/PrintSetupContent.qml | 272 ----- .../AddPrinterBySelectionContent.qml | 10 +- .../FirstStartMachineActionsContent.qml | 91 ++ resources/qml/WelcomePages/StepPanel.qml | 2 +- resources/qml/WelcomePages/TestContent.qml | 107 -- resources/qml/qmldir | 17 + 16 files changed, 288 insertions(+), 1559 deletions(-) rename {resources/qml/WelcomePages => plugins/MachineSettingsAction}/MachineSettingsExtruderTab.qml (93%) rename {resources/qml/WelcomePages => plugins/MachineSettingsAction}/MachineSettingsPrinterTab.qml (89%) delete mode 100644 resources/qml/MachineSettings/MachineSettingsContent.qml delete mode 100644 resources/qml/MachineSettings/PolygonTextField.qml delete mode 100644 resources/qml/MachineSettings/PrintSetupContent.qml create mode 100644 resources/qml/WelcomePages/FirstStartMachineActionsContent.qml delete mode 100644 resources/qml/WelcomePages/TestContent.qml diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 01b0e457ae..6a7295ba33 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -753,8 +753,6 @@ class CuraApplication(QtApplication): # Initialize setting visibility presets model. self._setting_visibility_presets_model = SettingVisibilityPresetsModel(self.getPreferences(), parent = self) - self._first_start_machine_actions_model.initialize() - # Initialize Cura API self._cura_API.initialize() diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index 8c2673c3a3..b7e806278c 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -1,52 +1,54 @@ -# Copyright (c) 2019 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -from typing import Optional - -from PyQt5.QtCore import QObject, Qt - -from UM.Qt.ListModel import ListModel - - -# -# This model holds all first-start machine actions for the currently active machine. It has 2 roles: -# - title : the title/name of the action -# - content : the QObject of the QML content of the action -# -class FirstStartMachineActionsModel(ListModel): - - TitleRole = Qt.UserRole + 1 - ContentRole = Qt.UserRole + 2 - - def __init__(self, parent: Optional[QObject] = None) -> None: - super().__init__(parent) - - self.addRoleName(self.TitleRole, "title") - self.addRoleName(self.ContentRole, "content") - - from cura.CuraApplication import CuraApplication - self._application = CuraApplication.getInstance() - - def initialize(self) -> None: - self._application.getMachineManager().globalContainerChanged.connect(self._update) - self._update() - - def _update(self) -> None: - global_stack = self._application.getMachineManager().activeMachine - if global_stack is None: - self.setItems([]) - return - - definition_id = global_stack.definition.getId() - first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) - - item_list = [] - for item in first_start_actions: - item_list.append({"title": item.label, - "content": item.displayItem, - }) - - self.setItems(item_list) - - -__all__ = ["FirstStartMachineActionsModel"] +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from typing import Optional + +from PyQt5.QtCore import QObject, Qt + +from UM.Qt.ListModel import ListModel + + +# +# This model holds all first-start machine actions for the currently active machine. It has 2 roles: +# - title : the title/name of the action +# - content : the QObject of the QML content of the action +# +class FirstStartMachineActionsModel(ListModel): + + TitleRole = Qt.UserRole + 1 + ContentRole = Qt.UserRole + 2 + + def __init__(self, parent: Optional[QObject] = None) -> None: + super().__init__(parent) + + self.addRoleName(self.TitleRole, "title") + self.addRoleName(self.ContentRole, "content") + + from cura.CuraApplication import CuraApplication + self._application = CuraApplication.getInstance() + + self._application.initializationFinished.connect(self._initialize) + + def _initialize(self) -> None: + self._application.getMachineManager().globalContainerChanged.connect(self._update) + self._update() + + def _update(self) -> None: + global_stack = self._application.getMachineManager().activeMachine + if global_stack is None: + self.setItems([]) + return + + definition_id = global_stack.definition.getId() + first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) + + item_list = [] + for item in first_start_actions: + item_list.append({"title": item.label, + "content": item.displayItem, + }) + + self.setItems(item_list) + + +__all__ = ["FirstStartMachineActionsModel"] diff --git a/cura/UI/MachineSettingsManager.py b/cura/UI/MachineSettingsManager.py index 3232323bcb..8fdbae09e1 100644 --- a/cura/UI/MachineSettingsManager.py +++ b/cura/UI/MachineSettingsManager.py @@ -25,10 +25,16 @@ class MachineSettingsManager(QObject): # an extruder's compatible material diameter. This ensures that after the modification, changes can be notified # and updated right away. @pyqtSlot(int) - def updateMaterialForDiameter(self, extruder_position: int): + def updateMaterialForDiameter(self, extruder_position: int) -> None: # Updates the material container to a material that matches the material diameter set for the printer self._application.getMachineManager().updateMaterialWithVariant(str(extruder_position)) + @pyqtSlot(int) + def setMachineExtruderCount(self, extruder_count: int) -> None: + # Note: this method was in this class before, but since it's quite generic and other plugins also need it + # it was moved to the machine manager instead. Now this method just calls the machine manager. + self._application.getMachineManager().setActiveMachineExtruderCount(extruder_count) + # FIXME(Lipu): Better document what this function does, especially the fuzzy gcode flavor and has_materials logic # regarding UM2 and UM2+ # Function for the Machine Settings panel (QML) to update after the usre changes "Number of Extruders". @@ -37,7 +43,7 @@ class MachineSettingsManager(QObject): machine_manager = self._application.getMachineManager() material_manager = self._application.getMaterialManager() - global_stack = material_manager.activeMachine + global_stack = machine_manager.activeMachine definition = global_stack.definition if definition.getProperty("machine_gcode_flavor", "value") != "UltiGCode" or definition.getMetaDataEntry( diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 87158b35c3..222de27d17 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -30,13 +30,6 @@ class WelcomePagesModel(ListModel): def initialize(self) -> None: from cura.CuraApplication import CuraApplication - self._pages.append({"id": "test", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "TestContent.qml"))), - }) - - # Add default welcome pages self._pages.append({"id": "welcome", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, @@ -68,6 +61,11 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", "AddPrinterByIpContent.qml"))), }) + self._pages.append({"id": "machine_actions", + "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", + "FirstStartMachineActionsContent.qml"))), + }) self._pages.append({"id": "cloud", "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, os.path.join("WelcomePages", diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index ef8fda224a..28eb37e939 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -1,939 +1,102 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.3 as UM +import Cura 1.1 as Cura +// +// This component contains the content for the "Welcome" page of the welcome on-boarding process. +// Cura.MachineAction { - id: base - property var extrudersModel: Cura.ExtrudersModel{} // Do not retrieve the Model from a backend. Otherwise the tabs - // in tabView will not removed/updated. Probably QML bug - property int extruderTabsCount: 0 + UM.I18nCatalog { id: catalog; name: "cura" } - property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width + property var extrudersModel: Cura.ExtrudersModel {} + + // If we create a CuraTabButton for "Printer" and use Repeater for extruders, for some reason, once the component + // finishes it will automatically change "currentIndex = 1", and it is VERY difficult to change "currentIndex = 0" + // after that. Using a model and a Repeater to create both "Printer" and extruder CuraTabButtons seem to solve this + // problem. Connections { - target: base.extrudersModel - onModelChanged: - { - var extruderCount = base.extrudersModel.count; - base.extruderTabsCount = extruderCount; - } + target: extrudersModel + onItemsChanged: tabNameModel.update() } - Connections + ListModel { - target: dialog ? dialog : null - ignoreUnknownSignals: true - // Any which way this action dialog is dismissed, make sure it is properly finished - onNextClicked: finishAction() - onBackClicked: finishAction() - onAccepted: finishAction() - onRejected: finishAction() - onClosing: finishAction() - } + id: tabNameModel - function finishAction() - { - forceActiveFocus(); - manager.onFinishAction(); - } + Component.onCompleted: update() - anchors.fill: parent; - Item - { - id: machineSettingsAction - anchors.fill: parent; - - UM.I18nCatalog { id: catalog; name: "cura"; } - - Label + function update() { - id: pageTitle - width: parent.width - text: catalog.i18nc("@title", "Machine Settings") - wrapMode: Text.WordWrap - font.pointSize: 18; - } - - TabView - { - id: settingsTabs - height: parent.height - y - width: parent.width - anchors.left: parent.left - anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - - property real columnWidth: Math.round((width - 3 * UM.Theme.getSize("default_margin").width) / 2) - property real labelColumnWidth: Math.round(columnWidth / 2) - - Tab + clear() + append({ name: catalog.i18nc("@title:tab", "Printer") }) + for (var i = 0; i < extrudersModel.count; i++) { - title: catalog.i18nc("@title:tab", "Printer"); - anchors.margins: UM.Theme.getSize("default_margin").width + const m = extrudersModel.getItem(i) + append({ name: m.name }) + } + } + } - Column + Rectangle + { + anchors.fill: parent + border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent" + border.width: UM.Theme.getSize("default_lining").width + radius: UM.Theme.getSize("default_radius").width + + UM.TabRow + { + id: tabBar + width: parent.width + + Repeater + { + model: tabNameModel + delegate: Cura.CuraTabButton { - spacing: UM.Theme.getSize("default_margin").height - - Row - { - width: parent.width - spacing: UM.Theme.getSize("default_margin").height - - Column - { - width: settingsTabs.columnWidth - spacing: UM.Theme.getSize("default_lining").height - - Label - { - text: catalog.i18nc("@label", "Printer Settings") - font.bold: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: buildAreaWidthField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_width" - property string label: catalog.i18nc("@label", "X (Width)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Loader - { - id: buildAreaDepthField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_depth" - property string label: catalog.i18nc("@label", "Y (Depth)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Loader - { - id: buildAreaHeightField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_height" - property string label: catalog.i18nc("@label", "Z (Height)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: shapeComboBox - sourceComponent: comboBoxWithOptions - property string settingKey: "machine_shape" - property string label: catalog.i18nc("@label", "Build plate shape") - property bool forceUpdateOnChange: true - } - - Loader - { - id: centerIsZeroCheckBox - sourceComponent: simpleCheckBox - property string settingKey: "machine_center_is_zero" - property string label: catalog.i18nc("@option:check", "Origin at center") - property bool forceUpdateOnChange: true - } - Loader - { - id: heatedBedCheckBox - sourceComponent: simpleCheckBox - property var settingKey: "machine_heated_bed" - property string label: catalog.i18nc("@option:check", "Heated bed") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: gcodeFlavorComboBox - sourceComponent: comboBoxWithOptions - property string settingKey: "machine_gcode_flavor" - property string label: catalog.i18nc("@label", "G-code flavor") - property bool forceUpdateOnChange: true - property var afterOnActivate: manager.updateHasMaterialsMetadata - } - } - - Column - { - width: settingsTabs.columnWidth - spacing: UM.Theme.getSize("default_lining").height - - Label - { - text: catalog.i18nc("@label", "Printhead Settings") - font.bold: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: printheadXMinField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "X min") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the left of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "x" - property string side: "min" - } - - Loader - { - id: printheadYMinField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "Y min") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the front of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "y" - property string side: "min" - } - - Loader - { - id: printheadXMaxField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "X max") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the right of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "x" - property string side: "max" - } - - Loader - { - id: printheadYMaxField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "Y max") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the rear of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "y" - property string side: "max" - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: gantryHeightField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "gantry_height" - property string label: catalog.i18nc("@label", "Gantry height") - property string unit: catalog.i18nc("@label", "mm") - property string tooltip: catalog.i18nc("@tooltip", "The height difference between the tip of the nozzle and the gantry system (X and Y axes). Used to prevent collisions between previous prints and the gantry when printing \"One at a Time\".") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - UM.TooltipArea - { - height: childrenRect.height - width: childrenRect.width - text: machineExtruderCountProvider.properties.description - visible: extruderCountModel.count >= 2 - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - text: catalog.i18nc("@label", "Number of Extruders") - elide: Text.ElideRight - width: Math.max(0, settingsTabs.labelColumnWidth) - anchors.verticalCenter: extruderCountComboBox.verticalCenter - } - ComboBox - { - id: extruderCountComboBox - model: ListModel - { - id: extruderCountModel - Component.onCompleted: - { - for(var i = 0; i < manager.definedExtruderCount; i++) - { - extruderCountModel.append({text: String(i + 1), value: i}); - } - } - } - - Connections - { - target: manager - onDefinedExtruderCountChanged: - { - extruderCountModel.clear(); - for(var i = 0; i < manager.definedExtruderCount; ++i) - { - extruderCountModel.append({text: String(i + 1), value: i}); - } - } - } - - currentIndex: machineExtruderCountProvider.properties.value - 1 - onActivated: - { - manager.setMachineExtruderCount(index + 1); - } - } - } - } - } - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.right: parent.right - height: parent.height - y - Column - { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "Start G-code") - font.bold: true - } - Loader - { - id: machineStartGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_start_gcode" - property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very start.") - } - } - - Column { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "End G-code") - font.bold: true - } - Loader - { - id: machineEndGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_end_gcode" - property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very end.") - } - } - } + text: model.name } } + } - onCurrentIndexChanged: + StackLayout + { + id: tabStack + anchors.top: tabBar.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + width: parent.width + currentIndex: tabBar.currentIndex + + MachineSettingsPrinterTab { - if(currentIndex > 0) - { - contentItem.forceActiveFocus(); - } + id: printerTab } Repeater { - id: extruderTabsRepeater - model: base.extruderTabsCount - - Tab + model: extrudersModel + delegate: MachineSettingsExtruderTab { - title: base.extrudersModel.getItem(index).name - anchors.margins: UM.Theme.getSize("default_margin").width - - Column - { - spacing: UM.Theme.getSize("default_lining").width - - Label - { - text: catalog.i18nc("@label", "Nozzle Settings") - font.bold: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: extruderNozzleSizeField - visible: !Cura.MachineManager.hasVariants - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_nozzle_size" - property string label: catalog.i18nc("@label", "Nozzle size") - property string unit: catalog.i18nc("@label", "mm") - function afterOnEditingFinished() - { - // Somehow the machine_nozzle_size dependent settings are not updated otherwise - Cura.MachineManager.forceUpdateAllSettings() - } - property bool isExtruderSetting: true - } - - Loader - { - id: materialDiameterField - visible: Cura.MachineManager.hasMaterials - sourceComponent: numericTextFieldWithUnit - property string settingKey: "material_diameter" - property string label: catalog.i18nc("@label", "Compatible material diameter") - property string unit: catalog.i18nc("@label", "mm") - property string tooltip: catalog.i18nc("@tooltip", "The nominal diameter of filament supported by the printer. The exact diameter will be overridden by the material and/or the profile.") - function afterOnEditingFinished() - { - if (settingsTabs.currentIndex > 0) - { - manager.updateMaterialForDiameter(settingsTabs.currentIndex - 1) - } - } - function setValueFunction(value) - { - if (settingsTabs.currentIndex > 0) - { - const extruderIndex = index.toString() - Cura.MachineManager.activeMachine.extruders[extruderIndex].compatibleMaterialDiameter = value - } - } - property bool isExtruderSetting: true - } - - Loader - { - id: extruderOffsetXField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_nozzle_offset_x" - property string label: catalog.i18nc("@label", "Nozzle offset X") - property string unit: catalog.i18nc("@label", "mm") - property bool isExtruderSetting: true - property bool forceUpdateOnChange: true - property bool allowNegative: true - } - - Loader - { - id: extruderOffsetYField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_nozzle_offset_y" - property string label: catalog.i18nc("@label", "Nozzle offset Y") - property string unit: catalog.i18nc("@label", "mm") - property bool isExtruderSetting: true - property bool forceUpdateOnChange: true - property bool allowNegative: true - } - - Loader - { - id: extruderCoolingFanNumberField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_extruder_cooling_fan_number" - property string label: catalog.i18nc("@label", "Cooling Fan Number") - property string unit: catalog.i18nc("@label", "") - property bool isExtruderSetting: true - property bool forceUpdateOnChange: true - property bool allowNegative: false - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.right: parent.right - height: parent.height - y - Column - { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "Extruder Start G-code") - font.bold: true - } - Loader - { - id: extruderStartGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_extruder_start_code" - property bool isExtruderSetting: true - } - } - Column { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "Extruder End G-code") - font.bold: true - } - Loader - { - id: extruderEndGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_extruder_end_code" - property bool isExtruderSetting: true - } - } - } - } + id: discoverTab + extruderPosition: model.index + extruderStackId: model.id } } } } - - Component - { - id: simpleCheckBox - UM.TooltipArea - { - height: checkBox.height - width: checkBox.width - text: _tooltip - - property bool _isExtruderSetting: (typeof(isExtruderSetting) === 'undefined') ? false: isExtruderSetting - property bool _forceUpdateOnChange: (typeof(forceUpdateOnChange) === 'undefined') ? false: forceUpdateOnChange - property string _tooltip: (typeof(tooltip) === 'undefined') ? propertyProvider.properties.description : tooltip - - UM.SettingPropertyProvider - { - id: propertyProvider - - containerStackId: { - if(_isExtruderSetting) - { - if(settingsTabs.currentIndex > 0) - { - return Cura.ExtruderManager.extruderIds[String(settingsTabs.currentIndex - 1)]; - } - return ""; - } - return base.activeMachineId - } - key: settingKey - watchedProperties: [ "value", "description" ] - storeIndex: manager.containerIndex - } - - CheckBox - { - id: checkBox - text: label - checked: String(propertyProvider.properties.value).toLowerCase() != 'false' - onClicked: - { - propertyProvider.setPropertyValue("value", checked); - if(_forceUpdateOnChange) - { - manager.forceUpdate(); - } - } - } - } - } - - Component - { - id: numericTextFieldWithUnit - UM.TooltipArea - { - height: childrenRect.height - width: childrenRect.width - text: _tooltip - - property bool _isExtruderSetting: (typeof(isExtruderSetting) === 'undefined') ? false: isExtruderSetting - property bool _allowNegative: (typeof(allowNegative) === 'undefined') ? false : allowNegative - property var _afterOnEditingFinished: (typeof(afterOnEditingFinished) === 'undefined') ? undefined : afterOnEditingFinished - property bool _forceUpdateOnChange: (typeof(forceUpdateOnChange) === 'undefined') ? false : forceUpdateOnChange - property string _label: (typeof(label) === 'undefined') ? "" : label - property string _tooltip: (typeof(tooltip) === 'undefined') ? propertyProvider.properties.description : tooltip - property var _setValueFunction: (typeof(setValueFunction) === 'undefined') ? undefined : setValueFunction - - UM.SettingPropertyProvider - { - id: propertyProvider - - containerStackId: { - if(_isExtruderSetting) - { - if(settingsTabs.currentIndex > 0) - { - return Cura.ExtruderManager.extruderIds[String(settingsTabs.currentIndex - 1)]; - } - return ""; - } - return base.activeMachineId - } - key: settingKey - watchedProperties: [ "value", "description" ] - storeIndex: manager.containerIndex - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - text: _label - visible: _label != "" - elide: Text.ElideRight - width: Math.max(0, settingsTabs.labelColumnWidth) - anchors.verticalCenter: textFieldWithUnit.verticalCenter - } - - Item - { - width: textField.width - height: textField.height - - id: textFieldWithUnit - TextField - { - id: textField - text: { - const value = propertyProvider.properties.value; - return value ? value : ""; - } - validator: RegExpValidator { regExp: _allowNegative ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ } - onEditingFinished: - { - if (propertyProvider && text != propertyProvider.properties.value) - { - // For some properties like the extruder-compatible material diameter, they need to - // trigger many updates, such as the available materials, the current material may - // need to be switched, etc. Although setting the diameter can be done directly via - // the provider, all the updates that need to be triggered then need to depend on - // the metadata update, a signal that can be fired way too often. The update functions - // can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary - // overhead. - // The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()", - // and it triggers the diameter update signals only when it is needed. Here it is optionally - // choose to use setCompatibleMaterialDiameter() or other more specific functions that - // are available. - if (_setValueFunction !== undefined) - { - _setValueFunction(text) - } - else - { - propertyProvider.setPropertyValue("value", text) - } - if(_forceUpdateOnChange) - { - manager.forceUpdate() - } - if(_afterOnEditingFinished) - { - _afterOnEditingFinished() - } - } - } - } - - Label - { - text: unit - anchors.right: textField.right - anchors.rightMargin: y - textField.y - anchors.verticalCenter: textField.verticalCenter - } - } - } - } - } - - Component - { - id: comboBoxWithOptions - UM.TooltipArea - { - height: childrenRect.height - width: childrenRect.width - text: _tooltip - - property bool _isExtruderSetting: (typeof(isExtruderSetting) === 'undefined') ? false : isExtruderSetting - property bool _forceUpdateOnChange: (typeof(forceUpdateOnChange) === 'undefined') ? false : forceUpdateOnChange - property var _afterOnActivate: (typeof(afterOnActivate) === 'undefined') ? undefined : afterOnActivate - property string _label: (typeof(label) === 'undefined') ? "" : label - property string _tooltip: (typeof(tooltip) === 'undefined') ? propertyProvider.properties.description : tooltip - - UM.SettingPropertyProvider - { - id: propertyProvider - - containerStackId: { - if(_isExtruderSetting) - { - if(settingsTabs.currentIndex > 0) - { - return Cura.ExtruderManager.extruderIds[String(settingsTabs.currentIndex - 1)]; - } - return ""; - } - return base.activeMachineId - } - key: settingKey - watchedProperties: [ "value", "options", "description" ] - storeIndex: manager.containerIndex - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - text: _label - visible: _label != "" - elide: Text.ElideRight - width: Math.max(0, settingsTabs.labelColumnWidth) - anchors.verticalCenter: comboBox.verticalCenter - } - ComboBox - { - id: comboBox - model: ListModel - { - id: optionsModel - Component.onCompleted: - { - // Options come in as a string-representation of an OrderedDict - var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/); - if(options) - { - options = options[1].split("), (") - for(var i = 0; i < options.length; i++) - { - var option = options[i].substring(1, options[i].length - 1).split("', '") - optionsModel.append({text: option[1], value: option[0]}); - } - } - } - } - currentIndex: - { - var currentValue = propertyProvider.properties.value; - var index = 0; - for(var i = 0; i < optionsModel.count; i++) - { - if(optionsModel.get(i).value == currentValue) { - index = i; - break; - } - } - return index - } - onActivated: - { - if(propertyProvider.properties.value != optionsModel.get(index).value) - { - propertyProvider.setPropertyValue("value", optionsModel.get(index).value); - if(_forceUpdateOnChange) - { - manager.forceUpdate(); - } - if(_afterOnActivate) - { - _afterOnActivate(); - } - } - } - } - } - } - } - - Component - { - id: gcodeTextArea - - UM.TooltipArea - { - height: gcodeArea.height - width: gcodeArea.width - text: _tooltip - - property bool _isExtruderSetting: (typeof(isExtruderSetting) === 'undefined') ? false : isExtruderSetting - property string _tooltip: (typeof(tooltip) === 'undefined') ? propertyProvider.properties.description : tooltip - - UM.SettingPropertyProvider - { - id: propertyProvider - - containerStackId: { - if(_isExtruderSetting) - { - if(settingsTabs.currentIndex > 0) - { - return Cura.ExtruderManager.extruderIds[String(settingsTabs.currentIndex - 1)]; - } - return ""; - } - return base.activeMachineId - } - key: settingKey - watchedProperties: [ "value", "description" ] - storeIndex: manager.containerIndex - } - - TextArea - { - id: gcodeArea - width: areaWidth - height: areaHeight - font: UM.Theme.getFont("fixed") - text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" - onActiveFocusChanged: - { - if(!activeFocus) - { - propertyProvider.setPropertyValue("value", gcodeArea.text) - } - } - Component.onCompleted: - { - wrapMode = TextEdit.NoWrap; - } - } - } - } - - Component - { - id: headPolygonTextField - UM.TooltipArea - { - height: textField.height - width: textField.width - text: tooltip - - property string _label: (typeof(label) === 'undefined') ? "" : label - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - text: _label - visible: _label != "" - elide: Text.ElideRight - width: Math.max(0, settingsTabs.labelColumnWidth) - anchors.verticalCenter: textFieldWithUnit.verticalCenter - } - - Item - { - id: textFieldWithUnit - width: textField.width - height: textField.height - - TextField - { - id: textField - text: - { - var polygon = JSON.parse(machineHeadPolygonProvider.properties.value); - var item = (axis == "x") ? 0 : 1 - var result = polygon[0][item]; - for(var i = 1; i < polygon.length; i++) { - if (side == "min") { - result = Math.min(result, polygon[i][item]); - } else { - result = Math.max(result, polygon[i][item]); - } - } - result = Math.abs(result); - printHeadPolygon[axis][side] = result; - return result; - } - validator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ } - onEditingFinished: - { - printHeadPolygon[axis][side] = parseFloat(textField.text.replace(',','.')); - var polygon = []; - polygon.push([-printHeadPolygon["x"]["min"], printHeadPolygon["y"]["max"]]); - polygon.push([-printHeadPolygon["x"]["min"],-printHeadPolygon["y"]["min"]]); - polygon.push([ printHeadPolygon["x"]["max"], printHeadPolygon["y"]["max"]]); - polygon.push([ printHeadPolygon["x"]["max"],-printHeadPolygon["y"]["min"]]); - var polygon_string = JSON.stringify(polygon); - if(polygon_string != machineHeadPolygonProvider.properties.value) - { - machineHeadPolygonProvider.setPropertyValue("value", polygon_string); - manager.forceUpdate(); - } - } - } - - Label - { - text: catalog.i18nc("@label", "mm") - anchors.right: textField.right - anchors.rightMargin: y - textField.y - anchors.verticalCenter: textField.verticalCenter - } - } - } - } - } - - property var printHeadPolygon: - { - "x": { - "min": 0, - "max": 0, - }, - "y": { - "min": 0, - "max": 0, - }, - } - - - UM.SettingPropertyProvider - { - id: machineExtruderCountProvider - - containerStackId: base.activeMachineId - key: "machine_extruder_count" - watchedProperties: [ "value", "description" ] - storeIndex: manager.containerIndex - } - - UM.SettingPropertyProvider - { - id: machineHeadPolygonProvider - - containerStackId: base.activeMachineId - key: "machine_head_with_fans_polygon" - watchedProperties: [ "value" ] - storeIndex: manager.containerIndex - } } diff --git a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml similarity index 93% rename from resources/qml/WelcomePages/MachineSettingsExtruderTab.qml rename to plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml index 3ed82a6dde..270bd7e828 100644 --- a/resources/qml/WelcomePages/MachineSettingsExtruderTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml @@ -7,13 +7,10 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura -import "../MachineSettings" - // // This component contains the content for the "Welcome" page of the welcome on-boarding process. // - Item { id: base @@ -68,7 +65,7 @@ Item renderType: Text.NativeRendering } - NumericTextFieldWithUnit // "Nozzle size" + Cura.NumericTextFieldWithUnit // "Nozzle size" { id: extruderNozzleSizeField visible: !Cura.MachineManager.hasVariants @@ -83,7 +80,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Compatible material diameter" + Cura.NumericTextFieldWithUnit // "Compatible material diameter" { id: extruderCompatibleMaterialDiameterField containerStackId: base.extruderStackId @@ -99,7 +96,7 @@ Item afterOnEditingFinishedFunction: updateMaterialDiameter } - NumericTextFieldWithUnit // "Nozzle offset X" + Cura.NumericTextFieldWithUnit // "Nozzle offset X" { id: extruderNozzleOffsetXField containerStackId: base.extruderStackId @@ -113,7 +110,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Nozzle offset Y" + Cura.NumericTextFieldWithUnit // "Nozzle offset Y" { id: extruderNozzleOffsetYField containerStackId: base.extruderStackId @@ -127,7 +124,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Cooling Fan Number" + Cura.NumericTextFieldWithUnit // "Cooling Fan Number" { id: extruderNozzleCoolingFanNumberField containerStackId: base.extruderStackId @@ -152,7 +149,7 @@ Item anchors.right: parent.right anchors.margins: UM.Theme.getSize("default_margin").width - GcodeTextArea // "Extruder Start G-code" + Cura.GcodeTextArea // "Extruder Start G-code" { anchors.top: parent.top anchors.bottom: parent.bottom @@ -166,7 +163,7 @@ Item settingStoreIndex: propertyStoreIndex } - GcodeTextArea // "Extruder End G-code" + Cura.GcodeTextArea // "Extruder End G-code" { anchors.top: parent.top anchors.bottom: parent.bottom diff --git a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml similarity index 89% rename from resources/qml/WelcomePages/MachineSettingsPrinterTab.qml rename to plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index 6971ab74db..c952e4cfb3 100644 --- a/resources/qml/WelcomePages/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -7,8 +7,6 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura -import "../MachineSettings" - // // This the content in the "Printer" tab in the Machine Settings dialog. @@ -62,7 +60,7 @@ Item renderType: Text.NativeRendering } - NumericTextFieldWithUnit // "X (Width)" + Cura.NumericTextFieldWithUnit // "X (Width)" { id: machineXWidthField containerStackId: machineStackId @@ -76,7 +74,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Y (Depth)" + Cura.NumericTextFieldWithUnit // "Y (Depth)" { id: machineYDepthField containerStackId: machineStackId @@ -90,7 +88,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Z (Height)" + Cura.NumericTextFieldWithUnit // "Z (Height)" { id: machineZHeightField containerStackId: machineStackId @@ -104,7 +102,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - ComboBoxWithOptions // "Build plate shape" + Cura.ComboBoxWithOptions // "Build plate shape" { id: buildPlateShapeComboBox containerStackId: machineStackId @@ -117,7 +115,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - SimpleCheckBox // "Origin at center" + Cura.SimpleCheckBox // "Origin at center" { id: originAtCenterCheckBox containerStackId: machineStackId @@ -129,7 +127,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - SimpleCheckBox // "Heated bed" + Cura.SimpleCheckBox // "Heated bed" { id: heatedBedCheckBox containerStackId: machineStackId @@ -141,7 +139,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - ComboBoxWithOptions // "G-code flavor" + Cura.ComboBoxWithOptions // "G-code flavor" { id: gcodeFlavorComboBox containerStackId: machineStackId @@ -177,7 +175,7 @@ Item renderType: Text.NativeRendering } - PrintHeadMinMaxTextField // "X min" + Cura.PrintHeadMinMaxTextField // "X min" { id: machineXMinField @@ -195,7 +193,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - PrintHeadMinMaxTextField // "Y min" + Cura.PrintHeadMinMaxTextField // "Y min" { id: machineYMinField @@ -213,7 +211,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - PrintHeadMinMaxTextField // "X max" + Cura.PrintHeadMinMaxTextField // "X max" { id: machineXMaxField @@ -231,7 +229,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - PrintHeadMinMaxTextField // "Y max" + Cura.PrintHeadMinMaxTextField // "Y max" { id: machineYMaxField @@ -251,7 +249,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - NumericTextFieldWithUnit // "Gantry Height" + Cura.NumericTextFieldWithUnit // "Gantry Height" { id: machineGantryHeightField containerStackId: machineStackId @@ -265,7 +263,7 @@ Item forceUpdateOnChangeFunction: forceUpdateFunction } - ComboBoxWithOptions // "Number of Extruders" + Cura.ComboBoxWithOptions // "Number of Extruders" { id: numberOfExtrudersComboBox containerStackId: machineStackId @@ -280,6 +278,7 @@ Item // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings. // I don't remember exactly what. afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata + setValueFunction: CuraApplication.getMachineSettingsManager().setMachineExtruderCount optionModel: ListModel { @@ -289,7 +288,10 @@ Item extruderCountModel.clear() for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) { - extruderCountModel.append({text: String(i), value: i}) + // Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue() + // takes a QVariant as value, and Number gets translated into a float. This will cause problem + // for integer settings such as "Number of Extruders". + extruderCountModel.append({ text: String(i), value: String(i) }) } } } @@ -306,7 +308,7 @@ Item anchors.right: parent.right anchors.margins: UM.Theme.getSize("default_margin").width - GcodeTextArea // "Start G-code" + Cura.GcodeTextArea // "Start G-code" { anchors.top: parent.top anchors.bottom: parent.bottom @@ -320,7 +322,7 @@ Item settingStoreIndex: propertyStoreIndex } - GcodeTextArea // "End G-code" + Cura.GcodeTextArea // "End G-code" { anchors.top: parent.top anchors.bottom: parent.bottom diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 6abc2bde22..012e36817b 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -41,6 +41,7 @@ UM.TooltipArea // callback functions property var forceUpdateOnChangeFunction: dummy_func property var afterOnEditingFinishedFunction: dummy_func + property var setValueFunction: null // a dummy function for default property values function dummy_func() {} @@ -76,7 +77,7 @@ UM.TooltipArea for (var i = 0; i < options.length; i++) { var option = options[i].substring(1, options[i].length - 1).split("', '") - append({text: option[1], value: option[0]}) + append({ text: option[1], value: option[0] }) } } } @@ -118,9 +119,17 @@ UM.TooltipArea onActivated: { - if (propertyProvider.properties.value != model.get(index).value) + var newValue = model.get(index).value + if (propertyProvider.properties.value != newValue) { - propertyProvider.setPropertyValue("value", model.get(index).value) + if (setValueFunction !== null) + { + setValueFunction(newValue) + } + else + { + propertyProvider.setPropertyValue("value", newValue) + } forceUpdateOnChangeFunction() afterOnEditingFinishedFunction() } diff --git a/resources/qml/MachineSettings/MachineSettingsContent.qml b/resources/qml/MachineSettings/MachineSettingsContent.qml deleted file mode 100644 index daa41d4c5d..0000000000 --- a/resources/qml/MachineSettings/MachineSettingsContent.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - - -Item -{ - id: base - anchors.fill: parent - - TabBar - { - id: bar - width: parent.width - TabButton - { - text: "Printer" - } - - Repeater - { - id: extrudersTabsRepeater - model: ["Extruder 1", "Extruder 2", "Extruder 3"] - - TabButton - { - text: modelData - } - } - } - - StackLayout - { - width: parent.width - currentIndex: bar.currentIndex - Item - { - id: printerTab - } - Repeater - { - model: ["Extruder 1", "Extruder 2", "Extruder 3"] - Item - { - anchors.centerIn: parent - - Label // TODO: this is a dummy - { - anchors.centerIn: parent - text: modelData - } - } - } - } -} diff --git a/resources/qml/MachineSettings/PolygonTextField.qml b/resources/qml/MachineSettings/PolygonTextField.qml deleted file mode 100644 index 59664b9f23..0000000000 --- a/resources/qml/MachineSettings/PolygonTextField.qml +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - -import UM 1.3 as UM -import Cura 1.1 as Cura - - -// -// TextField for editing polygon data in the Machine Settings dialog. -// -UM.TooltipArea -{ - UM.I18nCatalog { id: catalog; name: "cura"; } - - height: textField.height - width: textField.width - text: tooltip - - property alias containerStackId: propertyProvider.containerStackId - property alias settingKey: propertyProvider.key - property alias settingStoreIndex: propertyProvider.storeIndex - - property alias labelText: fieldLabel.text - property alias labelWidth: fieldLabel.width - property string unitText: catalog.i18nc("@label", "mm") - - // callback functions - property var forceUpdateOnChangeFunction: dummy_func - - // a dummy function for default property values - function dummy_func() {} - - property var printHeadPolygon: - { - "x": { - "min": 0, - "max": 0, - }, - "y": { - "min": 0, - "max": 0, - }, - } - - UM.SettingPropertyProvider - { - id: propertyProvider - watchedProperties: [ "value" ] - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - id: fieldLabel - anchors.verticalCenter: textFieldWithUnit.verticalCenter - visible: text != "" - elide: Text.ElideRight - //width: Math.max(0, settingsTabs.labelColumnWidth) - } - - Item - { - id: textFieldWithUnit - width: textField.width - height: textField.height - - TextField - { - id: textField - text: - { - var polygon = JSON.parse(propertyProvider.properties.value) - var item = (axis == "x") ? 0 : 1 - var result = polygon[0][item] - for (var i = 1; i < polygon.length; i++) { - result = (side == "min") - ? Math.min(result, polygon[i][item]) - : Math.max(result, polygon[i][item]) - } - result = Math.abs(result) - printHeadPolygon[axis][side] = result - return result - } - validator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ } - onEditingFinished: - { - printHeadPolygon[axis][side] = parseFloat(textField.text.replace(',','.')) - var polygon = [ - [-printHeadPolygon["x"]["min"], printHeadPolygon["y"]["max"]], - [-printHeadPolygon["x"]["min"], -printHeadPolygon["y"]["min"]], - [ printHeadPolygon["x"]["max"], printHeadPolygon["y"]["max"]], - [ printHeadPolygon["x"]["max"], -printHeadPolygon["y"]["min"]] - ] - var polygon_string = JSON.stringify(polygon) - if (polygon_string != propertyProvider.properties.value) - { - propertyProvider.setPropertyValue("value", polygon_string) - forceUpdateOnChangeFunction() - } - } - } - - Label - { - id: unitLabel - text: unitText - anchors.right: textField.right - anchors.rightMargin: y - textField.y - anchors.verticalCenter: textField.verticalCenter - } - } - } -} diff --git a/resources/qml/MachineSettings/PrintSetupContent.qml b/resources/qml/MachineSettings/PrintSetupContent.qml deleted file mode 100644 index d2469ff71d..0000000000 --- a/resources/qml/MachineSettings/PrintSetupContent.qml +++ /dev/null @@ -1,272 +0,0 @@ -import QtQuick 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - - -Column -{ - spacing: UM.Theme.getSize("default_margin").height - - Row - { - width: parent.width - spacing: UM.Theme.getSize("default_margin").height - - Column - { - width: settingsTabs.columnWidth - spacing: UM.Theme.getSize("default_lining").height - - Label - { - text: catalog.i18nc("@label", "Printer Settings") - font.bold: true - renderType: Text.NativeRendering - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: buildAreaWidthField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_width" - property string label: catalog.i18nc("@label", "X (Width)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Loader - { - id: buildAreaDepthField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_depth" - property string label: catalog.i18nc("@label", "Y (Depth)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Loader - { - id: buildAreaHeightField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "machine_height" - property string label: catalog.i18nc("@label", "Z (Height)") - property string unit: catalog.i18nc("@label", "mm") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: shapeComboBox - sourceComponent: comboBoxWithOptions - property string settingKey: "machine_shape" - property string label: catalog.i18nc("@label", "Build plate shape") - property bool forceUpdateOnChange: true - } - - Loader - { - id: centerIsZeroCheckBox - sourceComponent: simpleCheckBox - property string settingKey: "machine_center_is_zero" - property string label: catalog.i18nc("@option:check", "Origin at center") - property bool forceUpdateOnChange: true - } - Loader - { - id: heatedBedCheckBox - sourceComponent: simpleCheckBox - property var settingKey: "machine_heated_bed" - property string label: catalog.i18nc("@option:check", "Heated bed") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: gcodeFlavorComboBox - sourceComponent: comboBoxWithOptions - property string settingKey: "machine_gcode_flavor" - property string label: catalog.i18nc("@label", "G-code flavor") - property bool forceUpdateOnChange: true - property var afterOnActivate: manager.updateHasMaterialsMetadata - } - } - - Column - { - width: settingsTabs.columnWidth - spacing: UM.Theme.getSize("default_lining").height - - Label - { - text: catalog.i18nc("@label", "Printhead Settings") - font.bold: true - renderType: Text.NativeRendering - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: printheadXMinField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "X min") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the left of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "x" - property string side: "min" - } - - Loader - { - id: printheadYMinField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "Y min") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the front of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "y" - property string side: "min" - } - - Loader - { - id: printheadXMaxField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "X max") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the right of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "x" - property string side: "max" - } - - Loader - { - id: printheadYMaxField - sourceComponent: headPolygonTextField - property string label: catalog.i18nc("@label", "Y max") - property string tooltip: catalog.i18nc("@tooltip", "Distance from the rear of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".") - property string axis: "y" - property string side: "max" - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - Loader - { - id: gantryHeightField - sourceComponent: numericTextFieldWithUnit - property string settingKey: "gantry_height" - property string label: catalog.i18nc("@label", "Gantry height") - property string unit: catalog.i18nc("@label", "mm") - property string tooltip: catalog.i18nc("@tooltip", "The height difference between the tip of the nozzle and the gantry system (X and Y axes). Used to prevent collisions between previous prints and the gantry when printing \"One at a Time\".") - property bool forceUpdateOnChange: true - } - - Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height } - - UM.TooltipArea - { - height: childrenRect.height - width: childrenRect.width - text: machineExtruderCountProvider.properties.description - visible: extruderCountModel.count >= 2 - - Row - { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - anchors.verticalCenter: extruderCountComboBox.verticalCenter - width: Math.max(0, settingsTabs.labelColumnWidth) - text: catalog.i18nc("@label", "Number of Extruders") - elide: Text.ElideRight - renderType: Text.NativeRendering - } - ComboBox - { - id: extruderCountComboBox - model: ListModel - { - id: extruderCountModel - Component.onCompleted: - { - for(var i = 0; i < manager.definedExtruderCount; i++) - { - extruderCountModel.append({text: String(i + 1), value: i}) - } - } - } - - Connections - { - target: manager - onDefinedExtruderCountChanged: - { - extruderCountModel.clear(); - for(var i = 0; i < manager.definedExtruderCount; ++i) - { - extruderCountModel.append({text: String(i + 1), value: i}); - } - } - } - - currentIndex: machineExtruderCountProvider.properties.value - 1 - onActivated: - { - manager.setMachineExtruderCount(index + 1); - } - } - } - } - } - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.right: parent.right - height: parent.height - y - Column - { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "Start G-code") - font.bold: true - } - Loader - { - id: machineStartGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_start_gcode" - property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very start.") - } - } - - Column { - height: parent.height - width: settingsTabs.columnWidth - Label - { - text: catalog.i18nc("@label", "End G-code") - font.bold: true - } - Loader - { - id: machineEndGcodeField - sourceComponent: gcodeTextArea - property int areaWidth: parent.width - property int areaHeight: parent.height - y - property string settingKey: "machine_end_gcode" - property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very end.") - } - } - } -} diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index 3282b219c9..faa2d259be 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -137,18 +137,18 @@ Item // Create a network printer const networkPrinterItem = addNetworkPrinterDropDown.contentItem.currentItem CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinter(networkPrinterItem) + + // If we have created a machine, go to the last page, which is the "cloud" page. + base.gotoPage("cloud") } else { // Create a local printer const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem Cura.MachineManager.addMachine(localPrinterItem.id) + + base.gotoPage("machine_actions") } - - // TODO: implement machine actions - - // If we have created a machine, go to the last page, which is the "cloud" page. - base.gotoPage("cloud") } } } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml new file mode 100644 index 0000000000..84f5f5acac --- /dev/null +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -0,0 +1,91 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// This component contains the content for the "What's new in Ultimaker Cura" page of the welcome on-boarding process. +// +Item +{ + UM.I18nCatalog { id: catalog; name: "cura" } + + property var machineActionsModel: CuraApplication.getFirstStartMachineActionsModel() + + property int currentActionIndex: 0 + property var currentActionItem: currentActionIndex >= machineActionsModel.count + ? null : machineActionsModel.getItem(currentActionIndex) + property bool hasActions: machineActionsModel.count > 0 + + // Reset to the first page if the model gets changed. + Connections + { + target: machineActionsModel + onItemsChanged: currentActionIndex = 0 + } + + onVisibleChanged: + { + if (visible) + { + currentActionIndex = 0 + if (!hasActions) + { + base.showNextPage() + } + } + } + + Label + { + id: titleLabel + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: currentActionItem.title + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + Item + { + anchors.top: titleLabel.bottom + anchors.bottom: nextButton.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.left: parent.left + anchors.right: parent.right + + data: currentActionItem == undefined ? null : currentActionItem.content + } + + Cura.PrimaryButton + { + id: nextButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 40 + text: catalog.i18nc("@button", "Next") + width: 140 + fixedWidthMode: true + onClicked: + { + // If no more first-start actions to show, go to the next page. + if (currentActionIndex + 1 >= machineActionsModel.count) + { + currentActionIndex = 0 + base.showNextPage() + return + } + + currentActionIndex++ + } + } +} diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index bc99320e02..daca9bcb90 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -67,7 +67,7 @@ Item break } } - if (page_index > 0) + if (page_index >= 0) { currentStep = page_index } diff --git a/resources/qml/WelcomePages/TestContent.qml b/resources/qml/WelcomePages/TestContent.qml deleted file mode 100644 index 6071f965b2..0000000000 --- a/resources/qml/WelcomePages/TestContent.qml +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - -import UM 1.3 as UM -import Cura 1.1 as Cura - -import "../MachineSettings" -import "../Widgets" - - -// -// This component contains the content for the "Welcome" page of the welcome on-boarding process. -// - -Item -{ - id: base - UM.I18nCatalog { id: catalog; name: "cura" } - - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_margin").width - - property var extrudersModel: Cura.ExtrudersModel {} - - // If we create a CuraTabButton for "Printer" and use Repeater for extruders, for some reason, once the component - // finishes it will automatically change "currentIndex = 1", and it is VERY difficult to change "currentIndex = 0" - // after that. Using a model and a Repeater to create both "Printer" and extruder CuraTabButtons seem to solve this - // problem. - Connections - { - target: extrudersModel - onItemsChanged: tabNameModel.update() - } - - ListModel - { - id: tabNameModel - - Component.onCompleted: update() - - function update() - { - clear() - append({ name: catalog.i18nc("@title:tab", "Printer") }) - for (var i = 0; i < extrudersModel.count; i++) - { - const m = extrudersModel.getItem(i) - append({ name: m.name }) - } - } - } - - Rectangle - { - anchors.fill: parent - border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent" - border.width: UM.Theme.getSize("default_lining").width - radius: UM.Theme.getSize("default_radius").width - - UM.TabRow - { - id: tabBar - width: parent.width - - Repeater - { - model: tabNameModel - delegate: CuraTabButton - { - text: model.name - } - } - } - - StackLayout - { - id: tabStack - anchors.top: tabBar.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - width: parent.width - currentIndex: tabBar.currentIndex - - MachineSettingsPrinterTab - { - id: printerTab - } - - Repeater - { - model: extrudersModel - delegate: MachineSettingsExtruderTab - { - id: discoverTab - extruderPosition: model.index - extruderStackId: model.id - } - } - } - } -} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 62997cc27a..6de563e2a0 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -17,3 +17,20 @@ SettingView 1.0 SettingView.qml ProfileMenu 1.0 ProfileMenu.qml CheckBoxWithTooltip 1.0 CheckBoxWithTooltip.qml ToolTip 1.0 ToolTip.qml + + +# Cura/Widgets + +CuraCheckBox 1.0 CuraCheckBox.qml +CuraComboBox 1.0 CuraComboBox.qml +CuraProgressBar 1.0 CuraProgressBar.qml +CuraTabButton 1.0 CuraTabButton.qml + + +# Cura/MachineSettings + +ComboBoxWithOptions 1.0 ComboBoxWithOptions.qml +GcodeTextArea 1.0 GcodeTextArea.qml +NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml +PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml +SimpleCheckBox 1.0 SimpleCheckBox.qml From 3911c3d73d3d6eb6c46e574340fe32b7c4bafa1a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 14:47:21 +0100 Subject: [PATCH 061/211] WIP: Cleanup and unify MachineAction styles --- .../MachineSettingsAction.qml | 6 +-- .../BedLevelMachineAction.qml | 52 +++++++++++-------- .../UM2UpgradeSelection.py | 8 +-- .../UM2UpgradeSelectionMachineAction.qml | 38 ++++++-------- .../UMOUpgradeSelectionMachineAction.qml | 39 ++++++-------- .../qml/ActionPanel/SliceProcessWidget.qml | 4 +- .../MachineSettings/ComboBoxWithOptions.qml | 2 +- .../qml/MachineSettings/SimpleCheckBox.qml | 4 +- resources/qml/Settings/SettingComboBox.qml | 5 +- .../FirstStartMachineActionsContent.qml | 3 +- resources/qml/WelcomePages/StepPanel.qml | 4 +- .../{CuraCheckBox.qml => CheckBox.qml} | 2 +- .../{CuraComboBox.qml => ComboBox.qml} | 0 .../{CuraProgressBar.qml => ProgressBar.qml} | 0 .../{CuraTabButton.qml => TabButton.qml} | 0 resources/qml/qmldir | 8 +-- 16 files changed, 82 insertions(+), 93 deletions(-) rename resources/qml/Widgets/{CuraCheckBox.qml => CheckBox.qml} (97%) rename resources/qml/Widgets/{CuraComboBox.qml => ComboBox.qml} (100%) rename resources/qml/Widgets/{CuraProgressBar.qml => ProgressBar.qml} (100%) rename resources/qml/Widgets/{CuraTabButton.qml => TabButton.qml} (100%) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 28eb37e939..1521c38eaa 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -21,9 +21,9 @@ Cura.MachineAction property var extrudersModel: Cura.ExtrudersModel {} - // If we create a CuraTabButton for "Printer" and use Repeater for extruders, for some reason, once the component + // If we create a TabButton for "Printer" and use Repeater for extruders, for some reason, once the component // finishes it will automatically change "currentIndex = 1", and it is VERY difficult to change "currentIndex = 0" - // after that. Using a model and a Repeater to create both "Printer" and extruder CuraTabButtons seem to solve this + // after that. Using a model and a Repeater to create both "Printer" and extruder TabButtons seem to solve this // problem. Connections { @@ -64,7 +64,7 @@ Cura.MachineAction Repeater { model: tabNameModel - delegate: Cura.CuraTabButton + delegate: Cura.TabButton { text: model.name } diff --git a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml index 262d5df376..dac545990f 100644 --- a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml +++ b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml @@ -1,24 +1,27 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.3 as UM +import Cura 1.1 as Cura Cura.MachineAction { - anchors.fill: parent; + UM.I18nCatalog { id: catalog; name: "cura"; } + + anchors.fill: parent + Item { id: bedLevelMachineAction - anchors.fill: parent; - - UM.I18nCatalog { id: catalog; name: "cura"; } + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height * 3 + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 3 / 4 Label { @@ -26,17 +29,21 @@ Cura.MachineAction width: parent.width text: catalog.i18nc("@title", "Build Plate Leveling") wrapMode: Text.WordWrap - font.pointSize: 18; + font.pointSize: 18 + renderType: Text.NativeRendering } + Label { id: pageDescription anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.topMargin: UM.Theme.getSize("default_margin").height * 3 width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label", "To make sure your prints will come out great, you can now adjust your buildplate. When you click 'Move to Next Position' the nozzle will move to the different positions that can be adjusted.") + renderType: Text.NativeRendering } + Label { id: bedlevelingText @@ -45,37 +52,38 @@ Cura.MachineAction width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label", "For every position; insert a piece of paper under the nozzle and adjust the print build plate height. The print build plate height is right when the paper is slightly gripped by the tip of the nozzle.") + renderType: Text.NativeRendering } Row { id: bedlevelingWrapper anchors.top: bedlevelingText.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.topMargin: UM.Theme.getSize("default_margin").height * 3 anchors.horizontalCenter: parent.horizontalCenter width: childrenRect.width spacing: UM.Theme.getSize("default_margin").width - Button + Cura.ActionButton { id: startBedLevelingButton - text: catalog.i18nc("@action:button","Start Build Plate Leveling") + text: catalog.i18nc("@action:button", "Start Build Plate Leveling") onClicked: { - startBedLevelingButton.visible = false; - bedlevelingButton.visible = true; - manager.startBedLeveling(); + startBedLevelingButton.visible = false + bedlevelingButton.visible = true + manager.startBedLeveling() } } - Button + Cura.ActionButton { id: bedlevelingButton - text: catalog.i18nc("@action:button","Move to Next Position") + text: catalog.i18nc("@action:button", "Move to Next Position") visible: false onClicked: { - manager.moveToNextLevelPosition(); + manager.moveToNextLevelPosition() } } } diff --git a/plugins/UltimakerMachineActions/UM2UpgradeSelection.py b/plugins/UltimakerMachineActions/UM2UpgradeSelection.py index 6ff3f0b629..999cb1d35a 100644 --- a/plugins/UltimakerMachineActions/UM2UpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UM2UpgradeSelection.py @@ -1,13 +1,15 @@ # Copyright (c) 2018 Ultimaker B.V. # Uranium is released under the terms of the LGPLv3 or higher. -from UM.Settings.ContainerRegistry import ContainerRegistry -from cura.MachineAction import MachineAction -from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty +from PyQt5.QtCore import pyqtSignal, pyqtProperty +from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog from UM.Application import Application from UM.Util import parseBool + +from cura.MachineAction import MachineAction + catalog = i18nCatalog("cura") diff --git a/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml index 793f3f00a8..69023d3432 100644 --- a/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml +++ b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml @@ -1,32 +1,24 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.3 as UM +import Cura 1.1 as Cura Cura.MachineAction { - anchors.fill: parent; + UM.I18nCatalog { id: catalog; name: "cura"; } + anchors.fill: parent Item { id: upgradeSelectionMachineAction anchors.fill: parent - - Label - { - id: pageTitle - width: parent.width - text: catalog.i18nc("@title", "Select Printer Upgrades") - wrapMode: Text.WordWrap - font.pointSize: 18; - } + anchors.topMargin: UM.Theme.getSize("default_margin").width * 5 + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 4 Label { @@ -35,15 +27,19 @@ Cura.MachineAction anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker 2."); + text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker 2.") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } - CheckBox + Cura.CheckBox { id: olssonBlockCheckBox anchors.top: pageDescription.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height + height: UM.Theme.getSize("setting_control").height + text: catalog.i18nc("@label", "Olsson Block") checked: manager.hasVariants onClicked: manager.hasVariants = checked @@ -54,7 +50,5 @@ Cura.MachineAction onHasVariantsChanged: olssonBlockCheckBox.checked = manager.hasVariants } } - - UM.I18nCatalog { id: catalog; name: "cura"; } } -} \ No newline at end of file +} diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml index 2b973ca1bb..b0abad0fcf 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml @@ -1,43 +1,38 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.3 as UM +import Cura 1.1 as Cura Cura.MachineAction { - anchors.fill: parent; + UM.I18nCatalog { id: catalog; name: "cura"; } + anchors.fill: parent + Item { id: upgradeSelectionMachineAction anchors.fill: parent - - Label - { - id: pageTitle - width: parent.width - text: catalog.i18nc("@title", "Select Printer Upgrades") - wrapMode: Text.WordWrap - font.pointSize: 18; - } + anchors.topMargin: UM.Theme.getSize("default_margin").width * 5 + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 4 Label { id: pageDescription - anchors.top: pageTitle.bottom + anchors.top: parent.top anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker Original"); + text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker Original") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } - CheckBox + Cura.CheckBox { anchors.top: pageDescription.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -46,7 +41,5 @@ Cura.MachineAction checked: manager.hasHeatedBed onClicked: manager.setHeatedBed(checked) } - - UM.I18nCatalog { id: catalog; name: "cura"; } } -} \ No newline at end of file +} diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index f9ff706183..7030cd889a 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -9,8 +9,6 @@ import QtQuick.Controls 1.4 as Controls1 import UM 1.1 as UM import Cura 1.0 as Cura -import "../Widgets" - // This element contains all the elements the user needs to create a printjob from the // model(s) that is(are) on the buildplate. Mainly the button to start/stop the slicing @@ -66,7 +64,7 @@ Column } // Progress bar, only visible when the backend is in the process of slice the printjob - CuraProgressBar + Cura.ProgressBar { id: progressBar width: parent.width diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 012e36817b..bf56d1d58e 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -92,7 +92,7 @@ UM.TooltipArea onContainerStackChanged: defaultOptionsModel.updateModel() } - CuraComboBox + Cura.ComboBox { id: comboBox anchors.left: fieldLabel.right diff --git a/resources/qml/MachineSettings/SimpleCheckBox.qml b/resources/qml/MachineSettings/SimpleCheckBox.qml index 8aa65eff95..d2edc28487 100644 --- a/resources/qml/MachineSettings/SimpleCheckBox.qml +++ b/resources/qml/MachineSettings/SimpleCheckBox.qml @@ -8,8 +8,6 @@ import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.1 as Cura -import "../Widgets" - // // CheckBox widget for the on/off or true/false settings in the Machine Settings Dialog. @@ -58,7 +56,7 @@ UM.TooltipArea renderType: Text.NativeRendering } - CuraCheckBox + Cura.CheckBox { id: checkBox anchors.left: fieldLabel.right diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index d9ea47ac4d..37df0bd9b9 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -5,8 +5,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import UM 1.3 as UM - -import "../Widgets" as Widgets +import Cura 1.1 as Cura SettingItem @@ -14,7 +13,7 @@ SettingItem id: base property var focusItem: control - contents: Widgets.CuraComboBox + contents: Cura.ComboBox { id: control diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 84f5f5acac..0cd684e409 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -58,8 +58,7 @@ Item { anchors.top: titleLabel.bottom anchors.bottom: nextButton.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width anchors.left: parent.left anchors.right: parent.right diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index daca9bcb90..4cf6307a92 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -8,8 +8,6 @@ import QtGraphicalEffects 1.0 // For the dropshadow import UM 1.3 as UM import Cura 1.1 as Cura -import "../Widgets" - Item { @@ -117,7 +115,7 @@ Item z: panelBackground.z - 1 } - CuraProgressBar + Cura.ProgressBar { id: progressBar diff --git a/resources/qml/Widgets/CuraCheckBox.qml b/resources/qml/Widgets/CheckBox.qml similarity index 97% rename from resources/qml/Widgets/CuraCheckBox.qml rename to resources/qml/Widgets/CheckBox.qml index 865d9af5a2..c7536da6d3 100644 --- a/resources/qml/Widgets/CuraCheckBox.qml +++ b/resources/qml/Widgets/CheckBox.qml @@ -57,7 +57,7 @@ CheckBox width: Math.round(parent.width / 2.5) height: Math.round(parent.height / 2.5) sourceSize.height: width - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text"); + color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") source: UM.Theme.getIcon("check") opacity: control.checked ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100; } } diff --git a/resources/qml/Widgets/CuraComboBox.qml b/resources/qml/Widgets/ComboBox.qml similarity index 100% rename from resources/qml/Widgets/CuraComboBox.qml rename to resources/qml/Widgets/ComboBox.qml diff --git a/resources/qml/Widgets/CuraProgressBar.qml b/resources/qml/Widgets/ProgressBar.qml similarity index 100% rename from resources/qml/Widgets/CuraProgressBar.qml rename to resources/qml/Widgets/ProgressBar.qml diff --git a/resources/qml/Widgets/CuraTabButton.qml b/resources/qml/Widgets/TabButton.qml similarity index 100% rename from resources/qml/Widgets/CuraTabButton.qml rename to resources/qml/Widgets/TabButton.qml diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 6de563e2a0..7ca2b36b4b 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -21,10 +21,10 @@ ToolTip 1.0 ToolTip.qml # Cura/Widgets -CuraCheckBox 1.0 CuraCheckBox.qml -CuraComboBox 1.0 CuraComboBox.qml -CuraProgressBar 1.0 CuraProgressBar.qml -CuraTabButton 1.0 CuraTabButton.qml +CheckBox 1.0 CheckBox.qml +ComboBox 1.0 ComboBox.qml +ProgressBar 1.0 ProgressBar.qml +TabButton 1.0 TabButton.qml # Cura/MachineSettings From 09e317372e83eb8d3cda68f1d466d8a15d95c2a4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 15:47:46 +0100 Subject: [PATCH 062/211] WIP: Remove UMOCheckup MachineAction Not used any more. --- .../UMOCheckupMachineAction.py | 193 ------------ .../UMOCheckupMachineAction.qml | 288 ------------------ .../definitions/ultimaker_original.def.json | 4 +- .../ultimaker_original_dual.def.json | 4 +- .../ultimaker_original_plus.def.json | 4 +- 5 files changed, 6 insertions(+), 487 deletions(-) delete mode 100644 plugins/UltimakerMachineActions/UMOCheckupMachineAction.py delete mode 100644 plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py deleted file mode 100644 index f9ad4789e5..0000000000 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py +++ /dev/null @@ -1,193 +0,0 @@ -from cura.MachineAction import MachineAction -from cura.PrinterOutputDevice import PrinterOutputDevice -from UM.Application import Application -from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty - -from UM.Logger import Logger -from UM.i18n import i18nCatalog -catalog = i18nCatalog("cura") - - -## Action to check up if the self-built UMO was done correctly. -class UMOCheckupMachineAction(MachineAction): - def __init__(self): - super().__init__("UMOCheckup", catalog.i18nc("@action", "Checkup")) - self._qml_url = "UMOCheckupMachineAction.qml" - self._hotend_target_temp = 180 - self._bed_target_temp = 60 - self._output_device = None - self._bed_test_completed = False - self._hotend_test_completed = False - - # Endstop tests - self._x_min_endstop_test_completed = False - self._y_min_endstop_test_completed = False - self._z_min_endstop_test_completed = False - - self._check_started = False - - Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) - - onBedTestCompleted = pyqtSignal() - onHotendTestCompleted = pyqtSignal() - - onXMinEndstopTestCompleted = pyqtSignal() - onYMinEndstopTestCompleted = pyqtSignal() - onZMinEndstopTestCompleted = pyqtSignal() - - bedTemperatureChanged = pyqtSignal() - hotendTemperatureChanged = pyqtSignal() - - def _onOutputDevicesChanged(self): - # Check if this action was started, but no output device was found the first time. - # If so, re-try now that an output device has been added/removed. - if self._output_device is None and self._check_started: - self.startCheck() - - def _getPrinterOutputDevices(self): - return [printer_output_device for printer_output_device in - Application.getInstance().getOutputDeviceManager().getOutputDevices() if - isinstance(printer_output_device, PrinterOutputDevice)] - - def _reset(self): - if self._output_device: - self._output_device.bedTemperatureChanged.disconnect(self.bedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.disconnect(self.hotendTemperatureChanged) - self._output_device.bedTemperatureChanged.disconnect(self._onBedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.disconnect(self._onHotendTemperatureChanged) - self._output_device.endstopStateChanged.disconnect(self._onEndstopStateChanged) - try: - self._output_device.stopPollEndstop() - except AttributeError as e: # Connection is probably not a USB connection. Something went pretty wrong if this happens. - Logger.log("e", "An exception occurred while stopping end stop polling: %s" % str(e)) - - self._output_device = None - - self._check_started = False - self.checkStartedChanged.emit() - - # Ensure everything is reset (and right signals are emitted again) - self._bed_test_completed = False - self.onBedTestCompleted.emit() - self._hotend_test_completed = False - self.onHotendTestCompleted.emit() - - self._x_min_endstop_test_completed = False - self.onXMinEndstopTestCompleted.emit() - self._y_min_endstop_test_completed = False - self.onYMinEndstopTestCompleted.emit() - self._z_min_endstop_test_completed = False - self.onZMinEndstopTestCompleted.emit() - - self.heatedBedChanged.emit() - - @pyqtProperty(bool, notify = onBedTestCompleted) - def bedTestCompleted(self): - return self._bed_test_completed - - @pyqtProperty(bool, notify = onHotendTestCompleted) - def hotendTestCompleted(self): - return self._hotend_test_completed - - @pyqtProperty(bool, notify = onXMinEndstopTestCompleted) - def xMinEndstopTestCompleted(self): - return self._x_min_endstop_test_completed - - @pyqtProperty(bool, notify=onYMinEndstopTestCompleted) - def yMinEndstopTestCompleted(self): - return self._y_min_endstop_test_completed - - @pyqtProperty(bool, notify=onZMinEndstopTestCompleted) - def zMinEndstopTestCompleted(self): - return self._z_min_endstop_test_completed - - @pyqtProperty(float, notify = bedTemperatureChanged) - def bedTemperature(self): - if not self._output_device: - return 0 - return self._output_device.bedTemperature - - @pyqtProperty(float, notify=hotendTemperatureChanged) - def hotendTemperature(self): - if not self._output_device: - return 0 - return self._output_device.hotendTemperatures[0] - - def _onHotendTemperatureChanged(self): - if not self._output_device: - return - if not self._hotend_test_completed: - if self._output_device.hotendTemperatures[0] + 10 > self._hotend_target_temp and self._output_device.hotendTemperatures[0] - 10 < self._hotend_target_temp: - self._hotend_test_completed = True - self.onHotendTestCompleted.emit() - - def _onBedTemperatureChanged(self): - if not self._output_device: - return - if not self._bed_test_completed: - if self._output_device.bedTemperature + 5 > self._bed_target_temp and self._output_device.bedTemperature - 5 < self._bed_target_temp: - self._bed_test_completed = True - self.onBedTestCompleted.emit() - - def _onEndstopStateChanged(self, switch_type, state): - if state: - if switch_type == "x_min": - self._x_min_endstop_test_completed = True - self.onXMinEndstopTestCompleted.emit() - elif switch_type == "y_min": - self._y_min_endstop_test_completed = True - self.onYMinEndstopTestCompleted.emit() - elif switch_type == "z_min": - self._z_min_endstop_test_completed = True - self.onZMinEndstopTestCompleted.emit() - - checkStartedChanged = pyqtSignal() - - @pyqtProperty(bool, notify = checkStartedChanged) - def checkStarted(self): - return self._check_started - - @pyqtSlot() - def startCheck(self): - self._check_started = True - self.checkStartedChanged.emit() - output_devices = self._getPrinterOutputDevices() - if output_devices: - self._output_device = output_devices[0] - try: - self._output_device.sendCommand("M18") # Turn off all motors so the user can move the axes - self._output_device.startPollEndstop() - self._output_device.bedTemperatureChanged.connect(self.bedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.connect(self.hotendTemperatureChanged) - self._output_device.bedTemperatureChanged.connect(self._onBedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.connect(self._onHotendTemperatureChanged) - self._output_device.endstopStateChanged.connect(self._onEndstopStateChanged) - except AttributeError as e: # Connection is probably not a USB connection. Something went pretty wrong if this happens. - Logger.log("e", "An exception occurred while starting end stop polling: %s" % str(e)) - - @pyqtSlot() - def cooldownHotend(self): - if self._output_device is not None: - self._output_device.setTargetHotendTemperature(0, 0) - - @pyqtSlot() - def cooldownBed(self): - if self._output_device is not None: - self._output_device.setTargetBedTemperature(0) - - @pyqtSlot() - def heatupHotend(self): - if self._output_device is not None: - self._output_device.setTargetHotendTemperature(0, self._hotend_target_temp) - - @pyqtSlot() - def heatupBed(self): - if self._output_device is not None: - self._output_device.setTargetBedTemperature(self._bed_target_temp) - - heatedBedChanged = pyqtSignal() - - @pyqtProperty(bool, notify = heatedBedChanged) - def hasHeatedBed(self): - global_container_stack = Application.getInstance().getGlobalContainerStack() - return global_container_stack.getProperty("machine_heated_bed", "value") \ No newline at end of file diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml deleted file mode 100644 index 2a01cfaa40..0000000000 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml +++ /dev/null @@ -1,288 +0,0 @@ -import UM 1.2 as UM -import Cura 1.0 as Cura - -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 - -Cura.MachineAction -{ - anchors.fill: parent; - Item - { - id: checkupMachineAction - anchors.fill: parent; - property int leftRow: (checkupMachineAction.width * 0.40) | 0 - property int rightRow: (checkupMachineAction.width * 0.60) | 0 - property bool heatupHotendStarted: false - property bool heatupBedStarted: false - property bool printerConnected: Cura.MachineManager.printerConnected - - UM.I18nCatalog { id: catalog; name: "cura"} - Label - { - id: pageTitle - width: parent.width - text: catalog.i18nc("@title", "Check Printer") - wrapMode: Text.WordWrap - font.pointSize: 18; - } - - Label - { - id: pageDescription - anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional"); - } - - Row - { - id: startStopButtons - anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.horizontalCenter: parent.horizontalCenter - width: childrenRect.width - spacing: UM.Theme.getSize("default_margin").width - Button - { - id: startCheckButton - text: catalog.i18nc("@action:button","Start Printer Check"); - onClicked: - { - checkupMachineAction.heatupHotendStarted = false; - checkupMachineAction.heatupBedStarted = false; - manager.startCheck(); - startCheckButton.visible = false; - } - } - } - - Item - { - id: checkupContent - anchors.top: startStopButtons.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - visible: manager.checkStarted - width: parent.width - height: 250 - ////////////////////////////////////////////////////////// - Label - { - id: connectionLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: parent.top - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Connection: ") - } - Label - { - id: connectionStatus - width: checkupMachineAction.rightRow - anchors.left: connectionLabel.right - anchors.top: parent.top - wrapMode: Text.WordWrap - text: checkupMachineAction.printerConnected ? catalog.i18nc("@info:status","Connected"): catalog.i18nc("@info:status","Not connected") - } - ////////////////////////////////////////////////////////// - Label - { - id: endstopXLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: connectionLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop X: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopXStatus - width: checkupMachineAction.rightRow - anchors.left: endstopXLabel.right - anchors.top: connectionLabel.bottom - wrapMode: Text.WordWrap - text: manager.xMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - ////////////////////////////////////////////////////////////// - Label - { - id: endstopYLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: endstopXLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop Y: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopYStatus - width: checkupMachineAction.rightRow - anchors.left: endstopYLabel.right - anchors.top: endstopXLabel.bottom - wrapMode: Text.WordWrap - text: manager.yMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - ///////////////////////////////////////////////////////////////////// - Label - { - id: endstopZLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: endstopYLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop Z: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopZStatus - width: checkupMachineAction.rightRow - anchors.left: endstopZLabel.right - anchors.top: endstopYLabel.bottom - wrapMode: Text.WordWrap - text: manager.zMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - //////////////////////////////////////////////////////////// - Label - { - id: nozzleTempLabel - width: checkupMachineAction.leftRow - height: nozzleTempButton.height - anchors.left: parent.left - anchors.top: endstopZLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Nozzle temperature check: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: nozzleTempStatus - width: (checkupMachineAction.rightRow * 0.4) | 0 - anchors.top: nozzleTempLabel.top - anchors.left: nozzleTempLabel.right - wrapMode: Text.WordWrap - text: catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - Item - { - id: nozzleTempButton - width: (checkupMachineAction.rightRow * 0.3) | 0 - height: childrenRect.height - anchors.top: nozzleTempLabel.top - anchors.left: bedTempStatus.right - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2) - visible: checkupMachineAction.printerConnected - Button - { - text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") - onClicked: - { - if (checkupMachineAction.heatupHotendStarted) - { - manager.cooldownHotend() - checkupMachineAction.heatupHotendStarted = false - } else - { - manager.heatupHotend() - checkupMachineAction.heatupHotendStarted = true - } - } - } - } - Label - { - id: nozzleTemp - anchors.top: nozzleTempLabel.top - anchors.left: nozzleTempButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: (checkupMachineAction.rightRow * 0.2) | 0 - wrapMode: Text.WordWrap - text: manager.hotendTemperature + "°C" - font.bold: true - visible: checkupMachineAction.printerConnected - } - ///////////////////////////////////////////////////////////////////////////// - Label - { - id: bedTempLabel - width: checkupMachineAction.leftRow - height: bedTempButton.height - anchors.left: parent.left - anchors.top: nozzleTempLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Build plate temperature check:") - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - - Label - { - id: bedTempStatus - width: (checkupMachineAction.rightRow * 0.4) | 0 - anchors.top: bedTempLabel.top - anchors.left: bedTempLabel.right - wrapMode: Text.WordWrap - text: manager.bedTestCompleted ? catalog.i18nc("@info:status","Not checked"): catalog.i18nc("@info:status","Checked") - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - Item - { - id: bedTempButton - width: (checkupMachineAction.rightRow * 0.3) | 0 - height: childrenRect.height - anchors.top: bedTempLabel.top - anchors.left: bedTempStatus.right - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2) - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - Button - { - text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") - onClicked: - { - if (checkupMachineAction.heatupBedStarted) - { - manager.cooldownBed() - checkupMachineAction.heatupBedStarted = false - } else - { - manager.heatupBed() - checkupMachineAction.heatupBedStarted = true - } - } - } - } - Label - { - id: bedTemp - width: (checkupMachineAction.rightRow * 0.2) | 0 - anchors.top: bedTempLabel.top - anchors.left: bedTempButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - wrapMode: Text.WordWrap - text: manager.bedTemperature + "°C" - font.bold: true - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - Label - { - id: resultText - visible: false - anchors.top: bedTemp.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - width: parent.width - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "Everything is in order! You're done with your CheckUp.") - } - } - } -} \ No newline at end of file diff --git a/resources/definitions/ultimaker_original.def.json b/resources/definitions/ultimaker_original.def.json index 6a978c47cb..81d3261f45 100644 --- a/resources/definitions/ultimaker_original.def.json +++ b/resources/definitions/ultimaker_original.def.json @@ -12,8 +12,8 @@ "has_materials": true, "has_machine_quality": true, "exclude_materials": ["generic_hips", "generic_petg", "generic_bam", "ultimaker_bam", "generic_pva", "ultimaker_pva", "generic_tough_pla", "ultimaker_tough_pla_black", "ultimaker_tough_pla_green", "ultimaker_tough_pla_red", "ultimaker_tough_pla_white"], - "first_start_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"], - "supported_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"], + "first_start_actions": ["UMOUpgradeSelection", "BedLevel"], + "supported_actions": ["UMOUpgradeSelection", "BedLevel"], "machine_extruder_trains": { "0": "ultimaker_original_extruder_0" diff --git a/resources/definitions/ultimaker_original_dual.def.json b/resources/definitions/ultimaker_original_dual.def.json index 999650aa28..becd58f6de 100644 --- a/resources/definitions/ultimaker_original_dual.def.json +++ b/resources/definitions/ultimaker_original_dual.def.json @@ -20,8 +20,8 @@ }, "firmware_file": "MarlinUltimaker-{baudrate}-dual.hex", "firmware_hbk_file": "MarlinUltimaker-HBK-{baudrate}-dual.hex", - "first_start_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"], - "supported_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"] + "first_start_actions": ["UMOUpgradeSelection", "BedLevel"], + "supported_actions": ["UMOUpgradeSelection", "BedLevel"] }, "overrides": { diff --git a/resources/definitions/ultimaker_original_plus.def.json b/resources/definitions/ultimaker_original_plus.def.json index bdb8a3d788..949e2e8d0d 100644 --- a/resources/definitions/ultimaker_original_plus.def.json +++ b/resources/definitions/ultimaker_original_plus.def.json @@ -10,8 +10,8 @@ "platform": "ultimaker2_platform.obj", "platform_texture": "UltimakerPlusbackplate.png", "quality_definition": "ultimaker_original", - "first_start_actions": ["UMOCheckup", "BedLevel"], - "supported_actions": ["UMOCheckup", "BedLevel"], + "first_start_actions": ["BedLevel"], + "supported_actions": ["BedLevel"], "machine_extruder_trains": { "0": "ultimaker_original_plus_extruder_0" From 9d54064e7333c3a7d9e10119290bade47f2dad3f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 19 Mar 2019 15:49:09 +0100 Subject: [PATCH 063/211] WIP: Remove UMOCheckup MachineAction translations Not used any more --- resources/i18n/cura.pot | 100 --------------------------------- resources/i18n/de_DE/cura.po | 98 -------------------------------- resources/i18n/es_ES/cura.po | 98 -------------------------------- resources/i18n/fi_FI/cura.po | 98 -------------------------------- resources/i18n/fr_FR/cura.po | 98 -------------------------------- resources/i18n/it_IT/cura.po | 98 -------------------------------- resources/i18n/ja_JP/cura.po | 98 -------------------------------- resources/i18n/ko_KR/cura.po | 98 -------------------------------- resources/i18n/nl_NL/cura.po | 98 -------------------------------- resources/i18n/pl_PL/cura.po | 98 -------------------------------- resources/i18n/pt_BR/cura.po | 98 -------------------------------- resources/i18n/pt_PT/cura.po | 105 ----------------------------------- resources/i18n/ru_RU/cura.po | 98 -------------------------------- resources/i18n/tr_TR/cura.po | 98 -------------------------------- resources/i18n/zh_CN/cura.po | 98 -------------------------------- resources/i18n/zh_TW/cura.po | 98 -------------------------------- 16 files changed, 1577 deletions(-) diff --git a/resources/i18n/cura.pot b/resources/i18n/cura.pot index 749fdb65ee..133ca141f9 100644 --- a/resources/i18n/cura.pot +++ b/resources/i18n/cura.pot @@ -966,11 +966,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -3085,101 +3080,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "" -"It's a good idea to do a few sanity checks on your Ultimaker. You can skip " -"this step if you know your machine is functional" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "" - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/de_DE/cura.po b/resources/i18n/de_DE/cura.po index 11acb189fd..f2bb7728f5 100644 --- a/resources/i18n/de_DE/cura.po +++ b/resources/i18n/de_DE/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Upgrades wählen" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Check-up" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Beheizte Druckplatte (offizielles Kit oder Eigenbau)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Drucker prüfen" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Sie sollten einige Sanity Checks bei Ihrem Ultimaker durchführen. Sie können diesen Schritt überspringen, wenn Sie wissen, dass Ihr Gerät funktionsfähig ist" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Überprüfung des Druckers starten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Verbindung: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Verbunden" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Nicht verbunden" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Min. Endstopp X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Funktionsfähig" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Nicht überprüft" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Min. Endstopp Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Min. Endstopp Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Temperaturprüfung der Düse: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Aufheizen stoppen" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Aufheizen starten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Temperaturprüfung der Druckplatte:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Geprüft" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Alles ist in Ordnung! Der Check-up ist abgeschlossen." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/es_ES/cura.po b/resources/i18n/es_ES/cura.po index aa217b0275..5dc9662381 100644 --- a/resources/i18n/es_ES/cura.po +++ b/resources/i18n/es_ES/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Seleccionar actualizaciones" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Comprobación" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Placa de impresión caliente (kit oficial o construida por usted mismo)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Comprobar impresora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Es una buena idea hacer un par de comprobaciones en su Ultimaker. Puede omitir este paso si usted sabe que su máquina funciona correctamente" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Iniciar comprobación de impresora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Conexión: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Conectado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Sin conexión" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Parada final mín. en X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Funciona" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Sin comprobar" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Parada final mín. en Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Parada final mín. en Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Comprobación de la temperatura de la tobera: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Detener calentamiento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Iniciar calentamiento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Comprobación de la temperatura de la placa de impresión:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Comprobada" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "¡Todo correcto! Ha terminado con la comprobación." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/fi_FI/cura.po b/resources/i18n/fi_FI/cura.po index d07b032bad..5233112971 100644 --- a/resources/i18n/fi_FI/cura.po +++ b/resources/i18n/fi_FI/cura.po @@ -921,11 +921,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Valitse päivitykset" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Tarkastus" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2957,99 +2952,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Lämmitettävä alusta (virallinen sarja tai itse rakennettu)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Tarkista tulostin" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Ultimakerille on hyvä tehdä muutamia toimintatarkastuksia. Voit jättää tämän vaiheen väliin, jos tiedät laitteesi olevan toimintakunnossa" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Aloita tulostintarkistus" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Yhteys: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Yhdistetty" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Ei yhteyttä" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Min. päätyraja X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Toimii" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Ei tarkistettu" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Min. päätyraja Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Min. päätyraja Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Suuttimen lämpötilatarkistus: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Lopeta lämmitys" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Aloita lämmitys" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Alustan lämpötilan tarkistus:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Tarkistettu" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Kaikki on kunnossa! CheckUp on valmis." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/fr_FR/cura.po b/resources/i18n/fr_FR/cura.po index f7f48e9410..2be63006c0 100644 --- a/resources/i18n/fr_FR/cura.po +++ b/resources/i18n/fr_FR/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Sélectionner les mises à niveau" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Check-up" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Plateau chauffant (kit officiel ou fabriqué soi-même)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Tester l'imprimante" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Il est préférable de procéder à quelques tests de fonctionnement sur votre Ultimaker. Vous pouvez passer cette étape si vous savez que votre machine est fonctionnelle" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Démarrer le test de l'imprimante" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Connexion : " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Connecté" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Non connecté" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Fin de course X : " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Fonctionne" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Non testé" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Fin de course Y : " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Fin de course Z : " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Test de la température de la buse : " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Arrêter le chauffage" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Démarrer le chauffage" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Contrôle de la température du plateau :" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Contrôlée" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Tout est en ordre ! Vous avez terminé votre check-up." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/it_IT/cura.po b/resources/i18n/it_IT/cura.po index c857499eb3..8a1d650a0d 100644 --- a/resources/i18n/it_IT/cura.po +++ b/resources/i18n/it_IT/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Seleziona aggiornamenti" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Controllo" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Piano di stampa riscaldato (kit ufficiale o integrato)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Controllo stampante" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "È consigliabile eseguire alcuni controlli di integrità sulla Ultimaker. È possibile saltare questo passaggio se si è certi che la macchina funziona correttamente" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Avvia controllo stampante" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Collegamento: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Collegato" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Non collegato" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Endstop min. asse X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Funziona" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Controllo non selezionato" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Endstop min. asse Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Endstop min. asse Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Controllo temperatura ugello: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Arresto riscaldamento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Avvio riscaldamento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Controllo temperatura piano di stampa:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Controllo eseguito" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "È tutto in ordine! Controllo terminato." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/ja_JP/cura.po b/resources/i18n/ja_JP/cura.po index e57c3e4cea..28ab848f47 100644 --- a/resources/i18n/ja_JP/cura.po +++ b/resources/i18n/ja_JP/cura.po @@ -928,11 +928,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "アップグレードを選択する" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "チェックアップ" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2973,99 +2968,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "ヒーティッドビルドプレート(オフィシャルキットまたはセルフビルド)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "プリンターチェック" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "お持ちのUltimkaerにてサニティーチェックを数回行うことは推奨します。もしプリンター機能に問題ない場合はこの項目をスキップしてください" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "プリンターチェックを開始する" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "コネクション: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "接続済" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "プリンターにつながっていません" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "エンドストップ X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "作品" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "チェックされていません" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "エンドストップ Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "エンドストップ Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "ノズル温度チェック: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "ヒーティングストップ" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "ヒーティング開始" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "ビルドプレートの温度チェック:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "チェック済" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "すべてに異常はありません。チェックアップを終了しました。" - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/ko_KR/cura.po b/resources/i18n/ko_KR/cura.po index c3dd1a434f..11989a3285 100644 --- a/resources/i18n/ko_KR/cura.po +++ b/resources/i18n/ko_KR/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "업그레이드 선택" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "검사" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2971,99 +2966,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "히팅 빌드 플레이트 (공식 키트 또는 자체 조립식)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "프린터 확인" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Ultimaker에서 몇 가지 검사를 하는 것이 좋습니다. 기기가 제대로 작동한다고 생각이 되면 이 단계를 건너 뛸 수 있습니다" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "프린터 체 시작" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "연결 " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "연결됨" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "연결되지 않음" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "최소 엔드 스톱 X " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "작업" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "확인되지 않음" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "최소 엔드 스톱 Y " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "최소 엔드 스톱 Z " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "노즐 온도 확인 " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "가열 중지" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "가열 시작" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "빌드 플레이트 온도 확인 :" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "체크 됨" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "모든 점검이 순조롭게 끝났습니다." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/nl_NL/cura.po b/resources/i18n/nl_NL/cura.po index ce499a87d0..77d046cba1 100644 --- a/resources/i18n/nl_NL/cura.po +++ b/resources/i18n/nl_NL/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Upgrades selecteren" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Controle" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2969,99 +2964,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Verwarmd Platform (officiële kit of eigenbouw)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Printer Controleren" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Het wordt aangeraden een controle uit te voeren op de Ultimaker. U kunt deze stap overslaan als u zeker weet dat de machine correct functioneert" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Printercontrole Starten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Verbinding: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Aangesloten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Niet aangesloten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Min. eindstop X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Werkt" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Niet gecontroleerd" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Min. eindstop Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Min. eindstop Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Temperatuurcontrole nozzle: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Verwarmen Stoppen" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Verwarmen Starten" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Temperatuurcontrole platform:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Gecontroleerd" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Alles is in orde! De controle is voltooid." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/pl_PL/cura.po b/resources/i18n/pl_PL/cura.po index 10f01d54e1..9faffaea11 100644 --- a/resources/i18n/pl_PL/cura.po +++ b/resources/i18n/pl_PL/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Wybierz aktualizacje" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Sprawdzanie" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Płyta grzewcza (zestaw oficjalny lub własnej roboty)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Sprawdź drukarkę" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Dobrym pomysłem jest zrobienie kilku testów na swoim Ultimakera. Możesz pominąć ten krok, jeśli wiesz, że urządzenie jest funkcjonalne" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Rozpocznij sprawdzanie drukarki" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Połączenie: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Połączono" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Nie połączono" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Krańcówka min. X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Pracuje" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Niesprawdzone" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Krańcówka min. Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Krańcówka min. Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Sprawdzanie temperatury dyszy: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Zatrzymaj ogrzewanie" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Rozpocznij ogrzewanie" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Kontrola temperatury płyty konstrukcyjnej:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Sprawdzone" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Wszystko w porządku! Skończono sprawdzenie." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/pt_BR/cura.po b/resources/i18n/pt_BR/cura.po index 467c34786d..599fa75fcb 100644 --- a/resources/i18n/pt_BR/cura.po +++ b/resources/i18n/pt_BR/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Selecionar Atualizações" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Verificação" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Mesa de Impressão Aquecida (kit Oficial ou auto-construído)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Verificar Impressora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "É uma boa idéia fazer algumas verificações de sanidade em sua Ultimaker. Você pode pular este passo se você sabe que sua máquina está funcional" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Iniciar Verificação da Impressora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Conexão: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Conectado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Desconectado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Fim de curso mín. em X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Funciona" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Não verificado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Fim de curso mín. em Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Fim de curso mín. em Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Verificação da temperatura do bico: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Parar Aquecimento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Iniciar Aquecimento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Verificação da temperatura da mesa de impressão:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Verificado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Tudo está em ordem! A verificação terminou." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/pt_PT/cura.po b/resources/i18n/pt_PT/cura.po index 1822188c5a..a3237ca158 100644 --- a/resources/i18n/pt_PT/cura.po +++ b/resources/i18n/pt_PT/cura.po @@ -945,11 +945,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Selecionar atualizações" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Checkup" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -3008,106 +3003,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Base de Construção Aquecida (kit oficial ou de construção própria)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Verificar Impressora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "É recomendado efetuar algumas verificações de teste à sua Ultimaker. Pode ignorar este passo se souber que a sua máquina está funcional" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Iniciar Verificação da Impressora" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Ligação: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Ligado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Sem ligação" - -# rever! -# contexto?! -# X mín. de posição final: -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Mín. endstop X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Trabalhos" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Não verificado" - -# rever! -# contexto?! -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Mín. endstop Y: " - -# rever! -# contexto?! -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Mín. endstop Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Verificação da temperatura do nozzle: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Parar Aquecimento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Iniciar Aquecimento" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Verificação da temperatura da base de construção:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Verificado" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Está tudo em ordem! A verificação está concluída." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/ru_RU/cura.po b/resources/i18n/ru_RU/cura.po index 3ee414fb25..de4cecfdb0 100644 --- a/resources/i18n/ru_RU/cura.po +++ b/resources/i18n/ru_RU/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Выбор обновлений" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Проверка" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2977,99 +2972,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Нагреваемый стол (официальный набор или самодельный)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Проверка принтера" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Хорошей идеей будет выполнить несколько проверок вашего Ultimaker. Вы можете пропустить этот шаг, если уверены в функциональности своего принтера" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Начать проверку принтера" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Соединение: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Подключен" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Не подключен" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Минимальный концевик на оси X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "Работает" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Не проверен" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Минимальный концевик на оси Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Минимальный концевик на оси Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Проверка температуры сопла: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Завершение нагрева" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Начало нагрева" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Проверка температуры стола:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Проверена" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Всё в порядке! Проверка завершена." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/tr_TR/cura.po b/resources/i18n/tr_TR/cura.po index ce577a92b0..fd2cd5a396 100644 --- a/resources/i18n/tr_TR/cura.po +++ b/resources/i18n/tr_TR/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "Yükseltmeleri seçin" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "Kontrol" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2974,99 +2969,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "Isıtılmış Yapı Levhası (orijinal donanım veya şahsen yapılan)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "Yazıcıyı kontrol et" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "Ultimaker’ınızda birkaç uygunluk testi yapmak faydalı olabilir. Makinenizin işlevlerini yerine getirdiğini düşünüyorsanız bu adımı atlayabilirsiniz" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "Yazıcı Kontrolünü Başlat" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "Bağlantı: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "Bağlı" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "Bağlı değil" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "Min. Kapama X: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "İşlemler" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "Kontrol edilmedi" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Min. kapama Y: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Min. kapama Z: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "Nozül sıcaklık kontrolü: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "Isıtmayı Durdur" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "Isıtmayı Başlat" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "Yapı levhası sıcaklık kontrolü:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "Kontrol edildi" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "Her şey yolunda! Kontrol işlemini tamamladınız." - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/zh_CN/cura.po b/resources/i18n/zh_CN/cura.po index aac1415e84..c5ca0fe7b4 100644 --- a/resources/i18n/zh_CN/cura.po +++ b/resources/i18n/zh_CN/cura.po @@ -927,11 +927,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "选择升级" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "检查" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2971,99 +2966,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "热床(官方版本或自制)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "检查打印机" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "对 Ultimaker 进行几项正确性检查是很好的做法。如果您知道您的机器功能正常,则可跳过此步骤" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "开始打印机检查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "连接: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "已连接" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "未连接" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "X Min 限位开关: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "工作" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "未检查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Y Min 限位开关: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Z Min 限位开关: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "检查喷嘴温度: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "停止加热" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "开始加热" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "打印平台温度检查:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "已检查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "一切正常!你已经完成检查。" - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" diff --git a/resources/i18n/zh_TW/cura.po b/resources/i18n/zh_TW/cura.po index 61a311ff88..9050a47047 100644 --- a/resources/i18n/zh_TW/cura.po +++ b/resources/i18n/zh_TW/cura.po @@ -928,11 +928,6 @@ msgctxt "@action" msgid "Select upgrades" msgstr "選擇升級" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py:14 -msgctxt "@action" -msgid "Checkup" -msgstr "檢查" - #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/BedLevelMachineAction.py:21 msgctxt "@action" msgid "Level build plate" @@ -2972,99 +2967,6 @@ msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" msgstr "熱床(官方版本或自製版本)" -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:27 -msgctxt "@title" -msgid "Check Printer" -msgstr "檢查印表機" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:39 -msgctxt "@label" -msgid "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional" -msgstr "對 Ultimaker 進行幾項正確性檢查是很好的做法。如果你知道你的機器功能正常,則可跳過此步驟" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:53 -msgctxt "@action:button" -msgid "Start Printer Check" -msgstr "開始印表機檢查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:80 -msgctxt "@label" -msgid "Connection: " -msgstr "連線: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Connected" -msgstr "已連線" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:89 -msgctxt "@info:status" -msgid "Not connected" -msgstr "未連線" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:99 -msgctxt "@label" -msgid "Min endstop X: " -msgstr "X Min 限位開關: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -msgctxt "@info:status" -msgid "Works" -msgstr "正常" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:109 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:130 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:151 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:173 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Not checked" -msgstr "未檢查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:120 -msgctxt "@label" -msgid "Min endstop Y: " -msgstr "Y Min 限位開關: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:141 -msgctxt "@label" -msgid "Min endstop Z: " -msgstr "Z Min 限位開關: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:163 -msgctxt "@label" -msgid "Nozzle temperature check: " -msgstr "檢查噴頭溫度: " - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Stop Heating" -msgstr "停止加熱" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:187 -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:248 -msgctxt "@action:button" -msgid "Start Heating" -msgstr "開始加熱" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:223 -msgctxt "@label" -msgid "Build plate temperature check:" -msgstr "熱床溫度檢查:" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:234 -msgctxt "@info:status" -msgid "Checked" -msgstr "已檢查" - -#: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml:284 -msgctxt "@label" -msgid "Everything is in order! You're done with your CheckUp." -msgstr "一切正常!你已經完成檢查。" - #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus" msgid "Not connected to a printer" From a106a9ddb9daf1f3eed4c50921922dc22c05b558 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 08:41:01 +0100 Subject: [PATCH 064/211] WIP: Cleanup MachineSettingsAction --- .../Models/FirstStartMachineActionsModel.py | 4 + .../cura_empty_instance_containers.py | 20 ++- .../MachineSettingsAction.py | 116 +++++++----------- .../MachineSettingsExtruderTab.qml | 6 +- .../MachineSettingsPrinterTab.qml | 10 +- .../FirstStartMachineActionsContent.qml | 3 + 6 files changed, 76 insertions(+), 83 deletions(-) diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index b7e806278c..aabf8b8a8a 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -12,17 +12,20 @@ from UM.Qt.ListModel import ListModel # This model holds all first-start machine actions for the currently active machine. It has 2 roles: # - title : the title/name of the action # - content : the QObject of the QML content of the action +# - action : the MachineAction object itself # class FirstStartMachineActionsModel(ListModel): TitleRole = Qt.UserRole + 1 ContentRole = Qt.UserRole + 2 + ActionRole = Qt.UserRole + 3 def __init__(self, parent: Optional[QObject] = None) -> None: super().__init__(parent) self.addRoleName(self.TitleRole, "title") self.addRoleName(self.ContentRole, "content") + self.addRoleName(self.ActionRole, "action") from cura.CuraApplication import CuraApplication self._application = CuraApplication.getInstance() @@ -46,6 +49,7 @@ class FirstStartMachineActionsModel(ListModel): for item in first_start_actions: item_list.append({"title": item.label, "content": item.displayItem, + "action": item, }) self.setItems(item_list) diff --git a/cura/Settings/cura_empty_instance_containers.py b/cura/Settings/cura_empty_instance_containers.py index d76407ed79..534e6f4199 100644 --- a/cura/Settings/cura_empty_instance_containers.py +++ b/cura/Settings/cura_empty_instance_containers.py @@ -41,6 +41,22 @@ empty_quality_changes_container.setMetaDataEntry("type", "quality_changes") empty_quality_changes_container.setMetaDataEntry("quality_type", "not_supported") +# All empty container IDs set +ALL_EMPTY_CONTAINER_ID_SET = { + EMPTY_CONTAINER_ID, + EMPTY_DEFINITION_CHANGES_CONTAINER_ID, + EMPTY_VARIANT_CONTAINER_ID, + EMPTY_MATERIAL_CONTAINER_ID, + EMPTY_QUALITY_CONTAINER_ID, + EMPTY_QUALITY_CHANGES_CONTAINER_ID, +} + + +# Convenience function to check if a container ID represents an empty container. +def isEmptyContainer(container_id: str) -> bool: + return container_id in ALL_EMPTY_CONTAINER_ID_SET + + __all__ = ["EMPTY_CONTAINER_ID", "empty_container", # For convenience "EMPTY_DEFINITION_CHANGES_CONTAINER_ID", @@ -52,5 +68,7 @@ __all__ = ["EMPTY_CONTAINER_ID", "EMPTY_QUALITY_CHANGES_CONTAINER_ID", "empty_quality_changes_container", "EMPTY_QUALITY_CONTAINER_ID", - "empty_quality_container" + "empty_quality_container", + "ALL_EMPTY_CONTAINER_ID_SET", + "isEmptyContainer", ] diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index afd7aac86d..cddc4e5fe8 100755 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -1,16 +1,21 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import pyqtProperty, pyqtSignal +from typing import Optional, TYPE_CHECKING + +from PyQt5.QtCore import pyqtProperty import UM.i18n from UM.FlameProfiler import pyqtSlot -from UM.Application import Application from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.DefinitionContainer import DefinitionContainer from cura.MachineAction import MachineAction from cura.Settings.CuraStackBuilder import CuraStackBuilder +from cura.Settings.cura_empty_instance_containers import isEmptyContainer + +if TYPE_CHECKING: + from PyQt5.QtCore import QObject catalog = UM.i18n.i18nCatalog("cura") @@ -18,139 +23,102 @@ catalog = UM.i18n.i18nCatalog("cura") ## This action allows for certain settings that are "machine only") to be modified. # It automatically detects machine definitions that it knows how to change and attaches itself to those. class MachineSettingsAction(MachineAction): - def __init__(self, parent = None): + def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__("MachineSettingsAction", catalog.i18nc("@action", "Machine Settings")) self._qml_url = "MachineSettingsAction.qml" - self._application = Application.getInstance() - - self._global_container_stack = None + from cura.CuraApplication import CuraApplication + self._application = CuraApplication.getInstance() from cura.Settings.CuraContainerStack import _ContainerIndexes - self._container_index = _ContainerIndexes.DefinitionChanges + self._store_container_index = _ContainerIndexes.DefinitionChanges self._container_registry = ContainerRegistry.getInstance() self._container_registry.containerAdded.connect(self._onContainerAdded) - self._container_registry.containerRemoved.connect(self._onContainerRemoved) - self._application.globalContainerStackChanged.connect(self._onGlobalContainerChanged) + # The machine settings dialog blocks auto-slicing when it's shown, and re-enables it when it's finished. self._backend = self._application.getBackend() + self.onFinished.connect(self._onFinished) - self._empty_definition_container_id_list = [] - - def _isEmptyDefinitionChanges(self, container_id: str): - if not self._empty_definition_container_id_list: - self._empty_definition_container_id_list = [self._application.empty_container.getId(), - self._application.empty_definition_changes_container.getId()] - return container_id in self._empty_definition_container_id_list + # Which container index in a stack to store machine setting changes. + @pyqtProperty(int, constant = True) + def storeContainerIndex(self) -> int: + return self._store_container_index def _onContainerAdded(self, container): # Add this action as a supported action to all machine definitions if isinstance(container, DefinitionContainer) and container.getMetaDataEntry("type") == "machine": self._application.getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) - def _onContainerRemoved(self, container): - # Remove definition_changes containers when a stack is removed - if container.getMetaDataEntry("type") in ["machine", "extruder_train"]: - definition_changes_id = container.definitionChanges.getId() - if self._isEmptyDefinitionChanges(definition_changes_id): - return - def _reset(self): - if not self._global_container_stack: + global_stack = self._application.getMachineManager().activeMachine + if not global_stack: return # Make sure there is a definition_changes container to store the machine settings - definition_changes_id = self._global_container_stack.definitionChanges.getId() - if self._isEmptyDefinitionChanges(definition_changes_id): - CuraStackBuilder.createDefinitionChangesContainer(self._global_container_stack, - self._global_container_stack.getName() + "_settings") - - # Notify the UI in which container to store the machine settings data - from cura.Settings.CuraContainerStack import _ContainerIndexes - - container_index = _ContainerIndexes.DefinitionChanges - if container_index != self._container_index: - self._container_index = container_index - self.containerIndexChanged.emit() + definition_changes_id = global_stack.definitionChanges.getId() + if isEmptyContainer(definition_changes_id): + CuraStackBuilder.createDefinitionChangesContainer(global_stack, + global_stack.getName() + "_settings") # Disable auto-slicing while the MachineAction is showing if self._backend: # This sometimes triggers before backend is loaded. self._backend.disableTimer() - @pyqtSlot() - def onFinishAction(self): - # Restore autoslicing when the machineaction is dismissed + def _onFinished(self): + # Restore auto-slicing when the machine action is dismissed if self._backend and self._backend.determineAutoSlicing(): + self._backend.enableTimer() self._backend.tickle() - containerIndexChanged = pyqtSignal() - - @pyqtProperty(int, notify = containerIndexChanged) - def containerIndex(self): - return self._container_index - - def _onGlobalContainerChanged(self): - self._global_container_stack = Application.getInstance().getGlobalContainerStack() - - # This additional emit is needed because we cannot connect a UM.Signal directly to a pyqtSignal - self.globalContainerChanged.emit() - - globalContainerChanged = pyqtSignal() - - @pyqtProperty(int, notify = globalContainerChanged) - def definedExtruderCount(self): - if not self._global_container_stack: - return 0 - - return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains")) - @pyqtSlot(int) - def setMachineExtruderCount(self, extruder_count): + def setMachineExtruderCount(self, extruder_count: int) -> None: # Note: this method was in this class before, but since it's quite generic and other plugins also need it # it was moved to the machine manager instead. Now this method just calls the machine manager. self._application.getMachineManager().setActiveMachineExtruderCount(extruder_count) @pyqtSlot() - def forceUpdate(self): + def forceUpdate(self) -> None: # Force rebuilding the build volume by reloading the global container stack. # This is a bit of a hack, but it seems quick enough. - self._application.globalContainerStackChanged.emit() + self._application.getMachineManager().globalContainerChanged.emit() @pyqtSlot() - def updateHasMaterialsMetadata(self): + def updateHasMaterialsMetadata(self) -> None: + global_stack = self._application.getMachineManager().activeMachine + # Updates the has_materials metadata flag after switching gcode flavor - if not self._global_container_stack: + if not global_stack: return - definition = self._global_container_stack.getBottom() + definition = global_stack.getDefinition() if definition.getProperty("machine_gcode_flavor", "value") != "UltiGCode" or definition.getMetaDataEntry("has_materials", False): # In other words: only continue for the UM2 (extended), but not for the UM2+ return machine_manager = self._application.getMachineManager() material_manager = self._application.getMaterialManager() - extruder_positions = list(self._global_container_stack.extruders.keys()) - has_materials = self._global_container_stack.getProperty("machine_gcode_flavor", "value") != "UltiGCode" + extruder_positions = list(global_stack.extruders.keys()) + has_materials = global_stack.getProperty("machine_gcode_flavor", "value") != "UltiGCode" material_node = None if has_materials: - self._global_container_stack.setMetaDataEntry("has_materials", True) + global_stack.setMetaDataEntry("has_materials", True) else: # The metadata entry is stored in an ini, and ini files are parsed as strings only. # Because any non-empty string evaluates to a boolean True, we have to remove the entry to make it False. - if "has_materials" in self._global_container_stack.getMetaData(): - self._global_container_stack.removeMetaDataEntry("has_materials") + if "has_materials" in global_stack.getMetaData(): + global_stack.removeMetaDataEntry("has_materials") # set materials for position in extruder_positions: if has_materials: - material_node = material_manager.getDefaultMaterial(self._global_container_stack, position, None) + material_node = material_manager.getDefaultMaterial(global_stack, position, None) machine_manager.setMaterial(position, material_node) self._application.globalContainerStackChanged.emit() @pyqtSlot(int) - def updateMaterialForDiameter(self, extruder_position: int): + def updateMaterialForDiameter(self, extruder_position: int) -> None: # Updates the material container to a material that matches the material diameter set for the printer self._application.getMachineManager().updateMaterialWithVariant(str(extruder_position)) diff --git a/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml index 270bd7e828..f941d13561 100644 --- a/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml @@ -26,15 +26,15 @@ Item property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 property int columnSpacing: 3 - property int propertyStoreIndex: 5 // definition_changes + property int propertyStoreIndex: manager.storeContainerIndex // definition_changes property string extruderStackId: "" property int extruderPosition: 0 - property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate + property var forceUpdateFunction: manager.forceUpdate function updateMaterialDiameter() { - CuraApplication.getMachineSettingsManager().updateMaterialForDiameter(extruderPosition) + manager.updateMaterialForDiameter(extruderPosition) } Item diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index c952e4cfb3..d9c6bcf539 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -26,11 +26,11 @@ Item property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 property int columnSpacing: 3 - property int propertyStoreIndex: 5 // definition_changes + property int propertyStoreIndex: manager.storeContainerIndex // definition_changes property string machineStackId: Cura.MachineManager.activeMachineId - property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate + property var forceUpdateFunction: manager.forceUpdate Item { @@ -153,7 +153,7 @@ Item // FIXME(Lipu): better document this. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings. // I don't remember exactly what. - afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata + afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata } } @@ -277,8 +277,8 @@ Item // FIXME(Lipu): better document this. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings. // I don't remember exactly what. - afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata - setValueFunction: CuraApplication.getMachineSettingsManager().setMachineExtruderCount + afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata + setValueFunction: manager.setMachineExtruderCount optionModel: ListModel { diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 0cd684e409..1bc4b7c284 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -84,6 +84,9 @@ Item return } + // notify the current MachineAction that it has finished + currentActionItem.action.setFinished() + // move on to the next MachineAction currentActionIndex++ } } From f810f94b8a30da3603b4333e63f1fb5c94343a14 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 08:59:45 +0100 Subject: [PATCH 065/211] WIP: Fix null warning in SettingsMenu.qml --- resources/qml/Menus/SettingsMenu.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/SettingsMenu.qml b/resources/qml/Menus/SettingsMenu.qml index 00337ea8e1..f1f594f395 100644 --- a/resources/qml/Menus/SettingsMenu.qml +++ b/resources/qml/Menus/SettingsMenu.qml @@ -14,12 +14,14 @@ Menu PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } + property var activeMachine: Cura.MachineManager.activeMachine + onAboutToShow: extruderInstantiator.active = true onAboutToHide: extruderInstantiator.active = false Instantiator { id: extruderInstantiator - model: Cura.MachineManager.activeMachine.extruderList + model: activeMachine == null ? null : activeMachine.extruderList active: false asynchronous: true Menu From bfd0444fbf81cbd917df4e5302dd682b70e2ad38 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:05:38 +0100 Subject: [PATCH 066/211] dos2unix CuraStage.py --- cura/Stages/CuraStage.py | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/cura/Stages/CuraStage.py b/cura/Stages/CuraStage.py index 844b0d0768..2ab1f34353 100644 --- a/cura/Stages/CuraStage.py +++ b/cura/Stages/CuraStage.py @@ -1,29 +1,29 @@ -# Copyright (c) 2018 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -from PyQt5.QtCore import pyqtProperty, QUrl - -from UM.Stage import Stage - - -# Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure -# to indicate this. -# * The StageMenuComponent is the horizontal area below the stage bar. This should be used to show stage specific -# buttons and elements. This component will be drawn over the bar & main component. -# * The MainComponent is the component that will be drawn starting from the bottom of the stageBar and fills the rest -# of the screen. -class CuraStage(Stage): - def __init__(self, parent = None) -> None: - super().__init__(parent) - - @pyqtProperty(str, constant = True) - def stageId(self) -> str: - return self.getPluginId() - - @pyqtProperty(QUrl, constant = True) - def mainComponent(self) -> QUrl: - return self.getDisplayComponent("main") - - @pyqtProperty(QUrl, constant = True) - def stageMenuComponent(self) -> QUrl: - return self.getDisplayComponent("menu") \ No newline at end of file +# Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from PyQt5.QtCore import pyqtProperty, QUrl + +from UM.Stage import Stage + + +# Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure +# to indicate this. +# * The StageMenuComponent is the horizontal area below the stage bar. This should be used to show stage specific +# buttons and elements. This component will be drawn over the bar & main component. +# * The MainComponent is the component that will be drawn starting from the bottom of the stageBar and fills the rest +# of the screen. +class CuraStage(Stage): + def __init__(self, parent = None) -> None: + super().__init__(parent) + + @pyqtProperty(str, constant = True) + def stageId(self) -> str: + return self.getPluginId() + + @pyqtProperty(QUrl, constant = True) + def mainComponent(self) -> QUrl: + return self.getDisplayComponent("main") + + @pyqtProperty(QUrl, constant = True) + def stageMenuComponent(self) -> QUrl: + return self.getDisplayComponent("menu") From 5eb51c6cd426c6f26478be7ad2325c217faddfcf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:07:15 +0100 Subject: [PATCH 067/211] Move CuraStage into cura.UI module --- cura/Stages/__init__.py | 2 -- cura/{Stages => UI}/CuraStage.py | 3 +++ plugins/MonitorStage/MonitorStage.py | 4 +--- plugins/PrepareStage/PrepareStage.py | 2 +- plugins/PreviewStage/PreviewStage.py | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 cura/Stages/__init__.py rename cura/{Stages => UI}/CuraStage.py (97%) diff --git a/cura/Stages/__init__.py b/cura/Stages/__init__.py deleted file mode 100644 index 2977645166..0000000000 --- a/cura/Stages/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright (c) 2017 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. diff --git a/cura/Stages/CuraStage.py b/cura/UI/CuraStage.py similarity index 97% rename from cura/Stages/CuraStage.py rename to cura/UI/CuraStage.py index 2ab1f34353..6c4d46dd72 100644 --- a/cura/Stages/CuraStage.py +++ b/cura/UI/CuraStage.py @@ -27,3 +27,6 @@ class CuraStage(Stage): @pyqtProperty(QUrl, constant = True) def stageMenuComponent(self) -> QUrl: return self.getDisplayComponent("menu") + + +__all__ = ["CuraStage"] diff --git a/plugins/MonitorStage/MonitorStage.py b/plugins/MonitorStage/MonitorStage.py index 69b7f20f4e..4dae6b8579 100644 --- a/plugins/MonitorStage/MonitorStage.py +++ b/plugins/MonitorStage/MonitorStage.py @@ -2,9 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. import os.path from UM.Application import Application -from UM.PluginRegistry import PluginRegistry -from UM.Resources import Resources -from cura.Stages.CuraStage import CuraStage +from cura.UI.CuraStage import CuraStage ## Stage for monitoring a 3D printing while it's printing. diff --git a/plugins/PrepareStage/PrepareStage.py b/plugins/PrepareStage/PrepareStage.py index c2dee9693b..8150efca09 100644 --- a/plugins/PrepareStage/PrepareStage.py +++ b/plugins/PrepareStage/PrepareStage.py @@ -4,7 +4,7 @@ import os.path from UM.Application import Application from UM.PluginRegistry import PluginRegistry -from cura.Stages.CuraStage import CuraStage +from cura.UI.CuraStage import CuraStage ## Stage for preparing model (slicing). class PrepareStage(CuraStage): diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index 1c487c8340..eff307418e 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -4,7 +4,7 @@ import os.path from UM.Qt.QtApplication import QtApplication -from cura.Stages.CuraStage import CuraStage +from cura.UI.CuraStage import CuraStage from typing import TYPE_CHECKING, Optional From b6216bf4a34ebefdfd7321be325eeee620fe908f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:08:14 +0100 Subject: [PATCH 068/211] Move CuraSplashScreen into cura.UI module --- cura/CuraApplication.py | 3 +-- cura/{ => UI}/CuraSplashScreen.py | 0 2 files changed, 1 insertion(+), 2 deletions(-) rename cura/{ => UI}/CuraSplashScreen.py (100%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1192455312..7a193401b9 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -48,7 +48,6 @@ from cura.Arranging.Arrange import Arrange from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray -from cura.MultiplyObjectsJob import MultiplyObjectsJob from cura.GlobalStacksModel import GlobalStacksModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation @@ -96,7 +95,7 @@ from . import CameraAnimation from . import PrintInformation from . import CuraActions from cura.Scene import ZOffsetDecorator -from . import CuraSplashScreen +from cura.UI import CuraSplashScreen from . import PrintJobPreviewImageProvider from . import MachineActionManager diff --git a/cura/CuraSplashScreen.py b/cura/UI/CuraSplashScreen.py similarity index 100% rename from cura/CuraSplashScreen.py rename to cura/UI/CuraSplashScreen.py From 8c0cb2b7b8c864165f09b03b9d88262f56542f6e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:09:48 +0100 Subject: [PATCH 069/211] Move GlobalStackModel into cura.UI module --- cura/CuraApplication.py | 2 +- cura/{ => UI}/GlobalStacksModel.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) rename cura/{ => UI}/GlobalStacksModel.py (89%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7a193401b9..63304b3f8c 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -48,7 +48,7 @@ from cura.Arranging.Arrange import Arrange from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray -from cura.GlobalStacksModel import GlobalStacksModel +from cura.UI.GlobalStacksModel import GlobalStacksModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator diff --git a/cura/GlobalStacksModel.py b/cura/UI/GlobalStacksModel.py similarity index 89% rename from cura/GlobalStacksModel.py rename to cura/UI/GlobalStacksModel.py index a6d64cfc02..639f0b305f 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/UI/GlobalStacksModel.py @@ -19,7 +19,7 @@ class GlobalStacksModel(ListModel): MetaDataRole = Qt.UserRole + 5 SectionNameRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page - def __init__(self, parent = None): + def __init__(self, parent = None) -> None: super().__init__(parent) self._catalog = i18nCatalog("cura") @@ -44,12 +44,12 @@ class GlobalStacksModel(ListModel): self._updateDelayed() ## Handler for container added/removed events from registry - def _onContainerChanged(self, container): + def _onContainerChanged(self, container) -> None: # We only need to update when the added / removed container GlobalStack if isinstance(container, GlobalStack): self._updateDelayed() - def _updateDelayed(self): + def _updateDelayed(self) -> None: self._change_timer.start() def _update(self) -> None: @@ -61,7 +61,8 @@ class GlobalStacksModel(ListModel): has_remote_connection = False for connection_type in container_stack.configuredConnectionTypes: - has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] + has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, + ConnectionType.CloudConnection.value] if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue @@ -74,5 +75,5 @@ class GlobalStacksModel(ListModel): "hasRemoteConnection": has_remote_connection, "metadata": container_stack.getMetaData().copy(), "sectionName": section_name}) - items.sort(key=lambda i: not i["hasRemoteConnection"]) + items.sort(key = lambda i: not i["hasRemoteConnection"]) self.setItems(items) From dfc53d360481bf158c57ebbf6b5392d88a5d013b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:10:48 +0100 Subject: [PATCH 070/211] Move MachineActionManager into cura.UI module --- cura/CuraApplication.py | 3 +-- cura/{ => UI}/MachineActionManager.py | 2 +- tests/TestMachineAction.py | 2 +- tests/conftest.py | 5 +---- 4 files changed, 4 insertions(+), 8 deletions(-) rename cura/{ => UI}/MachineActionManager.py (99%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 63304b3f8c..79fd2ea632 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -95,9 +95,8 @@ from . import CameraAnimation from . import PrintInformation from . import CuraActions from cura.Scene import ZOffsetDecorator -from cura.UI import CuraSplashScreen +from cura.UI import CuraSplashScreen, MachineActionManager from . import PrintJobPreviewImageProvider -from . import MachineActionManager from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager diff --git a/cura/MachineActionManager.py b/cura/UI/MachineActionManager.py similarity index 99% rename from cura/MachineActionManager.py rename to cura/UI/MachineActionManager.py index db0f7bfbff..ef6a7dc6c4 100644 --- a/cura/MachineActionManager.py +++ b/cura/UI/MachineActionManager.py @@ -12,7 +12,7 @@ from UM.PluginRegistry import PluginRegistry # So MachineAction can be added as if TYPE_CHECKING: from cura.CuraApplication import CuraApplication from cura.Settings.GlobalStack import GlobalStack - from .MachineAction import MachineAction + from cura.MachineAction import MachineAction ## Raised when trying to add an unknown machine action as a required action diff --git a/tests/TestMachineAction.py b/tests/TestMachineAction.py index f1487a1d9f..9b0cb0a4a0 100755 --- a/tests/TestMachineAction.py +++ b/tests/TestMachineAction.py @@ -4,7 +4,7 @@ import pytest from cura.MachineAction import MachineAction -from cura.MachineActionManager import NotUniqueMachineActionError, UnknownMachineActionError +from cura.UI.MachineActionManager import NotUniqueMachineActionError, UnknownMachineActionError from cura.Settings.GlobalStack import GlobalStack diff --git a/tests/conftest.py b/tests/conftest.py index b21b32b028..5336c28fba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,11 +6,8 @@ import unittest.mock import pytest -import Arcus #Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first! -import Savitar -from UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used. from cura.CuraApplication import CuraApplication -from cura.MachineActionManager import MachineActionManager +from cura.UI.MachineActionManager import MachineActionManager # Create a CuraApplication object that will be shared among all tests. It needs to be initialized. From 228270d9d5486be66de06c1baaa2362c5d618960 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:12:21 +0100 Subject: [PATCH 071/211] Move ObjectModel into cura.UI module --- cura/CuraApplication.py | 2 +- cura/Scene/CuraSceneController.py | 2 +- cura/{ => UI}/ObjectsModel.py | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) rename cura/{ => UI}/ObjectsModel.py (95%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 79fd2ea632..07a2e97a64 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -110,7 +110,7 @@ from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsMode import cura.Settings.cura_empty_instance_containers from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions -from cura.ObjectsModel import ObjectsModel +from cura.UI.ObjectsModel import ObjectsModel from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index 9f26ea7cc3..91ff26cadc 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import Qt, pyqtSlot, QObject from PyQt5.QtWidgets import QApplication from UM.Scene.Camera import Camera -from cura.ObjectsModel import ObjectsModel +from cura.UI.ObjectsModel import ObjectsModel from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from UM.Application import Application diff --git a/cura/ObjectsModel.py b/cura/UI/ObjectsModel.py similarity index 95% rename from cura/ObjectsModel.py rename to cura/UI/ObjectsModel.py index f9f923b31d..4d0233f6cb 100644 --- a/cura/ObjectsModel.py +++ b/cura/UI/ObjectsModel.py @@ -1,6 +1,8 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from collections import defaultdict + from PyQt5.QtCore import QTimer from UM.Application import Application @@ -10,7 +12,6 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.SceneNode import SceneNode from UM.Scene.Selection import Selection from UM.i18n import i18nCatalog -from collections import defaultdict catalog = i18nCatalog("cura") @@ -30,19 +31,19 @@ class ObjectsModel(ListModel): self._build_plate_number = -1 - def setActiveBuildPlate(self, nr): + def setActiveBuildPlate(self, nr: int) -> None: if self._build_plate_number != nr: self._build_plate_number = nr self._update() - def _updateSceneDelayed(self, source): + def _updateSceneDelayed(self, source) -> None: if not isinstance(source, Camera): self._update_timer.start() - def _updateDelayed(self, *args): + def _updateDelayed(self, *args) -> None: self._update_timer.start() - def _update(self, *args): + def _update(self, *args) -> None: nodes = [] filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate") active_build_plate_number = self._build_plate_number From 5848174ad4c8eeb267fb013271f50f5380d3a8ca Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:13:38 +0100 Subject: [PATCH 072/211] Move PrintInformation into cura.UI module --- cura/CuraApplication.py | 3 +-- cura/{ => UI}/PrintInformation.py | 5 +---- tests/TestPrintInformation.py | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) rename cura/{ => UI}/PrintInformation.py (99%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 07a2e97a64..165a2a4feb 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -92,10 +92,9 @@ from .AutoSave import AutoSave from . import PlatformPhysics from . import BuildVolume from . import CameraAnimation -from . import PrintInformation from . import CuraActions from cura.Scene import ZOffsetDecorator -from cura.UI import CuraSplashScreen, MachineActionManager +from cura.UI import CuraSplashScreen, MachineActionManager, PrintInformation from . import PrintJobPreviewImageProvider from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager diff --git a/cura/PrintInformation.py b/cura/UI/PrintInformation.py similarity index 99% rename from cura/PrintInformation.py rename to cura/UI/PrintInformation.py index ba7c74fd6d..2122abbe82 100644 --- a/cura/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -5,8 +5,7 @@ import json import math import os import unicodedata -import re # To create abbreviations for printer names. -from typing import Dict, List, Optional +from typing import Dict, List, Optional, TYPE_CHECKING from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot @@ -16,8 +15,6 @@ from UM.Scene.SceneNode import SceneNode from UM.i18n import i18nCatalog from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError -from typing import TYPE_CHECKING - if TYPE_CHECKING: from cura.CuraApplication import CuraApplication diff --git a/tests/TestPrintInformation.py b/tests/TestPrintInformation.py index 177643bc90..66af734d89 100644 --- a/tests/TestPrintInformation.py +++ b/tests/TestPrintInformation.py @@ -1,7 +1,7 @@ import functools from UM.Qt.Duration import Duration -from cura import PrintInformation +from cura.UI import PrintInformation from cura.Settings.MachineManager import MachineManager from unittest.mock import MagicMock, patch From e1d26da5284f1a7759e6e328d98f1be6df37b0a7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:19:30 +0100 Subject: [PATCH 073/211] Move ExtrudersModel into cura.UI module --- cura/CuraApplication.py | 2 +- cura/{Settings => UI}/ExtrudersModel.py | 10 ++++++---- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) rename cura/{Settings => UI}/ExtrudersModel.py (97%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 165a2a4feb..a8f4d841a4 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -102,7 +102,7 @@ from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager from cura.Settings.MachineManager import MachineManager from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.UserChangesModel import UserChangesModel -from cura.Settings.ExtrudersModel import ExtrudersModel +from cura.UI.ExtrudersModel import ExtrudersModel from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler from cura.Settings.ContainerManager import ContainerManager from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsModel diff --git a/cura/Settings/ExtrudersModel.py b/cura/UI/ExtrudersModel.py similarity index 97% rename from cura/Settings/ExtrudersModel.py rename to cura/UI/ExtrudersModel.py index 93cc1ce402..9eee7f5f9e 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/UI/ExtrudersModel.py @@ -2,23 +2,25 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer -from typing import Iterable +from typing import Iterable, TYPE_CHECKING from UM.i18n import i18nCatalog -import UM.Qt.ListModel +from UM.Qt.ListModel import ListModel from UM.Application import Application import UM.FlameProfiler -from cura.Settings.ExtruderStack import ExtruderStack # To listen to changes on the extruders. +if TYPE_CHECKING: + from cura.Settings.ExtruderStack import ExtruderStack # To listen to changes on the extruders. catalog = i18nCatalog("cura") + ## Model that holds extruders. # # This model is designed for use by any list of extruders, but specifically # intended for drop-down lists of the current machine's extruders in place of # settings. -class ExtrudersModel(UM.Qt.ListModel.ListModel): +class ExtrudersModel(ListModel): # The ID of the container stack for the extruder. IdRole = Qt.UserRole + 1 diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 3cc23130ea..312de71e11 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -24,7 +24,7 @@ from cura import LayerPolygon import numpy from time import time -from cura.Settings.ExtrudersModel import ExtrudersModel +from cura.UI.ExtrudersModel import ExtrudersModel catalog = i18nCatalog("cura") From 1f5cf62a7c2801204a7a3abd3ef1b8b5c0fbbe39 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:22:42 +0100 Subject: [PATCH 074/211] Move UserChangesModel into cura.UI module --- cura/CuraApplication.py | 2 +- cura/{Settings => UI}/UserChangesModel.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) rename cura/{Settings => UI}/UserChangesModel.py (99%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a8f4d841a4..287e1a4da9 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -101,7 +101,7 @@ from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager from cura.Settings.MachineManager import MachineManager from cura.Settings.ExtruderManager import ExtruderManager -from cura.Settings.UserChangesModel import UserChangesModel +from cura.UI.UserChangesModel import UserChangesModel from cura.UI.ExtrudersModel import ExtrudersModel from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler from cura.Settings.ContainerManager import ContainerManager diff --git a/cura/Settings/UserChangesModel.py b/cura/UI/UserChangesModel.py similarity index 99% rename from cura/Settings/UserChangesModel.py rename to cura/UI/UserChangesModel.py index 9a26e5607e..e629295397 100644 --- a/cura/Settings/UserChangesModel.py +++ b/cura/UI/UserChangesModel.py @@ -10,7 +10,6 @@ from UM.Application import Application from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog from UM.Settings.SettingFunction import SettingFunction - from UM.Qt.ListModel import ListModel From e30104ff7fa541f10ac333ae9df684acf6784656 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:25:37 +0100 Subject: [PATCH 075/211] Move PrintJobOutputModel into cura.UI module --- cura/PrinterOutput/GenericOutputController.py | 2 +- cura/PrinterOutput/PrinterOutputController.py | 4 +--- cura/PrinterOutput/PrinterOutputModel.py | 2 +- cura/{PrinterOutput => UI}/PrintJobOutputModel.py | 9 ++++----- .../src/ClusterUM3PrinterOutputController.py | 2 +- plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py | 2 +- .../src/LegacyUM3PrinterOutputController.py | 2 +- plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- tests/PrinterOutput/TestPrinterOutputModel.py | 2 +- tests/{PrinterOutput => UI}/TestPrintJobOutputModel.py | 2 +- 11 files changed, 14 insertions(+), 17 deletions(-) rename cura/{PrinterOutput => UI}/PrintJobOutputModel.py (97%) rename tests/{PrinterOutput => UI}/TestPrintJobOutputModel.py (97%) diff --git a/cura/PrinterOutput/GenericOutputController.py b/cura/PrinterOutput/GenericOutputController.py index 1cb416787c..a48b08dfed 100644 --- a/cura/PrinterOutput/GenericOutputController.py +++ b/cura/PrinterOutput/GenericOutputController.py @@ -7,7 +7,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from PyQt5.QtCore import QTimer if TYPE_CHECKING: - from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel diff --git a/cura/PrinterOutput/PrinterOutputController.py b/cura/PrinterOutput/PrinterOutputController.py index aa06ada8a3..9d071d44ce 100644 --- a/cura/PrinterOutput/PrinterOutputController.py +++ b/cura/PrinterOutput/PrinterOutputController.py @@ -4,11 +4,9 @@ from UM.Logger import Logger from UM.Signal import Signal -from typing import Union - MYPY = False if MYPY: - from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index 12884b5f9b..ae1bd922d0 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -9,7 +9,7 @@ from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel MYPY = False if MYPY: - from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputController import PrinterOutputController diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/UI/PrintJobOutputModel.py similarity index 97% rename from cura/PrinterOutput/PrintJobOutputModel.py rename to cura/UI/PrintJobOutputModel.py index fb163ef065..372b1d591c 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/UI/PrintJobOutputModel.py @@ -1,10 +1,9 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot from typing import Optional, TYPE_CHECKING, List -from PyQt5.QtCore import QUrl +from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot, QUrl from PyQt5.QtGui import QImage if TYPE_CHECKING: @@ -25,7 +24,7 @@ class PrintJobOutputModel(QObject): previewImageChanged = pyqtSignal() compatibleMachineFamiliesChanged = pyqtSignal() - def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None: + def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent = None) -> None: super().__init__(parent) self._output_controller = output_controller self._state = "" @@ -142,13 +141,13 @@ class PrintJobOutputModel(QObject): @pyqtProperty(bool, notify=stateChanged) def isActive(self) -> bool: - inactiveStates = [ + inactive_states = [ "pausing", "paused", "resuming", "wait_cleanup" ] - if self.state in inactiveStates and self.timeRemaining > 0: + if self.state in inactive_states and self.timeRemaining > 0: return False return True diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py index fc6798386a..1d5dcd2c79 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py @@ -5,7 +5,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController MYPY = False if MYPY: - from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.UI.PrintJobOutputModel import PrintJobOutputModel class ClusterUM3PrinterOutputController(PrinterOutputController): def __init__(self, output_device): diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 2c7c33d382..b81c1387a4 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -3,7 +3,7 @@ from typing import List, Optional from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel -from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel +from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutputDevice import ConnectionType diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py index 63167b4ffb..b90d4c61a2 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py @@ -7,7 +7,7 @@ from UM.Version import Version MYPY = False if MYPY: - from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel diff --git a/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py index 4f44ca4af8..e51a891f58 100644 --- a/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py +++ b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py @@ -5,7 +5,7 @@ from typing import List from PyQt5.QtCore import pyqtProperty, pyqtSignal -from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel +from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from .ConfigurationChangeModel import ConfigurationChangeModel diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 3375ac27e7..a091848677 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -9,7 +9,7 @@ from UM.Qt.Duration import DurationFormat from cura.CuraApplication import CuraApplication from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel -from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel +from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.GenericOutputController import GenericOutputController from .AutoDetectBaudJob import AutoDetectBaudJob diff --git a/tests/PrinterOutput/TestPrinterOutputModel.py b/tests/PrinterOutput/TestPrinterOutputModel.py index f42149d50f..c0c7171410 100644 --- a/tests/PrinterOutput/TestPrinterOutputModel.py +++ b/tests/PrinterOutput/TestPrinterOutputModel.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock import pytest -from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel +from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ diff --git a/tests/PrinterOutput/TestPrintJobOutputModel.py b/tests/UI/TestPrintJobOutputModel.py similarity index 97% rename from tests/PrinterOutput/TestPrintJobOutputModel.py rename to tests/UI/TestPrintJobOutputModel.py index 658cff7a7e..6e3dcd1bda 100644 --- a/tests/PrinterOutput/TestPrintJobOutputModel.py +++ b/tests/UI/TestPrintJobOutputModel.py @@ -3,7 +3,7 @@ from unittest.mock import MagicMock import pytest from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel +from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ From 2b39d6422c63d0863c1ae4115197b25468f8e321 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:41:03 +0100 Subject: [PATCH 076/211] Move PrinterOutputDevice into cura.PrinterOutput module --- cura/CuraApplication.py | 2 +- cura/PrinterOutput/FirmwareUpdater.py | 2 +- cura/PrinterOutput/GenericOutputController.py | 3 ++- cura/PrinterOutput/NetworkedPrinterOutputDevice.py | 2 +- cura/{ => PrinterOutput}/PrinterOutputDevice.py | 0 cura/Settings/MachineManager.py | 2 +- cura/UI/GlobalStacksModel.py | 4 ++-- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py | 2 +- plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py | 2 +- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 5 ++--- plugins/USBPrinting/AvrFirmwareUpdater.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 6 ++---- plugins/UltimakerMachineActions/BedLevelMachineAction.py | 2 +- plugins/UltimakerMachineActions/UMOCheckupMachineAction.py | 2 +- .../VersionUpgrade35to40/VersionUpgrade35to40.py | 2 +- tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py | 2 +- tests/{ => PrinterOutput}/TestPrinterOutputDevice.py | 4 ++-- 20 files changed, 24 insertions(+), 26 deletions(-) rename cura/{ => PrinterOutput}/PrinterOutputDevice.py (100%) rename tests/{ => PrinterOutput}/TestPrinterOutputDevice.py (90%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 287e1a4da9..7b4b19eb1c 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -113,7 +113,7 @@ from cura.UI.ObjectsModel import ObjectsModel from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel -from cura.PrinterOutputDevice import PrinterOutputDevice +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage from cura import ApplicationMetadata, UltimakerCloudAuthentication diff --git a/cura/PrinterOutput/FirmwareUpdater.py b/cura/PrinterOutput/FirmwareUpdater.py index c6d9513ee0..3f20e0f3c4 100644 --- a/cura/PrinterOutput/FirmwareUpdater.py +++ b/cura/PrinterOutput/FirmwareUpdater.py @@ -9,7 +9,7 @@ from typing import Union MYPY = False if MYPY: - from cura.PrinterOutputDevice import PrinterOutputDevice + from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice class FirmwareUpdater(QObject): firmwareProgressChanged = pyqtSignal() diff --git a/cura/PrinterOutput/GenericOutputController.py b/cura/PrinterOutput/GenericOutputController.py index a48b08dfed..8963ffa107 100644 --- a/cura/PrinterOutput/GenericOutputController.py +++ b/cura/PrinterOutput/GenericOutputController.py @@ -3,9 +3,10 @@ from typing import TYPE_CHECKING, Set, Union, Optional -from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from PyQt5.QtCore import QTimer +from cura.PrinterOutput.PrinterOutputController import PrinterOutputController + if TYPE_CHECKING: from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index 0e33a71249..b846d98299 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -7,7 +7,7 @@ from UM.Scene.SceneNode import SceneNode #For typing. from cura.API import Account from cura.CuraApplication import CuraApplication -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py similarity index 100% rename from cura/PrinterOutputDevice.py rename to cura/PrinterOutput/PrinterOutputDevice.py diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index c910b67d0c..5d54d83be4 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -22,7 +22,7 @@ from UM.Settings.SettingFunction import SettingFunction from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel diff --git a/cura/UI/GlobalStacksModel.py b/cura/UI/GlobalStacksModel.py index 639f0b305f..38b2135b09 100644 --- a/cura/UI/GlobalStacksModel.py +++ b/cura/UI/GlobalStacksModel.py @@ -1,12 +1,12 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import pyqtProperty, Qt, QTimer +from PyQt5.QtCore import Qt, QTimer from UM.Qt.ListModel import ListModel from UM.i18n import i18nCatalog -from cura.PrinterOutputDevice import ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.GlobalStack import GlobalStack diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index d052d925d2..4fb8c4cd16 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -19,7 +19,7 @@ from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel -from cura.PrinterOutputDevice import ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .CloudOutputController import CloudOutputController from ..MeshFormatHandler import MeshFormatHandler diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 1d97127637..19b251be0a 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -24,7 +24,7 @@ from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationM from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel -from cura.PrinterOutputDevice import ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .Cloud.Utils import formatTimeCompleted, formatDateCompleted from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index 51c234650b..4cb8119d37 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -18,7 +18,7 @@ from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from .UM3OutputDevicePlugin import UM3OutputDevicePlugin if TYPE_CHECKING: - from cura.PrinterOutputDevice import PrinterOutputDevice + from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice catalog = i18nCatalog("cura") diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index b81c1387a4..299b501495 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -5,7 +5,7 @@ from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutp from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel -from cura.PrinterOutputDevice import ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.ContainerManager import ContainerManager from cura.Settings.ExtruderManager import ExtruderManager diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 2abd2f15c3..83510518d6 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -8,12 +8,11 @@ import os from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager -from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QObject +from PyQt5.QtCore import QUrl from PyQt5.QtGui import QDesktopServices from cura.CuraApplication import CuraApplication -from cura.PrinterOutputDevice import ConnectionType -from cura.Settings.GlobalStack import GlobalStack # typing +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from UM.i18n import i18nCatalog from UM.Logger import Logger diff --git a/plugins/USBPrinting/AvrFirmwareUpdater.py b/plugins/USBPrinting/AvrFirmwareUpdater.py index 56e3f99c23..0f7146560d 100644 --- a/plugins/USBPrinting/AvrFirmwareUpdater.py +++ b/plugins/USBPrinting/AvrFirmwareUpdater.py @@ -13,7 +13,7 @@ from time import sleep MYPY = False if MYPY: - from cura.PrinterOutputDevice import PrinterOutputDevice + from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice class AvrFirmwareUpdater(FirmwareUpdater): diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index a091848677..b27dfab284 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -7,7 +7,7 @@ from UM.i18n import i18nCatalog from UM.Qt.Duration import DurationFormat from cura.CuraApplication import CuraApplication -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.GenericOutputController import GenericOutputController diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index d4c0d1828e..f84a1bb175 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -5,15 +5,13 @@ import threading import time import serial.tools.list_ports -from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal +from PyQt5.QtCore import QObject, pyqtSignal -from UM.Logger import Logger from UM.Signal import Signal, signalemitter from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from UM.i18n import i18nCatalog -from cura.PrinterOutputDevice import ConnectionState -from cura.CuraApplication import CuraApplication +from cura.PrinterOutput.PrinterOutputDevice import ConnectionState from . import USBPrinterOutputDevice diff --git a/plugins/UltimakerMachineActions/BedLevelMachineAction.py b/plugins/UltimakerMachineActions/BedLevelMachineAction.py index d6de21c89b..818ad0e4f0 100644 --- a/plugins/UltimakerMachineActions/BedLevelMachineAction.py +++ b/plugins/UltimakerMachineActions/BedLevelMachineAction.py @@ -4,7 +4,7 @@ from typing import List from cura.MachineAction import MachineAction -from cura.PrinterOutputDevice import PrinterOutputDevice +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from UM.FlameProfiler import pyqtSlot diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py index f9ad4789e5..0e5b24850b 100644 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py +++ b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py @@ -1,5 +1,5 @@ from cura.MachineAction import MachineAction -from cura.PrinterOutputDevice import PrinterOutputDevice +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from UM.Application import Application from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty diff --git a/plugins/VersionUpgrade/VersionUpgrade35to40/VersionUpgrade35to40.py b/plugins/VersionUpgrade/VersionUpgrade35to40/VersionUpgrade35to40.py index 900c0a7396..71ce2e4fd0 100644 --- a/plugins/VersionUpgrade/VersionUpgrade35to40/VersionUpgrade35to40.py +++ b/plugins/VersionUpgrade/VersionUpgrade35to40/VersionUpgrade35to40.py @@ -3,7 +3,7 @@ from typing import Tuple, List, Set, Dict import io from UM.VersionUpgrade import VersionUpgrade -from cura.PrinterOutputDevice import ConnectionType +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType deleted_settings = {"bridge_wall_max_overhang"} # type: Set[str] renamed_configurations = {"connect_group_name": "group_name"} # type: Dict[str, str] diff --git a/tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py b/tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py index b3f7277051..da3ce66ac4 100644 --- a/tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py +++ b/tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock from PyQt5.QtNetwork import QNetworkAccessManager from PyQt5.QtCore import QUrl from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState -from cura.PrinterOutputDevice import ConnectionState +from cura.PrinterOutput.PrinterOutputDevice import ConnectionState def test_properties(): diff --git a/tests/TestPrinterOutputDevice.py b/tests/PrinterOutput/TestPrinterOutputDevice.py similarity index 90% rename from tests/TestPrinterOutputDevice.py rename to tests/PrinterOutput/TestPrinterOutputDevice.py index 9d3a337c21..4c12a34859 100644 --- a/tests/TestPrinterOutputDevice.py +++ b/tests/PrinterOutput/TestPrinterOutputDevice.py @@ -1,7 +1,7 @@ from unittest.mock import MagicMock import pytest -from cura.PrinterOutputDevice import PrinterOutputDevice +from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice test_validate_data_get_set = [ {"attribute": "connectionText", "value": "yay"}, @@ -34,4 +34,4 @@ def test_getAndSet(data): # Attempt to set the value again getattr(model, "set" + attribute)(data["value"]) # The signal should not fire again - assert signal.emit.call_count == 1 \ No newline at end of file + assert signal.emit.call_count == 1 From 6a8db55112f136f6ea3fbc4e987987c4c267b9db Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:42:22 +0100 Subject: [PATCH 077/211] Move PrinterOutputModel into cura.UI module --- cura/PrinterOutput/ExtruderOutputModel.py | 2 +- cura/PrinterOutput/GenericOutputController.py | 2 +- cura/PrinterOutput/PrinterOutputController.py | 2 +- cura/PrinterOutput/PrinterOutputDevice.py | 2 +- cura/UI/PrintJobOutputModel.py | 2 +- cura/{PrinterOutput => UI}/PrinterOutputModel.py | 0 plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py | 2 +- .../UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py | 2 +- plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- tests/UI/TestPrintJobOutputModel.py | 2 +- tests/{PrinterOutput => UI}/TestPrinterOutputModel.py | 2 +- 15 files changed, 14 insertions(+), 14 deletions(-) rename cura/{PrinterOutput => UI}/PrinterOutputModel.py (100%) rename tests/{PrinterOutput => UI}/TestPrinterOutputModel.py (97%) diff --git a/cura/PrinterOutput/ExtruderOutputModel.py b/cura/PrinterOutput/ExtruderOutputModel.py index 30d53bbd85..d111d54ee9 100644 --- a/cura/PrinterOutput/ExtruderOutputModel.py +++ b/cura/PrinterOutput/ExtruderOutputModel.py @@ -7,7 +7,7 @@ from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationM from typing import Optional, TYPE_CHECKING if TYPE_CHECKING: - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel diff --git a/cura/PrinterOutput/GenericOutputController.py b/cura/PrinterOutput/GenericOutputController.py index 8963ffa107..60b277c33e 100644 --- a/cura/PrinterOutput/GenericOutputController.py +++ b/cura/PrinterOutput/GenericOutputController.py @@ -9,7 +9,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController if TYPE_CHECKING: from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel diff --git a/cura/PrinterOutput/PrinterOutputController.py b/cura/PrinterOutput/PrinterOutputController.py index 9d071d44ce..22d4788ab0 100644 --- a/cura/PrinterOutput/PrinterOutputController.py +++ b/cura/PrinterOutput/PrinterOutputController.py @@ -8,7 +8,7 @@ MYPY = False if MYPY: from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice diff --git a/cura/PrinterOutput/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py index dbdf8c986c..9a83204e49 100644 --- a/cura/PrinterOutput/PrinterOutputDevice.py +++ b/cura/PrinterOutput/PrinterOutputDevice.py @@ -16,7 +16,7 @@ from UM.FlameProfiler import pyqtSlot MYPY = False if MYPY: - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater from UM.FileHandler.FileHandler import FileHandler diff --git a/cura/UI/PrintJobOutputModel.py b/cura/UI/PrintJobOutputModel.py index 372b1d591c..e394e122c2 100644 --- a/cura/UI/PrintJobOutputModel.py +++ b/cura/UI/PrintJobOutputModel.py @@ -8,7 +8,7 @@ from PyQt5.QtGui import QImage if TYPE_CHECKING: from cura.PrinterOutput.PrinterOutputController import PrinterOutputController - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.ConfigurationModel import ConfigurationModel diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/UI/PrinterOutputModel.py similarity index 100% rename from cura/PrinterOutput/PrinterOutputModel.py rename to cura/UI/PrinterOutputModel.py diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 4fb8c4cd16..60e9ec6e7c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -18,7 +18,7 @@ from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .CloudOutputController import CloudOutputController diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index bd3e482bde..65ce770192 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -3,7 +3,7 @@ from typing import List, Union, Dict, Optional, Any from cura.PrinterOutput.PrinterOutputController import PrinterOutputController -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from .CloudClusterBuildPlate import CloudClusterBuildPlate from .CloudClusterPrintCoreConfiguration import CloudClusterPrintCoreConfiguration from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 19b251be0a..50bc5cab22 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -22,7 +22,7 @@ from cura.CuraApplication import CuraApplication from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 299b501495..4f54aeee3d 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -2,7 +2,7 @@ from typing import List, Optional from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py index b90d4c61a2..089a083275 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py @@ -8,7 +8,7 @@ from UM.Version import Version MYPY = False if MYPY: from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel + from cura.UI.PrinterOutputModel import PrinterOutputModel class LegacyUM3PrinterOutputController(PrinterOutputController): diff --git a/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py b/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py index c4d891302e..2cbf2def50 100644 --- a/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py @@ -6,7 +6,7 @@ from unittest.mock import patch, MagicMock from UM.Scene.SceneNode import SceneNode from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from ...src.Cloud import CloudApiClient from ...src.Cloud.CloudOutputDevice import CloudOutputDevice from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index b27dfab284..43a91584fa 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -8,7 +8,7 @@ from UM.Qt.Duration import DurationFormat from cura.CuraApplication import CuraApplication from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.GenericOutputController import GenericOutputController diff --git a/tests/UI/TestPrintJobOutputModel.py b/tests/UI/TestPrintJobOutputModel.py index 6e3dcd1bda..8a760e6c1e 100644 --- a/tests/UI/TestPrintJobOutputModel.py +++ b/tests/UI/TestPrintJobOutputModel.py @@ -4,7 +4,7 @@ import pytest from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ {"attribute": "compatibleMachineFamilies", "value": ["yay"]}, diff --git a/tests/PrinterOutput/TestPrinterOutputModel.py b/tests/UI/TestPrinterOutputModel.py similarity index 97% rename from tests/PrinterOutput/TestPrinterOutputModel.py rename to tests/UI/TestPrinterOutputModel.py index c0c7171410..e0d57b90dc 100644 --- a/tests/PrinterOutput/TestPrinterOutputModel.py +++ b/tests/UI/TestPrinterOutputModel.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock import pytest from cura.UI.PrintJobOutputModel import PrintJobOutputModel -from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel +from cura.UI.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ {"attribute": "name", "value": "YAY"}, From 49c87a1e1d34f5982a3116be90532568909ce66e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:44:15 +0100 Subject: [PATCH 078/211] Move ExtruderConfigurationModel into cura.UI module --- cura/PrinterOutput/ConfigurationModel.py | 2 +- cura/PrinterOutput/ExtruderOutputModel.py | 2 +- cura/Settings/MachineManager.py | 2 +- cura/{PrinterOutput => UI}/ExtruderConfigurationModel.py | 2 +- .../src/Cloud/Models/CloudClusterPrintCoreConfiguration.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- tests/PrinterOutput/TestConfigurationModel.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename cura/{PrinterOutput => UI}/ExtruderConfigurationModel.py (99%) diff --git a/cura/PrinterOutput/ConfigurationModel.py b/cura/PrinterOutput/ConfigurationModel.py index 312e3cffb0..1b20bd2753 100644 --- a/cura/PrinterOutput/ConfigurationModel.py +++ b/cura/PrinterOutput/ConfigurationModel.py @@ -6,7 +6,7 @@ from typing import List MYPY = False if MYPY: - from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel + from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel class ConfigurationModel(QObject): diff --git a/cura/PrinterOutput/ExtruderOutputModel.py b/cura/PrinterOutput/ExtruderOutputModel.py index d111d54ee9..b8404ed6d9 100644 --- a/cura/PrinterOutput/ExtruderOutputModel.py +++ b/cura/PrinterOutput/ExtruderOutputModel.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot -from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from typing import Optional, TYPE_CHECKING diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 5d54d83be4..dd3e215461 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -24,7 +24,7 @@ from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.ExtruderManager import ExtruderManager diff --git a/cura/PrinterOutput/ExtruderConfigurationModel.py b/cura/UI/ExtruderConfigurationModel.py similarity index 99% rename from cura/PrinterOutput/ExtruderConfigurationModel.py rename to cura/UI/ExtruderConfigurationModel.py index da0ad6b0b2..b2fb9c2640 100644 --- a/cura/PrinterOutput/ExtruderConfigurationModel.py +++ b/cura/UI/ExtruderConfigurationModel.py @@ -67,4 +67,4 @@ class ExtruderConfigurationModel(QObject): # Calculating a hash function using the position of the extruder, the material GUID and the hotend id to check if is # unique within a set def __hash__(self): - return hash(self._position) ^ (hash(self._material.guid) if self._material is not None else hash(0)) ^ hash(self._hotend_id) \ No newline at end of file + return hash(self._position) ^ (hash(self._material.guid) if self._material is not None else hash(0)) ^ hash(self._hotend_id) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py index 7454401d09..49f2d8dfbc 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import Union, Dict, Optional, Any -from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from .CloudClusterPrinterConfigurationMaterial import CloudClusterPrinterConfigurationMaterial from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 50bc5cab22..e292e10a47 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -20,7 +20,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from cura.CuraApplication import CuraApplication from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel diff --git a/tests/PrinterOutput/TestConfigurationModel.py b/tests/PrinterOutput/TestConfigurationModel.py index d6b7b885c2..b16b8cb1f3 100644 --- a/tests/PrinterOutput/TestConfigurationModel.py +++ b/tests/PrinterOutput/TestConfigurationModel.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock import pytest from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel test_validate_data_get_set = [ {"attribute": "extruderConfigurations", "value": [ExtruderConfigurationModel()]}, From 2d78c2d7fcdb4f6d8db3c473a1f8482930758ff5 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:45:26 +0100 Subject: [PATCH 079/211] Move ExtruderOutputModel into cura.UI module --- cura/PrinterOutput/GenericOutputController.py | 2 +- cura/PrinterOutput/PrinterOutputController.py | 2 +- cura/{PrinterOutput => UI}/ExtruderOutputModel.py | 0 cura/UI/PrinterOutputModel.py | 2 +- .../src/Cloud/Models/CloudClusterPrintCoreConfiguration.py | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename cura/{PrinterOutput => UI}/ExtruderOutputModel.py (100%) diff --git a/cura/PrinterOutput/GenericOutputController.py b/cura/PrinterOutput/GenericOutputController.py index 60b277c33e..88ac529e01 100644 --- a/cura/PrinterOutput/GenericOutputController.py +++ b/cura/PrinterOutput/GenericOutputController.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice - from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel + from cura.UI.ExtruderOutputModel import ExtruderOutputModel class GenericOutputController(PrinterOutputController): diff --git a/cura/PrinterOutput/PrinterOutputController.py b/cura/PrinterOutput/PrinterOutputController.py index 22d4788ab0..4352c59762 100644 --- a/cura/PrinterOutput/PrinterOutputController.py +++ b/cura/PrinterOutput/PrinterOutputController.py @@ -7,7 +7,7 @@ from UM.Signal import Signal MYPY = False if MYPY: from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel + from cura.UI.ExtruderOutputModel import ExtruderOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice diff --git a/cura/PrinterOutput/ExtruderOutputModel.py b/cura/UI/ExtruderOutputModel.py similarity index 100% rename from cura/PrinterOutput/ExtruderOutputModel.py rename to cura/UI/ExtruderOutputModel.py diff --git a/cura/UI/PrinterOutputModel.py b/cura/UI/PrinterOutputModel.py index ae1bd922d0..5cd6e0e206 100644 --- a/cura/UI/PrinterOutputModel.py +++ b/cura/UI/PrinterOutputModel.py @@ -5,7 +5,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, from typing import List, Dict, Optional from UM.Math.Vector import Vector from cura.PrinterOutput.ConfigurationModel import ConfigurationModel -from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel +from cura.UI.ExtruderOutputModel import ExtruderOutputModel MYPY = False if MYPY: diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py index 49f2d8dfbc..922d3e840c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py @@ -3,7 +3,7 @@ from typing import Union, Dict, Optional, Any from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel -from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel +from cura.UI.ExtruderOutputModel import ExtruderOutputModel from .CloudClusterPrinterConfigurationMaterial import CloudClusterPrinterConfigurationMaterial from .BaseCloudModel import BaseCloudModel From 69eb381f1052de11f0da0e9167f5419c14f0dd0f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:47:10 +0100 Subject: [PATCH 080/211] Move MaterialOutputModel into cura.UI module --- cura/PrinterOutput/MaterialOutputModel.py | 34 ------------------- cura/Settings/MachineManager.py | 2 +- cura/UI/ExtruderConfigurationModel.py | 2 +- cura/UI/ExtruderOutputModel.py | 2 +- cura/UI/MaterialOutputModel.py | 34 +++++++++++++++++++ ...loudClusterPrinterConfigurationMaterial.py | 2 +- .../src/ClusterUM3OutputDevice.py | 2 +- .../src/LegacyUM3OutputDevice.py | 2 +- 8 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 cura/PrinterOutput/MaterialOutputModel.py create mode 100644 cura/UI/MaterialOutputModel.py diff --git a/cura/PrinterOutput/MaterialOutputModel.py b/cura/PrinterOutput/MaterialOutputModel.py deleted file mode 100644 index 64ebd3c94c..0000000000 --- a/cura/PrinterOutput/MaterialOutputModel.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2017 Ultimaker B.V. -# Cura is released under the terms of the LGPLv3 or higher. - -from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot - - -class MaterialOutputModel(QObject): - def __init__(self, guid, type, color, brand, name, parent = None): - super().__init__(parent) - self._guid = guid - self._type = type - self._color = color - self._brand = brand - self._name = name - - @pyqtProperty(str, constant = True) - def guid(self): - return self._guid - - @pyqtProperty(str, constant=True) - def type(self): - return self._type - - @pyqtProperty(str, constant=True) - def brand(self): - return self._brand - - @pyqtProperty(str, constant=True) - def color(self): - return self._color - - @pyqtProperty(str, constant=True) - def name(self): - return self._name \ No newline at end of file diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index dd3e215461..bcc52aed37 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -25,7 +25,7 @@ from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel -from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderStack import ExtruderStack diff --git a/cura/UI/ExtruderConfigurationModel.py b/cura/UI/ExtruderConfigurationModel.py index b2fb9c2640..7de37918b9 100644 --- a/cura/UI/ExtruderConfigurationModel.py +++ b/cura/UI/ExtruderConfigurationModel.py @@ -4,7 +4,7 @@ from typing import Optional from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal -from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.UI.MaterialOutputModel import MaterialOutputModel class ExtruderConfigurationModel(QObject): diff --git a/cura/UI/ExtruderOutputModel.py b/cura/UI/ExtruderOutputModel.py index b8404ed6d9..7fab441a08 100644 --- a/cura/UI/ExtruderOutputModel.py +++ b/cura/UI/ExtruderOutputModel.py @@ -8,7 +8,7 @@ from typing import Optional, TYPE_CHECKING if TYPE_CHECKING: from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel + from cura.UI.MaterialOutputModel import MaterialOutputModel class ExtruderOutputModel(QObject): diff --git a/cura/UI/MaterialOutputModel.py b/cura/UI/MaterialOutputModel.py new file mode 100644 index 0000000000..b3dd83fb72 --- /dev/null +++ b/cura/UI/MaterialOutputModel.py @@ -0,0 +1,34 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from PyQt5.QtCore import pyqtProperty, QObject + + +class MaterialOutputModel(QObject): + def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None): + super().__init__(parent) + self._guid = guid + self._type = type + self._color = color + self._brand = brand + self._name = name + + @pyqtProperty(str, constant = True) + def guid(self) -> str: + return self._guid + + @pyqtProperty(str, constant = True) + def type(self) -> str: + return self._type + + @pyqtProperty(str, constant = True) + def brand(self) -> str: + return self._brand + + @pyqtProperty(str, constant = True) + def color(self) -> str: + return self._color + + @pyqtProperty(str, constant = True) + def name(self) -> str: + return self._name diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py index 652cbdabda..73e54c8141 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py @@ -2,7 +2,7 @@ from typing import Optional from UM.Logger import Logger from cura.CuraApplication import CuraApplication -from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.UI.MaterialOutputModel import MaterialOutputModel from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index e292e10a47..3a3a30eac7 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -23,7 +23,7 @@ from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.UI.PrinterOutputModel import PrinterOutputModel -from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .Cloud.Utils import formatTimeCompleted, formatDateCompleted diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 4f54aeee3d..55a4a57026 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -4,7 +4,7 @@ from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.UI.PrinterOutputModel import PrinterOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel -from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.ContainerManager import ContainerManager From e555f7da68b5e81a9e135dfc48ac7cc04c6421f6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:51:06 +0100 Subject: [PATCH 081/211] Move ConfigurationModel into cura.UI module --- cura/PrinterOutput/PrinterOutputDevice.py | 2 +- cura/Settings/MachineManager.py | 2 +- cura/{PrinterOutput => UI}/ConfigurationModel.py | 8 ++++---- cura/UI/PrintJobOutputModel.py | 2 +- cura/UI/PrinterOutputModel.py | 2 +- .../src/Cloud/Models/CloudClusterPrintJobStatus.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- tests/{PrinterOutput => UI}/TestConfigurationModel.py | 2 +- tests/UI/TestPrintJobOutputModel.py | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) rename cura/{PrinterOutput => UI}/ConfigurationModel.py (94%) rename tests/{PrinterOutput => UI}/TestConfigurationModel.py (94%) diff --git a/cura/PrinterOutput/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py index 9a83204e49..471aed10ea 100644 --- a/cura/PrinterOutput/PrinterOutputDevice.py +++ b/cura/PrinterOutput/PrinterOutputDevice.py @@ -17,7 +17,7 @@ from UM.FlameProfiler import pyqtSlot MYPY = False if MYPY: from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.PrinterOutput.ConfigurationModel import ConfigurationModel + from cura.UI.ConfigurationModel import ConfigurationModel from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater from UM.FileHandler.FileHandler import FileHandler from UM.Scene.SceneNode import SceneNode diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index bcc52aed37..02fa845550 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -23,7 +23,7 @@ from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry diff --git a/cura/PrinterOutput/ConfigurationModel.py b/cura/UI/ConfigurationModel.py similarity index 94% rename from cura/PrinterOutput/ConfigurationModel.py rename to cura/UI/ConfigurationModel.py index 1b20bd2753..30031ef293 100644 --- a/cura/PrinterOutput/ConfigurationModel.py +++ b/cura/UI/ConfigurationModel.py @@ -19,14 +19,14 @@ class ConfigurationModel(QObject): self._extruder_configurations = [] # type: List[ExtruderConfigurationModel] self._buildplate_configuration = "" - def setPrinterType(self, printer_type): + def setPrinterType(self, printer_type: str) -> None: self._printer_type = printer_type @pyqtProperty(str, fset = setPrinterType, notify = configurationChanged) def printerType(self) -> str: return self._printer_type - def setExtruderConfigurations(self, extruder_configurations: List["ExtruderConfigurationModel"]): + def setExtruderConfigurations(self, extruder_configurations: List["ExtruderConfigurationModel"]) -> None: if self._extruder_configurations != extruder_configurations: self._extruder_configurations = extruder_configurations @@ -40,7 +40,7 @@ class ConfigurationModel(QObject): return self._extruder_configurations def setBuildplateConfiguration(self, buildplate_configuration: str) -> None: - if self._buildplate_configuration != buildplate_configuration: + if self._buildplate_configuration != buildplate_configuration: self._buildplate_configuration = buildplate_configuration self.configurationChanged.emit() @@ -86,4 +86,4 @@ class ConfigurationModel(QObject): if first_extruder: extruder_hash &= hash(first_extruder) - return hash(self._printer_type) ^ extruder_hash ^ hash(self._buildplate_configuration) \ No newline at end of file + return hash(self._printer_type) ^ extruder_hash ^ hash(self._buildplate_configuration) diff --git a/cura/UI/PrintJobOutputModel.py b/cura/UI/PrintJobOutputModel.py index e394e122c2..e3d4082511 100644 --- a/cura/UI/PrintJobOutputModel.py +++ b/cura/UI/PrintJobOutputModel.py @@ -9,7 +9,7 @@ from PyQt5.QtGui import QImage if TYPE_CHECKING: from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.PrinterOutput.ConfigurationModel import ConfigurationModel + from cura.UI.ConfigurationModel import ConfigurationModel class PrintJobOutputModel(QObject): diff --git a/cura/UI/PrinterOutputModel.py b/cura/UI/PrinterOutputModel.py index 5cd6e0e206..8e8d776a05 100644 --- a/cura/UI/PrinterOutputModel.py +++ b/cura/UI/PrinterOutputModel.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, QUrl from typing import List, Dict, Optional from UM.Math.Vector import Vector -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel MYPY = False diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py index 45b7d838a5..acd88668d5 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import List, Optional, Union, Dict, Any -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from ...UM3PrintJobOutputModel import UM3PrintJobOutputModel from ...ConfigurationChangeModel import ConfigurationChangeModel from ..CloudOutputController import CloudOutputController diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 3a3a30eac7..e66973fc90 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -19,7 +19,7 @@ from UM.Scene.SceneNode import SceneNode # For typing. from UM.Settings.ContainerRegistry import ContainerRegistry from cura.CuraApplication import CuraApplication -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.UI.PrinterOutputModel import PrinterOutputModel diff --git a/tests/PrinterOutput/TestConfigurationModel.py b/tests/UI/TestConfigurationModel.py similarity index 94% rename from tests/PrinterOutput/TestConfigurationModel.py rename to tests/UI/TestConfigurationModel.py index b16b8cb1f3..d9de26ce80 100644 --- a/tests/PrinterOutput/TestConfigurationModel.py +++ b/tests/UI/TestConfigurationModel.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock import pytest -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel test_validate_data_get_set = [ diff --git a/tests/UI/TestPrintJobOutputModel.py b/tests/UI/TestPrintJobOutputModel.py index 8a760e6c1e..bcc662bb1e 100644 --- a/tests/UI/TestPrintJobOutputModel.py +++ b/tests/UI/TestPrintJobOutputModel.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from cura.PrinterOutput.ConfigurationModel import ConfigurationModel +from cura.UI.ConfigurationModel import ConfigurationModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel From 81fbc525e493aca53fadfe72fcf7bff7071fec05 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:52:35 +0100 Subject: [PATCH 082/211] Rename ConfigurationModel to PrinterConfigurationModel --- cura/PrinterOutput/PrinterOutputDevice.py | 6 +++--- cura/Settings/MachineManager.py | 10 +++++----- cura/UI/PrintJobOutputModel.py | 8 ++++---- ...figurationModel.py => PrinterConfigurationModel.py} | 2 +- cura/UI/PrinterOutputModel.py | 6 +++--- .../src/Cloud/Models/CloudClusterPrintJobStatus.py | 6 +++--- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 4 ++-- tests/UI/TestPrintJobOutputModel.py | 4 ++-- ...rationModel.py => TestPrinterConfigurationModel.py} | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) rename cura/UI/{ConfigurationModel.py => PrinterConfigurationModel.py} (98%) rename tests/UI/{TestConfigurationModel.py => TestPrinterConfigurationModel.py} (91%) diff --git a/cura/PrinterOutput/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py index 471aed10ea..d15de94cc8 100644 --- a/cura/PrinterOutput/PrinterOutputDevice.py +++ b/cura/PrinterOutput/PrinterOutputDevice.py @@ -17,7 +17,7 @@ from UM.FlameProfiler import pyqtSlot MYPY = False if MYPY: from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.UI.ConfigurationModel import ConfigurationModel + from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater from UM.FileHandler.FileHandler import FileHandler from UM.Scene.SceneNode import SceneNode @@ -73,7 +73,7 @@ class PrinterOutputDevice(QObject, OutputDevice): super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] - self._unique_configurations = [] # type: List[ConfigurationModel] + self._unique_configurations = [] # type: List[PrinterConfigurationModel] self._monitor_view_qml_path = "" # type: str self._monitor_component = None # type: Optional[QObject] @@ -216,7 +216,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Returns the unique configurations of the printers within this output device @pyqtProperty("QVariantList", notify = uniqueConfigurationsChanged) - def uniqueConfigurations(self) -> List["ConfigurationModel"]: + def uniqueConfigurations(self) -> List["PrinterConfigurationModel"]: return self._unique_configurations def _updateUniqueConfigurations(self) -> None: diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 02fa845550..dbd0765199 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -23,7 +23,7 @@ from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry @@ -106,7 +106,7 @@ class MachineManager(QObject): # There might already be some output devices by the time the signal is connected self._onOutputDevicesChanged() - self._current_printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer + self._current_printer_configuration = PrinterConfigurationModel() # Indicates the current configuration setup in this printer self.activeMaterialChanged.connect(self._onCurrentConfigurationChanged) self.activeVariantChanged.connect(self._onCurrentConfigurationChanged) # Force to compute the current configuration @@ -174,7 +174,7 @@ class MachineManager(QObject): self.outputDevicesChanged.emit() @pyqtProperty(QObject, notify = currentConfigurationChanged) - def currentConfiguration(self) -> ConfigurationModel: + def currentConfiguration(self) -> PrinterConfigurationModel: return self._current_printer_configuration def _onCurrentConfigurationChanged(self) -> None: @@ -205,7 +205,7 @@ class MachineManager(QObject): self.currentConfigurationChanged.emit() @pyqtSlot(QObject, result = bool) - def matchesConfiguration(self, configuration: ConfigurationModel) -> bool: + def matchesConfiguration(self, configuration: PrinterConfigurationModel) -> bool: return self._current_printer_configuration == configuration @pyqtProperty("QVariantList", notify = outputDevicesChanged) @@ -1375,7 +1375,7 @@ class MachineManager(QObject): self.setActiveMachine(new_machine.getId()) @pyqtSlot(QObject) - def applyRemoteConfiguration(self, configuration: ConfigurationModel) -> None: + def applyRemoteConfiguration(self, configuration: PrinterConfigurationModel) -> None: if self._global_container_stack is None: return self.blurSettings.emit() diff --git a/cura/UI/PrintJobOutputModel.py b/cura/UI/PrintJobOutputModel.py index e3d4082511..a556680ef7 100644 --- a/cura/UI/PrintJobOutputModel.py +++ b/cura/UI/PrintJobOutputModel.py @@ -9,7 +9,7 @@ from PyQt5.QtGui import QImage if TYPE_CHECKING: from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.UI.ConfigurationModel import ConfigurationModel + from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel class PrintJobOutputModel(QObject): @@ -35,7 +35,7 @@ class PrintJobOutputModel(QObject): self._assigned_printer = None # type: Optional[PrinterOutputModel] self._owner = "" # Who started/owns the print job? - self._configuration = None # type: Optional[ConfigurationModel] + self._configuration = None # type: Optional[PrinterConfigurationModel] self._compatible_machine_families = [] # type: List[str] self._preview_image_id = 0 @@ -69,10 +69,10 @@ class PrintJobOutputModel(QObject): self.previewImageChanged.emit() @pyqtProperty(QObject, notify=configurationChanged) - def configuration(self) -> Optional["ConfigurationModel"]: + def configuration(self) -> Optional["PrinterConfigurationModel"]: return self._configuration - def updateConfiguration(self, configuration: Optional["ConfigurationModel"]) -> None: + def updateConfiguration(self, configuration: Optional["PrinterConfigurationModel"]) -> None: if self._configuration != configuration: self._configuration = configuration self.configurationChanged.emit() diff --git a/cura/UI/ConfigurationModel.py b/cura/UI/PrinterConfigurationModel.py similarity index 98% rename from cura/UI/ConfigurationModel.py rename to cura/UI/PrinterConfigurationModel.py index 30031ef293..3db34768d1 100644 --- a/cura/UI/ConfigurationModel.py +++ b/cura/UI/PrinterConfigurationModel.py @@ -9,7 +9,7 @@ if MYPY: from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel -class ConfigurationModel(QObject): +class PrinterConfigurationModel(QObject): configurationChanged = pyqtSignal() diff --git a/cura/UI/PrinterOutputModel.py b/cura/UI/PrinterOutputModel.py index 8e8d776a05..2c782cc701 100644 --- a/cura/UI/PrinterOutputModel.py +++ b/cura/UI/PrinterOutputModel.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, QUrl from typing import List, Dict, Optional from UM.Math.Vector import Vector -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel MYPY = False @@ -37,7 +37,7 @@ class PrinterOutputModel(QObject): self._controller = output_controller self._controller.canUpdateFirmwareChanged.connect(self._onControllerCanUpdateFirmwareChanged) self._extruders = [ExtruderOutputModel(printer = self, position = i) for i in range(number_of_extruders)] - self._printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer + self._printer_configuration = PrinterConfigurationModel() # Indicates the current configuration setup in this printer self._head_position = Vector(0, 0, 0) self._active_print_job = None # type: Optional[PrintJobOutputModel] self._firmware_version = firmware_version @@ -291,7 +291,7 @@ class PrinterOutputModel(QObject): # Returns the configuration (material, variant and buildplate) of the current printer @pyqtProperty(QObject, notify = configurationChanged) - def printerConfiguration(self) -> Optional[ConfigurationModel]: + def printerConfiguration(self) -> Optional[PrinterConfigurationModel]: if self._printer_configuration.isValid(): return self._printer_configuration return None \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py index acd88668d5..a4bc46e2d9 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import List, Optional, Union, Dict, Any -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from ...UM3PrintJobOutputModel import UM3PrintJobOutputModel from ...ConfigurationChangeModel import ConfigurationChangeModel from ..CloudOutputController import CloudOutputController @@ -95,9 +95,9 @@ class CloudClusterPrintJobStatus(BaseCloudModel): return model ## Creates a new configuration model - def _createConfigurationModel(self) -> ConfigurationModel: + def _createConfigurationModel(self) -> PrinterConfigurationModel: extruders = [extruder.createConfigurationModel() for extruder in self.configuration or ()] - configuration = ConfigurationModel() + configuration = PrinterConfigurationModel() configuration.setExtruderConfigurations(extruders) return configuration diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index e66973fc90..1312ab2129 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -19,7 +19,7 @@ from UM.Scene.SceneNode import SceneNode # For typing. from UM.Settings.ContainerRegistry import ContainerRegistry from cura.CuraApplication import CuraApplication -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.UI.PrinterOutputModel import PrinterOutputModel @@ -522,7 +522,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): print_job = UM3PrintJobOutputModel(output_controller=ClusterUM3PrinterOutputController(self), key=data["uuid"], name= data["name"]) - configuration = ConfigurationModel() + configuration = PrinterConfigurationModel() extruders = [ExtruderConfigurationModel(position = idx) for idx in range(0, self._number_of_extruders)] for index in range(0, self._number_of_extruders): try: diff --git a/tests/UI/TestPrintJobOutputModel.py b/tests/UI/TestPrintJobOutputModel.py index bcc662bb1e..71a08c223c 100644 --- a/tests/UI/TestPrintJobOutputModel.py +++ b/tests/UI/TestPrintJobOutputModel.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel @@ -11,7 +11,7 @@ test_validate_data_get_set = [ ] test_validate_data_get_update = [ - {"attribute": "configuration", "value": ConfigurationModel()}, + {"attribute": "configuration", "value": PrinterConfigurationModel()}, {"attribute": "owner", "value": "WHOO"}, {"attribute": "assignedPrinter", "value": PrinterOutputModel(MagicMock())}, {"attribute": "key", "value": "YAY"}, diff --git a/tests/UI/TestConfigurationModel.py b/tests/UI/TestPrinterConfigurationModel.py similarity index 91% rename from tests/UI/TestConfigurationModel.py rename to tests/UI/TestPrinterConfigurationModel.py index d9de26ce80..e365aaebf6 100644 --- a/tests/UI/TestConfigurationModel.py +++ b/tests/UI/TestPrinterConfigurationModel.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock import pytest -from cura.UI.ConfigurationModel import ConfigurationModel +from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel test_validate_data_get_set = [ @@ -16,7 +16,7 @@ test_validate_data_get_set = [ @pytest.mark.parametrize("data", test_validate_data_get_set) def test_getAndSet(data): - model = ConfigurationModel() + model = PrinterConfigurationModel() # Convert the first letter into a capital attribute = list(data["attribute"]) From 4078719c5802ef3bad7c2ac3a075d23892f3754c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 09:56:11 +0100 Subject: [PATCH 083/211] Move cura.Machine.Models to cura.UI.MachineModels --- cura/CuraApplication.py | 26 +++++++++---------- cura/Scene/CuraSceneController.py | 2 +- .../MachineModels}/BaseMaterialsModel.py | 0 .../MachineModels}/BuildPlateModel.py | 0 .../CustomQualityProfilesDropDownMenuModel.py | 2 +- .../MachineModels}/DiscoveredPrintersModel.py | 0 .../MachineModels}/FavoriteMaterialsModel.py | 2 +- .../MachineModels}/GenericMaterialsModel.py | 3 +-- .../MachineModels}/MachineManagementModel.py | 0 .../MachineModels}/MaterialBrandsModel.py | 5 ++-- .../MachineModels}/MultiBuildPlateModel.py | 0 .../MachineModels}/NozzleModel.py | 0 .../MachineModels}/QualityManagementModel.py | 0 .../QualityProfilesDropDownMenuModel.py | 0 .../MachineModels}/QualitySettingsModel.py | 0 .../SettingVisibilityPresetsModel.py | 0 .../Models => UI/MachineModels}/__init__.py | 0 .../CuraEngineBackend/CuraEngineBackend.py | 5 +--- .../Settings/TestSettingVisibilityPresets.py | 2 +- 19 files changed, 21 insertions(+), 26 deletions(-) rename cura/{Machines/Models => UI/MachineModels}/BaseMaterialsModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/BuildPlateModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/CustomQualityProfilesDropDownMenuModel.py (93%) rename cura/{Machines/Models => UI/MachineModels}/DiscoveredPrintersModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/FavoriteMaterialsModel.py (94%) rename cura/{Machines/Models => UI/MachineModels}/GenericMaterialsModel.py (91%) rename cura/{Machines/Models => UI/MachineModels}/MachineManagementModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/MaterialBrandsModel.py (96%) rename cura/{Machines/Models => UI/MachineModels}/MultiBuildPlateModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/NozzleModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/QualityManagementModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/QualityProfilesDropDownMenuModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/QualitySettingsModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/SettingVisibilityPresetsModel.py (100%) rename cura/{Machines/Models => UI/MachineModels}/__init__.py (100%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7b4b19eb1c..4786e5e25a 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -66,19 +66,19 @@ from UM.Settings.SettingFunction import SettingFunction from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.MachineNameValidator import MachineNameValidator -from cura.Machines.Models.BuildPlateModel import BuildPlateModel -from cura.Machines.Models.NozzleModel import NozzleModel -from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel -from cura.Machines.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel -from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel -from cura.Machines.Models.FavoriteMaterialsModel import FavoriteMaterialsModel -from cura.Machines.Models.GenericMaterialsModel import GenericMaterialsModel -from cura.Machines.Models.MaterialBrandsModel import MaterialBrandsModel -from cura.Machines.Models.QualityManagementModel import QualityManagementModel -from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel -from cura.Machines.Models.MachineManagementModel import MachineManagementModel +from cura.UI.Models.BuildPlateModel import BuildPlateModel +from cura.UI.Models.NozzleModel import NozzleModel +from cura.UI.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.UI.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel +from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel +from cura.UI.Models.FavoriteMaterialsModel import FavoriteMaterialsModel +from cura.UI.Models.GenericMaterialsModel import GenericMaterialsModel +from cura.UI.Models.MaterialBrandsModel import MaterialBrandsModel +from cura.UI.Models import QualityManagementModel +from cura.UI.Models.QualitySettingsModel import QualitySettingsModel +from cura.UI.Models.MachineManagementModel import MachineManagementModel -from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.UI.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Machines.MachineErrorChecker import MachineErrorChecker @@ -111,7 +111,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.UI.ObjectsModel import ObjectsModel -from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel +from cura.UI.Models.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index 91ff26cadc..e331a109ec 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QApplication from UM.Scene.Camera import Camera from cura.UI.ObjectsModel import ObjectsModel -from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel +from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel from UM.Application import Application from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/UI/MachineModels/BaseMaterialsModel.py similarity index 100% rename from cura/Machines/Models/BaseMaterialsModel.py rename to cura/UI/MachineModels/BaseMaterialsModel.py diff --git a/cura/Machines/Models/BuildPlateModel.py b/cura/UI/MachineModels/BuildPlateModel.py similarity index 100% rename from cura/Machines/Models/BuildPlateModel.py rename to cura/UI/MachineModels/BuildPlateModel.py diff --git a/cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py b/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py similarity index 93% rename from cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py rename to cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py index dcade8cb0d..9a31256ec3 100644 --- a/cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py +++ b/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py @@ -3,7 +3,7 @@ from UM.Logger import Logger -from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.UI.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel # diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/UI/MachineModels/DiscoveredPrintersModel.py similarity index 100% rename from cura/Machines/Models/DiscoveredPrintersModel.py rename to cura/UI/MachineModels/DiscoveredPrintersModel.py diff --git a/cura/Machines/Models/FavoriteMaterialsModel.py b/cura/UI/MachineModels/FavoriteMaterialsModel.py similarity index 94% rename from cura/Machines/Models/FavoriteMaterialsModel.py rename to cura/UI/MachineModels/FavoriteMaterialsModel.py index 98a2a01597..2540fd0608 100644 --- a/cura/Machines/Models/FavoriteMaterialsModel.py +++ b/cura/UI/MachineModels/FavoriteMaterialsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel ## Model that shows the list of favorite materials. class FavoriteMaterialsModel(BaseMaterialsModel): diff --git a/cura/Machines/Models/GenericMaterialsModel.py b/cura/UI/MachineModels/GenericMaterialsModel.py similarity index 91% rename from cura/Machines/Models/GenericMaterialsModel.py rename to cura/UI/MachineModels/GenericMaterialsModel.py index 8f41dd6a70..a99cdfc8eb 100644 --- a/cura/Machines/Models/GenericMaterialsModel.py +++ b/cura/UI/MachineModels/GenericMaterialsModel.py @@ -1,8 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from UM.Logger import Logger -from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel class GenericMaterialsModel(BaseMaterialsModel): diff --git a/cura/Machines/Models/MachineManagementModel.py b/cura/UI/MachineModels/MachineManagementModel.py similarity index 100% rename from cura/Machines/Models/MachineManagementModel.py rename to cura/UI/MachineModels/MachineManagementModel.py diff --git a/cura/Machines/Models/MaterialBrandsModel.py b/cura/UI/MachineModels/MaterialBrandsModel.py similarity index 96% rename from cura/Machines/Models/MaterialBrandsModel.py rename to cura/UI/MachineModels/MaterialBrandsModel.py index ac82cf6670..7f02dd5302 100644 --- a/cura/Machines/Models/MaterialBrandsModel.py +++ b/cura/UI/MachineModels/MaterialBrandsModel.py @@ -1,10 +1,9 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty +from PyQt5.QtCore import Qt, pyqtSignal from UM.Qt.ListModel import ListModel -from UM.Logger import Logger -from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel class MaterialTypesModel(ListModel): diff --git a/cura/Machines/Models/MultiBuildPlateModel.py b/cura/UI/MachineModels/MultiBuildPlateModel.py similarity index 100% rename from cura/Machines/Models/MultiBuildPlateModel.py rename to cura/UI/MachineModels/MultiBuildPlateModel.py diff --git a/cura/Machines/Models/NozzleModel.py b/cura/UI/MachineModels/NozzleModel.py similarity index 100% rename from cura/Machines/Models/NozzleModel.py rename to cura/UI/MachineModels/NozzleModel.py diff --git a/cura/Machines/Models/QualityManagementModel.py b/cura/UI/MachineModels/QualityManagementModel.py similarity index 100% rename from cura/Machines/Models/QualityManagementModel.py rename to cura/UI/MachineModels/QualityManagementModel.py diff --git a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py b/cura/UI/MachineModels/QualityProfilesDropDownMenuModel.py similarity index 100% rename from cura/Machines/Models/QualityProfilesDropDownMenuModel.py rename to cura/UI/MachineModels/QualityProfilesDropDownMenuModel.py diff --git a/cura/Machines/Models/QualitySettingsModel.py b/cura/UI/MachineModels/QualitySettingsModel.py similarity index 100% rename from cura/Machines/Models/QualitySettingsModel.py rename to cura/UI/MachineModels/QualitySettingsModel.py diff --git a/cura/Machines/Models/SettingVisibilityPresetsModel.py b/cura/UI/MachineModels/SettingVisibilityPresetsModel.py similarity index 100% rename from cura/Machines/Models/SettingVisibilityPresetsModel.py rename to cura/UI/MachineModels/SettingVisibilityPresetsModel.py diff --git a/cura/Machines/Models/__init__.py b/cura/UI/MachineModels/__init__.py similarity index 100% rename from cura/Machines/Models/__init__.py rename to cura/UI/MachineModels/__init__.py diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index ceba5f3006..3d0d4fb11e 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -10,20 +10,17 @@ from time import time from typing import Any, cast, Dict, List, Optional, Set, TYPE_CHECKING from UM.Backend.Backend import Backend, BackendState -from UM.Scene.Camera import Camera from UM.Scene.SceneNode import SceneNode from UM.Signal import Signal from UM.Logger import Logger from UM.Message import Message from UM.PluginRegistry import PluginRegistry -from UM.Resources import Resources from UM.Platform import Platform from UM.Qt.Duration import DurationFormat from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Settings.Interfaces import DefinitionContainerInterface from UM.Settings.SettingInstance import SettingInstance #For typing. from UM.Tool import Tool #For typing. -from UM.Mesh.MeshData import MeshData #For typing. from cura.CuraApplication import CuraApplication from cura.Settings.ExtruderManager import ExtruderManager @@ -33,7 +30,7 @@ from .StartSliceJob import StartSliceJob, StartJobResult import Arcus if TYPE_CHECKING: - from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel + from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel from cura.Machines.MachineErrorChecker import MachineErrorChecker from UM.Scene.Scene import Scene from UM.Settings.ContainerStack import ContainerStack diff --git a/tests/Settings/TestSettingVisibilityPresets.py b/tests/Settings/TestSettingVisibilityPresets.py index b82aa62ea7..079bda3912 100644 --- a/tests/Settings/TestSettingVisibilityPresets.py +++ b/tests/Settings/TestSettingVisibilityPresets.py @@ -5,7 +5,7 @@ import os.path from UM.Preferences import Preferences from UM.Resources import Resources from cura.CuraApplication import CuraApplication -from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.UI.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset setting_visibility_preset_test_settings = {"test", "zomg", "derp", "yay", "whoo"} From a97410656f440a26a23f8b884cf6be78d8ebdb41 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 10:00:14 +0100 Subject: [PATCH 084/211] Fix WelcomePagesModel qml type registering typo --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4786e5e25a..a05e73fe95 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -991,7 +991,7 @@ class CuraApplication(QtApplication): qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, "SimpleModeSettingsManager", self.getSimpleModeSettingsManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) - qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePageModel") + qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePagesModel") qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") From e623c807cef5f37af76a63d1c1f5b377139fe5b0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 10:39:23 +0100 Subject: [PATCH 085/211] Rename SectionName to DiscoverySource in GlobalStacksModel --- cura/UI/GlobalStacksModel.py | 6 +++--- resources/qml/Preferences/MachinesPage.qml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/UI/GlobalStacksModel.py b/cura/UI/GlobalStacksModel.py index 38b2135b09..579555e52c 100644 --- a/cura/UI/GlobalStacksModel.py +++ b/cura/UI/GlobalStacksModel.py @@ -17,7 +17,7 @@ class GlobalStacksModel(ListModel): HasRemoteConnectionRole = Qt.UserRole + 3 ConnectionTypeRole = Qt.UserRole + 4 MetaDataRole = Qt.UserRole + 5 - SectionNameRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page + DiscoverySourceRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page def __init__(self, parent = None) -> None: super().__init__(parent) @@ -28,7 +28,7 @@ class GlobalStacksModel(ListModel): self.addRoleName(self.IdRole, "id") self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.MetaDataRole, "metadata") - self.addRoleName(self.SectionNameRole, "sectionName") + self.addRoleName(self.DiscoverySourceRole, "discoverySource") self._container_stacks = [] self._change_timer = QTimer() @@ -74,6 +74,6 @@ class GlobalStacksModel(ListModel): "id": container_stack.getId(), "hasRemoteConnection": has_remote_connection, "metadata": container_stack.getMetaData().copy(), - "sectionName": section_name}) + "discoverySource": section_name}) items.sort(key = lambda i: not i["hasRemoteConnection"]) self.setItems(items) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 98958360a8..9bb17470c8 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -16,7 +16,7 @@ UM.ManagementPage title: catalog.i18nc("@title:tab", "Printers"); model: Cura.GlobalStacksModel { } - sectionRole: "sectionName" + sectionRole: "discoverySource" activeId: Cura.MachineManager.activeMachineId activeIndex: activeMachineIndex() From 105a07fc16825d2a3a41a00b167c15258f912f25 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 10:42:43 +0100 Subject: [PATCH 086/211] Rename vars and add typing in DiscoveredPrintersModel --- .../MachineModels/DiscoveredPrintersModel.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cura/UI/MachineModels/DiscoveredPrintersModel.py b/cura/UI/MachineModels/DiscoveredPrintersModel.py index 0dd07eb9ce..da16435605 100644 --- a/cura/UI/MachineModels/DiscoveredPrintersModel.py +++ b/cura/UI/MachineModels/DiscoveredPrintersModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Callable, List, Optional, TYPE_CHECKING +from typing import Callable, Dict, List, Optional, TYPE_CHECKING from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject @@ -81,34 +81,34 @@ class DiscoveredPrintersModel(QObject): def __init__(self, parent: Optional["QObject"]) -> None: super().__init__(parent) - self._discovered_printer_dict = dict() + self._discovered_printer_by_ip_dict = dict() # type: Dict[str, DiscoveredPrinter] discoveredPrintersChanged = pyqtSignal() @pyqtProperty(list, notify = discoveredPrintersChanged) def discovered_printers(self) -> "List[DiscoveredPrinter]": - item_list = list(x for x in self._discovered_printer_dict.values()) + 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 def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, device) -> None: - if ip_address in self._discovered_printer_dict: + if ip_address in self._discovered_printer_by_ip_dict: Logger.log("e", "Printer with ip [%s] has already been added", ip_address) return discovered_printer = DiscoveredPrinter(ip_address, key, name, create_callback, machine_type, device, parent = self) - self._discovered_printer_dict[ip_address] = discovered_printer + self._discovered_printer_by_ip_dict[ip_address] = discovered_printer self.discoveredPrintersChanged.emit() def updateDiscoveredPrinter(self, ip_address: str, name: Optional[str] = None, machine_type: Optional[str] = None) -> None: - if ip_address not in self._discovered_printer_dict: + if ip_address not in self._discovered_printer_by_ip_dict: Logger.log("e", "Printer with ip [%s] is not known", ip_address) return - item = self._discovered_printer_dict[ip_address] + item = self._discovered_printer_by_ip_dict[ip_address] if name is not None: item.setName(name) @@ -116,11 +116,11 @@ class DiscoveredPrintersModel(QObject): item.setMachineType(machine_type) def removeDiscoveredPrinter(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 - del self._discovered_printer_dict[ip_address] + del self._discovered_printer_by_ip_dict[ip_address] self.discoveredPrintersChanged.emit() @pyqtSlot("QVariant") From da351da61121abcefd2dbf2b502c29067c8f5b12 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 10:48:04 +0100 Subject: [PATCH 087/211] Update comments for associateActiveMachineWithPrinterDevice() --- cura/Settings/MachineManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index dbd0765199..0afca64c88 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1678,7 +1678,9 @@ class MachineManager(QObject): meta_data = global_stack.getMetaData() - if "um_network_key" in meta_data: # Global stack already had a connection, but it's changed. + # Global stack previously had a connection, so here it needs to change the connection information in all + # global stacks in that same group. + if "um_network_key" in meta_data: old_network_key = meta_data["um_network_key"] # Since we might have a bunch of hidden stacks, we also need to change it there. metadata_filter = {"um_network_key": old_network_key} @@ -1698,6 +1700,7 @@ class MachineManager(QObject): # Ensure that these containers do know that they are configured for network connection container.addConfiguredConnectionType(printer_device.connectionType.value) - else: # Global stack didn't have a connection yet, configure it. + # Global stack previously didn't have a connection, so directly configure it. + else: global_stack.setMetaDataEntry("um_network_key", printer_device.key) global_stack.addConfiguredConnectionType(printer_device.connectionType.value) From ccc4ba0bde1ad988912f6e8efd7d94e0525d42df Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:00:31 +0100 Subject: [PATCH 088/211] Simplify code in WelcomePagesModel --- cura/UI/WelcomePagesModel.py | 46 +++++++++++++++--------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b4fd199a28..40d76e6619 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -1,9 +1,9 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import os -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Optional, List, Dict, Any -from PyQt5.QtCore import QUrl, Qt, pyqtSlot +from PyQt5.QtCore import QUrl, Qt from UM.Qt.ListModel import ListModel from UM.Resources import Resources @@ -25,51 +25,43 @@ class WelcomePagesModel(ListModel): self.addRoleName(self.PageUrlRole, "page_url") self.addRoleName(self.NextPageIdRole, "next_page_id") - self._pages = [] + self._pages = [] # type: List[Dict[str, Any]] + + # Convenience function to get QUrl path to pages that's located in "resources/qml/WelcomePages". + def _getBuiltinWelcomePagePath(self, page_filename: str) -> "QUrl": + from cura.CuraApplication import CuraApplication + return QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + os.path.join("WelcomePages", page_filename))) def initialize(self) -> None: - from cura.CuraApplication import CuraApplication + # Add default welcome pages self._pages.append({"id": "welcome", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "WelcomeContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("WelcomeContent.qml"), }) self._pages.append({"id": "user_agreement", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "UserAgreementContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("UserAgreementContent.qml"), }) self._pages.append({"id": "whats_new", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "WhatsNewContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("WhatsNewContent.qml"), }) self._pages.append({"id": "data_collections", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "DataCollectionsContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("DataCollectionsContent.qml"), }) self._pages.append({"id": "add_printer_by_selection", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "AddPrinterBySelectionContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("AddPrinterBySelectionContent.qml"), }) self._pages.append({"id": "add_printer_by_ip", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "AddPrinterByIpContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), }) self._pages.append({"id": "cloud", - "page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, - os.path.join("WelcomePages", - "CloudContent.qml"))), + "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), }) self.setItems(self._pages) - - def addPage(self): + def addPage(self) -> None: pass + __all__ = ["WelcomePagesModel"] From 3a3e65224b07a348b7e18850b93f8075936157d0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:11:30 +0100 Subject: [PATCH 089/211] Remove debugging shortcut --- resources/qml/Actions.qml | 9 --------- resources/qml/Cura.qml | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 206f99af00..c35e845993 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -69,18 +69,9 @@ Item property alias browsePackages: browsePackagesAction - property alias showOnBoarding: showOnBoarding - UM.I18nCatalog{id: catalog; name: "cura"} - Controls2.Action - { - id: showOnBoarding - text: catalog.i18nc("@action:inmenu", "Show On boarding") - shortcut: "Ctrl+Alt+D" - } - Action { id: showTroubleShootingAction diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 47f712e21a..3a69523ced 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -58,16 +58,6 @@ UM.MainWindow z: stageMenu.z + 1 } - Connections - { - target: Cura.Actions.showOnBoarding - onTriggered: - { - welcomeDialog.currentStep = 0 - welcomeDialog.show() - } - } - Component.onCompleted: { CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) From 838944dc2bf8b74d42be76ec826524842334c1de Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:14:34 +0100 Subject: [PATCH 090/211] Change scroll policy to AsNeeded --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 2e85117d5c..7720ff8436 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -23,7 +23,7 @@ ScrollView property string preferredCategory: "Ultimaker" ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AlwaysOn + ScrollBar.vertical.policy: ScrollBar.AsNeeded property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height From f0104f6245db2258b319395b89ad65fba3615244 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:15:33 +0100 Subject: [PATCH 091/211] Remove unused code --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 7720ff8436..52269e3b29 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -100,7 +100,6 @@ ScrollView { id: arrow anchors.left: parent.left - //anchors.verticalCenter: label.verticalCenter width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width From 311407203871b5a19921fdc3a21d820289eea960 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:16:45 +0100 Subject: [PATCH 092/211] Fix code style --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 52269e3b29..2eb05a0530 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -161,7 +161,8 @@ ScrollView border.width: UM.Theme.getSize("default_lining").width border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") - Rectangle { + Rectangle + { width: parent.width / 2 height: width anchors.centerIn: parent From d46d0f29991985f9f1a6c261e0ec4232f6891974 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:17:58 +0100 Subject: [PATCH 093/211] Change Scroll policy to AsNeeded --- 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 bee0c49e92..f3c5b88723 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -56,7 +56,7 @@ Item anchors.right: parent.right ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AlwaysOn + ScrollBar.vertical.policy: ScrollBar.AsNeeded property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height From 79ab09ca01a6b49bacc07706fc95914939f6d8b1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 11:33:43 +0100 Subject: [PATCH 094/211] Fix troubleshooting typos --- .../AddNetworkPrinterScrollView.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index f3c5b88723..0d2aaca994 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -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 } } } From 61d2aa5c5f747bf80ec349de2a8edae9cc4a7656 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 20 Mar 2019 13:16:10 +0100 Subject: [PATCH 095/211] No more hardcoded margins (and other QML fixes) in 'add-by-ip'. [CURA-6294] --- .../WelcomePages/AddPrinterByIpContent.qml | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 3aa3e8dc2b..40216ec235 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -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: { From 615241a416d27566e48656b1b930bdf3858d4a6d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 13:39:08 +0100 Subject: [PATCH 096/211] Fix module renaming --- cura/CuraApplication.py | 26 +++++++++---------- cura/Scene/CuraSceneController.py | 2 +- .../CustomQualityProfilesDropDownMenuModel.py | 2 +- .../MachineModels/FavoriteMaterialsModel.py | 2 +- .../UI/MachineModels/GenericMaterialsModel.py | 2 +- cura/UI/MachineModels/MaterialBrandsModel.py | 2 +- .../CuraEngineBackend/CuraEngineBackend.py | 2 +- .../Settings/TestSettingVisibilityPresets.py | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a05e73fe95..d997a88fb6 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -66,19 +66,19 @@ from UM.Settings.SettingFunction import SettingFunction from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.MachineNameValidator import MachineNameValidator -from cura.UI.Models.BuildPlateModel import BuildPlateModel -from cura.UI.Models.NozzleModel import NozzleModel -from cura.UI.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel -from cura.UI.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel -from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel -from cura.UI.Models.FavoriteMaterialsModel import FavoriteMaterialsModel -from cura.UI.Models.GenericMaterialsModel import GenericMaterialsModel -from cura.UI.Models.MaterialBrandsModel import MaterialBrandsModel -from cura.UI.Models import QualityManagementModel -from cura.UI.Models.QualitySettingsModel import QualitySettingsModel -from cura.UI.Models.MachineManagementModel import MachineManagementModel +from cura.UI.MachineModels.BuildPlateModel import BuildPlateModel +from cura.UI.MachineModels.NozzleModel import NozzleModel +from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.UI.MachineModels.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel +from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel +from cura.UI.MachineModels.FavoriteMaterialsModel import FavoriteMaterialsModel +from cura.UI.MachineModels.GenericMaterialsModel import GenericMaterialsModel +from cura.UI.MachineModels.MaterialBrandsModel import MaterialBrandsModel +from cura.UI.MachineModels.QualityManagementModel import QualityManagementModel +from cura.UI.MachineModels.QualitySettingsModel import QualitySettingsModel +from cura.UI.MachineModels.MachineManagementModel import MachineManagementModel -from cura.UI.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Machines.MachineErrorChecker import MachineErrorChecker @@ -111,7 +111,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.UI.ObjectsModel import ObjectsModel -from cura.UI.Models.DiscoveredPrintersModel import DiscoveredPrintersModel +from cura.UI.MachineModels.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index e331a109ec..b0e9e10c32 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QApplication from UM.Scene.Camera import Camera from cura.UI.ObjectsModel import ObjectsModel -from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel +from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel from UM.Application import Application from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator diff --git a/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py b/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py index 9a31256ec3..387182dd90 100644 --- a/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py +++ b/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py @@ -3,7 +3,7 @@ from UM.Logger import Logger -from cura.UI.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel # diff --git a/cura/UI/MachineModels/FavoriteMaterialsModel.py b/cura/UI/MachineModels/FavoriteMaterialsModel.py index 2540fd0608..b81c25a2b4 100644 --- a/cura/UI/MachineModels/FavoriteMaterialsModel.py +++ b/cura/UI/MachineModels/FavoriteMaterialsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel ## Model that shows the list of favorite materials. class FavoriteMaterialsModel(BaseMaterialsModel): diff --git a/cura/UI/MachineModels/GenericMaterialsModel.py b/cura/UI/MachineModels/GenericMaterialsModel.py index a99cdfc8eb..122bb3fc8f 100644 --- a/cura/UI/MachineModels/GenericMaterialsModel.py +++ b/cura/UI/MachineModels/GenericMaterialsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel class GenericMaterialsModel(BaseMaterialsModel): diff --git a/cura/UI/MachineModels/MaterialBrandsModel.py b/cura/UI/MachineModels/MaterialBrandsModel.py index 7f02dd5302..bd641d29e7 100644 --- a/cura/UI/MachineModels/MaterialBrandsModel.py +++ b/cura/UI/MachineModels/MaterialBrandsModel.py @@ -3,7 +3,7 @@ from PyQt5.QtCore import Qt, pyqtSignal from UM.Qt.ListModel import ListModel -from cura.UI.Models.BaseMaterialsModel import BaseMaterialsModel +from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel class MaterialTypesModel(ListModel): diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 3d0d4fb11e..0527b4534e 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -30,7 +30,7 @@ from .StartSliceJob import StartSliceJob, StartJobResult import Arcus if TYPE_CHECKING: - from cura.UI.Models.MultiBuildPlateModel import MultiBuildPlateModel + from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel from cura.Machines.MachineErrorChecker import MachineErrorChecker from UM.Scene.Scene import Scene from UM.Settings.ContainerStack import ContainerStack diff --git a/tests/Settings/TestSettingVisibilityPresets.py b/tests/Settings/TestSettingVisibilityPresets.py index 079bda3912..13089e8aa6 100644 --- a/tests/Settings/TestSettingVisibilityPresets.py +++ b/tests/Settings/TestSettingVisibilityPresets.py @@ -5,7 +5,7 @@ import os.path from UM.Preferences import Preferences from UM.Resources import Resources from cura.CuraApplication import CuraApplication -from cura.UI.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset setting_visibility_preset_test_settings = {"test", "zomg", "derp", "yay", "whoo"} From 95a0a5fb2437f4596df54cfead95c6366d3cc0e4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 13:46:54 +0100 Subject: [PATCH 097/211] Theme window_disabled_background --- resources/qml/Cura.qml | 2 +- resources/themes/cura-light/theme.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3a69523ced..99858c5331 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -53,7 +53,7 @@ UM.MainWindow id: greyOutBackground anchors.fill: parent visible: welcomeDialog.visible - color: "black" + color: UM.Theme.getColor("window_disabled_background") opacity: 0.7 z: stageMenu.z + 1 } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 9ef6993bdc..cfdf03bcaf 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -191,6 +191,8 @@ "printer_type_label_background": [228, 228, 242, 255], + "window_disabled_background": [0, 0, 0, 255], + "text_light_blue": [50, 130, 255, 255], "text": [25, 25, 25, 255], From 428fb5a3a1c8924382f6f046ec538723bfea40cc Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 13:49:14 +0100 Subject: [PATCH 098/211] Use Item instead of transparent Rectangle --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 2eb05a0530..9007756e38 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -146,10 +146,9 @@ ScrollView font: UM.Theme.getFont("default") visible: base.currentSection == section - background: Rectangle + background: Item { anchors.fill: parent - color: "transparent" } indicator: Rectangle From 91acbca14124fad5f3b22eafab45282b3994ea3f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 14:04:59 +0100 Subject: [PATCH 099/211] Bind no printer label visible to item count --- 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 0d2aaca994..6cbfe46902 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -45,7 +45,7 @@ Item text: catalog.i18nc("@label", "There is no printer found over your network.") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter - visible: !networkPrinterScrollView.visible + visible: networkPrinterListView.count == 0 // Do not show if there are discovered devices. } ScrollView From 8cc05a2a62462b098b0c104a67bc50b89c9af543 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 14:04:59 +0100 Subject: [PATCH 100/211] Bind no printer label visible to item count --- 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 0d2aaca994..6cbfe46902 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -45,7 +45,7 @@ Item text: catalog.i18nc("@label", "There is no printer found over your network.") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter - visible: !networkPrinterScrollView.visible + visible: networkPrinterListView.count == 0 // Do not show if there are discovered devices. } ScrollView From c6bd31e5f6a94bf812e24cbe8cd3630d1e764f99 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 14:07:13 +0100 Subject: [PATCH 101/211] Simplify code --- 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 6cbfe46902..2275d3646e 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -61,7 +61,7 @@ Item property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height - visible: networkPrinterListView.model.length > 0 + visible: networkPrinterListView.count > 0 clip: true From 5d45dba8f3cc3a18f98a0cdb2f0bd0924b1a780e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 20 Mar 2019 15:58:04 +0100 Subject: [PATCH 102/211] Fix DiscoveredMachineModel test --- .../MachineModels/DiscoveredPrintersModel.py | 10 ++++--- tests/TestMachineManager.py | 17 ------------ .../TestDiscoveredPrintersModel.py | 27 +++++++++++++++++++ 3 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 tests/UI/MachineModels/TestDiscoveredPrintersModel.py diff --git a/cura/UI/MachineModels/DiscoveredPrintersModel.py b/cura/UI/MachineModels/DiscoveredPrintersModel.py index da16435605..0998a2aa3a 100644 --- a/cura/UI/MachineModels/DiscoveredPrintersModel.py +++ b/cura/UI/MachineModels/DiscoveredPrintersModel.py @@ -11,6 +11,8 @@ from UM.Logger import Logger if TYPE_CHECKING: from PyQt5.QtCore import QObject + from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice + catalog = i18nCatalog("cura") @@ -18,7 +20,7 @@ catalog = i18nCatalog("cura") class DiscoveredPrinter(QObject): def __init__(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], machine_type: str, - device, parent = None) -> None: + device: "NetworkedPrinterOutputDevice", parent: Optional["QObject"] = None) -> None: super().__init__(parent) self._ip_address = ip_address @@ -67,7 +69,7 @@ class DiscoveredPrinter(QObject): return self.readable_machine_type.lower() == "unknown" @pyqtProperty(QObject, constant = True) - def device(self): + def device(self) -> "NetworkedPrinterOutputDevice": return self._device @@ -78,7 +80,7 @@ class DiscoveredPrinter(QObject): # class DiscoveredPrintersModel(QObject): - def __init__(self, parent: Optional["QObject"]) -> None: + def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__(parent) self._discovered_printer_by_ip_dict = dict() # type: Dict[str, DiscoveredPrinter] @@ -92,7 +94,7 @@ class DiscoveredPrintersModel(QObject): return item_list def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], - machine_type: str, device) -> None: + machine_type: str, device: "NetworkedPrinterOutputDevice") -> None: if ip_address in self._discovered_printer_by_ip_dict: Logger.log("e", "Printer with ip [%s] has already been added", ip_address) return diff --git a/tests/TestMachineManager.py b/tests/TestMachineManager.py index 36ffe01b96..f261ce1b41 100644 --- a/tests/TestMachineManager.py +++ b/tests/TestMachineManager.py @@ -45,20 +45,3 @@ def test_setActiveMachine(machine_manager): # Although we mocked the application away, we still want to know if it was notified about the attempted change. machine_manager._application.setGlobalContainerStack.assert_called_with(mocked_global_stack) - - -def test_discoveredMachine(machine_manager): - mocked_callback = MagicMock() - machine_manager.addDiscoveredPrinter("test", "zomg", mocked_callback, "derp") - machine_manager.addMachineFromDiscoveredPrinter("test") - mocked_callback.assert_called_with("test") - - assert len(machine_manager.discoveredPrinters) == 1 - - # Test if removing it works - machine_manager.removeDiscoveredPrinter("test") - assert len(machine_manager.discoveredPrinters) == 0 - - # Just in case, nothing should happen. - machine_manager.addMachineFromDiscoveredPrinter("test") - assert mocked_callback.call_count == 1 diff --git a/tests/UI/MachineModels/TestDiscoveredPrintersModel.py b/tests/UI/MachineModels/TestDiscoveredPrintersModel.py new file mode 100644 index 0000000000..2fa5701b7b --- /dev/null +++ b/tests/UI/MachineModels/TestDiscoveredPrintersModel.py @@ -0,0 +1,27 @@ + +from unittest.mock import MagicMock + +import pytest + +from cura.UI.MachineModels.DiscoveredPrintersModel import DiscoveredPrintersModel + + +@pytest.fixture() +def discovered_printer_model(application) -> DiscoveredPrintersModel: + return DiscoveredPrintersModel() + + +def test_discoveredPrinters(discovered_printer_model): + mocked_device = MagicMock() + + mocked_callback = MagicMock() + discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device) + device = discovered_printer_model.discovered_printers[0] + discovered_printer_model.createMachineFromDiscoveredPrinter(device) + mocked_callback.assert_called_with("key") + + assert len(discovered_printer_model.discovered_printers) == 1 + + # Test if removing it works + discovered_printer_model.removeDiscoveredPrinter("ip") + assert len(discovered_printer_model.discovered_printers) == 0 From 1f2fea14ceed8b66f45ee6faf5ccd2dfe69a6035 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 20 Mar 2019 16:08:50 +0100 Subject: [PATCH 103/211] Little refactors (apply review comments). [CURA-6294] --- cura/CuraApplication.py | 1 - cura/UI/WelcomePagesModel.py | 1 - resources/qml/Cura.qml | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f3a79cecce..6fbe8fde73 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -453,7 +453,6 @@ class CuraApplication(QtApplication): # Misc.: "ConsoleLogger", #You want to be able to read the log if something goes wrong. "CuraEngineBackend", #Cura is useless without this one since you can't slice. - # NOTE: User-Agreement is part of the 'onboarding flow' now (See Welcome Pages). "FileLogger", #You want to be able to read the log if something goes wrong. "XmlMaterialProfile", #Cura crashes without this one. "Toolbox", #This contains the interface to enable/disable plug-ins, so if you disable it you can't enable it back. diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index c0aeffb3ad..d72071fd7f 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -7,7 +7,6 @@ from PyQt5.QtCore import QUrl, Qt from UM.Qt.ListModel import ListModel from UM.Resources import Resources -from logging import Logger if TYPE_CHECKING: from PyQt5.QtCore import QObject diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index d71f219052..47fa54dbc1 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -78,13 +78,13 @@ UM.MainWindow { welcomeDialog.visible = true; welcomeDialog.currentStep = 0; - welcomeDialog.show(); } else { - welcomeDialog.hide() welcomeDialog.visible = false; } + // TODO: While the new onboarding process contains the user-agreement, + // it should probably not entirely rely on 'needToShowUserAgreement' for show/hide. } Item From 9a2b800fe814c61360df20775bfe0aba66a11f40 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 20 Mar 2019 17:01:37 +0100 Subject: [PATCH 104/211] Future proof: also accept IPv6 address. [CURA-6294] --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 40216ec235..0ffc79cc5b 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -79,7 +79,7 @@ Item validator: RegExpValidator { - regExp: /[0-9\.\-\_]*/ + regExp: /[a-fA-F0-9\.\:]*/ } onAccepted: addPrinterButton.clicked() From 8f9bd0ad0697774c51194606f4fe65c553f6c252 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 20 Mar 2019 17:20:06 +0100 Subject: [PATCH 105/211] Adapted to more review comments. [CURA-6294] --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 0ffc79cc5b..f3ed58200b 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -18,7 +18,6 @@ Item id: addPrinterByIpScreen - property bool hasPushedAdd: false property bool hasSentRequest: false property bool haveConnection: false @@ -42,7 +41,7 @@ Item 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) | 0 + width: Math.floor(parent.width * 3 / 4) Item { @@ -99,12 +98,11 @@ Item { if (hostnameField.text.trim() != "") { - addPrinterByIpScreen.hasPushedAdd = true - UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text) + enabled = false; + UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text); } } - enabled: ! addPrinterByIpScreen.hasPushedAdd BusyIndicator { anchors.fill: parent From 9e92a186ec07881ec49e35f030e7b9b0c5717622 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 09:06:41 +0100 Subject: [PATCH 106/211] Fix code styles --- cura/UI/GlobalStacksModel.py | 2 -- cura/UI/MaterialOutputModel.py | 2 +- cura/UI/ObjectsModel.py | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cura/UI/GlobalStacksModel.py b/cura/UI/GlobalStacksModel.py index 579555e52c..f15fe1878b 100644 --- a/cura/UI/GlobalStacksModel.py +++ b/cura/UI/GlobalStacksModel.py @@ -29,7 +29,6 @@ class GlobalStacksModel(ListModel): self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.MetaDataRole, "metadata") self.addRoleName(self.DiscoverySourceRole, "discoverySource") - self._container_stacks = [] self._change_timer = QTimer() self._change_timer.setInterval(200) @@ -40,7 +39,6 @@ class GlobalStacksModel(ListModel): CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged) CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged) CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged) - self._filter_dict = {} self._updateDelayed() ## Handler for container added/removed events from registry diff --git a/cura/UI/MaterialOutputModel.py b/cura/UI/MaterialOutputModel.py index b3dd83fb72..0ac4cf36bc 100644 --- a/cura/UI/MaterialOutputModel.py +++ b/cura/UI/MaterialOutputModel.py @@ -5,7 +5,7 @@ from PyQt5.QtCore import pyqtProperty, QObject class MaterialOutputModel(QObject): - def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None): + def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None) -> None: super().__init__(parent) self._guid = guid self._type = type diff --git a/cura/UI/ObjectsModel.py b/cura/UI/ObjectsModel.py index 4d0233f6cb..09304451a5 100644 --- a/cura/UI/ObjectsModel.py +++ b/cura/UI/ObjectsModel.py @@ -2,6 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from collections import defaultdict +from typing import Dict from PyQt5.QtCore import QTimer @@ -18,7 +19,7 @@ catalog = i18nCatalog("cura") ## Keep track of all objects in the project class ObjectsModel(ListModel): - def __init__(self): + def __init__(self) -> None: super().__init__() Application.getInstance().getController().getScene().sceneChanged.connect(self._updateSceneDelayed) @@ -48,7 +49,7 @@ class ObjectsModel(ListModel): filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate") active_build_plate_number = self._build_plate_number group_nr = 1 - name_count_dict = defaultdict(int) + name_count_dict = defaultdict(int) # type: Dict[str, int] for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): if not isinstance(node, SceneNode): From cf5fd1c355f7415bc7b582703aef2610a1593213 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 09:13:00 +0100 Subject: [PATCH 107/211] Fix typing --- cura/UI/MaterialOutputModel.py | 6 ++++-- .../UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cura/UI/MaterialOutputModel.py b/cura/UI/MaterialOutputModel.py index 0ac4cf36bc..7a17ef3cce 100644 --- a/cura/UI/MaterialOutputModel.py +++ b/cura/UI/MaterialOutputModel.py @@ -1,11 +1,13 @@ # Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from typing import Optional + from PyQt5.QtCore import pyqtProperty, QObject class MaterialOutputModel(QObject): - def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None) -> None: + def __init__(self, guid: Optional[str], type: str, color: str, brand: str, name: str, parent = None) -> None: super().__init__(parent) self._guid = guid self._type = type @@ -15,7 +17,7 @@ class MaterialOutputModel(QObject): @pyqtProperty(str, constant = True) def guid(self) -> str: - return self._guid + return self._guid if self._guid else "" @pyqtProperty(str, constant = True) def type(self) -> str: diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 83510518d6..a7ea47cc3c 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -25,7 +25,11 @@ from UM.Version import Version from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager -from typing import Optional +from typing import Optional, TYPE_CHECKING + +if TYPE_CHECKING: + from cura.Settings.GlobalStack import GlobalStack + i18n_catalog = i18nCatalog("cura") @@ -431,7 +435,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): Logger.log("d", "Checking if cloud connection is possible...") # Pre-Check: Skip if active machine already has been cloud connected or you said don't ask again - active_machine = self._application.getMachineManager().activeMachine # type: Optional["GlobalStack"] + active_machine = self._application.getMachineManager().activeMachine # type: Optional[GlobalStack] if active_machine: # Check 1A: Printer isn't already configured for cloud @@ -519,7 +523,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): return def _onDontAskMeAgain(self, checked: bool) -> None: - active_machine = self._application.getMachineManager().activeMachine # type: Optional["GlobalStack"] + active_machine = self._application.getMachineManager().activeMachine # type: Optional[GlobalStack] if active_machine: active_machine.setMetaDataEntry("do_not_show_cloud_message", checked) if checked: From aa1ad9a93d50b06b7a59379ab7be89b53bf6f038 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 09:31:24 +0100 Subject: [PATCH 108/211] Fix merge conflicts --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 5a41bfa72b..66be0200c4 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -27,17 +27,10 @@ from UM.Version import Version from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager -<<<<<<< HEAD if TYPE_CHECKING: from cura.Settings.GlobalStack import GlobalStack from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin -======= -from typing import Optional, TYPE_CHECKING -if TYPE_CHECKING: - from cura.Settings.GlobalStack import GlobalStack - ->>>>>>> origin/WIP_onboarding i18n_catalog = i18nCatalog("cura") From 0671f68616cce403656ca2c84b85730f3a3a6869 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 09:54:01 +0100 Subject: [PATCH 109/211] Remove unnecessary code --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 9007756e38..ab7029903b 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -49,12 +49,6 @@ ScrollView updateCurrentItemUponSectionChange() } - background: Rectangle - { - anchors.fill: parent - color: "white" - } - ListView { id: machineList From 6742348a954437440db29adc508af2dade86da1b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 15:20:39 +0100 Subject: [PATCH 110/211] Theme radio_button size --- .../qml/WelcomePages/AddLocalPrinterScrollView.qml | 10 +++++----- resources/themes/cura-light/theme.json | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index ab7029903b..7ad0f5c96c 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -147,19 +147,19 @@ ScrollView indicator: Rectangle { - implicitWidth: 16 - implicitHeight: 16 + implicitWidth: UM.Theme.getSize("radio_button").width + implicitHeight: UM.Theme.getSize("radio_button").height anchors.verticalCenter: parent.verticalCenter - radius: width / 2 + radius: (width / 2) | 0 border.width: UM.Theme.getSize("default_lining").width border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") Rectangle { - width: parent.width / 2 + width: (parent.width / 2) | 0 height: width anchors.centerIn: parent - radius: width / 2 + radius: (width / 2) | 0 color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") visible: radioButton.checked } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index cfdf03bcaf..83edda6486 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -513,6 +513,8 @@ "action_button_icon": [1.0, 1.0], "action_button_radius": [0.15, 0.15], + "radio_button": [1.3, 1.3], + "small_button": [2, 2], "small_button_icon": [1.5, 1.5], From bff9287094f9dbfeff863a7109db3bb1947e9487 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 15:47:17 +0100 Subject: [PATCH 111/211] Simplify the horizontal-line in network printer panel --- .../AddNetworkPrinterScrollView.qml | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 2275d3646e..b27e4db1fe 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -118,23 +118,24 @@ Item } } - Cura.RoundedRectangle + Item { id: controlsRectangle anchors.left: parent.left anchors.right: parent.right anchors.top: networkPrinterInfo.bottom - // Make sure that the left, right, and bottom borders do not show up, otherwise you see double - // borders. - anchors.bottomMargin: -border.width - anchors.leftMargin: -border.width - anchors.rightMargin: -border.width + + // Horizontal line separating the buttons (below) and the discovered network printers (above) + Rectangle + { + anchors.left: parent.left + anchors.top: parent.top + anchors.right: parent.right + height: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - color: "white" - cornerSide: Cura.RoundedRectangle.Direction.Down Cura.SecondaryButton { From f13ceb2a4d2422347051b39803917691943605c0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 15:53:21 +0100 Subject: [PATCH 112/211] Use default margin for network printer button --- 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 b27e4db1fe..575ec9c126 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -91,7 +91,7 @@ Item anchors.left: parent.left anchors.right: parent.right - anchors.rightMargin: 10 + anchors.rightMargin: UM.Theme.getSize("default_margin").width outputDevice: modelData.device enabled: !modelData.is_unknown_machine_type From c3175e53227ce1d38035515201bed58942a06f3f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 21 Mar 2019 16:01:50 +0100 Subject: [PATCH 113/211] Theme welcome_pages_button --- resources/qml/WelcomePages/AddPrinterBySelectionContent.qml | 2 +- resources/qml/WelcomePages/CloudContent.qml | 6 +++--- resources/qml/WelcomePages/DataCollectionsContent.qml | 2 +- .../qml/WelcomePages/FirstStartMachineActionsContent.qml | 2 +- resources/qml/WelcomePages/UserAgreementContent.qml | 4 ++-- resources/qml/WelcomePages/WelcomeContent.qml | 2 +- resources/qml/WelcomePages/WhatsNewContent.qml | 2 +- resources/themes/cura-light/theme.json | 2 ++ 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml index faa2d259be..4b9ef1a779 100644 --- a/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml +++ b/resources/qml/WelcomePages/AddPrinterBySelectionContent.qml @@ -127,7 +127,7 @@ Item } text: catalog.i18nc("@button", "Next") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: { diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 09e52c17dd..36c2431e7c 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -85,7 +85,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Finish") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: base.showNextPage() } @@ -97,7 +97,7 @@ Item anchors.verticalCenter: finishButton.verticalCenter anchors.margins: 40 text: catalog.i18nc("@button", "Create an account") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") } @@ -108,7 +108,7 @@ Item anchors.left: createAccountButton.right anchors.verticalCenter: finishButton.verticalCenter text: catalog.i18nc("@button", "Sign in") - width: 80 + width: UM.Theme.getSize("welcome_pages_button").width shadowEnabled: false color: "transparent" hoverColor: "transparent" diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 93426d2c2c..c22434b9f1 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -62,7 +62,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Next") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 1bc4b7c284..d02f3cfcb0 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -72,7 +72,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Next") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: { diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 82b16ba2ee..493f42e6f2 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -60,7 +60,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Agree") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: { @@ -77,7 +77,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Decline and close") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: { diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index fe47567da6..272c7bda47 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -59,7 +59,7 @@ Column id: getStartedButton anchors.horizontalCenter: parent.horizontalCenter text: catalog.i18nc("@button", "Get started") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index b083c99e32..351f2f07b7 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -78,7 +78,7 @@ Item anchors.bottom: parent.bottom anchors.margins: 40 text: catalog.i18nc("@button", "Next") - width: 140 + width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true onClicked: base.showNextPage() } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 83edda6486..61797350e5 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -509,6 +509,8 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], + "welcome_pages_button": [12.0, 2.5], + "action_button": [15.0, 2.5], "action_button_icon": [1.0, 1.0], "action_button_radius": [0.15, 0.15], From 8250c91fc428ec5421e7f924b165ac4fac3744c7 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 21 Mar 2019 18:45:57 +0100 Subject: [PATCH 114/211] Make remove manual device (also) work (as failure-state of add manual device). [CURA-6294] --- .../src/UM3OutputDevicePlugin.py | 20 +++++------ .../WelcomePages/AddPrinterByIpContent.qml | 34 ++++++++++++++++--- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 9bcbf38b77..9f1684f624 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -258,22 +258,26 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): def _onNetworkRequestFinished(self, reply): 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! - return + if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200: + # 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 = { @@ -301,16 +305,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] diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index f3ed58200b..c67e93c9a7 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -113,6 +113,12 @@ Item ! addPrinterByIpScreen.haveConnection } } + + Connections + { + target: UM.OutputDeviceManager + onManualDeviceChanged: { addPrinterButton.enabled = ! UM.OutputDeviceManager.hasManualDevice } + } } } @@ -172,9 +178,18 @@ Item target: UM.OutputDeviceManager onManualDeviceChanged: { - typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type") - firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version") - addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address") + 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 = "" + } } } } @@ -184,8 +199,17 @@ Item target: UM.OutputDeviceManager onManualDeviceChanged: { - printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") - addPrinterByIpScreen.haveConnection = true + if (UM.OutputDeviceManager.hasManualDevice) + { + printerNameLabel.text = UM.OutputDeviceManager.manualDeviceProperty("name") + addPrinterByIpScreen.haveConnection = true + } + else + { + printerNameLabel.text = catalog.i18nc("@label", "Could not connect to device.") + addPrinterByIpScreen.hasSentRequest = false + addPrinterByIpScreen.haveConnection = false + } } } } From 9265a0de4a6e8b45d3b6b99a822c02820e91896f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 09:41:12 +0100 Subject: [PATCH 115/211] 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 116/211] 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 117/211] 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 118/211] 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 119/211] 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 120/211] 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 121/211] 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 122/211] 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 123/211] 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 124/211] 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 125/211] 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 126/211] 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 127/211] 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 e632b508ebb25b253603de45a4899e4e2cb9d20d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:28:17 +0100 Subject: [PATCH 128/211] Rename to AddNetworkOrLocalPrinterContent --- cura/UI/WelcomePagesModel.py | 4 ++-- ...lectionContent.qml => AddNetworkOrLocalPrinterContent.qml} | 0 resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename resources/qml/WelcomePages/{AddPrinterBySelectionContent.qml => AddNetworkOrLocalPrinterContent.qml} (100%) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 1e9a2a124b..bf33ba7baa 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -47,8 +47,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 diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index e71efb09aa..696db894b5 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_network_or_local_printer") } Cura.PrimaryButton From 03155d24dad123402bfd546c901b4c701554bb4b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 10:35:41 +0100 Subject: [PATCH 129/211] 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 69a5a99ac1..b8a5afb43e 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 130/211] 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 131/211] 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 132/211] 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 133/211] 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 134/211] 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 67428aee537a05e1c3d9ee528099245687c13bf3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 12:55:25 +0100 Subject: [PATCH 135/211] 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 26acad3dbcecaf61baca13a575045e43ac352d22 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 12:55:25 +0100 Subject: [PATCH 136/211] 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 137/211] 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 138/211] 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 1f75d00cd30755ce8684142bdfac8d7cd1f256e2 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 22 Mar 2019 13:10:31 +0100 Subject: [PATCH 139/211] Adapt add-by-ip-qml to handle unresponsive address. [CURA-6294] --- .../WelcomePages/AddPrinterByIpContent.qml | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index c67e93c9a7..6a90dce1f7 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -20,6 +20,7 @@ Item property bool hasSentRequest: false property bool haveConnection: false + property bool deviceUnresponsive: false Label { @@ -75,12 +76,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() } @@ -99,6 +102,7 @@ Item if (hostnameField.text.trim() != "") { enabled = false; + addPrinterByIpScreen.deviceUnresponsive = false; UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text); } } @@ -135,8 +139,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.") + } + } } Rectangle @@ -145,7 +163,7 @@ Item anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width - visible: addPrinterByIpScreen.haveConnection + visible: addPrinterByIpScreen.haveConnection && ! addPrinterByIpScreen.deviceUnresponsive Label { @@ -206,9 +224,9 @@ Item } else { - printerNameLabel.text = catalog.i18nc("@label", "Could not connect to device.") addPrinterByIpScreen.hasSentRequest = false addPrinterByIpScreen.haveConnection = false + addPrinterByIpScreen.deviceUnresponsive = true } } } From eb02b302f53ecd359c8f3d9a83b701c34ef0a042 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 13:18:33 +0100 Subject: [PATCH 140/211] 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 + } } } From 8de055dd33170969cc57ec52cbbaea702750e163 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 22 Mar 2019 13:19:19 +0100 Subject: [PATCH 141/211] Adjust add-by-ip to latest review comments. [CURA-6294] --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 6a90dce1f7..034ee74e76 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -18,9 +18,9 @@ Item id: addPrinterByIpScreen - property bool hasSentRequest: false - property bool haveConnection: false - property bool deviceUnresponsive: false + property bool hasSentRequest: false // True when a request has been sent to the device at the typed address. + property bool haveConnection: false // True when there is a connection with a machine, it can then be added. + property bool deviceUnresponsive: false // True when a request comes back, but the device hasn't responded. Label { @@ -126,7 +126,7 @@ Item } } - Rectangle + Item { width: parent.width anchors.top: userInputFields.bottom @@ -157,7 +157,7 @@ Item } } - Rectangle + Item { id: printerInfoLabels anchors.top: parent.top From f8c4cee2decc0563eca047b5d793f7257844dd04 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 13:47:12 +0100 Subject: [PATCH 142/211] Simplify user agreement page layout --- .../WelcomePages/DataCollectionsContent.qml | 2 +- .../qml/WelcomePages/UserAgreementContent.qml | 71 ++++++++++--------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index b17c24300a..2990b16795 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -31,7 +31,7 @@ Item // Area where the cloud contents can be put. Pictures, texts and such. Item { - id: cloudContentsArea + id: contentsArea anchors.top: titleLabel.bottom anchors.bottom: getStartedButton.top anchors.left: parent.left diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index dfec088ad6..792a4df991 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -12,45 +12,52 @@ import Cura 1.1 as Cura // Item { - Column + UM.I18nCatalog { id: catalog; name: "cura" } + + 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") + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("large_bold") + renderType: Text.NativeRendering + } + + + Item + { + anchors.top: titleLabel.bottom + anchors.bottom: agreeButton.top anchors.left: parent.left anchors.right: parent.right - anchors.margins: 20 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width - UM.I18nCatalog { id: catalog; name: "cura" } + Label + { + id: disclaimerLineLabel + /* + anchors.top: titleLabel.bottom + anchors.bottom: agreeButton.top + anchors.horizontalCenter: parent.horizontalCenter + */ + anchors.centerIn: parent + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width - spacing: 40 + width: (parent.width * 2 / 3) | 0 - // Placeholder - Label { text: " " } - - 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 - anchors.horizontalCenter: parent.horizontalCenter - text: "

Disclaimer by Ultimaker

" - + "

Please read this disclaimer carefully.

" - + "

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.

" - + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" - textFormat: Text.RichText - wrapMode: Text.WordWrap - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - } + text: "

Disclaimer by Ultimaker

" + + "

Please read this disclaimer carefully.

" + + "

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.

" + + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" + textFormat: Text.RichText + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + } } Cura.PrimaryButton From a9431b270f679f6dfd8af20a95efbdbdc0f2bdee Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 14:19:26 +0100 Subject: [PATCH 143/211] Rearrange items in WelcomeContent.qml --- .../qml/WelcomePages/UserAgreementContent.qml | 38 ++++++------- resources/qml/WelcomePages/WelcomeContent.qml | 54 +++++++++---------- 2 files changed, 43 insertions(+), 49 deletions(-) diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 792a4df991..583832e906 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -27,8 +27,7 @@ Item renderType: Text.NativeRendering } - - Item + Item // Area for pictures and texts { anchors.top: titleLabel.bottom anchors.bottom: agreeButton.top @@ -36,28 +35,23 @@ Item anchors.right: parent.right anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width - Label - { - id: disclaimerLineLabel - /* - anchors.top: titleLabel.bottom - anchors.bottom: agreeButton.top - anchors.horizontalCenter: parent.horizontalCenter - */ - anchors.centerIn: parent - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + Label + { + id: disclaimerLineLabel + anchors.centerIn: parent + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width - width: (parent.width * 2 / 3) | 0 + width: (parent.width * 2 / 3) | 0 - text: "

Disclaimer by Ultimaker

" - + "

Please read this disclaimer carefully.

" - + "

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.

" - + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" - textFormat: Text.RichText - wrapMode: Text.WordWrap - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - } + text: "

Disclaimer by Ultimaker

" + + "

Please read this disclaimer carefully.

" + + "

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.

" + + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" + textFormat: Text.RichText + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + } } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index fe47567da6..2fde182c4c 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -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. // -Column +Item { UM.I18nCatalog { id: catalog; name: "cura" } - spacing: 60 + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width - // Placeholder - Label { text: " " } - - Label + Column // Arrange the items vertically and put everything in the center { - id: titleLabel - 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 - } + anchors.centerIn: parent + width: parent.width + spacing: UM.Theme.getSize("welcome_pages_default_margin").height - Column - { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 40 + Label + { + id: titleLabel + 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 { @@ -52,15 +50,17 @@ Column font: UM.Theme.getFont("medium") renderType: Text.NativeRendering } - } - Cura.PrimaryButton - { - id: getStartedButton - anchors.horizontalCenter: parent.horizontalCenter - text: catalog.i18nc("@button", "Get started") - width: 140 - fixedWidthMode: true - onClicked: base.showNextPage() + Cura.PrimaryButton + { + id: getStartedButton + anchors.top: contentArea.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + text: catalog.i18nc("@button", "Get started") + width: 140 + fixedWidthMode: true + onClicked: base.showNextPage() + } } } From 6f911f9924c3f29ec936bc84e5593c6a837f3a7f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 14:29:32 +0100 Subject: [PATCH 144/211] Use rounding for width --- resources/qml/WelcomePages/WhatsNewContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index d9d3648d6a..b7db5159bb 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -35,7 +35,7 @@ Item 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 + width: (parent.width * 3 / 4) | 0 border.color: "#dfdfdf" border.width: 1 From 85b28a0c908ea5fd1002418ffc8256f94a79e3fd Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 22 Mar 2019 14:34:02 +0100 Subject: [PATCH 145/211] Use themed values for margins --- resources/qml/WelcomePages/WhatsNewContent.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index b7db5159bb..097470e444 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -38,12 +38,12 @@ Item width: (parent.width * 3 / 4) | 0 border.color: "#dfdfdf" - border.width: 1 + border.width: UM.Theme.getSize("default_lining").width ScrollView { anchors.fill: parent - anchors.margins: 1 + anchors.margins: UM.Theme.getSize("default_lining").width ScrollBar.horizontal.policy: ScrollBar.AlwaysOff From 4a171eebf65a17207c8146c0d90020438b6f7c08 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 08:29:18 +0100 Subject: [PATCH 146/211] Move models around again - Move machine related models to cura.Machines.Models - Move printer device related models to cura.PrinterOutput.Models - Other UI/GUI related modules in cura.UI --- cura/CuraApplication.py | 33 ++++++------ .../Models}/BaseMaterialsModel.py | 0 .../Models}/BuildPlateModel.py | 0 .../CustomQualityProfilesDropDownMenuModel.py | 2 +- .../Models}/DiscoveredPrintersModel.py | 0 .../{UI => Machines/Models}/ExtrudersModel.py | 0 .../Models}/FavoriteMaterialsModel.py | 2 +- .../Models}/GenericMaterialsModel.py | 2 +- .../Models}/GlobalStacksModel.py | 0 .../Models}/MachineManagementModel.py | 0 .../Models}/MaterialBrandsModel.py | 2 +- .../Models}/MultiBuildPlateModel.py | 0 .../Models}/NozzleModel.py | 0 .../Models}/QualityManagementModel.py | 0 .../QualityProfilesDropDownMenuModel.py | 0 .../Models}/QualitySettingsModel.py | 0 .../Models}/SettingVisibilityPresetsModel.py | 0 .../Models}/UserChangesModel.py | 0 .../Models}/__init__.py | 0 cura/PrinterOutput/GenericOutputController.py | 10 ++-- .../Models}/ExtruderConfigurationModel.py | 0 .../Models}/ExtruderOutputModel.py | 4 +- .../Models}/PrintJobOutputModel.py | 4 +- .../Models}/PrinterConfigurationModel.py | 2 +- .../Models}/PrinterOutputModel.py | 6 +-- cura/PrinterOutput/Models/__init__.py | 0 cura/PrinterOutput/PrinterOutputController.py | 8 +-- cura/PrinterOutput/PrinterOutputDevice.py | 12 ++--- cura/Scene/CuraSceneController.py | 2 +- cura/Settings/MachineManager.py | 4 +- .../CuraEngineBackend/CuraEngineBackend.py | 2 +- .../ProcessSlicedLayersJob.py | 2 +- .../src/Cloud/CloudOutputDevice.py | 2 +- .../CloudClusterPrintCoreConfiguration.py | 4 +- .../Models/CloudClusterPrintJobStatus.py | 2 +- .../Cloud/Models/CloudClusterPrinterStatus.py | 2 +- .../src/ClusterUM3OutputDevice.py | 6 +-- .../src/ClusterUM3PrinterOutputController.py | 2 +- .../src/LegacyUM3OutputDevice.py | 4 +- .../src/LegacyUM3PrinterOutputController.py | 4 +- .../src/UM3PrintJobOutputModel.py | 2 +- .../tests/Cloud/TestCloudOutputDevice.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 4 +- .../Models}/TestDiscoveredPrintersModel.py | 53 +++++++++---------- .../Models}/TestPrintJobOutputModel.py | 6 +-- .../Models}/TestPrinterConfigurationModel.py | 4 +- .../Models}/TestPrinterOutputModel.py | 4 +- .../Settings/TestSettingVisibilityPresets.py | 2 +- 48 files changed, 99 insertions(+), 101 deletions(-) rename cura/{UI/MachineModels => Machines/Models}/BaseMaterialsModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/BuildPlateModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/CustomQualityProfilesDropDownMenuModel.py (92%) rename cura/{UI/MachineModels => Machines/Models}/DiscoveredPrintersModel.py (100%) rename cura/{UI => Machines/Models}/ExtrudersModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/FavoriteMaterialsModel.py (94%) rename cura/{UI/MachineModels => Machines/Models}/GenericMaterialsModel.py (94%) rename cura/{UI => Machines/Models}/GlobalStacksModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/MachineManagementModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/MaterialBrandsModel.py (98%) rename cura/{UI/MachineModels => Machines/Models}/MultiBuildPlateModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/NozzleModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/QualityManagementModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/QualityProfilesDropDownMenuModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/QualitySettingsModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/SettingVisibilityPresetsModel.py (100%) rename cura/{UI => Machines/Models}/UserChangesModel.py (100%) rename cura/{UI/MachineModels => Machines/Models}/__init__.py (100%) rename cura/{UI => PrinterOutput/Models}/ExtruderConfigurationModel.py (100%) rename cura/{UI => PrinterOutput/Models}/ExtruderOutputModel.py (96%) rename cura/{UI => PrinterOutput/Models}/PrintJobOutputModel.py (97%) rename cura/{UI => PrinterOutput/Models}/PrinterConfigurationModel.py (97%) rename cura/{UI => PrinterOutput/Models}/PrinterOutputModel.py (97%) create mode 100644 cura/PrinterOutput/Models/__init__.py rename tests/{UI/MachineModels => Machines/Models}/TestDiscoveredPrintersModel.py (88%) rename tests/{UI => PrinterOutput/Models}/TestPrintJobOutputModel.py (90%) rename tests/{UI => PrinterOutput/Models}/TestPrinterConfigurationModel.py (87%) rename tests/{UI => PrinterOutput/Models}/TestPrinterOutputModel.py (94%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6fbe8fde73..951f1460d2 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -48,7 +48,7 @@ from cura.Arranging.Arrange import Arrange from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray -from cura.UI.GlobalStacksModel import GlobalStacksModel +from cura.Machines.Models.GlobalStacksModel import GlobalStacksModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator @@ -66,19 +66,18 @@ from UM.Settings.SettingFunction import SettingFunction from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.MachineNameValidator import MachineNameValidator -from cura.UI.MachineModels.BuildPlateModel import BuildPlateModel -from cura.UI.MachineModels.NozzleModel import NozzleModel -from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel -from cura.UI.MachineModels.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel -from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel -from cura.UI.MachineModels.FavoriteMaterialsModel import FavoriteMaterialsModel -from cura.UI.MachineModels.GenericMaterialsModel import GenericMaterialsModel -from cura.UI.MachineModels.MaterialBrandsModel import MaterialBrandsModel -from cura.UI.MachineModels.QualityManagementModel import QualityManagementModel -from cura.UI.MachineModels.QualitySettingsModel import QualitySettingsModel -from cura.UI.MachineModels.MachineManagementModel import MachineManagementModel - -from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.Machines.Models.BuildPlateModel import BuildPlateModel +from cura.Machines.Models.NozzleModel import NozzleModel +from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.Machines.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel +from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel +from cura.Machines.Models.FavoriteMaterialsModel import FavoriteMaterialsModel +from cura.Machines.Models.GenericMaterialsModel import GenericMaterialsModel +from cura.Machines.Models.MaterialBrandsModel import MaterialBrandsModel +from cura.Machines.Models.QualityManagementModel import QualityManagementModel +from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel +from cura.Machines.Models.MachineManagementModel import MachineManagementModel +from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Machines.MachineErrorChecker import MachineErrorChecker @@ -101,8 +100,8 @@ from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager from cura.Settings.MachineManager import MachineManager from cura.Settings.ExtruderManager import ExtruderManager -from cura.UI.UserChangesModel import UserChangesModel -from cura.UI.ExtrudersModel import ExtrudersModel +from cura.Machines.Models.UserChangesModel import UserChangesModel +from cura.Machines.Models.ExtrudersModel import ExtrudersModel from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler from cura.Settings.ContainerManager import ContainerManager from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsModel @@ -111,7 +110,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.UI.ObjectsModel import ObjectsModel -from cura.UI.MachineModels.DiscoveredPrintersModel import DiscoveredPrintersModel +from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage diff --git a/cura/UI/MachineModels/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py similarity index 100% rename from cura/UI/MachineModels/BaseMaterialsModel.py rename to cura/Machines/Models/BaseMaterialsModel.py diff --git a/cura/UI/MachineModels/BuildPlateModel.py b/cura/Machines/Models/BuildPlateModel.py similarity index 100% rename from cura/UI/MachineModels/BuildPlateModel.py rename to cura/Machines/Models/BuildPlateModel.py diff --git a/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py b/cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py similarity index 92% rename from cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py rename to cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py index 387182dd90..dcade8cb0d 100644 --- a/cura/UI/MachineModels/CustomQualityProfilesDropDownMenuModel.py +++ b/cura/Machines/Models/CustomQualityProfilesDropDownMenuModel.py @@ -3,7 +3,7 @@ from UM.Logger import Logger -from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel +from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel # diff --git a/cura/UI/MachineModels/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py similarity index 100% rename from cura/UI/MachineModels/DiscoveredPrintersModel.py rename to cura/Machines/Models/DiscoveredPrintersModel.py diff --git a/cura/UI/ExtrudersModel.py b/cura/Machines/Models/ExtrudersModel.py similarity index 100% rename from cura/UI/ExtrudersModel.py rename to cura/Machines/Models/ExtrudersModel.py diff --git a/cura/UI/MachineModels/FavoriteMaterialsModel.py b/cura/Machines/Models/FavoriteMaterialsModel.py similarity index 94% rename from cura/UI/MachineModels/FavoriteMaterialsModel.py rename to cura/Machines/Models/FavoriteMaterialsModel.py index b81c25a2b4..98a2a01597 100644 --- a/cura/UI/MachineModels/FavoriteMaterialsModel.py +++ b/cura/Machines/Models/FavoriteMaterialsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel +from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel ## Model that shows the list of favorite materials. class FavoriteMaterialsModel(BaseMaterialsModel): diff --git a/cura/UI/MachineModels/GenericMaterialsModel.py b/cura/Machines/Models/GenericMaterialsModel.py similarity index 94% rename from cura/UI/MachineModels/GenericMaterialsModel.py rename to cura/Machines/Models/GenericMaterialsModel.py index 122bb3fc8f..e81a73de24 100644 --- a/cura/UI/MachineModels/GenericMaterialsModel.py +++ b/cura/Machines/Models/GenericMaterialsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel +from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel class GenericMaterialsModel(BaseMaterialsModel): diff --git a/cura/UI/GlobalStacksModel.py b/cura/Machines/Models/GlobalStacksModel.py similarity index 100% rename from cura/UI/GlobalStacksModel.py rename to cura/Machines/Models/GlobalStacksModel.py diff --git a/cura/UI/MachineModels/MachineManagementModel.py b/cura/Machines/Models/MachineManagementModel.py similarity index 100% rename from cura/UI/MachineModels/MachineManagementModel.py rename to cura/Machines/Models/MachineManagementModel.py diff --git a/cura/UI/MachineModels/MaterialBrandsModel.py b/cura/Machines/Models/MaterialBrandsModel.py similarity index 98% rename from cura/UI/MachineModels/MaterialBrandsModel.py rename to cura/Machines/Models/MaterialBrandsModel.py index bd641d29e7..c4721db5f7 100644 --- a/cura/UI/MachineModels/MaterialBrandsModel.py +++ b/cura/Machines/Models/MaterialBrandsModel.py @@ -3,7 +3,7 @@ from PyQt5.QtCore import Qt, pyqtSignal from UM.Qt.ListModel import ListModel -from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel +from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel class MaterialTypesModel(ListModel): diff --git a/cura/UI/MachineModels/MultiBuildPlateModel.py b/cura/Machines/Models/MultiBuildPlateModel.py similarity index 100% rename from cura/UI/MachineModels/MultiBuildPlateModel.py rename to cura/Machines/Models/MultiBuildPlateModel.py diff --git a/cura/UI/MachineModels/NozzleModel.py b/cura/Machines/Models/NozzleModel.py similarity index 100% rename from cura/UI/MachineModels/NozzleModel.py rename to cura/Machines/Models/NozzleModel.py diff --git a/cura/UI/MachineModels/QualityManagementModel.py b/cura/Machines/Models/QualityManagementModel.py similarity index 100% rename from cura/UI/MachineModels/QualityManagementModel.py rename to cura/Machines/Models/QualityManagementModel.py diff --git a/cura/UI/MachineModels/QualityProfilesDropDownMenuModel.py b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py similarity index 100% rename from cura/UI/MachineModels/QualityProfilesDropDownMenuModel.py rename to cura/Machines/Models/QualityProfilesDropDownMenuModel.py diff --git a/cura/UI/MachineModels/QualitySettingsModel.py b/cura/Machines/Models/QualitySettingsModel.py similarity index 100% rename from cura/UI/MachineModels/QualitySettingsModel.py rename to cura/Machines/Models/QualitySettingsModel.py diff --git a/cura/UI/MachineModels/SettingVisibilityPresetsModel.py b/cura/Machines/Models/SettingVisibilityPresetsModel.py similarity index 100% rename from cura/UI/MachineModels/SettingVisibilityPresetsModel.py rename to cura/Machines/Models/SettingVisibilityPresetsModel.py diff --git a/cura/UI/UserChangesModel.py b/cura/Machines/Models/UserChangesModel.py similarity index 100% rename from cura/UI/UserChangesModel.py rename to cura/Machines/Models/UserChangesModel.py diff --git a/cura/UI/MachineModels/__init__.py b/cura/Machines/Models/__init__.py similarity index 100% rename from cura/UI/MachineModels/__init__.py rename to cura/Machines/Models/__init__.py diff --git a/cura/PrinterOutput/GenericOutputController.py b/cura/PrinterOutput/GenericOutputController.py index 88ac529e01..e770fc79a1 100644 --- a/cura/PrinterOutput/GenericOutputController.py +++ b/cura/PrinterOutput/GenericOutputController.py @@ -5,13 +5,13 @@ from typing import TYPE_CHECKING, Set, Union, Optional from PyQt5.QtCore import QTimer -from cura.PrinterOutput.PrinterOutputController import PrinterOutputController +from .PrinterOutputController import PrinterOutputController if TYPE_CHECKING: - from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice - from cura.UI.ExtruderOutputModel import ExtruderOutputModel + from .Models.PrintJobOutputModel import PrintJobOutputModel + from .Models.PrinterOutputModel import PrinterOutputModel + from .PrinterOutputDevice import PrinterOutputDevice + from .Models.ExtruderOutputModel import ExtruderOutputModel class GenericOutputController(PrinterOutputController): diff --git a/cura/UI/ExtruderConfigurationModel.py b/cura/PrinterOutput/Models/ExtruderConfigurationModel.py similarity index 100% rename from cura/UI/ExtruderConfigurationModel.py rename to cura/PrinterOutput/Models/ExtruderConfigurationModel.py diff --git a/cura/UI/ExtruderOutputModel.py b/cura/PrinterOutput/Models/ExtruderOutputModel.py similarity index 96% rename from cura/UI/ExtruderOutputModel.py rename to cura/PrinterOutput/Models/ExtruderOutputModel.py index 7fab441a08..6002f5637f 100644 --- a/cura/UI/ExtruderOutputModel.py +++ b/cura/PrinterOutput/Models/ExtruderOutputModel.py @@ -2,12 +2,12 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel from typing import Optional, TYPE_CHECKING if TYPE_CHECKING: - from cura.UI.PrinterOutputModel import PrinterOutputModel + from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel diff --git a/cura/UI/PrintJobOutputModel.py b/cura/PrinterOutput/Models/PrintJobOutputModel.py similarity index 97% rename from cura/UI/PrintJobOutputModel.py rename to cura/PrinterOutput/Models/PrintJobOutputModel.py index a556680ef7..b4296a5494 100644 --- a/cura/UI/PrintJobOutputModel.py +++ b/cura/PrinterOutput/Models/PrintJobOutputModel.py @@ -8,8 +8,8 @@ from PyQt5.QtGui import QImage if TYPE_CHECKING: from cura.PrinterOutput.PrinterOutputController import PrinterOutputController - from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel + from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel + from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel class PrintJobOutputModel(QObject): diff --git a/cura/UI/PrinterConfigurationModel.py b/cura/PrinterOutput/Models/PrinterConfigurationModel.py similarity index 97% rename from cura/UI/PrinterConfigurationModel.py rename to cura/PrinterOutput/Models/PrinterConfigurationModel.py index 3db34768d1..876e4e02bd 100644 --- a/cura/UI/PrinterConfigurationModel.py +++ b/cura/PrinterOutput/Models/PrinterConfigurationModel.py @@ -6,7 +6,7 @@ from typing import List MYPY = False if MYPY: - from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel + from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel class PrinterConfigurationModel(QObject): diff --git a/cura/UI/PrinterOutputModel.py b/cura/PrinterOutput/Models/PrinterOutputModel.py similarity index 97% rename from cura/UI/PrinterOutputModel.py rename to cura/PrinterOutput/Models/PrinterOutputModel.py index 2c782cc701..4004a90a33 100644 --- a/cura/UI/PrinterOutputModel.py +++ b/cura/PrinterOutput/Models/PrinterOutputModel.py @@ -4,12 +4,12 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, QUrl from typing import List, Dict, Optional from UM.Math.Vector import Vector -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel -from cura.UI.ExtruderOutputModel import ExtruderOutputModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.ExtruderOutputModel import ExtruderOutputModel MYPY = False if MYPY: - from cura.UI.PrintJobOutputModel import PrintJobOutputModel + from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputController import PrinterOutputController diff --git a/cura/PrinterOutput/Models/__init__.py b/cura/PrinterOutput/Models/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cura/PrinterOutput/PrinterOutputController.py b/cura/PrinterOutput/PrinterOutputController.py index 4352c59762..3d710582ca 100644 --- a/cura/PrinterOutput/PrinterOutputController.py +++ b/cura/PrinterOutput/PrinterOutputController.py @@ -6,10 +6,10 @@ from UM.Signal import Signal MYPY = False if MYPY: - from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.UI.ExtruderOutputModel import ExtruderOutputModel - from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice + from .Models.PrintJobOutputModel import PrintJobOutputModel + from .Models.ExtruderOutputModel import ExtruderOutputModel + from .Models.PrinterOutputModel import PrinterOutputModel + from .PrinterOutputDevice import PrinterOutputDevice class PrinterOutputController: diff --git a/cura/PrinterOutput/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py index d15de94cc8..8e1b220a86 100644 --- a/cura/PrinterOutput/PrinterOutputDevice.py +++ b/cura/PrinterOutput/PrinterOutputDevice.py @@ -3,9 +3,6 @@ from enum import IntEnum from typing import Callable, List, Optional, Union -from UM.Decorators import deprecated -from UM.i18n import i18nCatalog -from UM.OutputDevice.OutputDevice import OutputDevice from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QTimer, QUrl from PyQt5.QtWidgets import QMessageBox @@ -13,14 +10,17 @@ from UM.Logger import Logger from UM.Signal import signalemitter from UM.Qt.QtApplication import QtApplication from UM.FlameProfiler import pyqtSlot +from UM.Decorators import deprecated +from UM.i18n import i18nCatalog +from UM.OutputDevice.OutputDevice import OutputDevice MYPY = False if MYPY: - from cura.UI.PrinterOutputModel import PrinterOutputModel - from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel - from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater from UM.FileHandler.FileHandler import FileHandler from UM.Scene.SceneNode import SceneNode + from .Models.PrinterOutputModel import PrinterOutputModel + from .Models.PrinterConfigurationModel import PrinterConfigurationModel + from .FirmwareUpdater import FirmwareUpdater i18n_catalog = i18nCatalog("cura") diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index b0e9e10c32..91ff26cadc 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QApplication from UM.Scene.Camera import Camera from cura.UI.ObjectsModel import ObjectsModel -from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel +from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from UM.Application import Application from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index dd016ea851..8de19d9e00 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -23,8 +23,8 @@ from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.ExtruderManager import ExtruderManager diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 0527b4534e..f57aee190f 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -30,7 +30,7 @@ from .StartSliceJob import StartSliceJob, StartJobResult import Arcus if TYPE_CHECKING: - from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel + from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from cura.Machines.MachineErrorChecker import MachineErrorChecker from UM.Scene.Scene import Scene from UM.Settings.ContainerStack import ContainerStack diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 312de71e11..ed4f556cc9 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -24,7 +24,7 @@ from cura import LayerPolygon import numpy from time import time -from cura.UI.ExtrudersModel import ExtrudersModel +from cura.Machines.Models.ExtrudersModel import ExtrudersModel catalog = i18nCatalog("cura") diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 60e9ec6e7c..d98cdded9c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -18,7 +18,7 @@ from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .CloudOutputController import CloudOutputController diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py index 922d3e840c..aba1cdb755 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintCoreConfiguration.py @@ -2,8 +2,8 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import Union, Dict, Optional, Any -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel -from cura.UI.ExtruderOutputModel import ExtruderOutputModel +from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.PrinterOutput.Models.ExtruderOutputModel import ExtruderOutputModel from .CloudClusterPrinterConfigurationMaterial import CloudClusterPrinterConfigurationMaterial from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py index a4bc46e2d9..79050521af 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import List, Optional, Union, Dict, Any -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel from ...UM3PrintJobOutputModel import UM3PrintJobOutputModel from ...ConfigurationChangeModel import ConfigurationChangeModel from ..CloudOutputController import CloudOutputController diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 65ce770192..0b76ba1bce 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -3,7 +3,7 @@ from typing import List, Union, Dict, Optional, Any from cura.PrinterOutput.PrinterOutputController import PrinterOutputController -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from .CloudClusterBuildPlate import CloudClusterBuildPlate from .CloudClusterPrintCoreConfiguration import CloudClusterPrintCoreConfiguration from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 57a163172a..e280e937fb 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -19,10 +19,10 @@ from UM.Scene.SceneNode import SceneNode # For typing. from UM.Settings.ContainerRegistry import ContainerRegistry from cura.CuraApplication import CuraApplication -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py index 1d5dcd2c79..370cfc9008 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py @@ -5,7 +5,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController MYPY = False if MYPY: - from cura.UI.PrintJobOutputModel import PrintJobOutputModel + from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel class ClusterUM3PrinterOutputController(PrinterOutputController): def __init__(self, output_device): diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 55a4a57026..9f86415031 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -2,8 +2,8 @@ from typing import List, Optional from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState -from cura.UI.PrinterOutputModel import PrinterOutputModel -from cura.UI.PrintJobOutputModel import PrintJobOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py index 089a083275..9e372d4113 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py @@ -7,8 +7,8 @@ from UM.Version import Version MYPY = False if MYPY: - from cura.UI.PrintJobOutputModel import PrintJobOutputModel - from cura.UI.PrinterOutputModel import PrinterOutputModel + from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel + from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel class LegacyUM3PrinterOutputController(PrinterOutputController): diff --git a/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py index e51a891f58..b627b6e9c8 100644 --- a/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py +++ b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py @@ -5,7 +5,7 @@ from typing import List from PyQt5.QtCore import pyqtProperty, pyqtSignal -from cura.UI.PrintJobOutputModel import PrintJobOutputModel +from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from .ConfigurationChangeModel import ConfigurationChangeModel diff --git a/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py b/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py index 2cbf2def50..2c401fab25 100644 --- a/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/tests/Cloud/TestCloudOutputDevice.py @@ -6,7 +6,7 @@ from unittest.mock import patch, MagicMock from UM.Scene.SceneNode import SceneNode from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from ...src.Cloud import CloudApiClient from ...src.Cloud.CloudOutputDevice import CloudOutputDevice from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index de2c0c1d72..0c195e9017 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -11,8 +11,8 @@ from UM.Qt.Duration import DurationFormat from cura.CuraApplication import CuraApplication from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType -from cura.UI.PrinterOutputModel import PrinterOutputModel -from cura.UI.PrintJobOutputModel import PrintJobOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.GenericOutputController import GenericOutputController from .AutoDetectBaudJob import AutoDetectBaudJob diff --git a/tests/UI/MachineModels/TestDiscoveredPrintersModel.py b/tests/Machines/Models/TestDiscoveredPrintersModel.py similarity index 88% rename from tests/UI/MachineModels/TestDiscoveredPrintersModel.py rename to tests/Machines/Models/TestDiscoveredPrintersModel.py index 2fa5701b7b..c89274771f 100644 --- a/tests/UI/MachineModels/TestDiscoveredPrintersModel.py +++ b/tests/Machines/Models/TestDiscoveredPrintersModel.py @@ -1,27 +1,26 @@ - -from unittest.mock import MagicMock - -import pytest - -from cura.UI.MachineModels.DiscoveredPrintersModel import DiscoveredPrintersModel - - -@pytest.fixture() -def discovered_printer_model(application) -> DiscoveredPrintersModel: - return DiscoveredPrintersModel() - - -def test_discoveredPrinters(discovered_printer_model): - mocked_device = MagicMock() - - mocked_callback = MagicMock() - discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device) - device = discovered_printer_model.discovered_printers[0] - discovered_printer_model.createMachineFromDiscoveredPrinter(device) - mocked_callback.assert_called_with("key") - - assert len(discovered_printer_model.discovered_printers) == 1 - - # Test if removing it works - discovered_printer_model.removeDiscoveredPrinter("ip") - assert len(discovered_printer_model.discovered_printers) == 0 +from unittest.mock import MagicMock + +import pytest + +from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel + + +@pytest.fixture() +def discovered_printer_model(application) -> DiscoveredPrintersModel: + return DiscoveredPrintersModel() + + +def test_discoveredPrinters(discovered_printer_model): + mocked_device = MagicMock() + + mocked_callback = MagicMock() + discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device) + device = discovered_printer_model.discovered_printers[0] + discovered_printer_model.createMachineFromDiscoveredPrinter(device) + mocked_callback.assert_called_with("key") + + assert len(discovered_printer_model.discovered_printers) == 1 + + # Test if removing it works + discovered_printer_model.removeDiscoveredPrinter("ip") + assert len(discovered_printer_model.discovered_printers) == 0 diff --git a/tests/UI/TestPrintJobOutputModel.py b/tests/PrinterOutput/Models/TestPrintJobOutputModel.py similarity index 90% rename from tests/UI/TestPrintJobOutputModel.py rename to tests/PrinterOutput/Models/TestPrintJobOutputModel.py index 71a08c223c..b70883dd82 100644 --- a/tests/UI/TestPrintJobOutputModel.py +++ b/tests/PrinterOutput/Models/TestPrintJobOutputModel.py @@ -2,9 +2,9 @@ from unittest.mock import MagicMock import pytest -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel -from cura.UI.PrintJobOutputModel import PrintJobOutputModel -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ {"attribute": "compatibleMachineFamilies", "value": ["yay"]}, diff --git a/tests/UI/TestPrinterConfigurationModel.py b/tests/PrinterOutput/Models/TestPrinterConfigurationModel.py similarity index 87% rename from tests/UI/TestPrinterConfigurationModel.py rename to tests/PrinterOutput/Models/TestPrinterConfigurationModel.py index e365aaebf6..84b1d1b5bf 100644 --- a/tests/UI/TestPrinterConfigurationModel.py +++ b/tests/PrinterOutput/Models/TestPrinterConfigurationModel.py @@ -4,8 +4,8 @@ from unittest.mock import MagicMock import pytest -from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel -from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel +from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel +from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel test_validate_data_get_set = [ {"attribute": "extruderConfigurations", "value": [ExtruderConfigurationModel()]}, diff --git a/tests/UI/TestPrinterOutputModel.py b/tests/PrinterOutput/Models/TestPrinterOutputModel.py similarity index 94% rename from tests/UI/TestPrinterOutputModel.py rename to tests/PrinterOutput/Models/TestPrinterOutputModel.py index e0d57b90dc..3fdb61adbd 100644 --- a/tests/UI/TestPrinterOutputModel.py +++ b/tests/PrinterOutput/Models/TestPrinterOutputModel.py @@ -4,8 +4,8 @@ from unittest.mock import MagicMock import pytest -from cura.UI.PrintJobOutputModel import PrintJobOutputModel -from cura.UI.PrinterOutputModel import PrinterOutputModel +from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel +from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel test_validate_data_get_set = [ {"attribute": "name", "value": "YAY"}, diff --git a/tests/Settings/TestSettingVisibilityPresets.py b/tests/Settings/TestSettingVisibilityPresets.py index 13089e8aa6..b82aa62ea7 100644 --- a/tests/Settings/TestSettingVisibilityPresets.py +++ b/tests/Settings/TestSettingVisibilityPresets.py @@ -5,7 +5,7 @@ import os.path from UM.Preferences import Preferences from UM.Resources import Resources from cura.CuraApplication import CuraApplication -from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel +from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset setting_visibility_preset_test_settings = {"test", "zomg", "derp", "yay", "whoo"} From 418daae58ef161281f9c33522a54507b391088e0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 08:33:53 +0100 Subject: [PATCH 147/211] Remove unnecessary groups in SVG --- .../cura-light/images/first_run_ultimaker_cloud.svg | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg index f5e52ebee9..d3469ca32a 100644 --- a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg +++ b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg @@ -4,13 +4,9 @@ Group-cloud Created with Sketch. - - - - - - - + + + \ No newline at end of file From f4cef01c7d07e5a0727894342677742c7dee4369 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 08:41:26 +0100 Subject: [PATCH 148/211] Remove unnecessary IDs in SVGs --- .../images/first_run_share_data.svg | 74 +++++++++---------- .../images/first_run_ultimaker_cloud.svg | 6 +- .../images/first_run_welcome_cura.svg | 12 +-- 3 files changed, 42 insertions(+), 50 deletions(-) diff --git a/resources/themes/cura-light/images/first_run_share_data.svg b/resources/themes/cura-light/images/first_run_share_data.svg index 0d6f8998e5..cd87431067 100644 --- a/resources/themes/cura-light/images/first_run_share_data.svg +++ b/resources/themes/cura-light/images/first_run_share_data.svg @@ -4,25 +4,25 @@ Group 2 Created with Sketch. - + - + - + - + @@ -30,41 +30,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg index d3469ca32a..ffb042e87e 100644 --- a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg +++ b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg @@ -3,9 +3,9 @@ Group-cloud Created with Sketch. - - - + + + diff --git a/resources/themes/cura-light/images/first_run_welcome_cura.svg b/resources/themes/cura-light/images/first_run_welcome_cura.svg index 76a812d2c0..fddb073c82 100644 --- a/resources/themes/cura-light/images/first_run_welcome_cura.svg +++ b/resources/themes/cura-light/images/first_run_welcome_cura.svg @@ -3,13 +3,9 @@ cura Created with Sketch. - - - - - - - - + + + + \ No newline at end of file From 705cdedf0b7bcd9a4af7f2f8604000464a5669a0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 08:49:25 +0100 Subject: [PATCH 149/211] Remove tiny lines in ultimaker_cloud svg --- .../themes/cura-light/images/first_run_ultimaker_cloud.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg index ffb042e87e..1e9b313862 100644 --- a/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg +++ b/resources/themes/cura-light/images/first_run_ultimaker_cloud.svg @@ -4,9 +4,9 @@ Group-cloud Created with Sketch. - + - + \ No newline at end of file From d52f9600b11504c967078a600dee702c0ae9f9d6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 09:02:28 +0100 Subject: [PATCH 150/211] Fix binding loop in CloudContent --- resources/qml/WelcomePages/CloudContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 6c0a7ae53e..5ecda41a89 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -43,7 +43,7 @@ Item Column { anchors.centerIn: parent - width: childrenRect.width + width: parent.width height: childrenRect.height spacing: 20 * screenScaleFactor From 92d95a1c00f3fbaa7b4e9b26f99296328087d97a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 10:34:38 +0100 Subject: [PATCH 151/211] Move page index logic into WelcomePagesModel --- cura/UI/WelcomePagesModel.py | 101 +++++++++++++++++- resources/qml/Cura.qml | 1 - .../AddNetworkOrLocalPrinterContent.qml | 2 +- .../WelcomePages/AddPrinterByIpContent.qml | 2 +- .../FirstStartMachineActionsContent.qml | 3 +- resources/qml/WelcomePages/StepPanel.qml | 62 ++--------- resources/qml/WelcomePages/WelcomeDialog.qml | 13 ++- 7 files changed, 122 insertions(+), 62 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index bf33ba7baa..5c3fd67f0b 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -1,10 +1,12 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from collections import deque import os -from typing import TYPE_CHECKING, Optional, List, Dict, Any +from typing import TYPE_CHECKING, Optional, List, Dict, Any, Deque -from PyQt5.QtCore import QUrl, Qt +from PyQt5.QtCore import QUrl, Qt, pyqtSlot, pyqtProperty, pyqtSignal +from UM.Logger import Logger from UM.Qt.ListModel import ListModel from UM.Resources import Resources @@ -27,6 +29,99 @@ class WelcomePagesModel(ListModel): self._pages = [] # type: List[Dict[str, Any]] + self._current_page_index = 0 + # Store all the previous page indices so it can go back. + self._previous_page_indices_stack = deque() # type: Deque[int] + + allFinished = pyqtSignal() # emitted when all steps have been finished + currentPageIndexChanged = pyqtSignal() + + @pyqtProperty(int, notify = currentPageIndexChanged) + def currentPageIndex(self) -> int: + return self._current_page_index + + # Returns a float number in [0, 1] which indicates the current progress. + @pyqtProperty(float, notify = currentPageIndexChanged) + def currentProgress(self) -> float: + return self._current_page_index / len(self._items) + + # Indicates if the current page is the last page. + @pyqtProperty(bool, notify = currentPageIndexChanged) + def isCurrentPageLast(self) -> bool: + return self._current_page_index == len(self._items) - 1 + + def _setCurrentPageIndex(self, page_index: int) -> None: + if page_index != self._current_page_index: + self._previous_page_indices_stack.append(self._current_page_index) + self._current_page_index = page_index + self.currentPageIndexChanged.emit() + + # Goes to the next page. + @pyqtSlot() + def goToNextPage(self) -> None: + page_item = self._items[self._current_page_index] + # Check if there's a "next_page_id" assigned. If so, go to that page. Otherwise, go to the page with the + # current index + 1. + next_page_id = page_item.get("next_page_id") + next_page_index = self._current_page_index + 1 + if next_page_id: + idx = self.getPageIndexById(next_page_id) + if idx is None: + # FIXME: If we cannot find the next page, we cannot do anything here. + Logger.log("e", "Cannot find page with ID [%s]", next_page_id) + return + next_page_index = idx + + # If we have reached the last page, emit allFinished signal and reset. + if next_page_index == len(self._items): + self.allFinished.emit() + self.resetState() + + # Move to the next page + self._setCurrentPageIndex(next_page_index) + + # Goes to the previous page. If there's no previous page, do nothing. + @pyqtSlot() + def goToPreviousPage(self) -> None: + if len(self._previous_page_indices_stack) == 0: + Logger.log("i", "No previous page, do nothing") + return + + previous_page_index = self._previous_page_indices_stack.pop() + self._current_page_index = previous_page_index + self.currentPageIndexChanged.emit() + + # Sets the current page to the given page ID. If the page ID is not found, do nothing. + @pyqtSlot(str) + def goToPage(self, page_id: str) -> None: + page_index = self.getPageIndexById(page_id) + if page_index is None: + # FIXME: If we cannot find the next page, we cannot do anything here. + Logger.log("e", "Cannot find page with ID [%s]", page_index) + return + + # Move to that page + self._setCurrentPageIndex(page_index) + + # Resets the state of the WelcomePagesModel. This functions does the following: + # - Resets current_page_index to 0 + # - Clears the previous page indices stack + @pyqtSlot() + def resetState(self) -> None: + self._current_page_index = 0 + self._previous_page_indices_stack.clear() + + self.currentPageIndexChanged.emit() + + # Gets the page index with the given page ID. If the page ID doesn't exist, returns None. + def getPageIndexById(self, page_id: str) -> Optional[int]: + page_idx = None + for idx, page_item in enumerate(self._items): + if page_item["id"] == page_id: + page_idx = idx + break + return page_idx + # Convenience function to get QUrl path to pages that's located in "resources/qml/WelcomePages". def _getBuiltinWelcomePagePath(self, page_filename: str) -> "QUrl": from cura.CuraApplication import CuraApplication @@ -49,9 +144,11 @@ class WelcomePagesModel(ListModel): }) self._pages.append({"id": "add_network_or_local_printer", "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), + "next_page_id": "machine_actions", }) self._pages.append({"id": "add_printer_by_ip", "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), + "next_page_id": "machine_actions", }) self._pages.append({"id": "machine_actions", "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"), diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 37a34ebb52..6ee0e090a1 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -77,7 +77,6 @@ UM.MainWindow if (CuraApplication.needToShowUserAgreement) { welcomeDialog.visible = true; - welcomeDialog.currentStep = 0; } else { diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 8117957d46..75e5c58724 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -145,7 +145,7 @@ Item const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem Cura.MachineManager.addMachine(localPrinterItem.id) - base.goToPage("machine_actions") + base.showNextPage() } } } diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index a0b0e3c2cd..4fdffa5a79 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -247,7 +247,7 @@ Item text: catalog.i18nc("@button", "Cancel") width: UM.Theme.getSize("action_button").width fixedWidthMode: true - onClicked: base.goToPage("add_network_or_local_printer") + onClicked: base.showPreviousPage() } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 4dbdd57916..6b4a79a24a 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -33,6 +33,7 @@ Item { if (visible) { + // Reset the action to start from the beginning when it is shown. currentActionIndex = 0 if (!hasActions) { @@ -48,7 +49,7 @@ Item anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter - text: currentActionItem.title + text: currentActionItem == null ? "" : currentActionItem.title color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("large_bold") renderType: Text.NativeRendering diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index e3ae0cd17c..f1a4e5a4c8 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -21,70 +21,30 @@ Item property int stepBarHeight: 12 property int contentMargins: 1 - property int currentStep: 0 - property int totalStepCount: (model == null) ? 0 : model.count - property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount) - - property var currentItem: (model == null) ? null : model.getItem(currentStep) + property var currentItem: (model == null) ? null : model.getItem(model.currentPageIndex) property var model: null + property var progressValue: model == null ? 0 : model.currentProgress + property string pageUrl: currentItem == null ? null : currentItem.page_url + 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. - onShowNextPage: - { - if (currentStep < totalStepCount - 1) - { - currentStep++ - } - else - { - passLastPage() - } - } - - onShowPreviousPage: - { - if (currentStep > 0) - { - currentStep-- - } - } - - onGoToPage: - { - // find the page index - var page_index = -1 - for (var i = 0; i < base.model.count; i++) - { - const item = base.model.getItem(i) - if (item.id == page_id) - { - page_index = i - break - } - } - if (page_index >= 0) - { - currentStep = page_index - } - } + // Call the corresponding functions in the model + onShowNextPage: model.goToNextPage() + onShowPreviousPage: model.goToPreviousPage() + onGoToPage: model.goToPage(page_id) onVisibleChanged: { if (visible) { - base.currentStep = 0 - base.currentItem = base.model.getItem(base.currentStep) + model.resetState() } } - onModelChanged: - { - base.currentStep = 0 - } + onModelChanged: model.resetState() // Panel background Rectangle @@ -137,6 +97,6 @@ Item left: parent.left right: parent.right } - source: base.currentItem.page_url + source: base.pageUrl } } diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 626b6b6877..17b983ed0e 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -9,8 +9,12 @@ import UM 1.3 as UM import Cura 1.1 as Cura +// +// This is a no-frame dialog that shows the welcome process. +// Window { + id: dialog UM.I18nCatalog { id: catalog; name: "cura" } title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") @@ -21,19 +25,18 @@ Window height: 600 // TODO color: "transparent" - property alias currentStep: stepPanel.currentStep + property var model: CuraApplication.getWelcomePagesModel() StepPanel { id: stepPanel - currentStep: 0 - model: CuraApplication.getWelcomePagesModel() + model: dialog.model } // Close this dialog when there's no more page to show Connections { - target: stepPanel - onPassLastPage: close() + target: model + onAllFinished: close() } } From 60be55802e6c78ced9d7ac5143753a329aee709b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:04:17 +0100 Subject: [PATCH 152/211] Refactor StepPanel and WelcomeDialog --- resources/qml/WelcomePages/StepPanel.qml | 76 ++++++------------- resources/qml/WelcomePages/WelcomeContent.qml | 1 - resources/qml/WelcomePages/WelcomeDialog.qml | 17 +++++ 3 files changed, 41 insertions(+), 53 deletions(-) diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 551a01687a..182e0e7972 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtGraphicalEffects 1.0 // For the dropshadow import UM 1.3 as UM import Cura 1.1 as Cura @@ -15,14 +14,8 @@ Item { id: base - anchors.fill: parent clip: true - property int roundCornerRadius: 4 - property int shadowOffset: 1 - property int stepBarHeight: 12 - property int contentMargins: 1 - property int currentStep: 0 property int totalStepCount: (model == null) ? 0 : model.count property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount) @@ -88,57 +81,36 @@ Item base.currentStep = 0 } - // Panel background - Rectangle + Rectangle // Panel background { id: panelBackground anchors.fill: parent - anchors.margins: 2 - color: "white" // TODO - radius: base.roundCornerRadius // TODO - } + radius: UM.Theme.getSize("default_radius").width - // Drop shadow around the panel - DropShadow - { - id: shadow - radius: UM.Theme.getSize("monitor_shadow_radius").width - anchors.fill: parent - source: parent - horizontalOffset: base.shadowOffset - verticalOffset: base.shadowOffset - color: UM.Theme.getColor("monitor_shadow") - transparentBorder: true - // Should always be drawn behind the background. - z: panelBackground.z - 1 - } - - CuraProgressBar - { - id: progressBar - - value: base.progressValue - - anchors + CuraProgressBar { - left: panelBackground.left - right: panelBackground.right - top: panelBackground.top - } - height: base.stepBarHeight - } + id: progressBar + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right - Loader - { - id: contentLoader - anchors - { - margins: base.contentMargins - top: progressBar.bottom - bottom: parent.bottom - left: parent.left - right: parent.right + height: UM.Theme.getSize("progressbar").height + + value: base.progressValue + } + + Loader + { + id: contentLoader + anchors + { + margins: base.contentMargins + top: progressBar.bottom + bottom: parent.bottom + left: parent.left + right: parent.right + } + source: base.currentItem.page_url } - source: base.currentItem.page_url } } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index 2fde182c4c..770097d3a9 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -54,7 +54,6 @@ Item Cura.PrimaryButton { id: getStartedButton - anchors.top: contentArea.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Get started") diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 626b6b6877..00849ca037 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -4,6 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 // For the DropShadow import UM 1.3 as UM import Cura 1.1 as Cura @@ -21,15 +22,31 @@ Window height: 600 // TODO color: "transparent" + property int shadowOffset: 1 * screenScaleFactor + property alias currentStep: stepPanel.currentStep StepPanel { id: stepPanel + anchors.fill: parent currentStep: 0 model: CuraApplication.getWelcomePagesModel() } + // Drop shadow around the panel + DropShadow + { + id: shadow + radius: UM.Theme.getSize("monitor_shadow_radius").width + anchors.fill: stepPanel + source: stepPanel + horizontalOffset: shadowOffset + verticalOffset: shadowOffset + color: UM.Theme.getColor("monitor_shadow") + transparentBorder: true + } + // Close this dialog when there's no more page to show Connections { From fd0a60f8dc3205e357e69b34e247e6f06f67b76e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:06:43 +0100 Subject: [PATCH 153/211] Rename StepPanel to WizardPanel --- resources/qml/WelcomePages/WelcomeDialog.qml | 2 +- resources/qml/WelcomePages/{StepPanel.qml => WizardPanel.qml} | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) rename resources/qml/WelcomePages/{StepPanel.qml => WizardPanel.qml} (95%) diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 00849ca037..c5c1894764 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -26,7 +26,7 @@ Window property alias currentStep: stepPanel.currentStep - StepPanel + WizardPanel { id: stepPanel anchors.fill: parent diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml similarity index 95% rename from resources/qml/WelcomePages/StepPanel.qml rename to resources/qml/WelcomePages/WizardPanel.qml index 182e0e7972..61d9244b93 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -10,6 +10,10 @@ import Cura 1.1 as Cura import "../Widgets" +// +// This item is a wizard panel that contains a progress bar at the top and a content area that's beneath the progress +// bar. +// Item { id: base From 20bd9ea501fcb2f4e06615265f8b18f8e82bebea Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 09:02:28 +0100 Subject: [PATCH 154/211] Fix binding loop in CloudContent --- resources/qml/WelcomePages/CloudContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 84b8232a3f..60e07bd50c 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -43,7 +43,7 @@ Item Column { anchors.centerIn: parent - width: childrenRect.width + width: parent.width height: childrenRect.height spacing: 20 * screenScaleFactor From 418ad73a63a89fcd78b9e8d8eefe691ee1337991 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:34:44 +0100 Subject: [PATCH 155/211] Move page index logic into WelcomePagesModel --- cura/UI/WelcomePagesModel.py | 103 +++++++++++++++++- resources/qml/Cura.qml | 5 +- .../WelcomePages/AddPrinterByIpContent.qml | 2 +- resources/qml/WelcomePages/WelcomeDialog.qml | 18 ++- resources/qml/WelcomePages/WizardPanel.qml | 71 ++---------- 5 files changed, 126 insertions(+), 73 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 2b58218cd6..25765bf777 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -1,10 +1,12 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from collections import deque import os -from typing import TYPE_CHECKING, Optional, List, Dict, Any +from typing import TYPE_CHECKING, Optional, List, Dict, Any, Deque -from PyQt5.QtCore import QUrl, Qt +from PyQt5.QtCore import QUrl, Qt, pyqtSlot, pyqtProperty, pyqtSignal +from UM.Logger import Logger from UM.Qt.ListModel import ListModel from UM.Resources import Resources @@ -18,7 +20,6 @@ class WelcomePagesModel(ListModel): PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to - def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__(parent) @@ -28,6 +29,99 @@ class WelcomePagesModel(ListModel): self._pages = [] # type: List[Dict[str, Any]] + self._current_page_index = 0 + # Store all the previous page indices so it can go back. + self._previous_page_indices_stack = deque() # type: Deque[int] + + allFinished = pyqtSignal() # emitted when all steps have been finished + currentPageIndexChanged = pyqtSignal() + + @pyqtProperty(int, notify = currentPageIndexChanged) + def currentPageIndex(self) -> int: + return self._current_page_index + + # Returns a float number in [0, 1] which indicates the current progress. + @pyqtProperty(float, notify = currentPageIndexChanged) + def currentProgress(self) -> float: + return self._current_page_index / len(self._items) + + # Indicates if the current page is the last page. + @pyqtProperty(bool, notify = currentPageIndexChanged) + def isCurrentPageLast(self) -> bool: + return self._current_page_index == len(self._items) - 1 + + def _setCurrentPageIndex(self, page_index: int) -> None: + if page_index != self._current_page_index: + self._previous_page_indices_stack.append(self._current_page_index) + self._current_page_index = page_index + self.currentPageIndexChanged.emit() + + # Goes to the next page. + @pyqtSlot() + def goToNextPage(self) -> None: + page_item = self._items[self._current_page_index] + # Check if there's a "next_page_id" assigned. If so, go to that page. Otherwise, go to the page with the + # current index + 1. + next_page_id = page_item.get("next_page_id") + next_page_index = self._current_page_index + 1 + if next_page_id: + idx = self.getPageIndexById(next_page_id) + if idx is None: + # FIXME: If we cannot find the next page, we cannot do anything here. + Logger.log("e", "Cannot find page with ID [%s]", next_page_id) + return + next_page_index = idx + + # If we have reached the last page, emit allFinished signal and reset. + if next_page_index == len(self._items): + self.allFinished.emit() + self.resetState() + + # Move to the next page + self._setCurrentPageIndex(next_page_index) + + # Goes to the previous page. If there's no previous page, do nothing. + @pyqtSlot() + def goToPreviousPage(self) -> None: + if len(self._previous_page_indices_stack) == 0: + Logger.log("i", "No previous page, do nothing") + return + + previous_page_index = self._previous_page_indices_stack.pop() + self._current_page_index = previous_page_index + self.currentPageIndexChanged.emit() + + # Sets the current page to the given page ID. If the page ID is not found, do nothing. + @pyqtSlot(str) + def goToPage(self, page_id: str) -> None: + page_index = self.getPageIndexById(page_id) + if page_index is None: + # FIXME: If we cannot find the next page, we cannot do anything here. + Logger.log("e", "Cannot find page with ID [%s]", page_index) + return + + # Move to that page + self._setCurrentPageIndex(page_index) + + # Resets the state of the WelcomePagesModel. This functions does the following: + # - Resets current_page_index to 0 + # - Clears the previous page indices stack + @pyqtSlot() + def resetState(self) -> None: + self._current_page_index = 0 + self._previous_page_indices_stack.clear() + + self.currentPageIndexChanged.emit() + + # Gets the page index with the given page ID. If the page ID doesn't exist, returns None. + def getPageIndexById(self, page_id: str) -> Optional[int]: + page_idx = None + for idx, page_item in enumerate(self._items): + if page_item["id"] == page_id: + page_idx = idx + break + return page_idx + # Convenience function to get QUrl path to pages that's located in "resources/qml/WelcomePages". def _getBuiltinWelcomePagePath(self, page_filename: str) -> "QUrl": from cura.CuraApplication import CuraApplication @@ -35,7 +129,6 @@ class WelcomePagesModel(ListModel): os.path.join("WelcomePages", page_filename))) def initialize(self) -> None: - # Add default welcome pages self._pages.append({"id": "welcome", "page_url": self._getBuiltinWelcomePagePath("WelcomeContent.qml"), @@ -51,9 +144,11 @@ class WelcomePagesModel(ListModel): }) self._pages.append({"id": "add_network_or_local_printer", "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), + "next_page_id": "cloud", }) self._pages.append({"id": "add_printer_by_ip", "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), + "next_page_id": "cloud", }) self._pages.append({"id": "cloud", "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 37a34ebb52..3572d299bb 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -76,12 +76,11 @@ UM.MainWindow if (CuraApplication.needToShowUserAgreement) { - welcomeDialog.visible = true; - welcomeDialog.currentStep = 0; + welcomeDialog.show() } else { - welcomeDialog.visible = false; + welcomeDialog.close() } // TODO: While the new onboarding process contains the user-agreement, // it should probably not entirely rely on 'needToShowUserAgreement' for show/hide. diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 1ea0c1f19d..4fdffa5a79 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -247,7 +247,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.showPreviousPage() } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index c5c1894764..9704a318b6 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -14,6 +14,7 @@ Window { UM.I18nCatalog { id: catalog; name: "cura" } + id: dialog title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") modality: Qt.ApplicationModal flags: Qt.Window | Qt.FramelessWindowHint @@ -24,14 +25,21 @@ Window property int shadowOffset: 1 * screenScaleFactor - property alias currentStep: stepPanel.currentStep + property var model: CuraApplication.getWelcomePagesModel() + + onVisibleChanged: + { + if (visible) + { + model.resetState() + } + } WizardPanel { id: stepPanel anchors.fill: parent - currentStep: 0 - model: CuraApplication.getWelcomePagesModel() + model: dialog.model } // Drop shadow around the panel @@ -50,7 +58,7 @@ Window // Close this dialog when there's no more page to show Connections { - target: stepPanel - onPassLastPage: close() + target: model + onAllFinished: close() } } diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 61d9244b93..57f2873e80 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -20,70 +20,21 @@ Item clip: true - property int currentStep: 0 - property int totalStepCount: (model == null) ? 0 : model.count - property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount) - - property var currentItem: (model == null) ? null : model.getItem(currentStep) + property var currentItem: (model == null) ? null : model.getItem(model.currentPageIndex) property var model: null + // Convenience properties + property var progressValue: model == null ? 0 : model.currentProgress + property string pageUrl: currentItem == null ? null : currentItem.page_url + 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. - onShowNextPage: - { - if (currentStep < totalStepCount - 1) - { - currentStep++ - } - else - { - passLastPage() - } - } - - onShowPreviousPage: - { - if (currentStep > 0) - { - currentStep-- - } - } - - onGoToPage: - { - // find the page index - var page_index = -1 - for (var i = 0; i < base.model.count; i++) - { - const item = base.model.getItem(i) - if (item.id == page_id) - { - page_index = i - break - } - } - if (page_index > 0) - { - currentStep = page_index - } - } - - onVisibleChanged: - { - if (visible) - { - base.currentStep = 0 - base.currentItem = base.model.getItem(base.currentStep) - } - } - - onModelChanged: - { - base.currentStep = 0 - } + // Call the corresponding functions in the model + onShowNextPage: model.goToNextPage() + onShowPreviousPage: model.goToPreviousPage() + onGoToPage: model.goToPage(page_id) Rectangle // Panel background { @@ -108,13 +59,13 @@ Item id: contentLoader anchors { - margins: base.contentMargins + margins: UM.Theme.getSize("default_margin").width top: progressBar.bottom bottom: parent.bottom left: parent.left right: parent.right } - source: base.currentItem.page_url + source: base.pageUrl } } } From a6d05aa3bb69ba2fc6c6f4bd8de274919220166f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:47:04 +0100 Subject: [PATCH 156/211] Fix misc issues --- cura/UI/WelcomePagesModel.py | 1 + resources/qml/WelcomePages/WizardPanel.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 25765bf777..61329090e0 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -76,6 +76,7 @@ class WelcomePagesModel(ListModel): if next_page_index == len(self._items): self.allFinished.emit() self.resetState() + return # Move to the next page self._setCurrentPageIndex(next_page_index) diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 57f2873e80..39e9116c8c 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -25,7 +25,7 @@ Item // Convenience properties property var progressValue: model == null ? 0 : model.currentProgress - property string pageUrl: currentItem == null ? null : currentItem.page_url + property string pageUrl: currentItem == null ? "" : currentItem.page_url signal showNextPage() signal showPreviousPage() From f6d212dc8839161430481b7de4c59fca147e0b10 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:59:44 +0100 Subject: [PATCH 157/211] Use screenScaleFactor for WelcomeDialog size --- resources/qml/WelcomePages/WelcomeDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 9704a318b6..3d9c8d42f0 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -19,8 +19,8 @@ Window modality: Qt.ApplicationModal flags: Qt.Window | Qt.FramelessWindowHint - width: 580 // TODO - height: 600 // TODO + width: 580 * screenScaleFactor + height: 600 * screenScaleFactor color: "transparent" property int shadowOffset: 1 * screenScaleFactor From e5646877223137fbea51da9eca6491d7916eb5d4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 12:06:46 +0100 Subject: [PATCH 158/211] Use themed margins --- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 3004a563f4..4e7e5dfcad 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -35,7 +35,7 @@ Item anchors.top: titleLabel.bottom anchors.left: parent.left anchors.right: parent.right - anchors.margins: 20 + anchors.margins: UM.Theme.getSize("wide_margin").width title: catalog.i18nc("@label", "Add a networked printer") contentShown: true // by default expand the network printer list @@ -80,7 +80,7 @@ Item anchors.top: addNetworkPrinterDropDown.bottom anchors.left: parent.left anchors.right: parent.right - anchors.margins: 20 + anchors.margins: UM.Theme.getSize("wide_margin").width title: catalog.i18nc("@label", "Add a non-networked printer") From f99affd4f577a7ca59c0bab84ee599912f1a47b7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 14:46:06 +0100 Subject: [PATCH 159/211] Create Cura.RadioButton --- .../AddLocalPrinterScrollView.qml | 42 +-------------- resources/qml/Widgets/RadioButton.qml | 53 +++++++++++++++++++ resources/qml/qmldir | 1 + 3 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 resources/qml/Widgets/RadioButton.qml diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index f8db8b297e..d55d8f84ae 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -129,7 +129,7 @@ ScrollView { id: machineButton - RadioButton + Cura.RadioButton { id: radioButton anchors.left: parent.left @@ -140,47 +140,7 @@ ScrollView checked: ListView.view.currentIndex == index text: name - font: UM.Theme.getFont("default") visible: base.currentSection == section - - background: Item - { - anchors.fill: parent - } - - indicator: Rectangle - { - implicitWidth: UM.Theme.getSize("radio_button").width - implicitHeight: UM.Theme.getSize("radio_button").height - anchors.verticalCenter: parent.verticalCenter - radius: (width / 2) | 0 - border.width: UM.Theme.getSize("default_lining").width - border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") - - Rectangle - { - width: (parent.width / 2) | 0 - height: width - anchors.centerIn: parent - radius: (width / 2) | 0 - color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") - visible: radioButton.checked - } - } - - contentItem: Label - { - verticalAlignment: Text.AlignVCenter - leftPadding: radioButton.indicator.width + radioButton.spacing - text: radioButton.text - font: radioButton.font - renderType: Text.NativeRendering - } - - onClicked: - { - ListView.view.currentIndex = index - } } } } diff --git a/resources/qml/Widgets/RadioButton.qml b/resources/qml/Widgets/RadioButton.qml new file mode 100644 index 0000000000..e17a38d833 --- /dev/null +++ b/resources/qml/Widgets/RadioButton.qml @@ -0,0 +1,53 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.0 as Cura + + +// +// Cura-style RadioButton. +// +RadioButton +{ + id: radioButton + + font: UM.Theme.getFont("default") + + background: Item + { + anchors.fill: parent + } + + indicator: Rectangle + { + implicitWidth: UM.Theme.getSize("radio_button").width + implicitHeight: UM.Theme.getSize("radio_button").height + anchors.verticalCenter: parent.verticalCenter + radius: (width / 2) | 0 + border.width: UM.Theme.getSize("default_lining").width + border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") + + Rectangle + { + width: (parent.width / 2) | 0 + height: width + anchors.centerIn: parent + radius: (width / 2) | 0 + color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") + visible: radioButton.checked + } + } + + contentItem: Label + { + verticalAlignment: Text.AlignVCenter + leftPadding: radioButton.indicator.width + radioButton.spacing + text: radioButton.text + font: radioButton.font + renderType: Text.NativeRendering + } +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 7ca2b36b4b..a73d154c6a 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -24,6 +24,7 @@ ToolTip 1.0 ToolTip.qml CheckBox 1.0 CheckBox.qml ComboBox 1.0 ComboBox.qml ProgressBar 1.0 ProgressBar.qml +RadioButton 1.0 RadioButton.qml TabButton 1.0 TabButton.qml From 2511b7a26a9aee25abd6c041d43e31b41efaf797 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 15:18:54 +0100 Subject: [PATCH 160/211] Implement More-info button on Data Collection page --- .../WelcomePages/DataCollectionsContent.qml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 9c5ed3820f..8b67e1fdeb 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -36,11 +36,12 @@ Item anchors.bottom: getStartedButton.top anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width Column { anchors.centerIn: parent + width: parent.width spacing: UM.Theme.getSize("welcome_pages_default_margin").height @@ -54,12 +55,29 @@ Item Label { id: textLabel + width: parent.width 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") + text: + { + var t = catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality and user experience.") + var t2 = catalog.i18nc("@text", "More information") + t += " " + t2 + "" + return t + } textFormat: Text.RichText + wrapMode: Text.WordWrap font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + + MouseArea + { + anchors.fill: parent + onClicked: + { + CuraApplication.showMoreInformationDialogForAnonymousDataCollection() + } + } } } } From 98b7df790d3d2d59a08a061a3353c5b41ef13aba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 15:18:54 +0100 Subject: [PATCH 161/211] Implement More-info button on Data Collection page --- .../WelcomePages/DataCollectionsContent.qml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 2990b16795..23d3ad85a5 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -36,11 +36,12 @@ Item anchors.bottom: getStartedButton.top anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width Column { anchors.centerIn: parent + width: parent.width spacing: UM.Theme.getSize("welcome_pages_default_margin").height @@ -54,12 +55,29 @@ Item Label { id: textLabel + width: parent.width 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") + text: + { + var t = catalog.i18nc("@text", "Ultimaker Cura collects anonymous data to improve print quality and user experience.") + var t2 = catalog.i18nc("@text", "More information") + t += " " + t2 + "" + return t + } textFormat: Text.RichText + wrapMode: Text.WordWrap font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + + MouseArea + { + anchors.fill: parent + onClicked: + { + CuraApplication.showMoreInformationDialogForAnonymousDataCollection() + } + } } } } From 6843fb1ffb7091df767123cbeb350a68233d4104 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 15:46:02 +0100 Subject: [PATCH 162/211] Load change log from file for on-boarding page --- cura/CuraApplication.py | 7 ++ cura/UI/TextManager.py | 64 +++++++++++++++++++ plugins/ChangeLogPlugin/ChangeLog.py | 58 ++--------------- plugins/ChangeLogPlugin/ChangeLog.qml | 6 +- .../qml/WelcomePages/WhatsNewContent.qml | 13 +--- .../texts/change_log.txt | 0 6 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 cura/UI/TextManager.py rename plugins/ChangeLogPlugin/ChangeLog.txt => resources/texts/change_log.txt (100%) mode change 100755 => 100644 diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 951f1460d2..2f73d88481 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -109,6 +109,7 @@ import cura.Settings.cura_empty_instance_containers from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.UI.ObjectsModel import ObjectsModel +from cura.UI.TextManager import TextManager from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel @@ -211,6 +212,7 @@ class CuraApplication(QtApplication): self._discovered_printer_model = DiscoveredPrintersModel(self) self._welcome_pages_model = WelcomePagesModel(self) + self._text_manager = TextManager(self) self._quality_profile_drop_down_menu_model = None self._custom_quality_profile_drop_down_menu_model = None @@ -862,6 +864,10 @@ class CuraApplication(QtApplication): def getWelcomePagesModel(self, *args) -> "WelcomePagesModel": return self._welcome_pages_model + @pyqtSlot(result = QObject) + def getTextManager(self, *args) -> "TextManager": + return self._text_manager + def getCuraFormulaFunctions(self, *args) -> "CuraFormulaFunctions": if self._cura_formula_functions is None: self._cura_formula_functions = CuraFormulaFunctions(self) @@ -995,6 +1001,7 @@ class CuraApplication(QtApplication): qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePagesModel") + qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager") qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") diff --git a/cura/UI/TextManager.py b/cura/UI/TextManager.py new file mode 100644 index 0000000000..a2708801bb --- /dev/null +++ b/cura/UI/TextManager.py @@ -0,0 +1,64 @@ +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import collections +from typing import Optional + +from PyQt5.QtCore import QObject, pyqtSlot + +from UM.Resources import Resources +from UM.Version import Version + + +# +# This manager provides means to load texts to QML. +# +class TextManager(QObject): + + def __init__(self, parent: Optional["QObject"] = None) -> None: + super().__init__(parent) + + self._change_log_text = "" + + @pyqtSlot(result = str) + def getChangeLogText(self) -> str: + if not self._change_log_text: + self._change_log_text = self._loadChangeLogText() + return self._change_log_text + + def _loadChangeLogText(self) -> str: + # Load change log texts and organize them with a dict + file_path = Resources.getPath(Resources.Texts, "change_log.txt") + change_logs_dict = {} + with open(file_path, "r", encoding = "utf-8") as f: + open_version = None + open_header = "" # Initialise to an empty header in case there is no "*" in the first line of the changelog + for line in f: + line = line.replace("\n", "") + if "[" in line and "]" in line: + line = line.replace("[", "") + line = line.replace("]", "") + open_version = Version(line) + open_header = "" + change_logs_dict[open_version] = collections.OrderedDict() + elif line.startswith("*"): + open_header = line.replace("*", "") + change_logs_dict[open_version][open_header] = [] + elif line != "": + if open_header not in change_logs_dict[open_version]: + change_logs_dict[open_version][open_header] = [] + change_logs_dict[open_version][open_header].append(line) + + # Format changelog text + content = "" + for version in change_logs_dict: + content += "

" + str(version) + "


" + content += "" + for change in change_logs_dict[version]: + if str(change) != "": + content += "" + str(change) + "
" + for line in change_logs_dict[version][change]: + content += str(line) + "
" + content += "
" + + return content diff --git a/plugins/ChangeLogPlugin/ChangeLog.py b/plugins/ChangeLogPlugin/ChangeLog.py index eeec5edf9b..241d7a8953 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.py +++ b/plugins/ChangeLogPlugin/ChangeLog.py @@ -1,20 +1,20 @@ -# Copyright (c) 2018 Ultimaker B.V. +# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import os.path + +from PyQt5.QtCore import QObject + from UM.i18n import i18nCatalog from UM.Extension import Extension from UM.Application import Application from UM.PluginRegistry import PluginRegistry from UM.Version import Version -from PyQt5.QtCore import pyqtSlot, QObject - -import os.path -import collections - catalog = i18nCatalog("cura") -class ChangeLog(Extension, QObject,): + +class ChangeLog(Extension, QObject): def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) @@ -26,55 +26,11 @@ class ChangeLog(Extension, QObject,): else: self._current_app_version = None - self._change_logs = None Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) Application.getInstance().getPreferences().addPreference("general/latest_version_changelog_shown", "2.0.0") #First version of CURA with uranium self.setMenuName(catalog.i18nc("@item:inmenu", "Changelog")) self.addMenuItem(catalog.i18nc("@item:inmenu", "Show Changelog"), self.showChangelog) - def getChangeLogs(self): - if not self._change_logs: - self.loadChangeLogs() - return self._change_logs - - @pyqtSlot(result = str) - def getChangeLogString(self): - logs = self.getChangeLogs() - result = "" - for version in logs: - result += "

" + str(version) + "


" - result += "" - for change in logs[version]: - if str(change) != "": - result += "" + str(change) + "
" - for line in logs[version][change]: - result += str(line) + "
" - result += "
" - - pass - return result - - def loadChangeLogs(self): - self._change_logs = collections.OrderedDict() - with open(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "ChangeLog.txt"), "r", encoding = "utf-8") as f: - open_version = None - open_header = "" # Initialise to an empty header in case there is no "*" in the first line of the changelog - for line in f: - line = line.replace("\n","") - if "[" in line and "]" in line: - line = line.replace("[","") - line = line.replace("]","") - open_version = Version(line) - open_header = "" - self._change_logs[open_version] = collections.OrderedDict() - elif line.startswith("*"): - open_header = line.replace("*","") - self._change_logs[open_version][open_header] = [] - elif line != "": - if open_header not in self._change_logs[open_version]: - self._change_logs[open_version][open_header] = [] - self._change_logs[open_version][open_header].append(line) - def _onEngineCreated(self): if not self._current_app_version: return #We're on dev branch. diff --git a/plugins/ChangeLogPlugin/ChangeLog.qml b/plugins/ChangeLogPlugin/ChangeLog.qml index 512687f15a..7089a56caf 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.qml +++ b/plugins/ChangeLogPlugin/ChangeLog.qml @@ -6,7 +6,9 @@ import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 -import UM 1.1 as UM +import UM 1.3 as UM +import Cura 1.0 as Cura + UM.Dialog { @@ -20,7 +22,7 @@ UM.Dialog TextArea { anchors.fill: parent - text: manager.getChangeLogString() + text: CuraApplication.getTextManager().getChangeLogText() readOnly: true; textFormat: TextEdit.RichText } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 097470e444..8e545d237f 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -50,18 +50,7 @@ Item TextArea { id: whatsNewTextArea - text: catalog.i18nc("@text", "

Ultimaker Cura 4.0

- -

New features

- -

Brand new user interface. Ultimaker Cura is a very powerful tool with many features to support users’ needs. In the new UI, we present these features in a better, more intuitive way based on the workflow of our users. The Marketplace and user account control have been integrated into the main interface to easily access material profiles and plugins. Within the UI, three stages are shown in the header to give a clear guidance of the flow. The stage menu is populated with collapsible panels that allow users to focus on the 3D view when needed, while still showing important information at the same time, such as slicing configuration and settings. Users can now easily go to the preview stage to examine the layer view after slicing the model, which previously was less obvious or hidden. The new UI also creates more distinction between recommended and custom mode. Novice users or users who are not interested in all the settings can easily prepare a file without diving into details. Expert users can use custom mode with a resizable settings panel to make more settings visible, and the set position will persist between sessions.

- -

Cloud printing. Pair your Ultimaker printer with an Ultimaker account so you can send and monitor print jobs from outside your local network.

- -

Redesigned "Add Printer" dialog. Updated one of the first dialogs a new user is presented with. The layout is loosely modeled on the layout of the Ultimaker 3/Ultimaker S5 "Connect to Network" dialog, and adds some instructions and intention to the dialog. Contributed by fieldOfView.

- -

Integrated backups. Cura backups has been integrated into Ultimaker Cura and can be found in the 'extensions' menu. With this feature, users can backup their Ultimaker Cura configurations to the cloud.

- ") + text: CuraApplication.getTextManager().getChangeLogText() textFormat: Text.RichText wrapMode: Text.WordWrap readOnly: true diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/resources/texts/change_log.txt old mode 100755 new mode 100644 similarity index 100% rename from plugins/ChangeLogPlugin/ChangeLog.txt rename to resources/texts/change_log.txt From 1dd48c57288005aedc0fc3682f08d8c1da5fc3ba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 16:21:07 +0100 Subject: [PATCH 163/211] Show welcome page if no printer --- cura/CuraApplication.py | 7 ++++--- resources/qml/Cura.qml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2f73d88481..f6855aecdb 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -38,6 +38,7 @@ from UM.Settings.Validator import Validator from UM.Message import Message from UM.i18n import i18nCatalog from UM.Workspace.WorkspaceReader import WorkspaceReader +import UM.Util from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.GroupedOperation import GroupedOperation @@ -548,11 +549,11 @@ class CuraApplication(QtApplication): @pyqtProperty(bool) def needToShowUserAgreement(self) -> bool: - return not self.getPreferences().getValue("general/accepted_user_agreement") + return not UM.Util.parseBool(self.getPreferences().getValue("general/accepted_user_agreement")) @pyqtSlot(bool) - def setNeedToShowUserAgreement(self, set_value = True) -> None: - self.getPreferences().setValue("general/accepted_user_agreement", not set_value) + def setNeedToShowUserAgreement(self, set_value: bool = True) -> None: + self.getPreferences().setValue("general/accepted_user_agreement", str(not set_value)) @pyqtSlot(str, str) def writeToLog(self, severity: str, message: str) -> None: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3572d299bb..5a60f552f4 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -74,13 +74,13 @@ UM.MainWindow Cura.Actions.parent = backgroundItem CuraApplication.purgeWindows() - if (CuraApplication.needToShowUserAgreement) + if (CuraApplication.needToShowUserAgreement || Cura.MachineManager.activeMachine == null) { - welcomeDialog.show() + welcomeDialog.visible = true } else { - welcomeDialog.close() + welcomeDialog.visible = false } // TODO: While the new onboarding process contains the user-agreement, // it should probably not entirely rely on 'needToShowUserAgreement' for show/hide. From 6c7ae309a19c079fb38338ca28fc10db46189bc4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 16:27:06 +0100 Subject: [PATCH 164/211] Add network troubleshooting url --- 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 0d37b2092b..33d36d07ea 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -200,7 +200,7 @@ Item onClicked: { // open the troubleshooting URL with web browser - var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO + const url = "https://ultimaker.com/en/resources/39129-network-troubleshooting-cura" Qt.openUrlExternally(url) } onEntered: From 6dbae6f088e4c03fee93ee686b5f976877195ed2 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Mar 2019 09:34:48 +0100 Subject: [PATCH 165/211] Show machine actions page optionally --- .../Models/FirstStartMachineActionsModel.py | 48 +++++++++- cura/UI/WelcomePagesModel.py | 94 ++++++++++++++----- .../FirstStartMachineActionsContent.qml | 48 ++++------ 3 files changed, 136 insertions(+), 54 deletions(-) diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index aabf8b8a8a..73deb6ac24 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -1,9 +1,9 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional +from typing import Optional, Dict, Any -from PyQt5.QtCore import QObject, Qt +from PyQt5.QtCore import QObject, Qt, pyqtProperty, pyqtSignal, pyqtSlot from UM.Qt.ListModel import ListModel @@ -27,6 +27,8 @@ class FirstStartMachineActionsModel(ListModel): self.addRoleName(self.ContentRole, "content") self.addRoleName(self.ActionRole, "action") + self._current_action_index = 0 + from cura.CuraApplication import CuraApplication self._application = CuraApplication.getInstance() @@ -36,6 +38,47 @@ class FirstStartMachineActionsModel(ListModel): self._application.getMachineManager().globalContainerChanged.connect(self._update) self._update() + currentActionIndexChanged = pyqtSignal() + allFinished = pyqtSignal() # Emitted when all actions have been finished. + + @pyqtProperty(int, notify = currentActionIndexChanged) + def currentActionIndex(self) -> int: + return self._current_action_index + + @pyqtProperty("QVariantMap", notify = currentActionIndexChanged) + def currentItem(self) -> Optional[Dict[str, Any]]: + if self._current_action_index >= self.count: + return dict() + else: + return self.getItem(self._current_action_index) + + @pyqtProperty(bool, notify = currentActionIndexChanged) + def hasMoreActions(self) -> bool: + return self._current_action_index < self.count - 1 + + @pyqtSlot() + def goToNextAction(self) -> None: + # finish the current item + if "action" in self.currentItem: + self.currentItem["action"].setFinished() + + if not self.hasMoreActions: + self.allFinished.emit() + self.reset() + return + + self._current_action_index += 1 + self.currentActionIndexChanged.emit() + + # Resets the current action index to 0 so the wizard panel can show actions from the beginning. + @pyqtSlot() + def reset(self) -> None: + self._current_action_index = 0 + self.currentActionIndexChanged.emit() + + if self.count == 0: + self.allFinished.emit() + def _update(self) -> None: global_stack = self._application.getMachineManager().activeMachine if global_stack is None: @@ -53,6 +96,7 @@ class FirstStartMachineActionsModel(ListModel): }) self.setItems(item_list) + self.reset() __all__ = ["FirstStartMachineActionsModel"] diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 6cbe59e349..5cb29436d9 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -13,7 +13,20 @@ from UM.Resources import Resources if TYPE_CHECKING: from PyQt5.QtCore import QObject - +# +# This is the Qt ListModel that contains all welcome pages data. Each page is a page that can be shown as a step in the +# welcome wizard dialog. Each item in this ListModel represents a page, which contains the following fields: +# +# - id : A unique page_id which can be used in function goToPage(page_id) +# - page_url : The QUrl to the QML file that contains the content of this page +# - next_page_id : (OPTIONAL) The next page ID to go to when this page finished. This is optional. If this is not +# provided, it will go to the page with the current index + 1 +# - should_show_function : (OPTIONAL) An optional function that returns True/False indicating if this page should be +# shown. By default all pages should be shown. If a function returns False, that page will +# be skipped and its next page will be shown. +# +# Note that in any case, a page that has its "should_show_function" == False will ALWAYS be skipped. +# class WelcomePagesModel(ListModel): IdRole = Qt.UserRole + 1 # Page ID @@ -57,26 +70,40 @@ class WelcomePagesModel(ListModel): self.currentPageIndexChanged.emit() # Goes to the next page. + # If "from_index" is given, it will look for the next page to show starting from the "from_index" page instead of + # the "self._current_page_index". @pyqtSlot() - def goToNextPage(self) -> None: - page_item = self._items[self._current_page_index] - # Check if there's a "next_page_id" assigned. If so, go to that page. Otherwise, go to the page with the - # current index + 1. - next_page_id = page_item.get("next_page_id") - next_page_index = self._current_page_index + 1 - if next_page_id: - idx = self.getPageIndexById(next_page_id) - if idx is None: - # FIXME: If we cannot find the next page, we cannot do anything here. - Logger.log("e", "Cannot find page with ID [%s]", next_page_id) - return - next_page_index = idx + def goToNextPage(self, from_index: Optional[int] = None) -> None: + # Look for the next page that should be shown + current_index = self._current_page_index if from_index is None else from_index + while True: + page_item = self._items[current_index] - # If we have reached the last page, emit allFinished signal and reset. - if next_page_index == len(self._items): - self.allFinished.emit() - self.resetState() - return + # Check if there's a "next_page_id" assigned. If so, go to that page. Otherwise, go to the page with the + # current index + 1. + next_page_id = page_item.get("next_page_id") + next_page_index = current_index + 1 + if next_page_id: + idx = self.getPageIndexById(next_page_id) + if idx is None: + # FIXME: If we cannot find the next page, we cannot do anything here. + Logger.log("e", "Cannot find page with ID [%s]", next_page_id) + return + next_page_index = idx + + # If we have reached the last page, emit allFinished signal and reset. + if next_page_index == len(self._items): + self.allFinished.emit() + self.resetState() + return + + # Check if the this page should be shown (default yes), if not, keep looking for the next one. + next_page_item = self.getItem(next_page_index) + if self._shouldPageBeShown(next_page_index): + break + + Logger.log("d", "Page [%s] should not be displayed, look for the next page.", next_page_item["id"]) + current_index = next_page_index # Move to the next page self._setCurrentPageIndex(next_page_index) @@ -101,8 +128,19 @@ class WelcomePagesModel(ListModel): Logger.log("e", "Cannot find page with ID [%s]", page_index) return - # Move to that page - self._setCurrentPageIndex(page_index) + if self._shouldPageBeShown(page_index): + # Move to that page if it should be shown + self._setCurrentPageIndex(page_index) + else: + # Find the next page to show starting from the "page_index" + self.goToNextPage(from_index = page_index) + + # Checks if the page with the given index should be shown by calling the "should_show_function" associated with it. + # If the function is not present, returns True (show page by default). + def _shouldPageBeShown(self, page_index: int) -> bool: + next_page_item = self.getItem(page_index) + should_show_function = next_page_item.get("should_show_function", lambda: True) + return should_show_function() # Resets the state of the WelcomePagesModel. This functions does the following: # - Resets current_page_index to 0 @@ -154,6 +192,7 @@ class WelcomePagesModel(ListModel): self._pages.append({"id": "machine_actions", "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"), "next_page_id": "cloud", + "should_show_function": self.shouldShowMachineActions, }) self._pages.append({"id": "cloud", "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), @@ -161,6 +200,19 @@ class WelcomePagesModel(ListModel): self.setItems(self._pages) + # Indicates if the machine action panel should be shown by checking if there's any first start machine actions + # available. + def shouldShowMachineActions(self) -> bool: + from cura.CuraApplication import CuraApplication + application = CuraApplication.getInstance() + global_stack = application.getMachineManager().activeMachine + if global_stack is None: + return False + + definition_id = global_stack.definition.getId() + first_start_actions = application.getMachineActionManager().getFirstStartActions(definition_id) + return len(first_start_actions) > 0 + def addPage(self) -> None: pass diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 6b4a79a24a..f1a178e018 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -17,25 +17,19 @@ Item property var machineActionsModel: CuraApplication.getFirstStartMachineActionsModel() - property int currentActionIndex: 0 - property var currentActionItem: currentActionIndex >= machineActionsModel.count - ? null : machineActionsModel.getItem(currentActionIndex) - property bool hasActions: machineActionsModel.count > 0 + Component.onCompleted: + { + // Reset the action to start from the beginning when it is shown. + machineActionsModel.reset() + } - // Reset to the first page if the model gets changed. + // Go to the next page when all machine actions have been finished Connections { target: machineActionsModel - onItemsChanged: currentActionIndex = 0 - } - - onVisibleChanged: - { - if (visible) + onAllFinished: { - // Reset the action to start from the beginning when it is shown. - currentActionIndex = 0 - if (!hasActions) + if (visible) { base.showNextPage() } @@ -49,7 +43,7 @@ Item anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter - text: currentActionItem == null ? "" : currentActionItem.title + text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("large_bold") renderType: Text.NativeRendering @@ -63,7 +57,13 @@ Item anchors.left: parent.left anchors.right: parent.right - data: currentActionItem == undefined ? null : currentActionItem.content + data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content + } + + // An empty item in case there's no currentItem.content to show + Item + { + id: emptyItem } Cura.PrimaryButton @@ -75,20 +75,6 @@ Item text: catalog.i18nc("@button", "Next") width: UM.Theme.getSize("welcome_pages_button").width fixedWidthMode: true - onClicked: - { - // If no more first-start actions to show, go to the next page. - if (currentActionIndex + 1 >= machineActionsModel.count) - { - currentActionIndex = 0 - base.showNextPage() - return - } - - // notify the current MachineAction that it has finished - currentActionItem.action.setFinished() - // move on to the next MachineAction - currentActionIndex++ - } + onClicked: machineActionsModel.goToNextAction() } } From 0a8a25860c08f7c7afb941236836a2a68bbb0500 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 27 Mar 2019 13:09:25 +0100 Subject: [PATCH 166/211] Update network troubleshooting URL --- 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 33d36d07ea..93e8a0d83a 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -200,7 +200,7 @@ Item onClicked: { // open the troubleshooting URL with web browser - const url = "https://ultimaker.com/en/resources/39129-network-troubleshooting-cura" + const url = "https://ultimaker.com/in/cura/troubleshooting/network" Qt.openUrlExternally(url) } onEntered: From 804e2060ea0b5431edca0c1000ef85cefe564120 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Mar 2019 17:20:17 +0100 Subject: [PATCH 167/211] Re-added the imports to the conftest These are really really needed, otherwise the tests wont run. I've added a few more comments to further stress the importance of these. CURA-6057 --- tests/conftest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5336c28fba..7f46c202b3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,10 +6,15 @@ import unittest.mock import pytest +# Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first! +import Savitar # Dont remove this line +import Arcus # No really. Don't. It needs to be there! +from UM.Qt.QtApplication import QtApplication # QtApplication import is required, even though it isn't used. +# Even though your IDE says these files are not used, don't believe it. It's lying. They need to be there. + from cura.CuraApplication import CuraApplication from cura.UI.MachineActionManager import MachineActionManager - # Create a CuraApplication object that will be shared among all tests. It needs to be initialized. # Since we need to use it more that once, we create the application the first time and use its instance afterwards. @pytest.fixture() From 9091eaa6f853cf8f49551609ddf39bb5520be2d1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Mar 2019 17:20:17 +0100 Subject: [PATCH 168/211] Re-added the imports to the conftest These are really really needed, otherwise the tests wont run. I've added a few more comments to further stress the importance of these. CURA-6057 --- tests/conftest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5336c28fba..7f46c202b3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,10 +6,15 @@ import unittest.mock import pytest +# Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first! +import Savitar # Dont remove this line +import Arcus # No really. Don't. It needs to be there! +from UM.Qt.QtApplication import QtApplication # QtApplication import is required, even though it isn't used. +# Even though your IDE says these files are not used, don't believe it. It's lying. They need to be there. + from cura.CuraApplication import CuraApplication from cura.UI.MachineActionManager import MachineActionManager - # Create a CuraApplication object that will be shared among all tests. It needs to be initialized. # Since we need to use it more that once, we create the application the first time and use its instance afterwards. @pytest.fixture() From 84aa7fd007ef037a5ce6c15efd1883912ae941a5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Mar 2019 17:40:33 +0100 Subject: [PATCH 169/211] Fix mypy type errors CURA-6057 --- cura/UI/ObjectsModel.py | 8 +++++--- cura/UI/TextManager.py | 14 +++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cura/UI/ObjectsModel.py b/cura/UI/ObjectsModel.py index 09304451a5..36d590a668 100644 --- a/cura/UI/ObjectsModel.py +++ b/cura/UI/ObjectsModel.py @@ -51,12 +51,14 @@ class ObjectsModel(ListModel): group_nr = 1 name_count_dict = defaultdict(int) # type: Dict[str, int] - for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): + for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): # type: ignore if not isinstance(node, SceneNode): continue if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"): continue - if node.getParent() and node.getParent().callDecoration("isGroup"): + + parent = node.getParent() + if parent and parent.callDecoration("isGroup"): continue # Grouped nodes don't need resetting as their parent (the group) is resetted) if not node.callDecoration("isSliceable") and not node.callDecoration("isGroup"): continue @@ -72,7 +74,7 @@ class ObjectsModel(ListModel): group_nr += 1 if hasattr(node, "isOutsideBuildArea"): - is_outside_build_area = node.isOutsideBuildArea() + is_outside_build_area = node.isOutsideBuildArea() # type: ignore else: is_outside_build_area = False diff --git a/cura/UI/TextManager.py b/cura/UI/TextManager.py index a2708801bb..c09fc9b1c2 100644 --- a/cura/UI/TextManager.py +++ b/cura/UI/TextManager.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. import collections -from typing import Optional +from typing import Optional, Dict, List, cast from PyQt5.QtCore import QObject, pyqtSlot @@ -29,9 +29,9 @@ class TextManager(QObject): def _loadChangeLogText(self) -> str: # Load change log texts and organize them with a dict file_path = Resources.getPath(Resources.Texts, "change_log.txt") - change_logs_dict = {} + change_logs_dict = {} # type: Dict[Version, Dict[str, List[str]]] with open(file_path, "r", encoding = "utf-8") as f: - open_version = None + open_version = None # type: Optional[Version] open_header = "" # Initialise to an empty header in case there is no "*" in the first line of the changelog for line in f: line = line.replace("\n", "") @@ -43,11 +43,11 @@ class TextManager(QObject): change_logs_dict[open_version] = collections.OrderedDict() elif line.startswith("*"): open_header = line.replace("*", "") - change_logs_dict[open_version][open_header] = [] + change_logs_dict[cast(Version, open_version)][open_header] = [] elif line != "": - if open_header not in change_logs_dict[open_version]: - change_logs_dict[open_version][open_header] = [] - change_logs_dict[open_version][open_header].append(line) + if open_header not in change_logs_dict[cast(Version, open_version)]: + change_logs_dict[cast(Version, open_version)][open_header] = [] + change_logs_dict[cast(Version, open_version)][open_header].append(line) # Format changelog text content = "" From b28fdc2b0b34876f6cbeee6d934b29b83539e6fe Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:22:27 +0100 Subject: [PATCH 170/211] Use camelcase for pyqtProperty names --- cura/Machines/Models/DiscoveredPrintersModel.py | 10 +++++----- .../qml/WelcomePages/AddNetworkPrinterScrollView.qml | 8 ++++---- tests/Machines/Models/TestDiscoveredPrintersModel.py | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index e127ba48af..a27125382e 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -47,7 +47,7 @@ class DiscoveredPrinter(QObject): machineTypeChanged = pyqtSignal() @pyqtProperty(str, notify = machineTypeChanged) - def machine_type(self) -> str: + def machineType(self) -> str: return self._machine_type def setMachineType(self, machine_type: str) -> None: @@ -57,7 +57,7 @@ class DiscoveredPrinter(QObject): # Human readable machine type string @pyqtProperty(str, notify = machineTypeChanged) - def readable_machine_type(self) -> str: + def readableMachineType(self) -> str: from cura.CuraApplication import CuraApplication readable_type = CuraApplication.getInstance().getMachineManager().getMachineTypeNameFromId(self._machine_type) if not readable_type: @@ -65,8 +65,8 @@ class DiscoveredPrinter(QObject): return readable_type @pyqtProperty(bool, notify = machineTypeChanged) - def is_unknown_machine_type(self) -> bool: - return self.readable_machine_type.lower() == "unknown" + def isUnknownMachineType(self) -> bool: + return self.readableMachineType.lower() == "unknown" @pyqtProperty(QObject, constant = True) def device(self) -> "NetworkedPrinterOutputDevice": @@ -88,7 +88,7 @@ class DiscoveredPrintersModel(QObject): discoveredPrintersChanged = pyqtSignal() @pyqtProperty(list, notify = discoveredPrintersChanged) - def discovered_printers(self) -> List["DiscoveredPrinter"]: + def discoveredPrinters(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 diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 93e8a0d83a..53a3241527 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -69,14 +69,14 @@ Item { id: networkPrinterListView anchors.fill: parent - model: CuraApplication.getDiscoveredPrintersModel().discovered_printers + model: CuraApplication.getDiscoveredPrintersModel().discoveredPrinters Component.onCompleted: { // Select the first one that's not "unknown" by default. for (var i = 0; i < count; i++) { - if (!model[i].is_unknown_machine_type) + if (!model[i].isUnknownMachineType) { currentIndex = i break @@ -93,7 +93,7 @@ Item anchors.rightMargin: UM.Theme.getSize("default_margin").width outputDevice: modelData.device - enabled: !modelData.is_unknown_machine_type + enabled: !modelData.isUnknownMachineType printerTypeLabelAutoFit: true @@ -103,7 +103,7 @@ Item function updateMachineTypes() { - printerTypesList = [ modelData.readable_machine_type ] + printerTypesList = [ modelData.readableMachineType ] } checkable: false diff --git a/tests/Machines/Models/TestDiscoveredPrintersModel.py b/tests/Machines/Models/TestDiscoveredPrintersModel.py index c89274771f..4ccc3ba523 100644 --- a/tests/Machines/Models/TestDiscoveredPrintersModel.py +++ b/tests/Machines/Models/TestDiscoveredPrintersModel.py @@ -15,12 +15,12 @@ def test_discoveredPrinters(discovered_printer_model): mocked_callback = MagicMock() discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device) - device = discovered_printer_model.discovered_printers[0] + device = discovered_printer_model.discoveredPrinters[0] discovered_printer_model.createMachineFromDiscoveredPrinter(device) mocked_callback.assert_called_with("key") - assert len(discovered_printer_model.discovered_printers) == 1 + assert len(discovered_printer_model.discoveredPrinters) == 1 # Test if removing it works discovered_printer_model.removeDiscoveredPrinter("ip") - assert len(discovered_printer_model.discovered_printers) == 0 + assert len(discovered_printer_model.discoveredPrinters) == 0 From 8780fce7a721fb0869597eabc306ff3f2bf173e1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:26:50 +0100 Subject: [PATCH 171/211] Move MaterialOutputModel back --- .../Models/ExtruderConfigurationModel.py | 2 +- cura/PrinterOutput/Models/ExtruderOutputModel.py | 11 ++++++----- .../Models}/MaterialOutputModel.py | 0 cura/Settings/MachineManager.py | 6 +++--- .../CloudClusterPrinterConfigurationMaterial.py | 2 +- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- .../UM3NetworkPrinting/src/LegacyUM3OutputDevice.py | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) rename cura/{UI => PrinterOutput/Models}/MaterialOutputModel.py (100%) diff --git a/cura/PrinterOutput/Models/ExtruderConfigurationModel.py b/cura/PrinterOutput/Models/ExtruderConfigurationModel.py index 7de37918b9..a291888bfd 100644 --- a/cura/PrinterOutput/Models/ExtruderConfigurationModel.py +++ b/cura/PrinterOutput/Models/ExtruderConfigurationModel.py @@ -4,7 +4,7 @@ from typing import Optional from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal -from cura.UI.MaterialOutputModel import MaterialOutputModel +from .MaterialOutputModel import MaterialOutputModel class ExtruderConfigurationModel(QObject): diff --git a/cura/PrinterOutput/Models/ExtruderOutputModel.py b/cura/PrinterOutput/Models/ExtruderOutputModel.py index 6002f5637f..889e140312 100644 --- a/cura/PrinterOutput/Models/ExtruderOutputModel.py +++ b/cura/PrinterOutput/Models/ExtruderOutputModel.py @@ -1,14 +1,15 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot -from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel - from typing import Optional, TYPE_CHECKING +from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot + +from .ExtruderConfigurationModel import ExtruderConfigurationModel + if TYPE_CHECKING: - from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel - from cura.UI.MaterialOutputModel import MaterialOutputModel + from .MaterialOutputModel import MaterialOutputModel + from .PrinterOutputModel import PrinterOutputModel class ExtruderOutputModel(QObject): diff --git a/cura/UI/MaterialOutputModel.py b/cura/PrinterOutput/Models/MaterialOutputModel.py similarity index 100% rename from cura/UI/MaterialOutputModel.py rename to cura/PrinterOutput/Models/MaterialOutputModel.py diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 8de19d9e00..1870f2314e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -6,13 +6,13 @@ import re import unicodedata from typing import Any, List, Dict, TYPE_CHECKING, Optional, cast +from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, QTimer + from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.Interfaces import ContainerInterface from UM.Signal import Signal - -from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, QTimer from UM.FlameProfiler import pyqtSlot from UM import Util from UM.Logger import Logger @@ -25,7 +25,7 @@ from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel -from cura.UI.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutput.Models.MaterialOutputModel import MaterialOutputModel from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderStack import ExtruderStack diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py index 73e54c8141..db09133a14 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py @@ -2,7 +2,7 @@ from typing import Optional from UM.Logger import Logger from cura.CuraApplication import CuraApplication -from cura.UI.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutput.Models.MaterialOutputModel import MaterialOutputModel from .BaseCloudModel import BaseCloudModel diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index e280e937fb..2fefd2f955 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -23,7 +23,7 @@ from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigura from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel -from cura.UI.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutput.Models.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from .Cloud.Utils import formatTimeCompleted, formatDateCompleted diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 9f86415031..ac0b980a32 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -4,7 +4,7 @@ from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel -from cura.UI.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutput.Models.MaterialOutputModel import MaterialOutputModel from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.ContainerManager import ContainerManager From 397add861ff377419a9664b7688f8bcabaed1b89 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:29:37 +0100 Subject: [PATCH 172/211] Correct logging level --- cura/Machines/Models/DiscoveredPrintersModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index a27125382e..8c5b0b8b0e 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -119,7 +119,7 @@ class DiscoveredPrintersModel(QObject): def removeDiscoveredPrinter(self, ip_address: str) -> None: 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) + Logger.log("w", "Key [%s] does not exist in the discovered printers list.", ip_address) return del self._discovered_printer_by_ip_dict[ip_address] From 82471a0e398387980b4b02e5f5697bb295e9ea43 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:31:33 +0100 Subject: [PATCH 173/211] Add doc for MachineSettingsManager --- cura/UI/MachineSettingsManager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cura/UI/MachineSettingsManager.py b/cura/UI/MachineSettingsManager.py index 8fdbae09e1..518b922f92 100644 --- a/cura/UI/MachineSettingsManager.py +++ b/cura/UI/MachineSettingsManager.py @@ -1,11 +1,16 @@ +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. -from typing import Any, Dict, Optional, TYPE_CHECKING +from typing import Optional -from PyQt5.QtCore import Qt, QObject, pyqtSlot +from PyQt5.QtCore import QObject, pyqtSlot from UM.i18n import i18nCatalog +# +# This manager provides (convenience) functions to the Machine Settings Dialog QML to update certain machine settings. +# class MachineSettingsManager(QObject): def __init__(self, parent: Optional["QObject"] = None) -> None: From 3ad79a58881ef05db0479b65cb66914c074d77a1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:34:18 +0100 Subject: [PATCH 174/211] Fix divided by 0 problem --- cura/UI/WelcomePagesModel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 5cb29436d9..dde5ebcb06 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -56,7 +56,10 @@ class WelcomePagesModel(ListModel): # Returns a float number in [0, 1] which indicates the current progress. @pyqtProperty(float, notify = currentPageIndexChanged) def currentProgress(self) -> float: - return self._current_page_index / len(self._items) + if len(self._items) == 0: + return 0 + else: + return self._current_page_index / len(self._items) # Indicates if the current page is the last page. @pyqtProperty(bool, notify = currentPageIndexChanged) From f4d0e39788a09f0a434fa44114ba702f2c0cefd6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 14:43:37 +0100 Subject: [PATCH 175/211] Pass application --- .../Machines/Models/FirstStartMachineActionsModel.py | 11 ++++++----- cura/UI/MachineSettingsManager.py | 10 ++++++---- cura/UI/WelcomePagesModel.py | 12 +++++++----- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index 73deb6ac24..489509f4ec 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -1,12 +1,15 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional, Dict, Any +from typing import Optional, Dict, Any, TYPE_CHECKING from PyQt5.QtCore import QObject, Qt, pyqtProperty, pyqtSignal, pyqtSlot from UM.Qt.ListModel import ListModel +if TYPE_CHECKING: + from cura.CuraApplication import CuraApplication + # # This model holds all first-start machine actions for the currently active machine. It has 2 roles: @@ -20,7 +23,7 @@ class FirstStartMachineActionsModel(ListModel): ContentRole = Qt.UserRole + 2 ActionRole = Qt.UserRole + 3 - def __init__(self, parent: Optional[QObject] = None) -> None: + def __init__(self, application: "CuraApplication", parent: Optional[QObject] = None) -> None: super().__init__(parent) self.addRoleName(self.TitleRole, "title") @@ -29,9 +32,7 @@ class FirstStartMachineActionsModel(ListModel): self._current_action_index = 0 - from cura.CuraApplication import CuraApplication - self._application = CuraApplication.getInstance() - + self._application = application self._application.initializationFinished.connect(self._initialize) def _initialize(self) -> None: diff --git a/cura/UI/MachineSettingsManager.py b/cura/UI/MachineSettingsManager.py index 518b922f92..8c411f2537 100644 --- a/cura/UI/MachineSettingsManager.py +++ b/cura/UI/MachineSettingsManager.py @@ -1,24 +1,26 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional +from typing import Optional, TYPE_CHECKING from PyQt5.QtCore import QObject, pyqtSlot from UM.i18n import i18nCatalog +if TYPE_CHECKING: + from cura.CuraApplication import CuraApplication + # # This manager provides (convenience) functions to the Machine Settings Dialog QML to update certain machine settings. # class MachineSettingsManager(QObject): - def __init__(self, parent: Optional["QObject"] = None) -> None: + def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None: super().__init__(parent) self._i18n_catalog = i18nCatalog("cura") - from cura.CuraApplication import CuraApplication - self._application = CuraApplication.getInstance() + self._application = application # Force rebuilding the build volume by reloading the global container stack. This is a bit of a hack, but it seems # quite enough. diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index dde5ebcb06..a3aae49ed7 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -12,6 +12,8 @@ from UM.Resources import Resources if TYPE_CHECKING: from PyQt5.QtCore import QObject + from cura.CuraApplication import CuraApplication + # # This is the Qt ListModel that contains all welcome pages data. Each page is a page that can be shown as a step in the @@ -33,13 +35,15 @@ class WelcomePagesModel(ListModel): PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to - def __init__(self, parent: Optional["QObject"] = None) -> None: + def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None: super().__init__(parent) self.addRoleName(self.IdRole, "id") self.addRoleName(self.PageUrlRole, "page_url") self.addRoleName(self.NextPageIdRole, "next_page_id") + self._application = application + self._pages = [] # type: List[Dict[str, Any]] self._current_page_index = 0 @@ -206,14 +210,12 @@ class WelcomePagesModel(ListModel): # Indicates if the machine action panel should be shown by checking if there's any first start machine actions # available. def shouldShowMachineActions(self) -> bool: - from cura.CuraApplication import CuraApplication - application = CuraApplication.getInstance() - global_stack = application.getMachineManager().activeMachine + global_stack = self._application.getMachineManager().activeMachine if global_stack is None: return False definition_id = global_stack.definition.getId() - first_start_actions = application.getMachineActionManager().getFirstStartActions(definition_id) + first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) return len(first_start_actions) > 0 def addPage(self) -> None: From 109631d02340d5da17c0e5fcd17ae26488728189 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 15:13:41 +0100 Subject: [PATCH 176/211] Update doc for updateHasMaterialsMetadata() --- cura/UI/MachineSettingsManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/UI/MachineSettingsManager.py b/cura/UI/MachineSettingsManager.py index 8c411f2537..7ecd9ed65f 100644 --- a/cura/UI/MachineSettingsManager.py +++ b/cura/UI/MachineSettingsManager.py @@ -42,9 +42,12 @@ class MachineSettingsManager(QObject): # it was moved to the machine manager instead. Now this method just calls the machine manager. self._application.getMachineManager().setActiveMachineExtruderCount(extruder_count) - # FIXME(Lipu): Better document what this function does, especially the fuzzy gcode flavor and has_materials logic - # regarding UM2 and UM2+ # Function for the Machine Settings panel (QML) to update after the usre changes "Number of Extruders". + # + # fieldOfView: The Ultimaker 2 family (not 2+) does not have materials in Cura by default, because the material is + # to be set on the printer. But when switching to Marlin flavor, the printer firmware can not change/insert material + # settings on the fly so they need to be configured in Cura. So when switching between gcode flavors, materials may + # need to be enabled/disabled. @pyqtSlot() def updateHasMaterialsMetadata(self): machine_manager = self._application.getMachineManager() From d34b3b8585619a62ae4b8da054e05e9845383b02 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 28 Mar 2019 15:24:42 +0100 Subject: [PATCH 177/211] Move associate um network printer function into UM3OutputDevicePlugin --- cura/Settings/MachineManager.py | 40 ------------------ .../src/DiscoverUM3Action.py | 37 +--------------- .../src/UM3OutputDevicePlugin.py | 42 ++++++++++++++++++- 3 files changed, 41 insertions(+), 78 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1870f2314e..3cee636d1d 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1665,43 +1665,3 @@ class MachineManager(QObject): if results: machine_type_name = results[0]["name"] return machine_type_name - - @pyqtSlot(QObject) - def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None: - if not printer_device: - return - - Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) - - global_stack = self._global_container_stack - if not global_stack: - return - - meta_data = global_stack.getMetaData() - - # Global stack previously had a connection, so here it needs to change the connection information in all - # global stacks in that same group. - if "um_network_key" in meta_data: - old_network_key = meta_data["um_network_key"] - # Since we might have a bunch of hidden stacks, we also need to change it there. - metadata_filter = {"um_network_key": old_network_key} - containers = self._container_registry.findContainerStacks(type = "machine", **metadata_filter) - - for container in containers: - container.setMetaDataEntry("um_network_key", printer_device.key) - - # Delete old authentication data. - Logger.log("d", "Removing old authentication id %s for device %s", - global_stack.getMetaDataEntry("network_authentication_id", None), - printer_device.key) - - container.removeMetaDataEntry("network_authentication_id") - container.removeMetaDataEntry("network_authentication_key") - - # Ensure that these containers do know that they are configured for network connection - container.addConfiguredConnectionType(printer_device.connectionType.value) - - # Global stack previously didn't have a connection, so directly configure it. - else: - global_stack.setMetaDataEntry("um_network_key", printer_device.key) - global_stack.addConfiguredConnectionType(printer_device.connectionType.value) diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index 4cb8119d37..e1e6121244 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -124,43 +124,8 @@ class DiscoverUM3Action(MachineAction): # stored into the metadata of the currently active machine. @pyqtSlot(QObject) def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None: - if not printer_device: - return - - Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) - - global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() - if not global_container_stack: - return - - meta_data = global_container_stack.getMetaData() - - if "um_network_key" in meta_data: # Global stack already had a connection, but it's changed. - old_network_key = meta_data["um_network_key"] - # Since we might have a bunch of hidden stacks, we also need to change it there. - metadata_filter = {"um_network_key": old_network_key} - containers = CuraContainerRegistry.getInstance().findContainerStacks(type="machine", **metadata_filter) - - for container in containers: - container.setMetaDataEntry("um_network_key", printer_device.key) - - # Delete old authentication data. - Logger.log("d", "Removing old authentication id %s for device %s", - global_container_stack.getMetaDataEntry("network_authentication_id", None), printer_device.key) - - container.removeMetaDataEntry("network_authentication_id") - container.removeMetaDataEntry("network_authentication_key") - - # Ensure that these containers do know that they are configured for network connection - container.addConfiguredConnectionType(printer_device.connectionType.value) - - else: # Global stack didn't have a connection yet, configure it. - global_container_stack.setMetaDataEntry("um_network_key", printer_device.key) - global_container_stack.addConfiguredConnectionType(printer_device.connectionType.value) - if self._network_plugin: - # Ensure that the connection states are refreshed. - self._network_plugin.refreshConnections() + self._network_plugin.associateActiveMachineWithPrinterDevice(printer_device) @pyqtSlot(result = str) def getStoredKey(self) -> str: diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index f4f9c0081d..4a68f3b582 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -30,8 +30,9 @@ from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager if TYPE_CHECKING: from PyQt5.QtNetwork import QNetworkReply - from cura.Settings.GlobalStack import GlobalStack from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin + from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice + from cura.Settings.GlobalStack import GlobalStack i18n_catalog = i18nCatalog("cura") @@ -244,10 +245,47 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._application.getMachineManager().addMachine(machine_type_id, group_name) # connect the new machine to that network printer - self._application.getMachineManager().associateActiveMachineWithPrinterDevice(discovered_device) + self.associateActiveMachineWithPrinterDevice(discovered_device) # ensure that the connection states are refreshed. self.refreshConnections() + def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None: + if not printer_device: + return + + Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) + + global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() + if not global_container_stack: + return + + meta_data = global_container_stack.getMetaData() + + if "um_network_key" in meta_data: # Global stack already had a connection, but it's changed. + old_network_key = meta_data["um_network_key"] + # Since we might have a bunch of hidden stacks, we also need to change it there. + metadata_filter = {"um_network_key": old_network_key} + containers = self._application.findContainerStacks(type = "machine", **metadata_filter) + + for container in containers: + container.setMetaDataEntry("um_network_key", printer_device.key) + + # Delete old authentication data. + Logger.log("d", "Removing old authentication id %s for device %s", + global_container_stack.getMetaDataEntry("network_authentication_id", None), printer_device.key) + + container.removeMetaDataEntry("network_authentication_id") + container.removeMetaDataEntry("network_authentication_key") + + # Ensure that these containers do know that they are configured for network connection + container.addConfiguredConnectionType(printer_device.connectionType.value) + + else: # Global stack didn't have a connection yet, configure it. + global_container_stack.setMetaDataEntry("um_network_key", printer_device.key) + global_container_stack.addConfiguredConnectionType(printer_device.connectionType.value) + + self.refreshConnections() + def _checkManualDevice(self, address): # Check if a UM3 family device exists at this address. # If a printer responds, it will replace the preliminary printer created above From 1cebf145f52f961e041ccd9c951ed5f1295f2eac Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 09:23:10 +0100 Subject: [PATCH 178/211] Make User-Agreement work with new 'WizadPanel'. [CURA-6057] --- cura/UI/WelcomePagesModel.py | 9 +++++++-- resources/qml/WelcomePages/UserAgreementContent.qml | 2 +- resources/qml/WelcomePages/WizardPanel.qml | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index a3aae49ed7..cb47b37bfc 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -76,6 +76,12 @@ class WelcomePagesModel(ListModel): self._current_page_index = page_index self.currentPageIndexChanged.emit() + # Ends the Welcome-Pages. Put as a separate function for cases like the 'decline' in the User-Agreement. + @pyqtSlot() + def atEnd(self) -> None: + self.allFinished.emit() + self.resetState() + # Goes to the next page. # If "from_index" is given, it will look for the next page to show starting from the "from_index" page instead of # the "self._current_page_index". @@ -100,8 +106,7 @@ class WelcomePagesModel(ListModel): # If we have reached the last page, emit allFinished signal and reset. if next_page_index == len(self._items): - self.allFinished.emit() - self.resetState() + self.atEnd() return # Check if the this page should be shown (default yes), if not, keep looking for the next one. diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 2f4b2a0290..62e30ebbf7 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -83,7 +83,7 @@ Item onClicked: { CuraApplication.writeToLog("i", "User declined the User Agreement.") - base.passLastPage() + base.endWizard() CuraApplication.closeApplication() // NOTE: Hard exit, don't use if anything needs to be saved! } } diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 51b131409e..94fb083664 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -28,11 +28,13 @@ Item signal showNextPage() signal showPreviousPage() signal goToPage(string page_id) // Go to a specific page by the given page_id. + signal endWizard() // Call the corresponding functions in the model onShowNextPage: model.goToNextPage() onShowPreviousPage: model.goToPreviousPage() onGoToPage: model.goToPage(page_id) + onEndWizard: model.atEnd() Rectangle // Panel background { From 60920c89aff663a23f455994629b9c5bb177822c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 09:33:41 +0100 Subject: [PATCH 179/211] Remove old send slice-info confirm: part of the new onboard. [CURA-6057] --- plugins/SliceInfoPlugin/SliceInfo.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 5149b6a6a6..065923c43d 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -48,20 +48,6 @@ class SliceInfo(QObject, Extension): def _onAppInitialized(self): # DO NOT read any preferences values in the constructor because at the time plugins are created, no version # upgrade has been performed yet because version upgrades are plugins too! - if not self._application.getPreferences().getValue("info/asked_send_slice_info"): - self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymized usage statistics."), - lifetime = 0, - dismissable = False, - title = catalog.i18nc("@info:title", "Collecting Data")) - - self.send_slice_info_message.addAction("MoreInfo", name = catalog.i18nc("@action:button", "More info"), icon = None, - description = catalog.i18nc("@action:tooltip", "See more information on what data Cura sends."), button_style = Message.ActionButtonStyle.LINK) - - self.send_slice_info_message.addAction("Dismiss", name = catalog.i18nc("@action:button", "Allow"), icon = None, - description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing.")) - self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered) - self.send_slice_info_message.show() - if self._more_info_dialog is None: self._more_info_dialog = self._createDialog("MoreInfoWindow.qml") From f8b67be487db1b97075cf3b054bad86d3cc3eff1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 10:43:47 +0100 Subject: [PATCH 180/211] Fix error spam when a printer of a cluster is unreachable CURA-6057 --- cura/Machines/Models/DiscoveredPrintersModel.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 8c5b0b8b0e..9164958957 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -107,7 +107,7 @@ class DiscoveredPrintersModel(QObject): name: Optional[str] = None, machine_type: Optional[str] = None) -> None: if ip_address not in self._discovered_printer_by_ip_dict: - Logger.log("e", "Printer with ip [%s] is not known", ip_address) + Logger.log("w", "Printer with ip [%s] is not known", ip_address) return item = self._discovered_printer_by_ip_dict[ip_address] diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 2fefd2f955..2e3b51546b 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -632,7 +632,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateName(data["friendly_name"]) printer.updateKey(data["uuid"]) printer.updateType(data["machine_variant"]) - self._application.getDiscoveredPrintersModel().updateDiscoveredPrinter(data["ip_address"], + + if data["status"] != "unreachable": + self._application.getDiscoveredPrintersModel().updateDiscoveredPrinter(data["ip_address"], name = data["friendly_name"], machine_type = data["machine_variant"]) From 28dc18773195735706c288a654fbd5c2b5804f6d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 11:08:10 +0100 Subject: [PATCH 181/211] Set the flag of the welcome dialog to Dialog We want the dialog to be modal, but if it's a window (and not a dialog) the modality can't be set (or well, it can be set, but it's just ignored at that point) CURA-6057 --- resources/qml/WelcomePages/WelcomeDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index a5bcb3e8c7..b26fa06df7 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -20,7 +20,7 @@ Window id: dialog title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") modality: Qt.ApplicationModal - flags: Qt.Window | Qt.FramelessWindowHint + flags: Qt.Dialog | Qt.FramelessWindowHint width: 580 * screenScaleFactor height: 600 * screenScaleFactor From 7ceaade26dc86d641c76d32b9be4597fc26fcec7 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 11:27:37 +0100 Subject: [PATCH 182/211] Sort changelog correctly (newest on top). [CURA-6057] --- cura/UI/TextManager.py | 9 +++++++-- resources/qml/WelcomePages/WhatsNewContent.qml | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cura/UI/TextManager.py b/cura/UI/TextManager.py index c09fc9b1c2..7d428137f2 100644 --- a/cura/UI/TextManager.py +++ b/cura/UI/TextManager.py @@ -39,6 +39,8 @@ class TextManager(QObject): line = line.replace("[", "") line = line.replace("]", "") open_version = Version(line) + if open_version > Version([14, 99, 99]): # Bit of a hack: We released the 15.x.x versions before 2.x + open_version = Version([0, open_version.getMinor(), open_version.getRevision(), open_version.getPostfixVersion()]) open_header = "" change_logs_dict[open_version] = collections.OrderedDict() elif line.startswith("*"): @@ -51,8 +53,11 @@ class TextManager(QObject): # Format changelog text content = "" - for version in change_logs_dict: - content += "

" + str(version) + "


" + for version in sorted(change_logs_dict.keys(), reverse=True): + text_version = version + if version < Version([1, 0, 0]): # Bit of a hack: We released the 15.x.x versions before 2.x + text_version = Version([15, version.getMinor(), version.getRevision(), version.getPostfixVersion()]) + content += "

" + str(text_version) + "


" content += "" for change in change_logs_dict[version]: if str(change) != "": diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 298aaa7d4d..754e843621 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -57,6 +57,11 @@ Item font: UM.Theme.getFont("default") renderType: Text.NativeRendering } + + Component.onCompleted: + { + Scrollbar.vertical.position = 0; + } } } From 894a09b654f38d384a36f8b59e79625175bedbb7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 11:33:49 +0100 Subject: [PATCH 183/211] The welcome dialog is now a rectangle instead of a dialog The whole window approach was just causing to much cross platform issues, so I converted it into a rectangle and put a mouseArea that eats all the events in the greyOut background CURA-6057 --- resources/qml/Cura.qml | 22 ++++++++++++++------ resources/qml/WelcomePages/WelcomeDialog.qml | 8 +++---- resources/qml/WelcomePages/WizardPanel.qml | 4 +++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 5a60f552f4..1fb25efe74 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -42,12 +42,6 @@ UM.MainWindow tooltip.hide(); } - WelcomeDialog - { - id: welcomeDialog - visible: true // True, so if somehow no preferences are found/loaded, it's shown anyway. - } - Rectangle { id: greyOutBackground @@ -56,6 +50,22 @@ UM.MainWindow color: UM.Theme.getColor("window_disabled_background") opacity: 0.7 z: stageMenu.z + 1 + + MouseArea + { + // Prevent all mouse events from passing through. + enabled: parent.visible + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + } + } + + WelcomeDialog + { + id: welcomeDialog + visible: true // True, so if somehow no preferences are found/loaded, it's shown anyway. + z: greyOutBackground.z + 1 } Component.onCompleted: diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index b26fa06df7..fa5a09c8e6 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -13,18 +13,16 @@ import Cura 1.1 as Cura // // This is a no-frame dialog that shows the welcome process. // -Window +Item { UM.I18nCatalog { id: catalog; name: "cura" } id: dialog - title: catalog.i18nc("@title", "Welcome to Ultimaker Cura") - modality: Qt.ApplicationModal - flags: Qt.Dialog | Qt.FramelessWindowHint + + anchors.centerIn: parent width: 580 * screenScaleFactor height: 600 * screenScaleFactor - color: "transparent" property int shadowOffset: 1 * screenScaleFactor diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 94fb083664..27b1878a1a 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -25,6 +25,8 @@ Item property var progressValue: model == null ? 0 : model.currentProgress property string pageUrl: currentItem == null ? "" : currentItem.page_url + property alias backgroundColor: panelBackground.color + signal showNextPage() signal showPreviousPage() signal goToPage(string page_id) // Go to a specific page by the given page_id. @@ -41,7 +43,7 @@ Item id: panelBackground anchors.fill: parent radius: UM.Theme.getSize("default_radius").width - + color: UM.Theme.getColor("main_background") Cura.ProgressBar { id: progressBar From 69935115f312af7c5389f191925d22cb8f12051d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 11:44:09 +0100 Subject: [PATCH 184/211] Fix some layout issues with the addNetworkedOrLocalPrinter screen CURA-6057 --- resources/qml/WelcomePages/DropDownWidget.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index 9f413769e0..bbf5344398 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -59,11 +59,12 @@ Item anchors.top: header.bottom anchors.left: header.left anchors.right: header.right - height: contentLoader.height + // Add 2x lining, because it needs a bit of space on the top and the bottom. + height: contentLoader.height + 2 * UM.Theme.getSize("thick_lining").height border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - color: "white" + color: UM.Theme.getColor("main_background") radius: UM.Theme.getSize("default_radius").width visible: base.contentShown cornerSide: Cura.RoundedRectangle.Direction.Down From 2f34bdc650dc2203c7b8f3d5f75831823c678516 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 11:51:57 +0100 Subject: [PATCH 185/211] Fix shadow of the first run screen CURA-6057 --- resources/qml/WelcomePages/WelcomeDialog.qml | 4 ++-- resources/themes/cura-light/theme.json | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index fa5a09c8e6..e6a68fb020 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -47,12 +47,12 @@ Item DropShadow { id: shadow - radius: UM.Theme.getSize("monitor_shadow_radius").width + radius: UM.Theme.getSize("first_run_shadow_radius").width anchors.fill: stepPanel source: stepPanel horizontalOffset: shadowOffset verticalOffset: shadowOffset - color: UM.Theme.getColor("monitor_shadow") + color: UM.Theme.getColor("first_run_shadow") transparentBorder: true } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 0fa3aa97a2..ccd7a5dddf 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -187,6 +187,8 @@ "action_panel_secondary": [27, 95, 202, 255], + "first_run_shadow": [50, 50, 50, 255], + "toolbar_background": [255, 255, 255, 255], "printer_type_label_background": [228, 228, 242, 255], @@ -559,6 +561,7 @@ "save_button_specs_icons": [1.4, 1.4], "job_specs_button": [2.7, 2.7], + "first_run_shadow_radius": [1.2, 1.2], "monitor_preheat_temperature_control": [4.5, 2.0], From 91a886793bee356c70b2db67b5e96c0928be944d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Mar 2019 12:04:00 +0100 Subject: [PATCH 186/211] Hide welcome dialog instead of close cura if you complete it CURA-6057 --- resources/qml/WelcomePages/WelcomeDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index e6a68fb020..c7832e1e56 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -60,6 +60,6 @@ Item Connections { target: model - onAllFinished: close() + onAllFinished: dialog.visible = false } } From 39f6eafe3cfd384cd6f7311f5be032a7dd63a02f Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 13:04:11 +0100 Subject: [PATCH 187/211] Remove wrong qml in WhatsNewContent. --- resources/qml/WelcomePages/WhatsNewContent.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 754e843621..298aaa7d4d 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -57,11 +57,6 @@ Item font: UM.Theme.getFont("default") renderType: Text.NativeRendering } - - Component.onCompleted: - { - Scrollbar.vertical.position = 0; - } } } From 3ca8ba421a4b3ddb1ad8278d3895d42d1139cd10 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 13:09:39 +0100 Subject: [PATCH 188/211] Move CuraStage back to where plugins expect it. --- cura/{UI => Stages}/CuraStage.py | 0 cura/Stages/__init__.py | 0 plugins/MonitorStage/MonitorStage.py | 2 +- plugins/PrepareStage/PrepareStage.py | 2 +- plugins/PreviewStage/PreviewStage.py | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename cura/{UI => Stages}/CuraStage.py (100%) create mode 100644 cura/Stages/__init__.py diff --git a/cura/UI/CuraStage.py b/cura/Stages/CuraStage.py similarity index 100% rename from cura/UI/CuraStage.py rename to cura/Stages/CuraStage.py diff --git a/cura/Stages/__init__.py b/cura/Stages/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugins/MonitorStage/MonitorStage.py b/plugins/MonitorStage/MonitorStage.py index 4dae6b8579..3d2a1c3f37 100644 --- a/plugins/MonitorStage/MonitorStage.py +++ b/plugins/MonitorStage/MonitorStage.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. import os.path from UM.Application import Application -from cura.UI.CuraStage import CuraStage +from cura.Stages.CuraStage import CuraStage ## Stage for monitoring a 3D printing while it's printing. diff --git a/plugins/PrepareStage/PrepareStage.py b/plugins/PrepareStage/PrepareStage.py index 8150efca09..c2dee9693b 100644 --- a/plugins/PrepareStage/PrepareStage.py +++ b/plugins/PrepareStage/PrepareStage.py @@ -4,7 +4,7 @@ import os.path from UM.Application import Application from UM.PluginRegistry import PluginRegistry -from cura.UI.CuraStage import CuraStage +from cura.Stages.CuraStage import CuraStage ## Stage for preparing model (slicing). class PrepareStage(CuraStage): diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index eff307418e..1c487c8340 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -4,7 +4,7 @@ import os.path from UM.Qt.QtApplication import QtApplication -from cura.UI.CuraStage import CuraStage +from cura.Stages.CuraStage import CuraStage from typing import TYPE_CHECKING, Optional From 129c1ab3d4cd4c1dcfe103325af79798ade22f3f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Mar 2019 13:32:05 +0100 Subject: [PATCH 189/211] Fix welcome page buttons text not fitting On some operating systems the text would not fit due to different font rendering. Also, after translation, it probably wouldn't fit either. Usually we have the button size adjusting to the text inside it. The design didn't do this, either because it was too difficult to do in Zeplin, because the designer was lazy, or because the designer didn't know that this was the normal style in the rest of Cura. And the programmer took that over literally. Contributes to issue CURA-6057. --- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 2 -- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 6 ------ resources/qml/WelcomePages/CloudContent.qml | 4 ---- resources/qml/WelcomePages/DataCollectionsContent.qml | 2 -- .../qml/WelcomePages/FirstStartMachineActionsContent.qml | 2 -- resources/qml/WelcomePages/UserAgreementContent.qml | 4 ---- resources/qml/WelcomePages/WelcomeContent.qml | 2 -- resources/qml/WelcomePages/WhatsNewContent.qml | 2 -- resources/themes/cura-light/theme.json | 1 - 9 files changed, 25 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 60b9089c82..86220bf7e7 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -125,8 +125,6 @@ Item } text: catalog.i18nc("@button", "Next") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: { // Create a network printer or a local printer according to the selection diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 4fdffa5a79..c403fad159 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -96,8 +96,6 @@ Item anchors.top: parent.top anchors.right: parent.right anchors.margins: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("action_button").width - fixedWidthMode: true text: catalog.i18nc("@button", "Add") onClicked: @@ -245,8 +243,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Cancel") - width: UM.Theme.getSize("action_button").width - fixedWidthMode: true onClicked: base.showPreviousPage() } @@ -257,8 +253,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Connect") - width: UM.Theme.getSize("action_button").width - fixedWidthMode: true onClicked: { CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinterAddress( diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 5ecda41a89..e2279f5ce1 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -103,8 +103,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Finish") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: base.showNextPage() } @@ -115,8 +113,6 @@ Item anchors.verticalCenter: finishButton.verticalCenter anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Create an account") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") } diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 8b67e1fdeb..c63eb1839c 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -89,8 +89,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Next") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: base.showNextPage() } } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index f1a178e018..b9cb0da0d7 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -73,8 +73,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Next") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: machineActionsModel.goToNextAction() } } diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 62e30ebbf7..10f71be57b 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -61,8 +61,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Agree") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: { CuraApplication.writeToLog("i", "User accepted the User-Agreement.") @@ -78,8 +76,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Decline and close") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: { CuraApplication.writeToLog("i", "User declined the User Agreement.") diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index ed56dd36fd..bdaa0a0b48 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -57,8 +57,6 @@ Item 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() } } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 298aaa7d4d..f089006926 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -67,8 +67,6 @@ Item anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Next") - width: UM.Theme.getSize("welcome_pages_button").width - fixedWidthMode: true onClicked: base.showNextPage() } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index ccd7a5dddf..62fca2b221 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -509,7 +509,6 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], - "welcome_pages_button": [12.0, 2.5], "welcome_pages_default_margin": [2.5, 2.5], "action_button": [15.0, 2.5], From 5028290e0dd91af204b56c1d8652931e2293c4b4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Mar 2019 13:36:05 +0100 Subject: [PATCH 190/211] Remove welcome_pages_default_margin theme entry Use the wide margin instead. It's practically the same, nobody is going to notice. It still looks spacey and nice, and it's more consistent with the rest of the interface. We had previously agreed that we will not make any new widget-specific theme entries any more. Contributes to issue CURA-6057. --- .../WelcomePages/AddNetworkOrLocalPrinterContent.qml | 4 ++-- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 6 +++--- resources/qml/WelcomePages/CloudContent.qml | 8 ++++---- resources/qml/WelcomePages/DataCollectionsContent.qml | 8 ++++---- .../WelcomePages/FirstStartMachineActionsContent.qml | 4 ++-- resources/qml/WelcomePages/UserAgreementContent.qml | 10 +++++----- resources/qml/WelcomePages/WelcomeContent.qml | 6 +++--- resources/qml/WelcomePages/WhatsNewContent.qml | 8 ++++---- resources/themes/cura-light/theme.json | 2 -- 9 files changed, 27 insertions(+), 29 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 86220bf7e7..91380c38dd 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: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_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: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_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 c403fad159..b0085c1774 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -29,7 +29,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add printer by IP address") @@ -241,7 +241,7 @@ Item id: backButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Cancel") onClicked: base.showPreviousPage() } @@ -251,7 +251,7 @@ Item id: connectButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Connect") onClicked: { diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index e2279f5ce1..c4eb9db714 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: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_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: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Finish") onClicked: base.showNextPage() } @@ -111,7 +111,7 @@ Item id: createAccountButton anchors.left: parent.left anchors.verticalCenter: finishButton.verticalCenter - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Create an account") onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") } @@ -121,7 +121,7 @@ Item id: signInButton anchors.left: createAccountButton.right anchors.verticalCenter: finishButton.verticalCenter - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Sign in") color: UM.Theme.getColor("secondary_button_text") font: UM.Theme.getFont("medium") diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index c63eb1839c..79e4b0e3de 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: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") @@ -36,14 +36,14 @@ Item anchors.bottom: getStartedButton.top anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width Column { anchors.centerIn: parent width: parent.width - spacing: UM.Theme.getSize("welcome_pages_default_margin").height + spacing: UM.Theme.getSize("wide_margin").height Image { @@ -87,7 +87,7 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index b9cb0da0d7..7bf3d369b5 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -40,7 +40,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title @@ -71,7 +71,7 @@ Item id: nextButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: machineActionsModel.goToNextAction() } diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 10f71be57b..a1a197df54 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -18,7 +18,7 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "User Agreement") @@ -33,13 +33,13 @@ Item anchors.bottom: agreeButton.top anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width Label { id: disclaimerLineLabel anchors.centerIn: parent - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width width: (parent.width * 2 / 3) | 0 @@ -59,7 +59,7 @@ Item id: agreeButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Agree") onClicked: { @@ -74,7 +74,7 @@ Item id: declineButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Decline and close") onClicked: { diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index bdaa0a0b48..454c5585e2 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -15,13 +15,13 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width 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 + spacing: UM.Theme.getSize("wide_margin").height Label { @@ -55,7 +55,7 @@ Item { id: getStartedButton anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Get started") onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index f089006926..17bbe04f6f 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: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "What's new in Ultimaker Cura") @@ -32,8 +32,8 @@ Item { anchors.top: titleLabel.bottom anchors.bottom: getStartedButton.top - anchors.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height - anchors.bottomMargin: UM.Theme.getSize("welcome_pages_default_margin").height + anchors.topMargin: UM.Theme.getSize("wide_margin").height + anchors.bottomMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter width: (parent.width * 3 / 4) | 0 @@ -65,7 +65,7 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width + anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: base.showNextPage() } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 62fca2b221..e6a9d495a2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -509,8 +509,6 @@ "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 d8f89d83301c8b5ab80c48dfa927f6fc419429a6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Mar 2019 13:41:35 +0100 Subject: [PATCH 191/211] Fix sorting printers by name Because DiscoveredPrinter.name contains the MAC addresses of the printers. NetworkedPrinterOutputDevice.name contains the discovered name as communicated by ZeroConf. We already use that property from QML to display in the list. Contributes to issue CURA-6057. --- cura/Machines/Models/DiscoveredPrintersModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 9164958957..aa372a49e8 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -90,7 +90,7 @@ class DiscoveredPrintersModel(QObject): @pyqtProperty(list, notify = discoveredPrintersChanged) def discoveredPrinters(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) + item_list.sort(key = lambda x: x.device.name) return item_list def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], From 3d86499069b4dc463321c7de4f589fd58869320d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 29 Mar 2019 15:41:20 +0100 Subject: [PATCH 192/211] Don't round the radius of the RadioButton Otherwise it looks like a weird circle. Contributes to CURA-6057. --- resources/qml/Widgets/RadioButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Widgets/RadioButton.qml b/resources/qml/Widgets/RadioButton.qml index e17a38d833..eaa18c44cb 100644 --- a/resources/qml/Widgets/RadioButton.qml +++ b/resources/qml/Widgets/RadioButton.qml @@ -27,7 +27,7 @@ RadioButton implicitWidth: UM.Theme.getSize("radio_button").width implicitHeight: UM.Theme.getSize("radio_button").height anchors.verticalCenter: parent.verticalCenter - radius: (width / 2) | 0 + radius: width / 2 border.width: UM.Theme.getSize("default_lining").width border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") @@ -36,7 +36,7 @@ RadioButton width: (parent.width / 2) | 0 height: width anchors.centerIn: parent - radius: (width / 2) | 0 + radius: width / 2 color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") visible: radioButton.checked } From dc8524b90d80a034bd37add7dd5ce9d2cf533c94 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 29 Mar 2019 16:23:16 +0100 Subject: [PATCH 193/211] Fix 'DiscoverUM3Action' required attention from user in flow. [CURA-6057] --- cura/MachineAction.py | 6 ++++++ cura/UI/WelcomePagesModel.py | 2 +- plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cura/MachineAction.py b/cura/MachineAction.py index 94b096f9c1..773a1cad1a 100644 --- a/cura/MachineAction.py +++ b/cura/MachineAction.py @@ -33,6 +33,12 @@ class MachineAction(QObject, PluginObject): def getKey(self) -> str: return self._key + ## Whether this action needs to ask the user anything. + # If not, we shouldn't present the user with certain screens which otherwise show up. + # Defaults to true to be in line with the old behaviour. + def needsUserInteraction(self) -> bool: + return True + @pyqtProperty(str, notify = labelChanged) def label(self) -> str: return self._label diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index cb47b37bfc..1dc87de50b 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -221,7 +221,7 @@ class WelcomePagesModel(ListModel): definition_id = global_stack.definition.getId() first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) - return len(first_start_actions) > 0 + return len([action for action in first_start_actions if action.needsUserInteraction()]) > 0 def addPage(self) -> None: pass diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index e1e6121244..a2a319b46a 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -41,6 +41,11 @@ class DiscoverUM3Action(MachineAction): # Time to wait after a zero-conf service change before allowing a zeroconf reset self._zero_conf_change_grace_period = 0.25 #type: float + # Overrides the one in MachineAction. + # This requires not attention from the user (any more), so we don't need to show any 'upgrade screens'. + def needsUserInteraction(self) -> bool: + return False + @pyqtSlot() def startDiscovery(self): if not self._network_plugin: From 1d6d3d729d00a370b8487bf50069e4492336203b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 1 Apr 2019 12:59:31 +0200 Subject: [PATCH 194/211] Once the user logged in in the cloudContent page ensure that it moves to the next. This fixes the weird situation that when logging in, the screen was still visible and the user could still press the create / sign in button. CURA-6057 --- resources/qml/WelcomePages/CloudContent.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index c4eb9db714..f6a18ee32c 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -15,6 +15,18 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } + property bool isLoggedIn: Cura.API.account.isLoggedIn + + onIsLoggedInChanged: + { + if(isLoggedIn) + { + // If the user created an account or logged in by pressing any button on this page, all the actions that + // need / can be done by this page are completed, so we can just go to the next (if any). + base.showNextPage() + } + } + Label { id: titleLabel From 74903fe3e562bd765080c10b1c83b7b410b5f20d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 1 Apr 2019 13:44:27 +0200 Subject: [PATCH 195/211] Cleaned up the QML This moves all the "default" margins of the welcome pages into a single point (the WizardPanel) in order to prevent having to re-define it every time. I've also fixed some incorrect margins that we had CURA-6057 --- .../AddNetworkOrLocalPrinterContent.qml | 2 - resources/qml/WelcomePages/CloudContent.qml | 19 +++++---- .../WelcomePages/DataCollectionsContent.qml | 16 ++++---- .../FirstStartMachineActionsContent.qml | 14 +++---- .../qml/WelcomePages/UserAgreementContent.qml | 41 ++++++++----------- resources/qml/WelcomePages/WelcomeContent.qml | 2 - .../qml/WelcomePages/WhatsNewContent.qml | 6 +-- resources/qml/WelcomePages/WizardPanel.qml | 3 +- 8 files changed, 46 insertions(+), 57 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 91380c38dd..6e1d827fb4 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -19,7 +19,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add a printer") @@ -110,7 +109,6 @@ Item id: nextButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width enabled: { // If the network printer dropdown is expanded, make sure that there is a selected item diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index f6a18ee32c..6074c06eac 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -31,7 +31,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Ultimaker Cloud") @@ -44,11 +43,15 @@ Item Item { id: cloudContentsArea - anchors.top: titleLabel.bottom - anchors.bottom: finishButton.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: UM.Theme.getSize("default_margin").width + anchors + { + top: titleLabel.bottom + bottom: finishButton.top + left: parent.left + right: parent.right + topMargin: UM.Theme.getSize("default_margin").height + } + // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in // the cloud contents area. @@ -113,7 +116,6 @@ Item id: finishButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Finish") onClicked: base.showNextPage() } @@ -123,7 +125,6 @@ Item id: createAccountButton anchors.left: parent.left anchors.verticalCenter: finishButton.verticalCenter - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Create an account") onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create") } @@ -133,7 +134,7 @@ Item id: signInButton anchors.left: createAccountButton.right anchors.verticalCenter: finishButton.verticalCenter - anchors.margins: UM.Theme.getSize("wide_margin").width + anchors.leftMargin: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Sign in") color: UM.Theme.getColor("secondary_button_text") font: UM.Theme.getFont("medium") diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 79e4b0e3de..0ab3bb6c01 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -19,7 +19,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") @@ -32,11 +31,15 @@ Item Item { id: contentsArea - anchors.top: titleLabel.bottom - anchors.bottom: getStartedButton.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: UM.Theme.getSize("wide_margin").width + + anchors + { + top: titleLabel.bottom + bottom: getStartedButton.top + left: parent.left + right: parent.right + topMargin: UM.Theme.getSize("default_margin").width + } Column { @@ -87,7 +90,6 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 7bf3d369b5..330b76479d 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -40,7 +40,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title @@ -51,11 +50,13 @@ Item Item { - anchors.top: titleLabel.bottom - anchors.bottom: nextButton.top - anchors.margins: UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.right: parent.right + anchors + { + top: titleLabel.bottom + bottom: nextButton.top + left: parent.left + right: parent.right + } data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content } @@ -71,7 +72,6 @@ Item id: nextButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: machineActionsModel.goToNextAction() } diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index a1a197df54..6ccf82b650 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -18,7 +18,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "User Agreement") @@ -27,31 +26,25 @@ Item renderType: Text.NativeRendering } - Item // Area for pictures and texts + Label { - anchors.top: titleLabel.bottom - anchors.bottom: agreeButton.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: UM.Theme.getSize("wide_margin").width - - Label + id: disclaimerLineLabel + anchors { - id: disclaimerLineLabel - anchors.centerIn: parent - anchors.margins: UM.Theme.getSize("wide_margin").width - - width: (parent.width * 2 / 3) | 0 - - text: "

Disclaimer by Ultimaker

" - + "

Please read this disclaimer carefully.

" - + "

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.

" - + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" - textFormat: Text.RichText - wrapMode: Text.WordWrap - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering + top: titleLabel.bottom + topMargin: UM.Theme.getSize("wide_margin").height + left: parent.left + right: parent.right } + + text: "

Disclaimer by Ultimaker

" + + "

Please read this disclaimer carefully.

" + + "

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.

" + + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" + textFormat: Text.RichText + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } Cura.PrimaryButton @@ -59,7 +52,6 @@ Item id: agreeButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Agree") onClicked: { @@ -74,7 +66,6 @@ Item id: declineButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Decline and close") onClicked: { diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index 454c5585e2..57ee28068f 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -15,8 +15,6 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } - anchors.margins: UM.Theme.getSize("wide_margin").width - Column // Arrange the items vertically and put everything in the center { anchors.centerIn: parent diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 17bbe04f6f..ec1792c3e6 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -19,7 +19,6 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "What's new in Ultimaker Cura") @@ -34,8 +33,8 @@ Item anchors.bottom: getStartedButton.top anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.bottomMargin: UM.Theme.getSize("wide_margin").height - anchors.horizontalCenter: parent.horizontalCenter - width: (parent.width * 3 / 4) | 0 + anchors.left: parent.left + anchors.right: parent.right border.color: "#dfdfdf" border.width: UM.Theme.getSize("default_lining").width @@ -65,7 +64,6 @@ Item id: getStartedButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Next") onClicked: base.showNextPage() } diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 27b1878a1a..23dc914b27 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -61,7 +61,8 @@ Item id: contentLoader anchors { - margins: UM.Theme.getSize("default_margin").width + margins: UM.Theme.getSize("wide_margin").width + bottomMargin: UM.Theme.getSize("default_margin").width top: progressBar.bottom bottom: parent.bottom left: parent.left From 69293a054504992b723fa12e91af4b062cf24bf0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 1 Apr 2019 13:52:07 +0200 Subject: [PATCH 196/211] Fix typing --- cura/UI/WelcomePagesModel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 1dc87de50b..b26964bd2e 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from collections import deque import os -from typing import TYPE_CHECKING, Optional, List, Dict, Any, Deque +from typing import TYPE_CHECKING, Optional, List, Dict, Any from PyQt5.QtCore import QUrl, Qt, pyqtSlot, pyqtProperty, pyqtSignal @@ -48,7 +48,7 @@ class WelcomePagesModel(ListModel): self._current_page_index = 0 # Store all the previous page indices so it can go back. - self._previous_page_indices_stack = deque() # type: Deque[int] + self._previous_page_indices_stack = deque() # type: deque allFinished = pyqtSignal() # emitted when all steps have been finished currentPageIndexChanged = pyqtSignal() From 7a3cd81e3f1afea6e576d6851a4e85a48968cf95 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 1 Apr 2019 14:10:09 +0200 Subject: [PATCH 197/211] Fix font size for the titles in the welcome flow CURA-6057 --- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 2 +- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 9 +++------ resources/qml/WelcomePages/DataCollectionsContent.qml | 2 +- .../qml/WelcomePages/FirstStartMachineActionsContent.qml | 2 +- resources/qml/WelcomePages/UserAgreementContent.qml | 2 +- resources/qml/WelcomePages/WelcomeContent.qml | 2 +- resources/qml/WelcomePages/WhatsNewContent.qml | 2 +- resources/themes/cura-light/theme.json | 5 +++++ 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 6e1d827fb4..c1ec7481a2 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -23,7 +23,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add a printer") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index b0085c1774..5ec8bd42f8 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -29,12 +29,11 @@ Item { id: titleLabel anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Add printer by IP address") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } @@ -44,8 +43,8 @@ Item anchors.bottom: connectButton.top anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.bottomMargin: UM.Theme.getSize("default_margin").height - anchors.horizontalCenter: parent.horizontalCenter - width: Math.floor(parent.width * 3 / 4) + anchors.left: parent.left + anchors.right: parent.right Item { @@ -241,7 +240,6 @@ Item id: backButton anchors.left: parent.left anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Cancel") onClicked: base.showPreviousPage() } @@ -251,7 +249,6 @@ Item id: connectButton anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("wide_margin").width text: catalog.i18nc("@button", "Connect") onClicked: { diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 0ab3bb6c01..610ce889d6 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -23,7 +23,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 330b76479d..3acca4dea6 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -44,7 +44,7 @@ Item horizontalAlignment: Text.AlignHCenter text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 6ccf82b650..5308241ae3 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -22,7 +22,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "User Agreement") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index 57ee28068f..b59c91a0b7 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -28,7 +28,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "Welcome to Ultimaker Cura") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index ec1792c3e6..db6cd3b576 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -23,7 +23,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@label", "What's new in Ultimaker Cura") color: UM.Theme.getColor("primary_button") - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("huge") renderType: Text.NativeRendering } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 29c9c1ba12..1cccb288c0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -29,6 +29,11 @@ "weight": 63, "family": "Noto Sans" }, + "huge": { + "size": 1.8, + "weight": 50, + "family": "Noto Sans" + }, "medium": { "size": 1.16, "weight": 40, From 52589ffcad03945906a8173762f456e4284cffc2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 1 Apr 2019 14:29:11 +0200 Subject: [PATCH 198/211] Fix incorrect margin CURA-6057 --- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index c1ec7481a2..c219ba0eca 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -34,7 +34,7 @@ Item anchors.top: titleLabel.bottom anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("wide_margin").width + anchors.topMargin: UM.Theme.getSize("wide_margin").height title: catalog.i18nc("@label", "Add a networked printer") contentShown: true // by default expand the network printer list @@ -79,7 +79,7 @@ Item anchors.top: addNetworkPrinterDropDown.bottom anchors.left: parent.left anchors.right: parent.right - anchors.margins: UM.Theme.getSize("wide_margin").width + anchors.topMargin: UM.Theme.getSize("wide_margin").height title: catalog.i18nc("@label", "Add a non-networked printer") From 467a9f179d98cb6fcbfcb77fdeed8be583385a1e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 1 Apr 2019 17:30:43 +0200 Subject: [PATCH 199/211] Code style: Spaces around binary operators Contributes to issue CURA-6057. --- cura/UI/TextManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/UI/TextManager.py b/cura/UI/TextManager.py index 7d428137f2..86838a0b48 100644 --- a/cura/UI/TextManager.py +++ b/cura/UI/TextManager.py @@ -53,7 +53,7 @@ class TextManager(QObject): # Format changelog text content = "" - for version in sorted(change_logs_dict.keys(), reverse=True): + for version in sorted(change_logs_dict.keys(), reverse = True): text_version = version if version < Version([1, 0, 0]): # Bit of a hack: We released the 15.x.x versions before 2.x text_version = Version([15, version.getMinor(), version.getRevision(), version.getPostfixVersion()]) From 453a785beedbee7d43881e143bdc0400daa253c9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 3 Apr 2019 10:42:07 +0200 Subject: [PATCH 200/211] Fix typo Contributes to issue CURA-6057. --- resources/qml/WelcomePages/UserAgreementContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 5308241ae3..7c83df29cd 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -39,7 +39,7 @@ Item text: "

Disclaimer by Ultimaker

" + "

Please read this disclaimer carefully.

" - + "

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.

" + + "

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 performance of Ultimaker software is with you.

" + "

Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.

" textFormat: Text.RichText wrapMode: Text.WordWrap From 745d9e61161490edacb46eb7a6d25abe6e922ada Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 3 Apr 2019 11:03:55 +0200 Subject: [PATCH 201/211] Also catch middle mouse button in overlay Just catch all buttons. There's an entry for that in QML. Contributes to issue CURA-6057. --- resources/qml/Cura.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 1fb25efe74..6272157ec4 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -57,7 +57,7 @@ UM.MainWindow enabled: parent.visible anchors.fill: parent hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton + acceptedButtons: Qt.AllButtons } } @@ -719,11 +719,13 @@ UM.MainWindow onTriggered: { var path = UM.Resources.getPath(UM.Resources.Preferences, ""); - if(Qt.platform.os == "windows") { + if(Qt.platform.os == "windows") + { path = path.replace(/\\/g,"/"); } Qt.openUrlExternally(path); - if(Qt.platform.os == "linux") { + if(Qt.platform.os == "linux") + { Qt.openUrlExternally(UM.Resources.getPath(UM.Resources.Resources, "")); } } From df32f3e263b92e2c7ec7c9270d4270c663d1703c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 3 Apr 2019 11:51:57 +0200 Subject: [PATCH 202/211] Move Cura.ProgressBar to Uranium It is not specific to 3D printing. Contributes to issue CURA-6057. --- .../qml/MonitorPrintJobProgressBar.qml | 18 +-------- .../qml/ActionPanel/SliceProcessWidget.qml | 4 +- resources/qml/WelcomePages/WizardPanel.qml | 2 +- resources/qml/Widgets/ProgressBar.qml | 38 ------------------- resources/qml/qmldir | 1 - 5 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 resources/qml/Widgets/ProgressBar.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 2ba70268b2..d3e49393c9 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -22,7 +22,7 @@ Item width: childrenRect.width height: 18 * screenScaleFactor // TODO: Theme! - ProgressBar + UM.ProgressBar { id: progressBar anchors @@ -30,22 +30,6 @@ Item verticalCenter: parent.verticalCenter } value: printJob ? printJob.progress : 0 - style: ProgressBarStyle - { - background: Rectangle - { - color: UM.Theme.getColor("monitor_progress_bar_empty") - implicitHeight: visible ? 12 * screenScaleFactor : 0 // TODO: Theme! - implicitWidth: 180 * screenScaleFactor // TODO: Theme! - radius: 2 * screenScaleFactor // TODO: Theme! - } - progress: Rectangle - { - id: progressItem; - color: printJob && printJob.isActive ? UM.Theme.getColor("monitor_progress_bar_fill") : UM.Theme.getColor("monitor_progress_bar_deactive") - radius: 2 * screenScaleFactor // TODO: Theme! - } - } } Label { diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 484cba2e85..17021661b1 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 import QtQuick.Controls 1.4 as Controls1 -import UM 1.1 as UM +import UM 1.3 as UM import Cura 1.0 as Cura @@ -64,7 +64,7 @@ Column } // Progress bar, only visible when the backend is in the process of slice the printjob - Cura.ProgressBar + UM.ProgressBar { id: progressBar width: parent.width diff --git a/resources/qml/WelcomePages/WizardPanel.qml b/resources/qml/WelcomePages/WizardPanel.qml index 23dc914b27..91f351810c 100644 --- a/resources/qml/WelcomePages/WizardPanel.qml +++ b/resources/qml/WelcomePages/WizardPanel.qml @@ -44,7 +44,7 @@ Item anchors.fill: parent radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("main_background") - Cura.ProgressBar + UM.ProgressBar { id: progressBar anchors.top: parent.top diff --git a/resources/qml/Widgets/ProgressBar.qml b/resources/qml/Widgets/ProgressBar.qml deleted file mode 100644 index a08c02ebc4..0000000000 --- a/resources/qml/Widgets/ProgressBar.qml +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 - -import UM 1.3 as UM -import Cura 1.0 as Cura - -// -// Cura-style progress bar, with a grey background and a blue indication bar. -// -ProgressBar -{ - id: progressBar - width: parent.width - height: UM.Theme.getSize("progressbar").height - - background: Rectangle - { - anchors.fill: parent - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - } - - contentItem: Item - { - anchors.fill: parent - - Rectangle - { - width: progressBar.visualPosition * parent.width - height: parent.height - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_control") - } - } -} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 1376262922..eda0411f42 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -24,7 +24,6 @@ ToolTip 1.0 ToolTip.qml CheckBox 1.0 CheckBox.qml ComboBox 1.0 ComboBox.qml NotificationIcon 1.0 NotificationIcon.qml -ProgressBar 1.0 ProgressBar.qml RadioButton 1.0 RadioButton.qml TabButton 1.0 TabButton.qml From ffce5b8d58c046376eee6795a97c6d82d3c6aaaa Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 3 Apr 2019 12:10:06 +0200 Subject: [PATCH 203/211] FixassociateActiveMachineWithPrinterDevice() CURA-6057 --- 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 4a68f3b582..9670867475 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -265,7 +265,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): old_network_key = meta_data["um_network_key"] # Since we might have a bunch of hidden stacks, we also need to change it there. metadata_filter = {"um_network_key": old_network_key} - containers = self._application.findContainerStacks(type = "machine", **metadata_filter) + containers = self._application.getContainerRegistry().findContainerStacks(type = "machine", **metadata_filter) for container in containers: container.setMetaDataEntry("um_network_key", printer_device.key) From cf04ee98ef403674815d393e488c2acf6692ea26 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 3 Apr 2019 15:04:59 +0200 Subject: [PATCH 204/211] Fix being able to add a local machine that is not the first in the list CURA-6057 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index d55d8f84ae..6fa50c69a1 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -27,7 +27,6 @@ ScrollView ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.vertical.policy: ScrollBar.AsNeeded - property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height @@ -139,6 +138,13 @@ ScrollView height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 checked: ListView.view.currentIndex == index + onCheckedChanged: + { + if(checked) + { + machineList.currentIndex = index + } + } text: name visible: base.currentSection == section } From 1207533046916035f192dc82e5999b14f62e4e30 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 3 Apr 2019 15:11:52 +0200 Subject: [PATCH 205/211] Fix local printer selection update CURA-6057 --- cura/Machines/Models/FirstStartMachineActionsModel.py | 1 + resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 1 + 2 files changed, 2 insertions(+) diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index 489509f4ec..aad5372cde 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -95,6 +95,7 @@ class FirstStartMachineActionsModel(ListModel): "content": item.displayItem, "action": item, }) + item.reset() self.setItems(item_list) self.reset() diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 6fa50c69a1..ff64cdc33e 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -147,6 +147,7 @@ ScrollView } text: name visible: base.currentSection == section + onClicked: ListView.view.currentIndex = index } } } From 2ccc30b8246312b86b855dc42fd90deb0bcc9e89 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 3 Apr 2019 15:52:07 +0200 Subject: [PATCH 206/211] Only show add machine dialogue if your stack got corrupt, not whole onboarding We don't need to accept the EULA again or whatever. Just add the printer that got lost. Contributes to issue CURA-6057. --- resources/qml/Cura.qml | 6 +++++- resources/qml/Dialogs/AddMachineDialog.qml | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 6272157ec4..47f5449baf 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -84,7 +84,7 @@ UM.MainWindow Cura.Actions.parent = backgroundItem CuraApplication.purgeWindows() - if (CuraApplication.needToShowUserAgreement || Cura.MachineManager.activeMachine == null) + if (CuraApplication.needToShowUserAgreement) { welcomeDialog.visible = true } @@ -851,6 +851,10 @@ UM.MainWindow { base.visible = true; } + if(Cura.MachineManager.activeMachine == null) + { + addMachineDialog.open(); + } } } diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index dafe12693f..d3988155b7 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -38,7 +38,8 @@ UM.Dialog onVisibilityChanged: { // Reset selection and machine name - if (visible) { + if (visible) + { activeCategory = preferredCategory; machineList.currentIndex = 0; machineName.text = getMachineName(); From b9efeb47ed764e8cd76f6077cb733ae5ae6a85dc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 3 Apr 2019 15:56:54 +0200 Subject: [PATCH 207/211] Don't open add printer wizard on first launch Oops. Contributes to issue CURA-6057. --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 47f5449baf..dd985fe5c3 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -851,7 +851,7 @@ UM.MainWindow { base.visible = true; } - if(Cura.MachineManager.activeMachine == null) + if(!CuraApplication.needToShowUserAgreement && Cura.MachineManager.activeMachine == null) { addMachineDialog.open(); } From 362036e06420a50f939a102975a9e1cd684a7fdd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 3 Apr 2019 17:03:39 +0200 Subject: [PATCH 208/211] Fix small display issue where a line was drawn between the tabs CURA-6057 --- .../MachineSettingsAction.qml | 51 ++++++++++--------- resources/qml/Widgets/TabButton.qml | 28 ---------- 2 files changed, 26 insertions(+), 53 deletions(-) delete mode 100644 resources/qml/Widgets/TabButton.qml diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 1521c38eaa..a1540c22ab 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -17,7 +17,6 @@ Cura.MachineAction UM.I18nCatalog { id: catalog; name: "cura" } anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_margin").width property var extrudersModel: Cura.ExtrudersModel {} @@ -49,37 +48,26 @@ Cura.MachineAction } } - Rectangle + Cura.RoundedRectangle { - anchors.fill: parent - border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent" + anchors + { + top: tabBar.bottom + topMargin: -UM.Theme.getSize("default_lining").height + bottom: parent.bottom + left: parent.left + right: parent.right + } + cornerSide: Cura.RoundedRectangle.Direction.Down + border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width radius: UM.Theme.getSize("default_radius").width - - UM.TabRow - { - id: tabBar - width: parent.width - - Repeater - { - model: tabNameModel - delegate: Cura.TabButton - { - text: model.name - } - } - } - + color: UM.Theme.getColor("main_background") StackLayout { id: tabStack - anchors.top: tabBar.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom + anchors.fill: parent - width: parent.width currentIndex: tabBar.currentIndex MachineSettingsPrinterTab @@ -99,4 +87,17 @@ Cura.MachineAction } } } + UM.TabRow + { + id: tabBar + width: parent.width + Repeater + { + model: tabNameModel + delegate: UM.TabRowButton + { + text: model.name + } + } + } } diff --git a/resources/qml/Widgets/TabButton.qml b/resources/qml/Widgets/TabButton.qml deleted file mode 100644 index 86d1180abf..0000000000 --- a/resources/qml/Widgets/TabButton.qml +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 2.3 - -import UM 1.3 as UM -import Cura 1.1 as Cura - - -// -// This is the default Cura Tab button which is a plaintext label. -// -UM.TabRowButton -{ - id: tabButton - text: model.name - - contentItem: Label - { - anchors.centerIn: tabButton - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: tabButton.text - font: tabButton.checked ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium") - renderType: Text.NativeRendering - } -} From 75386c0b7e5b697519aff1f81b9e9aa0e63ed296 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 3 Apr 2019 17:08:07 +0200 Subject: [PATCH 209/211] Change the font of the customMachineSettings window CURA-6057 --- plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml | 2 +- resources/qml/WelcomePages/FirstStartMachineActionsContent.qml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index d9c6bcf539..ccc0548059 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -22,7 +22,7 @@ Item property int labelWidth: 130 property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 - property var labelFont: UM.Theme.getFont("medium") + property var labelFont: UM.Theme.getFont("default") property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 property int columnSpacing: 3 diff --git a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml index 3acca4dea6..17fdb1e9fe 100644 --- a/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml +++ b/resources/qml/WelcomePages/FirstStartMachineActionsContent.qml @@ -54,6 +54,7 @@ Item { top: titleLabel.bottom bottom: nextButton.top + bottomMargin: UM.Theme.getSize("default_margin").height left: parent.left right: parent.right } From 2e50c19949de3a85f1ec4d5d54df214b068d3c41 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 4 Apr 2019 09:51:53 +0200 Subject: [PATCH 210/211] Added missing rendertype --- resources/qml/Widgets/NotificationIcon.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Widgets/NotificationIcon.qml b/resources/qml/Widgets/NotificationIcon.qml index 7e4b0878dc..d06d9f16be 100644 --- a/resources/qml/Widgets/NotificationIcon.qml +++ b/resources/qml/Widgets/NotificationIcon.qml @@ -31,5 +31,6 @@ Rectangle horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font: UM.Theme.getFont("small") + renderType: Text.NativeRendering } } From 06f427ef4602a0ee9b653c5e6f71f0cf3ffb710c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 4 Apr 2019 14:18:51 +0200 Subject: [PATCH 211/211] Make GCode TextField scrollable CURA-6057 --- .../qml/MachineSettings/GcodeTextArea.qml | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml index ef9540791e..eb20cdc856 100644 --- a/resources/qml/MachineSettings/GcodeTextArea.qml +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -44,44 +44,48 @@ UM.TooltipArea renderType: Text.NativeRendering } - TextArea + ScrollView { - id: gcodeTextArea anchors.top: titleLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - hoverEnabled: true - selectByMouse: true - - font: UM.Theme.getFont("fixed") - renderType: Text.NativeRendering - text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" - wrapMode: TextEdit.NoWrap - - background: Rectangle + TextArea { - border.color: + id: gcodeTextArea + + hoverEnabled: true + selectByMouse: true + + font: UM.Theme.getFont("fixed") + renderType: Text.NativeRendering + text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" + wrapMode: TextEdit.NoWrap + + background: Rectangle { - if (!gcodeTextArea.enabled) + border.color: { - return UM.Theme.getColor("setting_control_disabled_border") + if (!gcodeTextArea.enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + if (gcodeTextArea.hovered || gcodeTextArea.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") } - if (gcodeTextArea.hovered || gcodeTextArea.activeFocus) - { - return UM.Theme.getColor("setting_control_border_highlight") - } - return UM.Theme.getColor("setting_control_border") } - } - onActiveFocusChanged: - { - if (!activeFocus) + onActiveFocusChanged: { - propertyProvider.setPropertyValue("value", text) + if (!activeFocus) + { + propertyProvider.setPropertyValue("value", text) + } } } }