From 193f11385168d1b0ca015127cfc46ac607a1d2a6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 10:33:01 +0200 Subject: [PATCH 001/558] Clean up Cura.qml: - Create a Skeleton folder where the main parts of the application will be stored. - Separate the top menus to a different file. Contributes to CURA-5784. --- cura/CuraApplication.py | 4 +- resources/qml/Cura.qml | 259 ++------------------- resources/qml/Skeleton/ApplicationMenu.qml | 234 +++++++++++++++++++ 3 files changed, 251 insertions(+), 246 deletions(-) create mode 100644 resources/qml/Skeleton/ApplicationMenu.qml diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 67bdd5805e..1990fd1b36 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -617,9 +617,7 @@ class CuraApplication(QtApplication): self._message_box_callback(button, *self._message_box_callback_arguments) self._message_box_callback = None self._message_box_callback_arguments = [] - - showPrintMonitor = pyqtSignal(bool, arguments = ["show"]) - + def setSaveDataEnabled(self, enabled: bool) -> None: self._save_data_enabled = enabled diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index b3367471ad..380e425ef5 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -11,28 +11,21 @@ import UM 1.3 as UM import Cura 1.1 as Cura import "Menus" +import "Skeleton" UM.MainWindow { id: base - //: Cura application window title - title: catalog.i18nc("@title:window","Ultimaker Cura"); - viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) - property bool showPrintMonitor: false + // Cura application window title + title: catalog.i18nc("@title:window", "Ultimaker Cura") + viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) backgroundColor: UM.Theme.getColor("viewport_background") - // This connection is here to support legacy printer output devices that use the showPrintMonitor signal on Application to switch to the monitor stage - // It should be phased out in newer plugin versions. - Connections + + UM.I18nCatalog { - target: CuraApplication - onShowPrintMonitor: { - if (show) { - UM.Controller.setActiveStage("MonitorStage") - } else { - UM.Controller.setActiveStage("PrepareStage") - } - } + id: catalog + name:"cura" } onWidthChanged: @@ -72,12 +65,12 @@ UM.MainWindow Item { - id: backgroundItem; - anchors.fill: parent; - UM.I18nCatalog{id: catalog; name:"cura"} + id: backgroundItem + anchors.fill: parent signal hasMesh(string name) //this signal sends the filebase name so it can be used for the JobSpecs.qml - function getMeshName(path){ + function getMeshName(path) + { //takes the path the complete path of the meshname and returns only the filebase var fileName = path.slice(path.lastIndexOf("/") + 1) var fileBase = fileName.slice(0, fileName.indexOf(".")) @@ -85,238 +78,18 @@ UM.MainWindow } //DeleteSelection on the keypress backspace event - Keys.onPressed: { + Keys.onPressed: + { if (event.key == Qt.Key_Backspace) { Cura.Actions.deleteSelection.trigger() } } - UM.ApplicationMenu + ApplicationMenu { id: menu window: base - - Menu - { - id: fileMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&File"); - MenuItem - { - id: newProjectMenu - action: Cura.Actions.newProject; - } - - MenuItem - { - id: openMenu - action: Cura.Actions.open; - } - - RecentFilesMenu { } - - MenuItem - { - id: saveWorkspaceMenu - text: catalog.i18nc("@title:menu menubar:file","&Save...") - onTriggered: - { - var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; - if(UM.Preferences.getValue("cura/dialog_on_project_save")) - { - saveWorkspaceDialog.args = args; - saveWorkspaceDialog.open() - } - else - { - UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) - } - } - } - - MenuSeparator { } - - MenuItem - { - id: saveAsMenu - text: catalog.i18nc("@title:menu menubar:file", "&Export...") - onTriggered: - { - var localDeviceId = "local_file"; - UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}); - } - } - - MenuItem - { - id: exportSelectionMenu - text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection..."); - enabled: UM.Selection.hasSelection; - iconName: "document-save-as"; - onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}); - } - - MenuSeparator { } - - MenuItem - { - id: reloadAllMenu - action: Cura.Actions.reloadAll; - } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.quit; } - } - - Menu - { - title: catalog.i18nc("@title:menu menubar:toplevel","&Edit"); - - MenuItem { action: Cura.Actions.undo; } - MenuItem { action: Cura.Actions.redo; } - MenuSeparator { } - MenuItem { action: Cura.Actions.selectAll; } - MenuItem { action: Cura.Actions.arrangeAll; } - MenuItem { action: Cura.Actions.deleteSelection; } - MenuItem { action: Cura.Actions.deleteAll; } - MenuItem { action: Cura.Actions.resetAllTranslation; } - MenuItem { action: Cura.Actions.resetAll; } - MenuSeparator { } - MenuItem { action: Cura.Actions.groupObjects;} - MenuItem { action: Cura.Actions.mergeObjects;} - MenuItem { action: Cura.Actions.unGroupObjects;} - } - - ViewMenu { title: catalog.i18nc("@title:menu", "&View") } - - Menu - { - id: settingsMenu - title: catalog.i18nc("@title:menu", "&Settings") - - PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } - - Instantiator - { - model: Cura.ExtrudersModel { simpleNames: true } - Menu { - title: model.name - - NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } - MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } - - MenuSeparator - { - visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") - onTriggered: Cura.MachineManager.setExtruderIndex(model.index) - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Enable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) - visible: !Cura.MachineManager.getExtruder(model.index).isEnabled - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Disable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) - visible: Cura.MachineManager.getExtruder(model.index).isEnabled - enabled: Cura.MachineManager.numberExtrudersEnabled > 1 - } - - } - onObjectAdded: settingsMenu.insertItem(index, object) - onObjectRemoved: settingsMenu.removeItem(object) - } - - // TODO Only show in dev mode. Remove check when feature ready - BuildplateMenu { title: catalog.i18nc("@title:menu", "&Build plate"); visible: CuraSDKVersion == "dev" ? Cura.MachineManager.hasVariantBuildplates : false } - ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile"); } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.configureSettingVisibility } - } - - Menu - { - id: extension_menu - title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions"); - - Instantiator - { - id: extensions - model: UM.ExtensionModel { } - - Menu - { - id: sub_menu - title: model.name; - visible: actions != null - enabled: actions != null - Instantiator - { - model: actions - MenuItem - { - text: model.text - onTriggered: extensions.model.subMenuTriggered(name, model.text) - } - onObjectAdded: sub_menu.insertItem(index, object) - onObjectRemoved: sub_menu.removeItem(object) - } - } - - onObjectAdded: extension_menu.insertItem(index, object) - onObjectRemoved: extension_menu.removeItem(object) - } - } - - Menu - { - id: plugin_menu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Toolbox") - - MenuItem { action: Cura.Actions.browsePackages } - } - - Menu - { - id: preferencesMenu - title: catalog.i18nc("@title:menu menubar:toplevel","P&references"); - - MenuItem { action: Cura.Actions.preferences; } - } - - Menu - { - id: helpMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&Help"); - - MenuItem { action: Cura.Actions.showProfileFolder; } - MenuItem { action: Cura.Actions.documentation; } - MenuItem { action: Cura.Actions.reportBug; } - MenuSeparator { } - MenuItem { action: Cura.Actions.about; } - } - } - - UM.SettingPropertyProvider - { - id: machineExtruderCount - - containerStack: Cura.MachineManager.activeMachine - key: "machine_extruder_count" - watchedProperties: [ "value" ] - storeIndex: 0 } Item diff --git a/resources/qml/Skeleton/ApplicationMenu.qml b/resources/qml/Skeleton/ApplicationMenu.qml new file mode 100644 index 0000000000..9abaa80f2a --- /dev/null +++ b/resources/qml/Skeleton/ApplicationMenu.qml @@ -0,0 +1,234 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.2 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +import "../Menus" + +UM.ApplicationMenu +{ + id: menu + + Menu + { + id: fileMenu + title: catalog.i18nc("@title:menu menubar:toplevel","&File") + + MenuItem + { + id: newProjectMenu + action: Cura.Actions.newProject + } + + MenuItem + { + id: openMenu + action: Cura.Actions.open + } + + RecentFilesMenu { } + + MenuItem + { + id: saveWorkspaceMenu + text: catalog.i18nc("@title:menu menubar:file","&Save...") + onTriggered: + { + var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; + if(UM.Preferences.getValue("cura/dialog_on_project_save")) + { + saveWorkspaceDialog.args = args + saveWorkspaceDialog.open() + } + else + { + UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + } + } + } + + MenuSeparator { } + + MenuItem + { + id: saveAsMenu + text: catalog.i18nc("@title:menu menubar:file", "&Export...") + onTriggered: + { + var localDeviceId = "local_file" + UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } + } + + MenuItem + { + id: exportSelectionMenu + text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") + enabled: UM.Selection.hasSelection + iconName: "document-save-as" + onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } + + MenuSeparator { } + + MenuItem + { + id: reloadAllMenu + action: Cura.Actions.reloadAll + } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.quit } + } + + Menu + { + title: catalog.i18nc("@title:menu menubar:toplevel","&Edit") + + MenuItem { action: Cura.Actions.undo } + MenuItem { action: Cura.Actions.redo } + MenuSeparator { } + MenuItem { action: Cura.Actions.selectAll } + MenuItem { action: Cura.Actions.arrangeAll } + MenuItem { action: Cura.Actions.deleteSelection } + MenuItem { action: Cura.Actions.deleteAll } + MenuItem { action: Cura.Actions.resetAllTranslation } + MenuItem { action: Cura.Actions.resetAll } + MenuSeparator { } + MenuItem { action: Cura.Actions.groupObjects } + MenuItem { action: Cura.Actions.mergeObjects } + MenuItem { action: Cura.Actions.unGroupObjects } + } + + ViewMenu { title: catalog.i18nc("@title:menu", "&View") } + + Menu + { + id: settingsMenu + title: catalog.i18nc("@title:menu", "&Settings") + + PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } + + Instantiator + { + model: Cura.ExtrudersModel { simpleNames: true } + Menu { + title: model.name + + NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } + MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } + + MenuSeparator + { + visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") + onTriggered: Cura.MachineManager.setExtruderIndex(model.index) + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Enable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) + visible: !Cura.MachineManager.getExtruder(model.index).isEnabled + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Disable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) + visible: Cura.MachineManager.getExtruder(model.index).isEnabled + enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + } + + } + onObjectAdded: settingsMenu.insertItem(index, object) + onObjectRemoved: settingsMenu.removeItem(object) + } + + // TODO Only show in dev mode. Remove check when feature ready + BuildplateMenu + { + title: catalog.i18nc("@title:menu", "&Build plate") + visible: CuraSDKVersion == "dev" && Cura.MachineManager.hasVariantBuildplates + } + ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile") } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.configureSettingVisibility } + } + + Menu + { + id: extension_menu + title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions") + + Instantiator + { + id: extensions + model: UM.ExtensionModel { } + + Menu + { + id: sub_menu + title: model.name; + visible: actions != null + enabled: actions != null + Instantiator + { + model: actions + MenuItem + { + text: model.text + onTriggered: extensions.model.subMenuTriggered(name, model.text) + } + onObjectAdded: sub_menu.insertItem(index, object) + onObjectRemoved: sub_menu.removeItem(object) + } + } + + onObjectAdded: extension_menu.insertItem(index, object) + onObjectRemoved: extension_menu.removeItem(object) + } + } + + Menu + { + id: plugin_menu + title: catalog.i18nc("@title:menu menubar:toplevel", "&Toolbox") + + MenuItem { action: Cura.Actions.browsePackages } + } + + Menu + { + id: preferencesMenu + title: catalog.i18nc("@title:menu menubar:toplevel","P&references") + + MenuItem { action: Cura.Actions.preferences } + } + + Menu + { + id: helpMenu + title: catalog.i18nc("@title:menu menubar:toplevel","&Help") + + MenuItem { action: Cura.Actions.showProfileFolder } + MenuItem { action: Cura.Actions.documentation } + MenuItem { action: Cura.Actions.reportBug } + MenuSeparator { } + MenuItem { action: Cura.Actions.about } + } +} \ No newline at end of file From 8bdd27183fcb318cf76c1c5f5aab1b0e7507e4f7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 10:59:46 +0200 Subject: [PATCH 002/558] Move TopBar to the Skeleton folder. Clean up the Cura.qml even more by moving some components to the ApplicationMenu, where they are called. Contributes to CURA-5784. --- resources/qml/Cura.qml | 35 -- .../{ => Dialogs}/WorkspaceSummaryDialog.qml | 0 resources/qml/Skeleton/ApplicationMenu.qml | 413 ++++++++++-------- resources/qml/{ => Skeleton}/Topbar.qml | 3 +- 4 files changed, 229 insertions(+), 222 deletions(-) rename resources/qml/{ => Dialogs}/WorkspaceSummaryDialog.qml (100%) rename resources/qml/{ => Skeleton}/Topbar.qml (99%) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 380e425ef5..18280ea4ae 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -183,7 +183,6 @@ UM.MainWindow bottom: parent.bottom; left: parent.left; } - } Topbar @@ -340,13 +339,6 @@ UM.MainWindow } } - WorkspaceSummaryDialog - { - id: saveWorkspaceDialog - property var args - onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) - } - Connections { target: Cura.Actions.preferences @@ -359,33 +351,6 @@ UM.MainWindow onShowPreferencesWindow: preferences.visible = true } - MessageDialog - { - id: newProjectDialog - modality: Qt.ApplicationModal - title: catalog.i18nc("@title:window", "New project") - text: catalog.i18nc("@info:question", "Are you sure you want to start a new project? This will clear the build plate and any unsaved settings.") - standardButtons: StandardButton.Yes | StandardButton.No - icon: StandardIcon.Question - onYes: - { - CuraApplication.deleteAll(); - Cura.Actions.resetProfile.trigger(); - } - } - - Connections - { - target: Cura.Actions.newProject - onTriggered: - { - if(Printer.platformActivity || Cura.MachineManager.hasUserSettings) - { - newProjectDialog.visible = true - } - } - } - Connections { target: Cura.Actions.addProfile diff --git a/resources/qml/WorkspaceSummaryDialog.qml b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml similarity index 100% rename from resources/qml/WorkspaceSummaryDialog.qml rename to resources/qml/Dialogs/WorkspaceSummaryDialog.qml diff --git a/resources/qml/Skeleton/ApplicationMenu.qml b/resources/qml/Skeleton/ApplicationMenu.qml index 9abaa80f2a..97d8f7ca7e 100644 --- a/resources/qml/Skeleton/ApplicationMenu.qml +++ b/resources/qml/Skeleton/ApplicationMenu.qml @@ -11,224 +11,267 @@ import UM 1.3 as UM import Cura 1.1 as Cura import "../Menus" +import "../Dialogs" -UM.ApplicationMenu +Item { id: menu + width: applicationMenu.width + height: applicationMenu.height + property alias window: applicationMenu.window - Menu + UM.ApplicationMenu { - id: fileMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&File") + id: applicationMenu - MenuItem + Menu { - id: newProjectMenu - action: Cura.Actions.newProject - } + id: fileMenu + title: catalog.i18nc("@title:menu menubar:toplevel","&File") - MenuItem - { - id: openMenu - action: Cura.Actions.open - } - - RecentFilesMenu { } - - MenuItem - { - id: saveWorkspaceMenu - text: catalog.i18nc("@title:menu menubar:file","&Save...") - onTriggered: + MenuItem { - var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; - if(UM.Preferences.getValue("cura/dialog_on_project_save")) + id: newProjectMenu + action: Cura.Actions.newProject + } + + MenuItem + { + id: openMenu + action: Cura.Actions.open + } + + RecentFilesMenu { } + + MenuItem + { + id: saveWorkspaceMenu + text: catalog.i18nc("@title:menu menubar:file","&Save...") + onTriggered: { - saveWorkspaceDialog.args = args - saveWorkspaceDialog.open() - } - else - { - UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; + if(UM.Preferences.getValue("cura/dialog_on_project_save")) + { + saveWorkspaceDialog.args = args + saveWorkspaceDialog.open() + } + else + { + UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + } } } - } - MenuSeparator { } + MenuSeparator { } - MenuItem - { - id: saveAsMenu - text: catalog.i18nc("@title:menu menubar:file", "&Export...") - onTriggered: + MenuItem { - var localDeviceId = "local_file" - UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + id: saveAsMenu + text: catalog.i18nc("@title:menu menubar:file", "&Export...") + onTriggered: + { + var localDeviceId = "local_file" + UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } } - } - MenuItem - { - id: exportSelectionMenu - text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") - enabled: UM.Selection.hasSelection - iconName: "document-save-as" - onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) - } - - MenuSeparator { } - - MenuItem - { - id: reloadAllMenu - action: Cura.Actions.reloadAll - } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.quit } - } - - Menu - { - title: catalog.i18nc("@title:menu menubar:toplevel","&Edit") - - MenuItem { action: Cura.Actions.undo } - MenuItem { action: Cura.Actions.redo } - MenuSeparator { } - MenuItem { action: Cura.Actions.selectAll } - MenuItem { action: Cura.Actions.arrangeAll } - MenuItem { action: Cura.Actions.deleteSelection } - MenuItem { action: Cura.Actions.deleteAll } - MenuItem { action: Cura.Actions.resetAllTranslation } - MenuItem { action: Cura.Actions.resetAll } - MenuSeparator { } - MenuItem { action: Cura.Actions.groupObjects } - MenuItem { action: Cura.Actions.mergeObjects } - MenuItem { action: Cura.Actions.unGroupObjects } - } - - ViewMenu { title: catalog.i18nc("@title:menu", "&View") } - - Menu - { - id: settingsMenu - title: catalog.i18nc("@title:menu", "&Settings") - - PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } - - Instantiator - { - model: Cura.ExtrudersModel { simpleNames: true } - Menu { - title: model.name - - NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } - MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } - - MenuSeparator - { - visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") - onTriggered: Cura.MachineManager.setExtruderIndex(model.index) - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Enable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) - visible: !Cura.MachineManager.getExtruder(model.index).isEnabled - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Disable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) - visible: Cura.MachineManager.getExtruder(model.index).isEnabled - enabled: Cura.MachineManager.numberExtrudersEnabled > 1 - } - - } - onObjectAdded: settingsMenu.insertItem(index, object) - onObjectRemoved: settingsMenu.removeItem(object) - } - - // TODO Only show in dev mode. Remove check when feature ready - BuildplateMenu - { - title: catalog.i18nc("@title:menu", "&Build plate") - visible: CuraSDKVersion == "dev" && Cura.MachineManager.hasVariantBuildplates - } - ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile") } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.configureSettingVisibility } - } - - Menu - { - id: extension_menu - title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions") - - Instantiator - { - id: extensions - model: UM.ExtensionModel { } - - Menu + MenuItem { - id: sub_menu - title: model.name; - visible: actions != null - enabled: actions != null - Instantiator - { - model: actions + id: exportSelectionMenu + text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") + enabled: UM.Selection.hasSelection + iconName: "document-save-as" + onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } + + MenuSeparator { } + + MenuItem + { + id: reloadAllMenu + action: Cura.Actions.reloadAll + } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.quit } + } + + Menu + { + title: catalog.i18nc("@title:menu menubar:toplevel","&Edit") + + MenuItem { action: Cura.Actions.undo } + MenuItem { action: Cura.Actions.redo } + MenuSeparator { } + MenuItem { action: Cura.Actions.selectAll } + MenuItem { action: Cura.Actions.arrangeAll } + MenuItem { action: Cura.Actions.deleteSelection } + MenuItem { action: Cura.Actions.deleteAll } + MenuItem { action: Cura.Actions.resetAllTranslation } + MenuItem { action: Cura.Actions.resetAll } + MenuSeparator { } + MenuItem { action: Cura.Actions.groupObjects } + MenuItem { action: Cura.Actions.mergeObjects } + MenuItem { action: Cura.Actions.unGroupObjects } + } + + ViewMenu { title: catalog.i18nc("@title:menu", "&View") } + + Menu + { + id: settingsMenu + title: catalog.i18nc("@title:menu", "&Settings") + + PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } + + Instantiator + { + model: Cura.ExtrudersModel { simpleNames: true } + Menu { + title: model.name + + NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } + MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } + + MenuSeparator + { + visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials + } + MenuItem { - text: model.text - onTriggered: extensions.model.subMenuTriggered(name, model.text) + text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") + onTriggered: Cura.MachineManager.setExtruderIndex(model.index) } - onObjectAdded: sub_menu.insertItem(index, object) - onObjectRemoved: sub_menu.removeItem(object) + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Enable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) + visible: !Cura.MachineManager.getExtruder(model.index).isEnabled + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Disable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) + visible: Cura.MachineManager.getExtruder(model.index).isEnabled + enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + } + } + onObjectAdded: settingsMenu.insertItem(index, object) + onObjectRemoved: settingsMenu.removeItem(object) } - onObjectAdded: extension_menu.insertItem(index, object) - onObjectRemoved: extension_menu.removeItem(object) + // TODO Only show in dev mode. Remove check when feature ready + BuildplateMenu + { + title: catalog.i18nc("@title:menu", "&Build plate") + visible: CuraSDKVersion == "dev" && Cura.MachineManager.hasVariantBuildplates + } + ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile") } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.configureSettingVisibility } + } + + Menu + { + id: extension_menu + title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions") + + Instantiator + { + id: extensions + model: UM.ExtensionModel { } + + Menu + { + id: sub_menu + title: model.name; + visible: actions != null + enabled: actions != null + Instantiator + { + model: actions + MenuItem + { + text: model.text + onTriggered: extensions.model.subMenuTriggered(name, model.text) + } + onObjectAdded: sub_menu.insertItem(index, object) + onObjectRemoved: sub_menu.removeItem(object) + } + } + + onObjectAdded: extension_menu.insertItem(index, object) + onObjectRemoved: extension_menu.removeItem(object) + } + } + + Menu + { + id: plugin_menu + title: catalog.i18nc("@title:menu menubar:toplevel", "&Toolbox") + + MenuItem { action: Cura.Actions.browsePackages } + } + + Menu + { + id: preferencesMenu + title: catalog.i18nc("@title:menu menubar:toplevel","P&references") + + MenuItem { action: Cura.Actions.preferences } + } + + Menu + { + id: helpMenu + title: catalog.i18nc("@title:menu menubar:toplevel","&Help") + + MenuItem { action: Cura.Actions.showProfileFolder } + MenuItem { action: Cura.Actions.documentation } + MenuItem { action: Cura.Actions.reportBug } + MenuSeparator { } + MenuItem { action: Cura.Actions.about } } } - Menu + WorkspaceSummaryDialog { - id: plugin_menu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Toolbox") - - MenuItem { action: Cura.Actions.browsePackages } + id: saveWorkspaceDialog + property var args + onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) } - Menu + MessageDialog { - id: preferencesMenu - title: catalog.i18nc("@title:menu menubar:toplevel","P&references") - - MenuItem { action: Cura.Actions.preferences } + id: newProjectDialog + modality: Qt.ApplicationModal + title: catalog.i18nc("@title:window", "New project") + text: catalog.i18nc("@info:question", "Are you sure you want to start a new project? This will clear the build plate and any unsaved settings.") + standardButtons: StandardButton.Yes | StandardButton.No + icon: StandardIcon.Question + onYes: + { + CuraApplication.deleteAll(); + Cura.Actions.resetProfile.trigger(); + } } - Menu + Connections { - id: helpMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&Help") - - MenuItem { action: Cura.Actions.showProfileFolder } - MenuItem { action: Cura.Actions.documentation } - MenuItem { action: Cura.Actions.reportBug } - MenuSeparator { } - MenuItem { action: Cura.Actions.about } + target: Cura.Actions.newProject + onTriggered: + { + if(Printer.platformActivity || Cura.MachineManager.hasUserSettings) + { + newProjectDialog.visible = true + } + } } } \ No newline at end of file diff --git a/resources/qml/Topbar.qml b/resources/qml/Skeleton/Topbar.qml similarity index 99% rename from resources/qml/Topbar.qml rename to resources/qml/Skeleton/Topbar.qml index 17819dbd27..d27d9865b8 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Skeleton/Topbar.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -8,7 +8,6 @@ import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "Menus" Rectangle { From 3acfdadd12c8a0f5b136cb94d011cf6ccfebc693 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 11:31:53 +0200 Subject: [PATCH 003/558] Organize the components in a Column. Separate the TopHeader and place it below the application menu, using all the width. Contributes to CURA-5784. --- resources/qml/Cura.qml | 104 +++++++++--------- .../Skeleton/{Topbar.qml => TopHeader.qml} | 0 2 files changed, 53 insertions(+), 51 deletions(-) rename resources/qml/Skeleton/{Topbar.qml => TopHeader.qml} (100%) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 18280ea4ae..62ec4799c9 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -63,7 +63,7 @@ UM.MainWindow CuraApplication.purgeWindows() } - Item + Column { id: backgroundItem anchors.fill: parent @@ -92,19 +92,25 @@ UM.MainWindow window: base } + TopHeader + { + id: topHeader + anchors.left: parent.left + anchors.right: parent.right + } + Item { - id: contentItem; + id: contentItem - y: menu.height - width: parent.width; - height: parent.height - menu.height; + width: parent.width + height: parent.height - menu.height - topHeader.height Keys.forwardTo: menu DropArea { - anchors.fill: parent; + anchors.fill: parent onDropped: { if (drop.urls.length > 0) @@ -137,69 +143,61 @@ UM.MainWindow id: jobSpecs anchors { - bottom: parent.bottom; - right: sidebar.left; - bottomMargin: UM.Theme.getSize("default_margin").height; - rightMargin: UM.Theme.getSize("default_margin").width; + bottom: parent.bottom + right: sidebar.left + bottomMargin: UM.Theme.getSize("default_margin").height + rightMargin: UM.Theme.getSize("default_margin").width } } Button { - id: openFileButton; - text: catalog.i18nc("@action:button","Open File"); + id: openFileButton + text: catalog.i18nc("@action:button","Open File") iconSource: UM.Theme.getIcon("load") style: UM.Theme.styles.tool_button tooltip: "" anchors { - top: topbar.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - left: parent.left; + top: parent.top + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left } - action: Cura.Actions.open; + action: Cura.Actions.open } Toolbar { - id: toolbar; + id: toolbar property int mouseX: base.mouseX property int mouseY: base.mouseY anchors { - top: openFileButton.bottom; - topMargin: UM.Theme.getSize("window_margin").height; - left: parent.left; + top: openFileButton.bottom + topMargin: UM.Theme.getSize("window_margin").height + left: parent.left } } ObjectsList { - id: objectsList; - visible: UM.Preferences.getValue("cura/use_multi_build_plate"); + id: objectsList + visible: UM.Preferences.getValue("cura/use_multi_build_plate") anchors { - bottom: parent.bottom; - left: parent.left; + bottom: parent.bottom + left: parent.left } } - Topbar - { - id: topbar - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - } - Loader { id: main anchors { - top: topbar.bottom + top: parent.top bottom: parent.bottom left: parent.left right: sidebar.left @@ -220,26 +218,30 @@ UM.MainWindow { id: sidebar - property bool collapsed: false; - property var initialWidth: UM.Theme.getSize("sidebar").width; + property bool collapsed: false + property var initialWidth: UM.Theme.getSize("sidebar").width - function callExpandOrCollapse() { - if (collapsed) { - sidebar.visible = true; - sidebar.initialWidth = UM.Theme.getSize("sidebar").width; - viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0); + function callExpandOrCollapse() + { + if (collapsed) + { + sidebar.visible = true + sidebar.initialWidth = UM.Theme.getSize("sidebar").width + viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) expandSidebarAnimation.start(); - } else { - viewportRect = Qt.rect(0, 0, 1, 1.0); - collapseSidebarAnimation.start(); } - collapsed = !collapsed; - UM.Preferences.setValue("cura/sidebar_collapsed", collapsed); + else + { + viewportRect = Qt.rect(0, 0, 1, 1.0) + collapseSidebarAnimation.start() + } + collapsed = !collapsed + UM.Preferences.setValue("cura/sidebar_collapsed", collapsed) } anchors { - top: topbar.top + top: parent.top bottom: parent.bottom } @@ -265,13 +267,13 @@ UM.MainWindow Component.onCompleted: { - var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed"); + var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed") if (sidebar_collapsed) { - sidebar.collapsed = true; + sidebar.collapsed = true viewportRect = Qt.rect(0, 0, 1, 1.0) - collapseSidebarAnimation.start(); + collapseSidebarAnimation.start() } } @@ -290,8 +292,8 @@ UM.MainWindow { horizontalCenter: parent.horizontalCenter horizontalCenterOffset: -(Math.round(UM.Theme.getSize("sidebar").width / 2)) - top: parent.verticalCenter; - bottom: parent.bottom; + top: parent.verticalCenter + bottom: parent.bottom bottomMargin: UM.Theme.getSize("default_margin").height } } diff --git a/resources/qml/Skeleton/Topbar.qml b/resources/qml/Skeleton/TopHeader.qml similarity index 100% rename from resources/qml/Skeleton/Topbar.qml rename to resources/qml/Skeleton/TopHeader.qml From 075a9a161fb77c999ad432666cd9b6d943f52cad Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 12:57:16 +0200 Subject: [PATCH 004/558] Create a component for the Views selector. This component contains the list of the views and also the shortcuts for the camera position. The theme colors, sizes and the styles have been updated. Contributes to CURA-5784. --- .../resources/qml/ToolboxTabButton.qml | 6 +- resources/qml/Cura.qml | 12 + .../ConfigurationMenu/ConfigurationItem.qml | 4 +- resources/qml/Skeleton/ApplicationViews.qml | 108 +++++++++ resources/qml/Skeleton/OrientationViews.qml | 56 +++++ resources/qml/Skeleton/TopHeader.qml | 208 ++---------------- resources/themes/cura-dark/theme.json | 15 +- resources/themes/cura-light/styles.qml | 106 ++------- resources/themes/cura-light/theme.json | 24 +- 9 files changed, 235 insertions(+), 304 deletions(-) create mode 100644 resources/qml/Skeleton/ApplicationViews.qml create mode 100644 resources/qml/Skeleton/OrientationViews.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml index 22fb6d73ca..58149e419a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml @@ -32,15 +32,15 @@ Button { if(control.hovered) { - return UM.Theme.getColor("topbar_button_text_hovered"); + return UM.Theme.getColor("toolbox_header_button_text_hovered"); } if(control.active) { - return UM.Theme.getColor("topbar_button_text_active"); + return UM.Theme.getColor("toolbox_header_button_text_active"); } else { - return UM.Theme.getColor("topbar_button_text_inactive"); + return UM.Theme.getColor("toolbox_header_button_text_inactive"); } } font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic") diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 62ec4799c9..b7245b1b65 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -191,6 +191,18 @@ UM.MainWindow } } + ApplicationViews + { + id: applicationViews + + visible: UM.Controller.activeStage.stageId != "MonitorStage" + anchors + { + top: parent.top + right: sidebar.left + } + } + Loader { id: main diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 942dd81d9c..517b69428e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -77,8 +77,8 @@ Rectangle UM.RecolorImage { id: buildplateIcon anchors.left: parent.left - width: UM.Theme.getSize("topbar_button_icon").width - height: UM.Theme.getSize("topbar_button_icon").height + width: UM.Theme.getSize("topheader_button_icon").width + height: UM.Theme.getSize("topheader_button_icon").height sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("buildplate") diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml new file mode 100644 index 0000000000..8e0b6efc0b --- /dev/null +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -0,0 +1,108 @@ +// Copyright (c) 2018 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.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 + +import UM 1.4 as UM +import Cura 1.0 as Cura + +// This item contains the views selector, a combobox that is dinamically created from +// the list of available Views (packages that create different visualizactions of the +// scene. Aside the selector, there is a row of buttons that change the orientation of the view. +Item +{ + id: applicationViewsSelector + + height: UM.Theme.getSize("views_selector").height + + OrientationViews + { + id: orientationViews + + anchors { + verticalCenter: parent.verticalCenter + right: viewModeButton.left + rightMargin: UM.Theme.getSize("default_margin").width + } + } + + ComboBox + { + id: viewModeButton + + anchors { + verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + + style: UM.Theme.styles.combobox + + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags () + { + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) + { + model.getItem(i).active = (i == currentIndex) + } + } + + // get the index of the active model item on start + function getActiveIndex () + { + for (var i = 0; i < model.rowCount(); i++) + { + if (model.getItem(i).active) { + return i + } + } + return 0 + } + + // set the active index + function setActiveIndex (index) + { + UM.Controller.setActiveView(index) + // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here + } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + viewModeButton.setActiveIndex(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() + + // watch the active view proxy for changes made from the menu item + Connections + { + target: UM.ActiveView + onActiveViewChanged: viewModeButton.updateItemActiveFlags() + } + } + + Loader + { + id: viewPanel + + anchors.top: viewModeButton.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: viewModeButton.right + + property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + + height: childrenRect.height + width: childrenRect.width + + source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" + } +} diff --git a/resources/qml/Skeleton/OrientationViews.qml b/resources/qml/Skeleton/OrientationViews.qml new file mode 100644 index 0000000000..d1b370ed71 --- /dev/null +++ b/resources/qml/Skeleton/OrientationViews.qml @@ -0,0 +1,56 @@ +// Copyright (c) 2018 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.Controls.Styles 1.1 + +import UM 1.4 as UM + +// View orientation Item +Row +{ + id: viewOrientationControl + + spacing: 2 * screenScaleFactor + + // #1 3d view + Button + { + iconSource: UM.Theme.getIcon("view_3d") + style: UM.Theme.styles.small_tool_button + onClicked:UM.Controller.rotateView("3d", 0) + } + + // #2 Front view + Button + { + iconSource: UM.Theme.getIcon("view_front") + style: UM.Theme.styles.small_tool_button + onClicked: UM.Controller.rotateView("home", 0) + } + + // #3 Top view + Button + { + iconSource: UM.Theme.getIcon("view_top") + style: UM.Theme.styles.small_tool_button + onClicked: UM.Controller.rotateView("y", 90) + } + + // #4 Left view + Button + { + iconSource: UM.Theme.getIcon("view_left") + style: UM.Theme.styles.small_tool_button + onClicked: UM.Controller.rotateView("x", 90) + } + + // #5 Right view + Button + { + iconSource: UM.Theme.getIcon("view_right") + style: UM.Theme.styles.small_tool_button + onClicked: UM.Controller.rotateView("x", -90) + } +} diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index d27d9865b8..bdc9afd0cc 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -12,38 +12,9 @@ import Cura 1.0 as Cura Rectangle { id: base - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("sidebar_header").height - color: UM.Controller.activeStage.stageId == "MonitorStage" ? UM.Theme.getColor("topbar_background_color_monitoring") : UM.Theme.getColor("topbar_background_color") - property bool printerConnected: Cura.MachineManager.printerConnected - property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands - - property int rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width; - property int allItemsWidth: 0; - - function updateMarginsAndSizes() { - if (UM.Preferences.getValue("cura/sidebar_collapsed")) - { - rightMargin = UM.Theme.getSize("default_margin").width; - } - else - { - rightMargin = UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width; - } - allItemsWidth = ( - logo.width + UM.Theme.getSize("topbar_logo_right_margin").width + - UM.Theme.getSize("topbar_logo_right_margin").width + stagesMenuContainer.width + - UM.Theme.getSize("default_margin").width + viewModeButton.width + - rightMargin); - } - - UM.I18nCatalog - { - id: catalog - name:"cura" - } + height: UM.Theme.getSize("topheader").height + color: UM.Theme.getColor("topheader_background") Image { @@ -52,36 +23,36 @@ Rectangle anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - source: UM.Theme.getImage("logo"); - width: UM.Theme.getSize("logo").width; - height: UM.Theme.getSize("logo").height; + source: UM.Theme.getImage("logo") + width: UM.Theme.getSize("logo").width + height: UM.Theme.getSize("logo").height - sourceSize.width: width; - sourceSize.height: height; + sourceSize.width: width + sourceSize.height: height } Row { id: stagesMenuContainer anchors.left: logo.right - anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width + anchors.leftMargin: UM.Theme.getSize("topheader_logo_right_margin").width spacing: UM.Theme.getSize("default_margin").width - // The topbar is dynamically filled with all available stages + // The topheader is dynamically filled with all available stages Repeater { id: stagesMenu - model: UM.StageModel{} + model: UM.StageModel { } delegate: Button { text: model.name checkable: true checked: model.active - exclusiveGroup: topbarMenuGroup - style: (model.stage.iconSource != "") ? UM.Theme.styles.topbar_header_tab_no_overlay : UM.Theme.styles.topbar_header_tab - height: UM.Theme.getSize("sidebar_header").height + exclusiveGroup: topheaderMenuGroup + style: UM.Theme.styles.topheader_tab + height: UM.Theme.getSize("topheader").height onClicked: UM.Controller.setActiveStage(model.id) iconSource: model.stage.iconSource @@ -90,157 +61,6 @@ Rectangle } } - ExclusiveGroup { id: topbarMenuGroup } + ExclusiveGroup { id: topheaderMenuGroup } } - - // View orientation Item - Row - { - id: viewOrientationControl - height: 30 - - spacing: 2 - visible: UM.Controller.activeStage.stageId != "MonitorStage" - - anchors - { - verticalCenter: base.verticalCenter - right: viewModeButton.left - rightMargin: UM.Theme.getSize("default_margin").width - } - - // #1 3d view - Button - { - iconSource: UM.Theme.getIcon("view_3d") - style: UM.Theme.styles.small_tool_button - anchors.verticalCenter: viewOrientationControl.verticalCenter - onClicked:UM.Controller.rotateView("3d", 0) - visible: base.width - allItemsWidth - 4 * this.width > 0 - } - - // #2 Front view - Button - { - iconSource: UM.Theme.getIcon("view_front") - style: UM.Theme.styles.small_tool_button - anchors.verticalCenter: viewOrientationControl.verticalCenter - onClicked: UM.Controller.rotateView("home", 0); - visible: base.width - allItemsWidth - 3 * this.width > 0 - } - - // #3 Top view - Button - { - iconSource: UM.Theme.getIcon("view_top") - style: UM.Theme.styles.small_tool_button - anchors.verticalCenter: viewOrientationControl.verticalCenter - onClicked: UM.Controller.rotateView("y", 90) - visible: base.width - allItemsWidth - 2 * this.width > 0 - } - - // #4 Left view - Button - { - iconSource: UM.Theme.getIcon("view_left") - style: UM.Theme.styles.small_tool_button - anchors.verticalCenter: viewOrientationControl.verticalCenter - onClicked: UM.Controller.rotateView("x", 90) - visible: base.width - allItemsWidth - 1 * this.width > 0 - } - - // #5 Right view - Button - { - iconSource: UM.Theme.getIcon("view_right") - style: UM.Theme.styles.small_tool_button - anchors.verticalCenter: viewOrientationControl.verticalCenter - onClicked: UM.Controller.rotateView("x", -90) - visible: base.width - allItemsWidth > 0 - } - } - - ComboBox - { - id: viewModeButton - - anchors { - verticalCenter: parent.verticalCenter - right: parent.right - rightMargin: rightMargin - } - - style: UM.Theme.styles.combobox - visible: UM.Controller.activeStage.stageId != "MonitorStage" - - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags () { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) { - model.getItem(i).active = (i == currentIndex) - } - } - - // get the index of the active model item on start - function getActiveIndex () { - for (var i = 0; i < model.rowCount(); i++) { - if (model.getItem(i).active) { - return i - } - } - return 0 - } - - // set the active index - function setActiveIndex (index) { - UM.Controller.setActiveView(index) - // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here - } - - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) - viewModeButton.setActiveIndex(model.getItem(currentIndex).id) - } - currentIndex: getActiveIndex() - - // watch the active view proxy for changes made from the menu item - Connections - { - target: UM.ActiveView - onActiveViewChanged: viewModeButton.updateItemActiveFlags() - } - } - - Loader - { - id: view_panel - - anchors.top: viewModeButton.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: viewModeButton.right - - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - - height: childrenRect.height - width: childrenRect.width - - source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : ""; - } - - // Expand or collapse sidebar - Connections - { - target: Cura.Actions.expandSidebar - onTriggered: updateMarginsAndSizes() - } - - Component.onCompleted: - { - updateMarginsAndSizes(); - } - } diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 26e6c2ac8b..fa0da2851e 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -15,12 +15,11 @@ "border": [127, 127, 127, 255], "secondary": [241, 242, 242, 255], - "topbar_background_color": [0, 0, 0, 0], - "topbar_background_color_monitoring": [31, 36, 39, 255], + "topheader_background": [31, 36, 39, 255], - "topbar_button_text_active": [255, 255, 255, 255], - "topbar_button_text_inactive": [128, 128, 128, 255], - "topbar_button_text_hovered": [255, 255, 255, 255], + "topheader_button_text_active": [255, 255, 255, 255], + "topheader_button_text_inactive": [128, 128, 128, 255], + "topheader_button_text_hovered": [255, 255, 255, 255], "text": [255, 255, 255, 204], "text_detail": [255, 255, 255, 172], @@ -221,6 +220,10 @@ "quality_slider_available": [255, 255, 255, 255], "quality_slider_handle": [255, 255, 255, 255], "quality_slider_handle_hover": [127, 127, 127, 255], - "quality_slider_text": [255, 255, 255, 255] + "quality_slider_text": [255, 255, 255, 255], + + "toolbox_header_button_text_active": [255, 255, 255, 255], + "toolbox_header_button_text_inactive": [128, 128, 128, 255], + "toolbox_header_button_text_hovered": [255, 255, 255, 255] } } diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index b71ddd2d86..b54d12e07b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -90,85 +90,11 @@ QtObject { } } - property Component topbar_header_tab_no_overlay: Component { - ButtonStyle { - background: Rectangle { - implicitHeight: Theme.getSize("topbar_button").height - implicitWidth: Theme.getSize("topbar_button").width - color: "transparent" - anchors.fill: parent - - Rectangle - { - id: underline - - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - width: parent.width - height: Theme.getSize("sidebar_header_highlight").height - color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : UM.Theme.getColor("sidebar_header_highlight_hover") - visible: control.hovered || control.checked - } - } - - label: Rectangle { - implicitHeight: Theme.getSize("topbar_button_icon").height - implicitWidth: Theme.getSize("topbar_button").width - color: "transparent" - anchors.fill: parent - - Item - { - anchors.centerIn: parent - width: Math.round(textLabel.width + icon.width + Theme.getSize("default_margin").width / 2) - Label - { - id: textLabel - text: control.text - anchors.right: icon.visible ? icon.left : parent.right - anchors.rightMargin: icon.visible ? Math.round(Theme.getSize("default_margin").width / 2) : 0 - anchors.verticalCenter: parent.verticalCenter; - font: control.checked ? UM.Theme.getFont("large") : UM.Theme.getFont("large_nonbold") - color: - { - if(control.hovered) - { - return UM.Theme.getColor("topbar_button_text_hovered"); - } - if(control.checked) - { - return UM.Theme.getColor("topbar_button_text_active"); - } - else - { - return UM.Theme.getColor("topbar_button_text_inactive"); - } - } - } - Image - { - id: icon - visible: control.iconSource != "" - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - opacity: !control.enabled ? 0.2 : 1.0 - source: control.iconSource - width: visible ? Theme.getSize("topbar_button_icon").width : 0 - height: Theme.getSize("topbar_button_icon").height - - sourceSize: Theme.getSize("topbar_button_icon") - } - } - } - } - } - - property Component topbar_header_tab: Component { + property Component topheader_tab: Component { ButtonStyle { background: Item { - implicitHeight: Theme.getSize("topbar_button").height - implicitWidth: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width + implicitHeight: Theme.getSize("topheader_button").height + implicitWidth: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width Rectangle { id: buttonFace; @@ -182,7 +108,7 @@ QtObject { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - width: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width + width: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width height: Theme.getSize("sidebar_header_highlight").height color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : UM.Theme.getColor("sidebar_header_highlight_hover") visible: control.hovered || control.checked @@ -192,14 +118,14 @@ QtObject { label: Item { - implicitHeight: Theme.getSize("topbar_button_icon").height - implicitWidth: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width + implicitHeight: Theme.getSize("topheader_button_icon").height + implicitWidth: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter; width: childrenRect.width - height: Theme.getSize("topbar_button_icon").height + height: Theme.getSize("topheader_button_icon").height Label { id: button_label @@ -210,15 +136,15 @@ QtObject { { if(control.hovered) { - return UM.Theme.getColor("topbar_button_text_hovered"); + return UM.Theme.getColor("topheader_button_text_hovered"); } if(control.checked) { - return UM.Theme.getColor("topbar_button_text_active"); + return UM.Theme.getColor("topheader_button_text_active"); } else { - return UM.Theme.getColor("topbar_button_text_inactive"); + return UM.Theme.getColor("topheader_button_text_inactive"); } } } @@ -231,10 +157,10 @@ QtObject { color: UM.Theme.getColor("text_emphasis") opacity: !control.enabled ? 0.2 : 1.0 source: control.iconSource - width: visible ? Theme.getSize("topbar_button_icon").width : 0 - height: Theme.getSize("topbar_button_icon").height + width: visible ? Theme.getSize("topheader_button_icon").width : 0 + height: Theme.getSize("topheader_button_icon").height - sourceSize: Theme.getSize("topbar_button_icon") + sourceSize: Theme.getSize("topheader_button_icon") } UM.RecolorImage { @@ -245,10 +171,10 @@ QtObject { color: control.overlayColor opacity: !control.enabled ? 0.2 : 1.0 source: control.overlayIconSource - width: visible ? Theme.getSize("topbar_button_icon").width : 0 - height: Theme.getSize("topbar_button_icon").height + width: visible ? Theme.getSize("topheader_button_icon").width : 0 + height: Theme.getSize("topheader_button_icon").height - sourceSize: Theme.getSize("topbar_button_icon") + sourceSize: Theme.getSize("topheader_button_icon") } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 43d892c34c..74644c4de9 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -79,12 +79,11 @@ "border": [127, 127, 127, 255], "secondary": [245, 245, 245, 255], - "topbar_background_color": [255, 255, 255, 0], - "topbar_background_color_monitoring": [255, 255, 255, 255], + "topheader_background": [255, 255, 255, 255], - "topbar_button_text_active": [0, 0, 0, 255], - "topbar_button_text_inactive": [128, 128, 128, 255], - "topbar_button_text_hovered": [0, 0, 0, 255], + "topheader_button_text_active": [0, 0, 0, 255], + "topheader_button_text_inactive": [128, 128, 128, 255], + "topheader_button_text_hovered": [0, 0, 0, 255], "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], @@ -317,6 +316,10 @@ "printer_config_matched": [12, 169, 227, 255], "printer_config_mismatch": [127, 127, 127, 255], + "toolbox_header_button_text_active": [0, 0, 0, 255], + "toolbox_header_button_text_inactive": [128, 128, 128, 255], + "toolbox_header_button_text_hovered": [0, 0, 0, 255], + "favorites_header_bar": [245, 245, 245, 255], "favorites_header_hover": [245, 245, 245, 255], "favorites_header_text": [31, 36, 39, 255], @@ -332,6 +335,13 @@ "sizes": { "window_minimum_size": [70, 50], + "topheader": [0.0, 4.0], + "topheader_logo_right_margin": [3, 0], + "topheader_button": [8, 4], + "topheader_button_icon": [1.2, 1.2], + + "views_selector": [0.0, 4.0], + "default_lining": [0.08, 0.08], "default_arrow": [0.8, 0.8], "logo": [7.6, 1.6], @@ -390,10 +400,6 @@ "printer_status_icon": [1.8, 1.8], "printer_sync_icon": [1.2, 1.2], - "topbar_logo_right_margin": [3, 0], - "topbar_button": [8, 4], - "topbar_button_icon": [1.2, 1.2], - "button_tooltip": [1.0, 1.3], "button_tooltip_arrow": [0.25, 0.25], From 41add97b135482b19b23246793d52d32b992a7d0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 14:50:13 +0200 Subject: [PATCH 005/558] Add Toolbox shortcut to the TopHeader and align the stage tabs to the center. Contributes to CURA-5784. --- resources/qml/Cura.qml | 13 ----------- resources/qml/Skeleton/ApplicationMenu.qml | 27 +++++++++++++++++++--- resources/qml/Skeleton/TopHeader.qml | 26 +++++++++++++++++---- resources/themes/cura-light/theme.json | 1 - 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index b7245b1b65..445bfb6ec9 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -422,19 +422,6 @@ UM.MainWindow } } - UM.ExtensionModel { - id: curaExtensions - } - - // show the plugin browser dialog - Connections - { - target: Cura.Actions.browsePackages - onTriggered: { - curaExtensions.callExtensionMethod("Toolbox", "browsePackages") - } - } - Timer { id: createProfileTimer diff --git a/resources/qml/Skeleton/ApplicationMenu.qml b/resources/qml/Skeleton/ApplicationMenu.qml index 97d8f7ca7e..a8774e8ceb 100644 --- a/resources/qml/Skeleton/ApplicationMenu.qml +++ b/resources/qml/Skeleton/ApplicationMenu.qml @@ -180,7 +180,7 @@ Item Menu { - id: extension_menu + id: extensionMenu title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions") Instantiator @@ -207,8 +207,8 @@ Item } } - onObjectAdded: extension_menu.insertItem(index, object) - onObjectRemoved: extension_menu.removeItem(object) + onObjectAdded: extensionMenu.insertItem(index, object) + onObjectRemoved: extensionMenu.removeItem(object) } } @@ -241,6 +241,10 @@ Item } } + // ############################################################################################### + // Definition of other components that are linked to the menus + // ############################################################################################### + WorkspaceSummaryDialog { id: saveWorkspaceDialog @@ -263,6 +267,14 @@ Item } } + UM.ExtensionModel { + id: curaExtensions + } + + // ############################################################################################### + // Definition of all the connections + // ############################################################################################### + Connections { target: Cura.Actions.newProject @@ -274,4 +286,13 @@ Item } } } + + // show the plugin browser dialog + Connections + { + target: Cura.Actions.browsePackages + onTriggered: { + curaExtensions.callExtensionMethod("Toolbox", "browsePackages") + } + } } \ No newline at end of file diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index bdc9afd0cc..bf92fbb41d 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -33,15 +33,19 @@ Rectangle Row { - id: stagesMenuContainer - anchors.left: logo.right - anchors.leftMargin: UM.Theme.getSize("topheader_logo_right_margin").width + id: stagesListContainer + + anchors + { + horizontalCenter: parent.horizontalCenter + leftMargin: UM.Theme.getSize("default_margin").width + } spacing: UM.Theme.getSize("default_margin").width // The topheader is dynamically filled with all available stages Repeater { - id: stagesMenu + id: stagesHeader model: UM.StageModel { } @@ -63,4 +67,18 @@ Rectangle ExclusiveGroup { id: topheaderMenuGroup } } + + // Shortcut button to quick access the Toolbox + Button + { + id: toolboxShortcutButton + text: catalog.i18nc("@action:button", "Toolbox") + anchors + { + right: parent.right + leftMargin: UM.Theme.getSize("default_margin").width + } + style: UM.Theme.styles.topheader_tab + action: Cura.Actions.browsePackages + } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 74644c4de9..f5372bbb0f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -336,7 +336,6 @@ "window_minimum_size": [70, 50], "topheader": [0.0, 4.0], - "topheader_logo_right_margin": [3, 0], "topheader_button": [8, 4], "topheader_button_icon": [1.2, 1.2], From 2ffcf03f43e7c68a57471123a2a221be13d964d1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 17:35:24 +0200 Subject: [PATCH 006/558] Create an AvatarImage component that will show the profile image of the user. Still WIP. Create an AccountWidget (WIP) that shows the avatar image and the dropdown menu to manage accounts. Contributes to CURA-5784. --- resources/qml/Skeleton/ApplicationViews.qml | 2 + resources/qml/Skeleton/TopHeader.qml | 17 ++++- .../qml/Skeleton/components/AccountWidget.qml | 71 ++++++++++++++++++ .../qml/Skeleton/components/AvatarImage.qml | 42 +++++++++++ .../{ => components}/OrientationViews.qml | 0 .../themes/cura-light/icons/circle_mask.svg | 64 ++++++++++++++++ .../cura-light/images/avatar_default.png | Bin 0 -> 3115 bytes 7 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 resources/qml/Skeleton/components/AccountWidget.qml create mode 100644 resources/qml/Skeleton/components/AvatarImage.qml rename resources/qml/Skeleton/{ => components}/OrientationViews.qml (100%) create mode 100644 resources/themes/cura-light/icons/circle_mask.svg create mode 100644 resources/themes/cura-light/images/avatar_default.png diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index 8e0b6efc0b..25c2ff9983 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -9,6 +9,8 @@ import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import "components" + // This item contains the views selector, a combobox that is dinamically created from // the list of available Views (packages that create different visualizactions of the // scene. Aside the selector, there is a row of buttons that change the orientation of the view. diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index bf92fbb41d..c2e03aa04b 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -4,11 +4,12 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import "components" + Rectangle { id: base @@ -75,10 +76,20 @@ Rectangle text: catalog.i18nc("@action:button", "Toolbox") anchors { - right: parent.right - leftMargin: UM.Theme.getSize("default_margin").width + right: accountWidget.left + rightMargin: UM.Theme.getSize("default_margin").width } style: UM.Theme.styles.topheader_tab action: Cura.Actions.browsePackages } + + AccountWidget + { + id: accountWidget + anchors + { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + } } diff --git a/resources/qml/Skeleton/components/AccountWidget.qml b/resources/qml/Skeleton/components/AccountWidget.qml new file mode 100644 index 0000000000..3d33aeaf27 --- /dev/null +++ b/resources/qml/Skeleton/components/AccountWidget.qml @@ -0,0 +1,71 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM + +Item +{ + id: base + height: UM.Theme.getSize("topheader").height + width: UM.Theme.getSize("topheader").height + + AvatarImage + { + id: avatar + width: Math.round(0.8 * parent.width) + height: Math.round(0.8 * parent.height) + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea + { + anchors.fill: avatar + onClicked: + { + // Collapse/Expand the dropdown panel + accountManagementPanel.visible = !accountManagementPanel.visible + } + } + + UM.PointingRectangle + { + id: accountManagementPanel + + width: 250 + height: 250 + + anchors + { + top: parent.bottom + topMargin: UM.Theme.getSize("default_margin").height + right: parent.right + } + + target: Qt.point(parent.width / 2, parent.bottom) + arrowSize: UM.Theme.getSize("default_arrow").width + + visible: false + opacity: visible ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + + color: UM.Theme.getColor("tool_panel_background") + borderColor: UM.Theme.getColor("lining") + borderWidth: UM.Theme.getSize("default_lining").width + + Loader + { + id: panel + sourceComponent: login + } + } + + Component + { + id: login + Label {text: "HOLA"} + } +} \ No newline at end of file diff --git a/resources/qml/Skeleton/components/AvatarImage.qml b/resources/qml/Skeleton/components/AvatarImage.qml new file mode 100644 index 0000000000..52e2757cbf --- /dev/null +++ b/resources/qml/Skeleton/components/AvatarImage.qml @@ -0,0 +1,42 @@ +// Copyright (c) 2018 Ultimaker B.V. +import QtQuick 2.7 +import QtQuick.Controls 2.1 +import QtGraphicalEffects 1.0 + +import UM 1.4 as UM + +Item +{ + id: avatar + + Image + { + id: profileImage + source: UM.Theme.getImage("avatar_default") + sourceSize: Qt.size(parent.width, parent.height) + width: parent.width + height: parent.height + fillMode: Image.PreserveAspectCrop + visible: false + } + + UM.RecolorImage + { + id: profileImageMask + source: UM.Theme.getIcon("circle_mask") + sourceSize: Qt.size(parent.width, parent.height) + width: parent.width + height: parent.height + color: UM.Theme.getColor("topheader_background") + visible: false + } + + OpacityMask + { + anchors.fill: profileImage + source: profileImage + maskSource: profileImageMask + cached: true + invert: false + } +} \ No newline at end of file diff --git a/resources/qml/Skeleton/OrientationViews.qml b/resources/qml/Skeleton/components/OrientationViews.qml similarity index 100% rename from resources/qml/Skeleton/OrientationViews.qml rename to resources/qml/Skeleton/components/OrientationViews.qml diff --git a/resources/themes/cura-light/icons/circle_mask.svg b/resources/themes/cura-light/icons/circle_mask.svg new file mode 100644 index 0000000000..d5bfe53a97 --- /dev/null +++ b/resources/themes/cura-light/icons/circle_mask.svg @@ -0,0 +1,64 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/images/avatar_default.png b/resources/themes/cura-light/images/avatar_default.png new file mode 100644 index 0000000000000000000000000000000000000000..0c306680f721dba0de73fb7be90fe5c548608692 GIT binary patch literal 3115 zcmbVOX*iS%8y@?FGN>;UW^hD^kmA@)wk*+Nt%xutWD5~v3CY&j$IjT-F&O*4hwKUE z94T3j?C-quPWgQQzF+4%*LPp{bv?_E`&q8%$MgEOiQZ{;0d^P+cG^H6Z4QGmp16!K zIMa#gEfyO(2~=(y-Mu-mK<{6mcg{kT38-cisu+e!2WiFqw8CCm*DTcYfleBQa=K}W z6fmrs>RSxBWCM@Vj~=ESx#R%hHPqgDdjCgy-55mZ0NwL}%npz|24!@BLFH5j!qLkL zYV#yS8iV2+LAQLsJr9VdfK8Lo(>x%t3GDqyFX*KOlmd^^jtcr{9kWn!Gnm{0woE~< z$>3wckweDO8#35B4Yf@}F=Ws_{mA|#QxCSyK;0kc*}S| z044`$nu0n`l;`O_ML=*R6<0}(sR!fg!TcT?c^vATgRr?kSQRy|hvr`fWOjm%nMY5u zfY54c?K{Yu2xN7FIbAf@93Z<3^e6zH6#!*}v=?Q-i*lfO3QC}Wr318xT51%D8eIoA zyob`;z~BmMNF~)N3uv5x^15kp4Pamy;G6}t&p;`y;Ojatq>Aca3fN^FJ;?-~mjHgn zfKM?Hc`^bCta%4zcY?WHG(tNV+W@xDLd63#$1I?77%CZ{74^~byJ^IJT2Vi(d=PTV z2HsLm8V2x9U{VX{Nd!__KrbRt{SK-gfjkO&Kz8A*gl~BKFY~dyFwK*r`ebwANjJhOPID+-Nx%tm}=cC;EG* z#j=W=110?DuK3Bl{ogFoz#k(fe^#n1(1$%vfMY>V7)@S@FQ#q&H)`@+?Kl-^bK z5*Dlcm!jhhSB~R0IFIg|H0dW=j%nAldy31hybBvnzOL2Nhpo2Lx~EFOMGUNdm2NsG zh5GY$-DN#CudgzRh^Efe_!*-p%e97Y-;K7pxgIY#RIJYs`VqZz>L!Eb3rHt5GlMlR zQ|+fCHHETsYbaK?(h^f8C9P3RP)rBLBZ4o9U@Sal3%goW8s4#y#d6j0{<)Wp7=^xA zmh6KEYa-FyaSHr6f((MUB~<}oa|_ApZ>oS?RMp?fvA6pb)@8uYR4>Sov~I;JL1qfY zZ)bDPZ0*AFPaV2)ZsLd;p^LA&^e44huViRzijg8&Riki2?u3b0&7l<`LTw4RR^mee zvpAUkg(`gwuH9@(n$uHbP5OOZokpFY)MW!5*L_4tyXKuEt)SUG5##ky9r^)JoMbpv zf|NUO5l3~A9#e+zzDE)E<@>IarxY*!Wbc!$naWc}B=jn-Bm0DFCW*d? zNA(92M74lu;TX(}eY9}=MCk`q@I1Ou1*L9jK#uQG3kY)(3=j0ma%yJ)hzU+=XVzAk zPfLYi&2@V}M_}t>BimU%5OX4ba@i&&DOR$_4@(l1gx!bt6|2s=533TC&aBK~2+svp z?rRuhaZQIx#+$F2d?Slzb(T~#rx#G}ZUq=Y1cm0ZU=VF%K$v6l#7Y`pz%`{5V^RPapBoiInb0l{pRd3o5KK;rtv`vVp?zlnlPr52w` zS>uLVnewJ0`RejxSbY>x$UTPBd>pU6;flx`=H|UPK?yA!(FYegvW@Et&~D;nND}3| ztq~?JW5b{R+MD|ZW@#Ab;~vW3b)dt#lFcipr9L7L%TVG&rFkEGnj*>R4BVS?PO-3y z4ze|P^z~c!+2)pHb%7>U2gj$89m7G4-m7$98nNIk>u_bpLH{ocJG{?_X*St}D6^H> z$%caxp)Gucn$HILak_Zsa*+(jvK>}iD_Z~S}J(c6PmtYBo}LxjmnoK3eG!M|T8dU$L@T2I>M z=d~V_7THE`bO%9R=q*yuV{1+B<$mWS1j=h=en2`(g1oyziM}Xl1?>z7eeQL>pmFTN zQ()LuP*JtGkVHQ{d_?iEmDxjHmFqm%sqRdX-PEvn@Ul9@3M4&Oafbsl;`-=Zmd+PyK-FW)M+61ViY?&|~d%7+HD z%C(8V!oP4UezbjFEk1@La&c~3W|KRD9O$sJV z<`iFDZ})Yu{v%7Z5z6O`v!)*0dh=(z|Ju7n%#wxowrLl`u(0j%4W0b*;}TVNL-BLR zZBeKxzfCU=cJy9aMG|NBD&Vl6Xm+dq5V%ULzP@Cnsrv=}fKA73t=t18I&(0E*6rHh zc)+KQX>Ca4eyi%o+biNHRBBJWm_EhKU;c=e6r1JPYdD1P|1u|6FmAiMGf3QAG10YL zOXi`gW9SEhy0*)4GE_IbwMG};&_T%#7H^&AV6@752f;Mx@s)kZLC-5TV`=lvZpi9* zIj4h!ck3zKYKg70(Y>uBL}0%HzXQZ2`q`XI{#%X-s>9lv9NRv+uKIW*$(numCzf09 z!uH;>W9=!@K5!lsuG<&wyJewqoJq`;)QVkN9zND{N)=Ix|4NmTmpixnY|ZVLc*aBo zU;6!b%cyIe$i0ClV5``j*k}kfrh!ZuL_7fxlLIYRP;~?)^X>KgE9jZXbIB;nPZ9b8 zomui?yg!g(Er5CC_boxR32;6cwb;VIt+4*!Ot@;A9#QOtvh<#U$dhwX2G-oDAKvqh z=S98$;z_d+JJJ+79UM>+` zZEH_9OHbEqx^_qRt3w3gdZzqkh!;+lN;YeWmHYh`e~|*5l$mTMb&n05Oo)P-Yx;HFQ2VR8c z;?Slc3;~iRk;A?|gGJ;GLO00@xhLA=BEx}p7m2MVX|BrkxCs3=$02g;ns!G2 Date: Tue, 9 Oct 2018 15:58:13 +0200 Subject: [PATCH 007/558] Add the callout panel to the account panel, with the two components that will show up when the user is logged in or when not. Contributes to CURA-5784. --- .../components => Accounts}/AccountWidget.qml | 32 ++++++---- .../components => Accounts}/AvatarImage.qml | 4 +- .../qml/Accounts/GeneralManagementWidget.qml | 23 +++++++ .../qml/Accounts/UserManagementWidget.qml | 33 ++++++++++ resources/qml/Cura.qml | 1 + resources/qml/Skeleton/ApplicationViews.qml | 2 +- resources/qml/Skeleton/TopHeader.qml | 2 +- resources/qml/components/ActionButton.qml | 61 +++++++++++++++++++ .../components/OrientationViews.qml | 0 9 files changed, 143 insertions(+), 15 deletions(-) rename resources/qml/{Skeleton/components => Accounts}/AccountWidget.qml (60%) rename resources/qml/{Skeleton/components => Accounts}/AvatarImage.qml (88%) create mode 100644 resources/qml/Accounts/GeneralManagementWidget.qml create mode 100644 resources/qml/Accounts/UserManagementWidget.qml create mode 100644 resources/qml/components/ActionButton.qml rename resources/qml/{Skeleton => }/components/OrientationViews.qml (100%) diff --git a/resources/qml/Skeleton/components/AccountWidget.qml b/resources/qml/Accounts/AccountWidget.qml similarity index 60% rename from resources/qml/Skeleton/components/AccountWidget.qml rename to resources/qml/Accounts/AccountWidget.qml index 3d33aeaf27..89f9acd8cc 100644 --- a/resources/qml/Skeleton/components/AccountWidget.qml +++ b/resources/qml/Accounts/AccountWidget.qml @@ -5,10 +5,14 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import UM 1.4 as UM +import Cura 1.1 as Cura Item { - id: base + id: accountWidget + property var profile: Cura.API.account.userProfile + property var loggedIn: Cura.API.account.isLoggedIn + property var logoutCallback: Cura.API.account.logout height: UM.Theme.getSize("topheader").height width: UM.Theme.getSize("topheader").height @@ -19,24 +23,21 @@ Item height: Math.round(0.8 * parent.height) anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter + source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") } MouseArea { - anchors.fill: avatar - onClicked: - { - // Collapse/Expand the dropdown panel - accountManagementPanel.visible = !accountManagementPanel.visible - } + anchors.fill: parent + onClicked: accountManagementPanel.visible = !accountManagementPanel.visible // Collapse/Expand the dropdown panel } UM.PointingRectangle { id: accountManagementPanel - width: 250 - height: 250 + width: panel.width + height: panel.height anchors { @@ -56,16 +57,23 @@ Item borderColor: UM.Theme.getColor("lining") borderWidth: UM.Theme.getSize("default_lining").width + // Shows the user management options or general options to create account Loader { id: panel - sourceComponent: login + sourceComponent: loggedIn ? userManagementWidget : generalManagementWidget } } Component { - id: login - Label {text: "HOLA"} + id: userManagementWidget + UserManagementWidget { } + } + + Component + { + id: generalManagementWidget + GeneralManagementWidget { } } } \ No newline at end of file diff --git a/resources/qml/Skeleton/components/AvatarImage.qml b/resources/qml/Accounts/AvatarImage.qml similarity index 88% rename from resources/qml/Skeleton/components/AvatarImage.qml rename to resources/qml/Accounts/AvatarImage.qml index 52e2757cbf..18ac19a45d 100644 --- a/resources/qml/Skeleton/components/AvatarImage.qml +++ b/resources/qml/Accounts/AvatarImage.qml @@ -9,10 +9,12 @@ Item { id: avatar + property var source + Image { id: profileImage - source: UM.Theme.getImage("avatar_default") + source: avatar.source ? avatar.source : UM.Theme.getImage("avatar_default") sourceSize: Qt.size(parent.width, parent.height) width: parent.width height: parent.height diff --git a/resources/qml/Accounts/GeneralManagementWidget.qml b/resources/qml/Accounts/GeneralManagementWidget.qml new file mode 100644 index 0000000000..2bb0c89f98 --- /dev/null +++ b/resources/qml/Accounts/GeneralManagementWidget.qml @@ -0,0 +1,23 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + +import "../components" + +Column +{ + ActionButton + { + text: catalog.i18nc("@button", "Sign In") + color: "transparent" + hoverColor: "transparent" + textColor: UM.Theme.getColor("text") + textHoverColor: UM.Theme.getColor("text_link") + onClicked: Cura.API.account.login() + } +} \ No newline at end of file diff --git a/resources/qml/Accounts/UserManagementWidget.qml b/resources/qml/Accounts/UserManagementWidget.qml new file mode 100644 index 0000000000..24f4966679 --- /dev/null +++ b/resources/qml/Accounts/UserManagementWidget.qml @@ -0,0 +1,33 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + +import "../components" + +Column +{ + ActionButton + { + text: catalog.i18nc("@button", "Manage Profile") + color: "transparent" + hoverColor: "transparent" + textColor: UM.Theme.getColor("text") + textHoverColor: UM.Theme.getColor("text_link") + onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + } + + ActionButton + { + text: catalog.i18nc("@button", "Sign Out") + color: "transparent" + hoverColor: "transparent" + textColor: UM.Theme.getColor("text") + textHoverColor: UM.Theme.getColor("text_link") + onClicked: Cura.API.account.logout() + } +} \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 445bfb6ec9..16bae8aa3b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -105,6 +105,7 @@ UM.MainWindow width: parent.width height: parent.height - menu.height - topHeader.height + z: topHeader.z - 1 Keys.forwardTo: menu diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index 25c2ff9983..b3d08ab627 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -9,7 +9,7 @@ import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "components" +import "../components" // This item contains the views selector, a combobox that is dinamically created from // the list of available Views (packages that create different visualizactions of the diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index c2e03aa04b..fedb00898f 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -8,7 +8,7 @@ import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "components" +import "../Accounts" Rectangle { diff --git a/resources/qml/components/ActionButton.qml b/resources/qml/components/ActionButton.qml new file mode 100644 index 0000000000..02c279a458 --- /dev/null +++ b/resources/qml/components/ActionButton.qml @@ -0,0 +1,61 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM + +Button +{ + id: button + property alias cursorShape: mouseArea.cursorShape + property var iconSource: "" + property var color: UM.Theme.getColor("primary") + property var hoverColor: UM.Theme.getColor("primary_hover") + property var disabledColor: color + property var textColor: UM.Theme.getColor("button_text") + property var textHoverColor: UM.Theme.getColor("button_text_hover") + property var textDisabledColor: textColor + property var textFont: UM.Theme.getFont("action_button") + + contentItem: Row + { + UM.RecolorImage + { + id: buttonIcon + source: button.iconSource + width: 16 * screenScaleFactor + height: 16 * screenScaleFactor + sourceSize.width: width + sourceSize.height: height + color: button.hovered ? button.textHoverColor : button.textColor + visible: button.iconSource != "" + } + + Label + { + id: buttonText + text: button.text + color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor + font: button.textFont + visible: button.text != "" + renderType: Text.NativeRendering + } + } + + background: Rectangle + { + color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor + } + + MouseArea + { + id: mouseArea + anchors.fill: parent + onPressed: mouse.accepted = false + hoverEnabled: true + cursorShape: button.enabled ? (hovered ? Qt.PointingHandCursor : Qt.ArrowCursor) : Qt.ForbiddenCursor + } +} diff --git a/resources/qml/Skeleton/components/OrientationViews.qml b/resources/qml/components/OrientationViews.qml similarity index 100% rename from resources/qml/Skeleton/components/OrientationViews.qml rename to resources/qml/components/OrientationViews.qml From 49e96980f124381410b3e6f34cd1c9c1737178d0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 9 Oct 2018 17:11:01 +0200 Subject: [PATCH 008/558] Store the dialogs in a folder called Dialogs. Contributes to CURA-5784. --- resources/qml/{Accounts => Account}/AccountWidget.qml | 0 resources/qml/{Accounts => Account}/AvatarImage.qml | 0 resources/qml/{Accounts => Account}/GeneralManagementWidget.qml | 0 resources/qml/{Accounts => Account}/UserManagementWidget.qml | 0 resources/qml/Cura.qml | 1 + resources/qml/{ => Dialogs}/AboutDialog.qml | 0 resources/qml/{ => Dialogs}/AddMachineDialog.qml | 0 resources/qml/{ => Dialogs}/AskOpenAsProjectOrModelsDialog.qml | 0 .../qml/{ => Dialogs}/DiscardOrKeepProfileChangesDialog.qml | 0 .../qml/{ => Dialogs}/OpenFilesIncludingProjectsDialog.qml | 0 resources/qml/Menus/RecentFilesMenu.qml | 2 ++ resources/qml/Skeleton/TopHeader.qml | 2 +- 12 files changed, 4 insertions(+), 1 deletion(-) rename resources/qml/{Accounts => Account}/AccountWidget.qml (100%) rename resources/qml/{Accounts => Account}/AvatarImage.qml (100%) rename resources/qml/{Accounts => Account}/GeneralManagementWidget.qml (100%) rename resources/qml/{Accounts => Account}/UserManagementWidget.qml (100%) rename resources/qml/{ => Dialogs}/AboutDialog.qml (100%) rename resources/qml/{ => Dialogs}/AddMachineDialog.qml (100%) rename resources/qml/{ => Dialogs}/AskOpenAsProjectOrModelsDialog.qml (100%) rename resources/qml/{ => Dialogs}/DiscardOrKeepProfileChangesDialog.qml (100%) rename resources/qml/{ => Dialogs}/OpenFilesIncludingProjectsDialog.qml (100%) diff --git a/resources/qml/Accounts/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml similarity index 100% rename from resources/qml/Accounts/AccountWidget.qml rename to resources/qml/Account/AccountWidget.qml diff --git a/resources/qml/Accounts/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml similarity index 100% rename from resources/qml/Accounts/AvatarImage.qml rename to resources/qml/Account/AvatarImage.qml diff --git a/resources/qml/Accounts/GeneralManagementWidget.qml b/resources/qml/Account/GeneralManagementWidget.qml similarity index 100% rename from resources/qml/Accounts/GeneralManagementWidget.qml rename to resources/qml/Account/GeneralManagementWidget.qml diff --git a/resources/qml/Accounts/UserManagementWidget.qml b/resources/qml/Account/UserManagementWidget.qml similarity index 100% rename from resources/qml/Accounts/UserManagementWidget.qml rename to resources/qml/Account/UserManagementWidget.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 16bae8aa3b..2af085fee7 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -10,6 +10,7 @@ import QtQuick.Dialogs 1.2 import UM 1.3 as UM import Cura 1.1 as Cura +import "Dialogs" import "Menus" import "Skeleton" diff --git a/resources/qml/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml similarity index 100% rename from resources/qml/AboutDialog.qml rename to resources/qml/Dialogs/AboutDialog.qml diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml similarity index 100% rename from resources/qml/AddMachineDialog.qml rename to resources/qml/Dialogs/AddMachineDialog.qml diff --git a/resources/qml/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml similarity index 100% rename from resources/qml/AskOpenAsProjectOrModelsDialog.qml rename to resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml diff --git a/resources/qml/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml similarity index 100% rename from resources/qml/DiscardOrKeepProfileChangesDialog.qml rename to resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml diff --git a/resources/qml/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml similarity index 100% rename from resources/qml/OpenFilesIncludingProjectsDialog.qml rename to resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml diff --git a/resources/qml/Menus/RecentFilesMenu.qml b/resources/qml/Menus/RecentFilesMenu.qml index 12f53fb517..0f1f67b6fa 100644 --- a/resources/qml/Menus/RecentFilesMenu.qml +++ b/resources/qml/Menus/RecentFilesMenu.qml @@ -7,6 +7,8 @@ import QtQuick.Controls 1.1 import UM 1.3 as UM import Cura 1.0 as Cura +import "../Dialogs" + Menu { id: menu diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index fedb00898f..5013c12703 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -8,7 +8,7 @@ import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "../Accounts" +import "../Account" Rectangle { From 0df7fa1a6cb4e2ac0284fb9300c3025a692bab0a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 10 Oct 2018 11:04:08 +0200 Subject: [PATCH 009/558] Add style to the top header tabs. Contributes to CURA-5784. --- resources/qml/Skeleton/TopHeader.qml | 3 +- resources/themes/cura-light/images/logo.svg | 200 +++++++++++++++----- resources/themes/cura-light/styles.qml | 109 ++++------- resources/themes/cura-light/theme.json | 12 +- 4 files changed, 195 insertions(+), 129 deletions(-) diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index 5013c12703..8cb568df4d 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -41,7 +41,6 @@ Rectangle horizontalCenter: parent.horizontalCenter leftMargin: UM.Theme.getSize("default_margin").width } - spacing: UM.Theme.getSize("default_margin").width // The topheader is dynamically filled with all available stages Repeater @@ -52,7 +51,7 @@ Rectangle delegate: Button { - text: model.name + text: model.name.toUpperCase() checkable: true checked: model.active exclusiveGroup: topheaderMenuGroup diff --git a/resources/themes/cura-light/images/logo.svg b/resources/themes/cura-light/images/logo.svg index 5fa5895443..89692f8295 100644 --- a/resources/themes/cura-light/images/logo.svg +++ b/resources/themes/cura-light/images/logo.svg @@ -1,4 +1,6 @@ + + + id="svg8" + inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" + sodipodi:docname="logo.svg"> + + + id="metadata5"> @@ -26,47 +49,124 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index b54d12e07b..ba0350fd4b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -90,92 +90,57 @@ QtObject { } } - property Component topheader_tab: Component { - ButtonStyle { - background: Item { - implicitHeight: Theme.getSize("topheader_button").height - implicitWidth: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width + property Component topheader_tab: Component + { + ButtonStyle + { + // This property will be back-propagated when the width of the label is calculated + property var buttonWidth: 0 - Rectangle { - id: buttonFace; - anchors.fill: parent; + background: Rectangle + { + id: buttonFace + implicitHeight: control.height + implicitWidth: buttonWidth + color: control.checked ? UM.Theme.getColor("topheader_button_background_active") : UM.Theme.getColor("topheader_button_background_inactive") - color: "transparent" - Behavior on color { ColorAnimation { duration: 50; } } - - Rectangle { - id: underline; - - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - width: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width - height: Theme.getSize("sidebar_header_highlight").height - color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : UM.Theme.getColor("sidebar_header_highlight_hover") - visible: control.hovered || control.checked - } - } + Behavior on color { ColorAnimation { duration: 50 } } } label: Item { - implicitHeight: Theme.getSize("topheader_button_icon").height - implicitWidth: Theme.getSize("topheader_button").width + Theme.getSize("topheader_button_icon").width - Item + id: contents + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + height: control.height + width: buttonLabel.width + 4 * UM.Theme.getSize("default_margin").width + + Label { + id: buttonLabel + text: control.text + anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter; - width: childrenRect.width - height: Theme.getSize("topheader_button_icon").height - Label + font: UM.Theme.getFont("medium_bold") + color: { - id: button_label - text: control.text; - anchors.verticalCenter: parent.verticalCenter; - font: control.checked ? UM.Theme.getFont("large") : UM.Theme.getFont("large_nonbold") - color: + if (control.checked) { - if(control.hovered) + return UM.Theme.getColor("topheader_button_text_active") + } + else + { + if (control.hovered) { - return UM.Theme.getColor("topheader_button_text_hovered"); - } - if(control.checked) - { - return UM.Theme.getColor("topheader_button_text_active"); - } - else - { - return UM.Theme.getColor("topheader_button_text_inactive"); + return UM.Theme.getColor("topheader_button_text_hovered") } + return UM.Theme.getColor("topheader_button_text_inactive") } } - UM.RecolorImage - { - visible: control.iconSource != "" - id: icon - anchors.left: button_label.right - anchors.leftMargin: (icon.visible || overlayIcon.visible) ? Theme.getSize("default_margin").width : 0 - color: UM.Theme.getColor("text_emphasis") - opacity: !control.enabled ? 0.2 : 1.0 - source: control.iconSource - width: visible ? Theme.getSize("topheader_button_icon").width : 0 - height: Theme.getSize("topheader_button_icon").height - - sourceSize: Theme.getSize("topheader_button_icon") - } - UM.RecolorImage - { - id: overlayIcon - anchors.left: button_label.right - anchors.leftMargin: (icon.visible || overlayIcon.visible) ? Theme.getSize("default_margin").width : 0 - visible: control.overlayIconSource != "" && control.iconSource != "" - color: control.overlayColor - opacity: !control.enabled ? 0.2 : 1.0 - source: control.overlayIconSource - width: visible ? Theme.getSize("topheader_button_icon").width : 0 - height: Theme.getSize("topheader_button_icon").height - - sourceSize: Theme.getSize("topheader_button_icon") - } + } + Component.onCompleted: + { + buttonWidth = width } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f5372bbb0f..e49824ae74 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -79,11 +79,13 @@ "border": [127, 127, 127, 255], "secondary": [245, 245, 245, 255], - "topheader_background": [255, 255, 255, 255], + "topheader_background": [12, 169, 227, 255], - "topheader_button_text_active": [0, 0, 0, 255], - "topheader_button_text_inactive": [128, 128, 128, 255], + "topheader_button_text_active": [12, 169, 227, 255], + "topheader_button_text_inactive": [255, 255, 255, 255], "topheader_button_text_hovered": [0, 0, 0, 255], + "topheader_button_background_active": [255, 255, 255, 255], + "topheader_button_background_inactive": [255, 255, 255, 0], "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], @@ -335,7 +337,7 @@ "sizes": { "window_minimum_size": [70, 50], - "topheader": [0.0, 4.0], + "topheader": [0.0, 4.5], "topheader_button": [8, 4], "topheader_button_icon": [1.2, 1.2], @@ -343,7 +345,7 @@ "default_lining": [0.08, 0.08], "default_arrow": [0.8, 0.8], - "logo": [7.6, 1.6], + "logo": [8, 2.4], "default_margin": [1.0, 1.0], "wide_margin": [2.0, 2.0], From b89c220a4d43e423432af9b4b032de077727fcbf Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 10 Oct 2018 11:17:09 +0200 Subject: [PATCH 010/558] Add linings between tabs in the top header. Contributes to CURA-5784. --- resources/themes/cura-light/styles.qml | 34 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index ba0350fd4b..b08d9e8728 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -97,14 +97,38 @@ QtObject { // This property will be back-propagated when the width of the label is calculated property var buttonWidth: 0 - background: Rectangle + background: Item { - id: buttonFace implicitHeight: control.height - implicitWidth: buttonWidth - color: control.checked ? UM.Theme.getColor("topheader_button_background_active") : UM.Theme.getColor("topheader_button_background_inactive") + implicitWidth: buttonWidth + 2 * UM.Theme.getSize("default_lining").width - Behavior on color { ColorAnimation { duration: 50 } } + Rectangle + { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + implicitHeight: parent.height - 2 * UM.Theme.getSize("default_margin").width + implicitWidth: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("topheader_button_background_active") + visible: !control.checked + } + Rectangle + { + id: buttonFace + implicitHeight: parent.height + implicitWidth: parent.width + color: control.checked ? UM.Theme.getColor("topheader_button_background_active") : UM.Theme.getColor("topheader_button_background_inactive") + + Behavior on color { ColorAnimation { duration: 50 } } + } + Rectangle + { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + implicitHeight: parent.height - 2 * UM.Theme.getSize("default_margin").width + implicitWidth: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("topheader_button_background_active") + visible: !control.checked + } } label: Item From b3fc76092d4b957ac0462910a49b2244a982654b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 10 Oct 2018 14:01:34 +0200 Subject: [PATCH 011/558] Removed unused EngineLog --- resources/qml/Actions.qml | 9 ------- resources/qml/Cura.qml | 5 ---- resources/qml/EngineLog.qml | 53 ------------------------------------- 3 files changed, 67 deletions(-) delete mode 100644 resources/qml/EngineLog.qml diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 7d898eed2c..1b1881ab76 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -58,7 +58,6 @@ Item property alias preferences: preferencesAction; - property alias showEngineLog: showEngineLogAction; property alias showProfileFolder: showProfileFolderAction; property alias documentation: documentationAction; property alias reportBug: reportBugAction; @@ -396,14 +395,6 @@ Item shortcut: StandardKey.New } - Action - { - id: showEngineLogAction; - text: catalog.i18nc("@action:inmenu menubar:help","Show Engine &Log..."); - iconName: "view-list-text"; - shortcut: StandardKey.WhatsThis; - } - Action { id: showProfileFolderAction; diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2af085fee7..0a6e054a5f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -655,11 +655,6 @@ UM.MainWindow } } - EngineLog - { - id: engineLog; - } - Connections { target: Cura.Actions.showProfileFolder diff --git a/resources/qml/EngineLog.qml b/resources/qml/EngineLog.qml deleted file mode 100644 index 965587b59e..0000000000 --- a/resources/qml/EngineLog.qml +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2015 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 UM 1.1 as UM - -UM.Dialog -{ - id: dialog; - - //: Engine Log dialog title - title: catalog.i18nc("@title:window","Engine Log"); - - modality: Qt.NonModal; - - TextArea - { - id: textArea - anchors.fill: parent; - - Timer - { - id: updateTimer; - interval: 1000; - running: false; - repeat: true; - onTriggered: textArea.text = CuraApplication.getEngineLog(); - } - UM.I18nCatalog{id: catalog; name:"cura"} - } - - rightButtons: Button - { - //: Close engine log button - text: catalog.i18nc("@action:button","Close"); - onClicked: dialog.visible = false; - } - - onVisibleChanged: - { - if(visible) - { - textArea.text = CuraApplication.getEngineLog(); - updateTimer.start(); - } else - { - updateTimer.stop(); - } - } -} From 1ed3558b9a0489a8c479e30170040ec74ec7cb2b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 10 Oct 2018 14:21:09 +0200 Subject: [PATCH 012/558] Move ViewOrientationControl to lower left corner This also renames the component to better reflect what it is (the old name implied that it had something to do with orientation views, wheres it's actually a set of controls to change orientation) CURA-5772 --- resources/qml/Cura.qml | 17 ++++++++++++++++- resources/qml/Skeleton/ApplicationViews.qml | 10 ---------- ...ionViews.qml => ViewOrientationControls.qml} | 3 ++- 3 files changed, 18 insertions(+), 12 deletions(-) rename resources/qml/components/{OrientationViews.qml => ViewOrientationControls.qml} (95%) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 0a6e054a5f..50419067b4 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -13,6 +13,7 @@ import Cura 1.1 as Cura import "Dialogs" import "Menus" import "Skeleton" +import "components" UM.MainWindow { @@ -197,7 +198,7 @@ UM.MainWindow { id: applicationViews - visible: UM.Controller.activeStage.stageId != "MonitorStage" + anchors { top: parent.top @@ -311,6 +312,20 @@ UM.MainWindow bottomMargin: UM.Theme.getSize("default_margin").height } } + + + ViewOrientationControls + { + id: viewOrientationControls + + anchors + { + left: parent.left + margins: UM.Theme.getSize("default_margin").width + + bottom: parent.bottom + } + } } } diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index b3d08ab627..94315a73fb 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -20,16 +20,6 @@ Item height: UM.Theme.getSize("views_selector").height - OrientationViews - { - id: orientationViews - - anchors { - verticalCenter: parent.verticalCenter - right: viewModeButton.left - rightMargin: UM.Theme.getSize("default_margin").width - } - } ComboBox { diff --git a/resources/qml/components/OrientationViews.qml b/resources/qml/components/ViewOrientationControls.qml similarity index 95% rename from resources/qml/components/OrientationViews.qml rename to resources/qml/components/ViewOrientationControls.qml index d1b370ed71..bf56ef2997 100644 --- a/resources/qml/components/OrientationViews.qml +++ b/resources/qml/components/ViewOrientationControls.qml @@ -13,7 +13,8 @@ Row id: viewOrientationControl spacing: 2 * screenScaleFactor - + height: childrenRect.height + width: childrenRect.width // #1 3d view Button { From 5befc0b256f93a4ad5d0199eccfcd5a023aa2be9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 10 Oct 2018 16:34:55 +0200 Subject: [PATCH 013/558] Restyle the dropdown of the accounts, with information about the user and available operations that can be done when the user is logged in or not. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 77 +++++++++++++++++++ resources/qml/Account/AccountWidget.qml | 23 ++---- resources/qml/Account/AvatarImage.qml | 12 +++ .../qml/Account/GeneralManagementWidget.qml | 23 ------ resources/qml/Account/GeneralOperations.qml | 35 +++++++++ .../qml/Account/UserManagementWidget.qml | 33 -------- resources/qml/Account/UserOperations.qml | 35 +++++++++ resources/qml/Skeleton/TopHeader.qml | 24 +++++- resources/qml/components/ActionButton.qml | 4 + .../cura-light/icons/circle_outline.svg | 64 +++++++++++++++ resources/themes/cura-light/styles.qml | 8 ++ resources/themes/cura-light/theme.json | 5 ++ 12 files changed, 267 insertions(+), 76 deletions(-) create mode 100644 resources/qml/Account/AccountDetails.qml delete mode 100644 resources/qml/Account/GeneralManagementWidget.qml create mode 100644 resources/qml/Account/GeneralOperations.qml delete mode 100644 resources/qml/Account/UserManagementWidget.qml create mode 100644 resources/qml/Account/UserOperations.qml create mode 100644 resources/themes/cura-light/icons/circle_outline.svg diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml new file mode 100644 index 0000000000..ab1ccc15df --- /dev/null +++ b/resources/qml/Account/AccountDetails.qml @@ -0,0 +1,77 @@ +// 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 UM 1.4 as UM +import Cura 1.1 as Cura + +import "../components" + +Column +{ + property var profile: null + property var loggedIn: false + + padding: 2 * UM.Theme.getSize("default_margin").height + spacing: 2 * UM.Theme.getSize("default_margin").height + + AvatarImage + { + id: avatar + width: 75 * screenScaleFactor + height: 75 * screenScaleFactor + anchors.horizontalCenter: parent.horizontalCenter + source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") + } + + Label + { + id: message + anchors.horizontalCenter: parent.horizontalCenter + visible: !loggedIn + text: catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura") + } + + Column + { + id: userInformation + anchors.horizontalCenter: parent.horizontalCenter + visible: loggedIn + + Label + { + anchors.horizontalCenter: parent.horizontalCenter + text: loggedIn ? profile["username"] : "" + font: UM.Theme.getFont("large") + } + + Label + { + anchors.horizontalCenter: parent.horizontalCenter + text: "email.address@hardcoded.is" + font: UM.Theme.getFont("default") + } + } + + Loader + { + id: accountEntryPoints + anchors.horizontalCenter: parent.horizontalCenter + sourceComponent: loggedIn ? userOperations : generalOperations + } + + Component + { + id: userOperations + UserOperations { } + } + + Component + { + id: generalOperations + GeneralOperations { } + } +} \ No newline at end of file diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 89f9acd8cc..1d9541de2c 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -1,8 +1,8 @@ // Copyright (c) 2018 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 2.7 +import QtQuick.Controls 2.1 import UM 1.4 as UM import Cura 1.1 as Cura @@ -12,7 +12,6 @@ Item id: accountWidget property var profile: Cura.API.account.userProfile property var loggedIn: Cura.API.account.isLoggedIn - property var logoutCallback: Cura.API.account.logout height: UM.Theme.getSize("topheader").height width: UM.Theme.getSize("topheader").height @@ -24,6 +23,7 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") } MouseArea @@ -58,22 +58,11 @@ Item borderWidth: UM.Theme.getSize("default_lining").width // Shows the user management options or general options to create account - Loader + AccountDetails { id: panel - sourceComponent: loggedIn ? userManagementWidget : generalManagementWidget + profile: Cura.API.account.userProfile + loggedIn: Cura.API.account.isLoggedIn } } - - Component - { - id: userManagementWidget - UserManagementWidget { } - } - - Component - { - id: generalManagementWidget - GeneralManagementWidget { } - } } \ No newline at end of file diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 18ac19a45d..96c3cd2330 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -10,6 +10,8 @@ Item id: avatar property var source + property var fallbackSource: UM.Theme.getImage("avatar_default") + property var outlineColor: UM.Theme.getColor("account_widget_ouline_active") Image { @@ -41,4 +43,14 @@ Item cached: true invert: false } + + UM.RecolorImage + { + id: profileImageOutline + source: UM.Theme.getIcon("circle_outline") + sourceSize: Qt.size(parent.width, parent.height) + width: parent.width + height: parent.height + color: avatar.outlineColor + } } \ No newline at end of file diff --git a/resources/qml/Account/GeneralManagementWidget.qml b/resources/qml/Account/GeneralManagementWidget.qml deleted file mode 100644 index 2bb0c89f98..0000000000 --- a/resources/qml/Account/GeneralManagementWidget.qml +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.1 - -import UM 1.4 as UM -import Cura 1.1 as Cura - -import "../components" - -Column -{ - ActionButton - { - text: catalog.i18nc("@button", "Sign In") - color: "transparent" - hoverColor: "transparent" - textColor: UM.Theme.getColor("text") - textHoverColor: UM.Theme.getColor("text_link") - onClicked: Cura.API.account.login() - } -} \ No newline at end of file diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml new file mode 100644 index 0000000000..d224de44bb --- /dev/null +++ b/resources/qml/Account/GeneralOperations.qml @@ -0,0 +1,35 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + +import "../components" + +Row +{ + spacing: UM.Theme.getSize("default_margin").width + + ActionButton + { + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Create account") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("text_link") + textHoverColor: UM.Theme.getColor("text") + onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + } + + ActionButton + { + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Login") + onClicked: Cura.API.account.login() + } +} \ No newline at end of file diff --git a/resources/qml/Account/UserManagementWidget.qml b/resources/qml/Account/UserManagementWidget.qml deleted file mode 100644 index 24f4966679..0000000000 --- a/resources/qml/Account/UserManagementWidget.qml +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.1 - -import UM 1.4 as UM -import Cura 1.1 as Cura - -import "../components" - -Column -{ - ActionButton - { - text: catalog.i18nc("@button", "Manage Profile") - color: "transparent" - hoverColor: "transparent" - textColor: UM.Theme.getColor("text") - textHoverColor: UM.Theme.getColor("text_link") - onClicked: Qt.openUrlExternally("https://account.ultimaker.com") - } - - ActionButton - { - text: catalog.i18nc("@button", "Sign Out") - color: "transparent" - hoverColor: "transparent" - textColor: UM.Theme.getColor("text") - textHoverColor: UM.Theme.getColor("text_link") - onClicked: Cura.API.account.logout() - } -} \ No newline at end of file diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml new file mode 100644 index 0000000000..1704254ed3 --- /dev/null +++ b/resources/qml/Account/UserOperations.qml @@ -0,0 +1,35 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + +import "../components" + +Row +{ + spacing: UM.Theme.getSize("default_margin").width + + ActionButton + { + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Manage account") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("text_link") + textHoverColor: UM.Theme.getColor("text") + onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + } + + ActionButton + { + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Logout") + onClicked: Cura.API.account.logout() + } +} \ No newline at end of file diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index 8cb568df4d..c24fe86af0 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -1,13 +1,14 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.7 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import "../components" import "../Account" Rectangle @@ -72,13 +73,30 @@ Rectangle Button { id: toolboxShortcutButton - text: catalog.i18nc("@action:button", "Toolbox") anchors { right: accountWidget.left rightMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + style: ButtonStyle + { + background: Rectangle + { + color: control.hovered ? UM.Theme.getColor("secondary") : UM.Theme.getColor("topheader_button_background_active") + radius: 2 * screenScaleFactor + } + + label: Label + { + text: catalog.i18nc("@action:button", "Toolbox") + color: UM.Theme.getColor("topheader_button_text_active") + font: UM.Theme.getFont("action_button") + renderType: Text.NativeRendering + anchors.verticalCenter: control.verticalCenter + } + } - style: UM.Theme.styles.topheader_tab action: Cura.Actions.browsePackages } diff --git a/resources/qml/components/ActionButton.qml b/resources/qml/components/ActionButton.qml index 02c279a458..b49e3f1dcb 100644 --- a/resources/qml/components/ActionButton.qml +++ b/resources/qml/components/ActionButton.qml @@ -19,6 +19,7 @@ Button property var textHoverColor: UM.Theme.getColor("button_text_hover") property var textDisabledColor: textColor property var textFont: UM.Theme.getFont("action_button") + property var cornerRadius: 2 * screenScaleFactor contentItem: Row { @@ -32,6 +33,7 @@ Button sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor visible: button.iconSource != "" + anchors.verticalCenter: parent.verticalCenter } Label @@ -42,12 +44,14 @@ Button font: button.textFont visible: button.text != "" renderType: Text.NativeRendering + anchors.verticalCenter: parent.verticalCenter } } background: Rectangle { color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor + radius: cornerRadius } MouseArea diff --git a/resources/themes/cura-light/icons/circle_outline.svg b/resources/themes/cura-light/icons/circle_outline.svg new file mode 100644 index 0000000000..4d0b0e4eb0 --- /dev/null +++ b/resources/themes/cura-light/icons/circle_outline.svg @@ -0,0 +1,64 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index b08d9e8728..939399efc8 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -90,6 +90,14 @@ QtObject { } } + property Component action_button: Component + { + ButtonStyle + { + + } + } + property Component topheader_tab: Component { ButtonStyle diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e49824ae74..285d2724a0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -87,6 +87,9 @@ "topheader_button_background_active": [255, 255, 255, 255], "topheader_button_background_inactive": [255, 255, 255, 0], + "account_widget_ouline_active": [9, 140, 188, 255], + "account_widget_ouline_inactive": [175, 175, 175, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [12, 169, 227, 255], @@ -341,6 +344,8 @@ "topheader_button": [8, 4], "topheader_button_icon": [1.2, 1.2], + "account_button": [12, 3], + "views_selector": [0.0, 4.0], "default_lining": [0.08, 0.08], From 85436c1469142301ea02cc647df70e42a9eaba7c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 11 Oct 2018 10:29:59 +0200 Subject: [PATCH 014/558] Move machine selector to own component & new location This also simplifies & cleans up the actually used QML CURA-5772 --- resources/qml/Cura.qml | 8 ++++ resources/qml/PrepareSidebar.qml | 39 ++------------- .../MachineAndConfigurationSelector.qml | 48 +++++++++++++++++++ 3 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 resources/qml/components/MachineAndConfigurationSelector.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 50419067b4..f040469916 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -169,6 +169,14 @@ UM.MainWindow action: Cura.Actions.open } + MachineAndConfigurationSelector + { + anchors.left: openFileButton.right + //anchors.right: sidebar.left + anchors.leftMargin: UM.Theme.getSize("default_margin").height + anchors.top: openFileButton.top + } + Toolbar { id: toolbar diff --git a/resources/qml/PrepareSidebar.qml b/resources/qml/PrepareSidebar.qml index fe0fb033f7..a44f3fad7d 100644 --- a/resources/qml/PrepareSidebar.qml +++ b/resources/qml/PrepareSidebar.qml @@ -9,6 +9,8 @@ import UM 1.2 as UM import Cura 1.0 as Cura import "Menus" import "Menus/ConfigurationMenu" +import "components" + Rectangle { @@ -19,7 +21,6 @@ Rectangle property bool hideView: Cura.MachineManager.activeMachineName == "" // Is there an output device for this printer? - property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" property bool printerConnected: Cura.MachineManager.printerConnected property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null @@ -85,41 +86,11 @@ Rectangle } } - MachineSelection - { - id: machineSelection - width: base.width - configSelection.width - separator.width - height: UM.Theme.getSize("sidebar_header").height - anchors.top: base.top - anchors.left: parent.left - } - - Rectangle - { - id: separator - visible: configSelection.visible - width: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 - height: UM.Theme.getSize("sidebar_header").height - color: UM.Theme.getColor("sidebar_lining_thin") - anchors.left: machineSelection.right - } - - ConfigurationSelection - { - id: configSelection - visible: isNetworkPrinter && printerConnected - width: visible ? Math.round(base.width * 0.15) : 0 - height: UM.Theme.getSize("sidebar_header").height - anchors.top: base.top - anchors.right: parent.right - panelWidth: base.width - } - SidebarHeader { id: header width: parent.width visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants) - anchors.top: machineSelection.bottom + anchors.top: parent.top onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() @@ -160,10 +131,9 @@ Rectangle } // Settings mode selection toggle - Rectangle + Item { id: settingsModeSelection - color: "transparent" width: Math.round(parent.width * 0.55) height: UM.Theme.getSize("sidebar_header_mode_toggle").height @@ -328,7 +298,6 @@ Rectangle anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height height: timeDetails.height + costSpec.height width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width) - clip: true Label { diff --git a/resources/qml/components/MachineAndConfigurationSelector.qml b/resources/qml/components/MachineAndConfigurationSelector.qml new file mode 100644 index 0000000000..5b919c42d8 --- /dev/null +++ b/resources/qml/components/MachineAndConfigurationSelector.qml @@ -0,0 +1,48 @@ +// Copyright (c) 2017 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 + +import UM 1.2 as UM +import Cura 1.0 as Cura +import "../Menus" +import "../Menus/ConfigurationMenu" +import ".." + +Rectangle +{ + color: UM.Theme.getColor("sidebar_lining_thin") + + implicitHeight: UM.Theme.getSize("sidebar_header").height + implicitWidth: UM.Theme.getSize("sidebar").width + + property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property bool printerConnected: Cura.MachineManager.printerConnected + + MachineSelection + { + id: machineSelection + anchors + { + left: parent.left + right: configSelection.left + rightMargin: UM.Theme.getSize("sidebar_lining_thin").height / 2 + top: parent.top + bottom: parent.bottom + } + } + + ConfigurationSelection + { + id: configSelection + visible: isNetworkPrinter && printerConnected + width: visible ? Math.round(parent.width * 0.15) : 0 + panelWidth: parent.width + anchors + { + right: parent.right + top: parent.top + bottom: parent.bottom + } + } +} \ No newline at end of file From cc6d5617eefe9431012bbf98496743c4c11723c4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 11 Oct 2018 10:41:29 +0200 Subject: [PATCH 015/558] Update documentation & typing CURA-5772 --- cura/Stages/CuraStage.py | 19 ++++++++++++++----- resources/qml/PrepareSidebar.qml | 6 ++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cura/Stages/CuraStage.py b/cura/Stages/CuraStage.py index b2f6d61799..774a5a6e76 100644 --- a/cura/Stages/CuraStage.py +++ b/cura/Stages/CuraStage.py @@ -5,19 +5,28 @@ 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): + def __init__(self, parent = None) -> None: super().__init__(parent) @pyqtProperty(str, constant = True) - def stageId(self): + def stageId(self) -> str: return self.getPluginId() @pyqtProperty(QUrl, constant = True) - def mainComponent(self): + def mainComponent(self) -> QUrl: return self.getDisplayComponent("main") @pyqtProperty(QUrl, constant = True) - def sidebarComponent(self): + def sidebarComponent(self) -> QUrl: return self.getDisplayComponent("sidebar") + + @pyqtProperty(QUrl, constant=True) + def stageMenuComponent(self) -> QUrl: + return self.getDisplayComponent("menu") \ No newline at end of file diff --git a/resources/qml/PrepareSidebar.qml b/resources/qml/PrepareSidebar.qml index a44f3fad7d..7c99e6e145 100644 --- a/resources/qml/PrepareSidebar.qml +++ b/resources/qml/PrepareSidebar.qml @@ -86,7 +86,8 @@ Rectangle } } - SidebarHeader { + SidebarHeader + { id: header width: parent.width visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants) @@ -96,7 +97,8 @@ Rectangle onHideTooltip: base.hideTooltip() } - Rectangle { + Rectangle + { id: headerSeparator width: parent.width visible: settingsModeSelection.visible && header.visible From f18d490ca1037296b4c507481058f1372cbe2ca3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 11 Oct 2018 13:08:57 +0200 Subject: [PATCH 016/558] Move extruderIcon to it's own location This also simplifies the qml that actually handles the display CURA-5772 --- resources/qml/ExtruderIcon.qml | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 resources/qml/ExtruderIcon.qml diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml new file mode 100644 index 0000000000..2c2edcb492 --- /dev/null +++ b/resources/qml/ExtruderIcon.qml @@ -0,0 +1,56 @@ +import QtQuick 2.7 +import QtQuick.Controls 1.1 +import UM 1.2 as UM + +Item +{ + + id: extruderIconItem + + implicitWidth: UM.Theme.getSize("button").width + implicitHeight: implicitWidth + + property bool checked: true + property alias material_color: materialColorCircle.color + property alias text_color: extruderNumberText.color + + UM.RecolorImage + { + id: mainCircle + anchors.fill: parent + + sourceSize.width: parent.width + sourceSize.height: parent.width + source: UM.Theme.getIcon("extruder_button") + color: extruderNumberText.color + } + + Label + { + id: extruderNumberText + anchors.centerIn: parent + text: index + 1; + font: UM.Theme.getFont("default_bold") + } + + // Material colour circle + // Only draw the filling colour of the material inside the SVG border. + Rectangle + { + id: materialColorCircle + + anchors + { + right: parent.right + } + + width: Math.round(parent.width * 0.35) + height: Math.round(parent.height * 0.35) + radius: Math.round(width / 2) + + border.width: 1 + border.color: UM.Theme.getColor("extruder_button_material_border") + + opacity: !extruderIconItem.checked ? 0.6 : 1.0 + } +} \ No newline at end of file From a861b88de11ed317f32523e233eb0a3a0252aca9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 11 Oct 2018 15:03:37 +0200 Subject: [PATCH 017/558] Move most of the sidebarHeader items to materialAndVariantSelector CURA-5772 --- resources/qml/MaterialAndVariantSelector.qml | 349 +++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 resources/qml/MaterialAndVariantSelector.qml diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/MaterialAndVariantSelector.qml new file mode 100644 index 0000000000..3d2ef2e98f --- /dev/null +++ b/resources/qml/MaterialAndVariantSelector.qml @@ -0,0 +1,349 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +import "Menus" // TODO: This needs to be fixed in the qmldir! + +Rectangle +{ + implicitWidth: parent.width + implicitHeight: parent.height + + id: base + + color: "purple" + // Height has an extra 2x margin for the top & bottom margin. + height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width + + Cura.ExtrudersModel { id: extrudersModel; } + + ListView + { + // Horizontal list that shows the extruders + id: extrudersList + visible: extrudersModel.items.length > 1 + property var index: 0 + + height: UM.Theme.getSize("sidebar_header_mode_tabs").height + boundsBehavior: Flickable.StopAtBounds + + anchors + { + left: parent.left + right: parent.right + top: parent.top + margins: UM.Theme.getSize("sidebar_margin").width + } + + ExclusiveGroup { id: extruderMenuGroup; } + + orientation: ListView.Horizontal + + model: extrudersModel + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + } + + delegate: Button + { + height: parent.height + width: Math.round(ListView.view.width / extrudersModel.rowCount()) + + text: model.name + tooltip: model.name + exclusiveGroup: extruderMenuGroup + checked: Cura.ExtruderManager.activeExtruderIndex == index + + property bool extruder_enabled: true + + MouseArea // TODO; This really should be fixed. It makes absolutely no sense to have a button AND a mouse area. + { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + switch (mouse.button) { + case Qt.LeftButton: + extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled + if (extruder_enabled) + { + forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + Cura.ExtruderManager.setActiveExtruderIndex(index); + } + break; + case Qt.RightButton: + extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled + extruderMenu.popup(); + break; + } + + } + } + + Menu + { + id: extruderMenu + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Enable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) + visible: !extruder_enabled // using an intermediate variable prevents an empty popup that occured now and then + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Disable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) + visible: extruder_enabled + enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + } + } + + style: ButtonStyle + { + background: Rectangle + { + anchors.fill: parent + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border") + } + return UM.Theme.getColor("action_button_border") + } + return UM.Theme.getColor("action_button_disabled_border") + } + color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered") + } + return UM.Theme.getColor("action_button") + } + return UM.Theme.getColor("action_button_disabled") + } + Behavior on color { ColorAnimation { duration: 50; } } + + Item + { + id: extruderButtonFace + anchors.centerIn: parent + width: childrenRect.width + + Label + { + // Static text that holds the "Extruder" label + id: extruderStaticText + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + + color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text") + } + return UM.Theme.getColor("action_button_text") + } + return UM.Theme.getColor("action_button_disabled_text") + } + + font: UM.Theme.getFont("large_nonbold") + text: catalog.i18nc("@label", "Extruder") + visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width) + elide: Text.ElideRight + } + + ExtruderIcon + { + // Round icon with the extruder number and material color indicator. + anchors.verticalCenter: parent.verticalCenter + anchors.left: extruderStaticText.right + width: control.height - Math.round(UM.Theme.getSize("default_margin").width / 2) + height: width + + checked: control.checked + material_color: model.color + text_color: extruderStaticText.color + } + } + } + + label: Item {} + } + } + } + + Item + { + id: materialRow + height: UM.Theme.getSize("sidebar_setup").height + visible: Cura.MachineManager.hasMaterials + + anchors + { + left: parent.left + right: parent.right + top: extrudersList.bottom + margins: UM.Theme.getSize("sidebar_margin").width + } + + Label + { + id: materialLabel + text: catalog.i18nc("@label", "Material"); + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) + height: parent.height + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + ToolButton + { + id: materialSelection + + property var activeExtruder: Cura.MachineManager.activeStack + property var hasActiveExtruder: activeExtruder != null + property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" + + text: currentRootMaterialName + tooltip: currentRootMaterialName + visible: Cura.MachineManager.hasMaterials + + enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 + + height: UM.Theme.getSize("setting_control").height + width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width + anchors.right: parent.right + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + menu: MaterialMenu + { + extruderIndex: Cura.ExtruderManager.activeExtruderIndex + } + + property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true + property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported + } + } + + Item + { + id: variantRow + height: UM.Theme.getSize("sidebar_setup").height + visible: Cura.MachineManager.hasVariants + + anchors + { + left: parent.left + right: parent.right + top: materialRow.bottom + margins: UM.Theme.getSize("sidebar_margin").width + } + + Label + { + id: variantLabel + text: Cura.MachineManager.activeDefinitionVariantsName; + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) + height: parent.height + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + ToolButton + { + id: variantSelection + text: Cura.MachineManager.activeVariantName + tooltip: Cura.MachineManager.activeVariantName; + visible: Cura.MachineManager.hasVariants + + height: UM.Theme.getSize("setting_control").height + width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width) + anchors.right: parent.right + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + + menu: NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } + } + } + + Item + { + id: materialCompatibilityLink + height: UM.Theme.getSize("sidebar_setup").height + + anchors.right: parent.right + anchors.top: variantRow.bottom + anchors.margins: UM.Theme.getSize("sidebar_margin").width + UM.RecolorImage + { + id: warningImage + + anchors.right: materialInfoLabel.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + source: UM.Theme.getIcon("warning") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: UM.Theme.getColor("material_compatibility_warning") + + visible: !Cura.MachineManager.isCurrentSetupSupported + } + + Label + { + id: materialInfoLabel + wrapMode: Text.WordWrap + text: "" + catalog.i18nc("@label", "Check compatibility") + "" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + linkColor: UM.Theme.getColor("text_link") + + verticalAlignment: Text.AlignTop + + anchors.right: parent.right + + MouseArea + { + anchors.fill: parent + + onClicked: { + // open the material URL with web browser + Qt.openUrlExternally("https://ultimaker.com/incoming-links/cura/material-compatibilty"); + } + } + } + } + +} \ No newline at end of file From 9ab0fdfb68e12576977e226103c88f428f4cbce3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 11 Oct 2018 15:03:37 +0200 Subject: [PATCH 018/558] Move most of the sidebarHeader items to materialAndVariantSelector CURA-5772 --- resources/qml/MaterialAndVariantSelector.qml | 349 +++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 resources/qml/MaterialAndVariantSelector.qml diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/MaterialAndVariantSelector.qml new file mode 100644 index 0000000000..8acaba9ec7 --- /dev/null +++ b/resources/qml/MaterialAndVariantSelector.qml @@ -0,0 +1,349 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +import "Menus" // TODO: This needs to be fixed in the qmldir! + +Rectangle +{ + implicitWidth: parent.width + implicitHeight: parent.height + + id: base + color: UM.Theme.getColor("sidebar") + + // Height has an extra 2x margin for the top & bottom margin. + height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width + + Cura.ExtrudersModel { id: extrudersModel; } + + ListView + { + // Horizontal list that shows the extruders + id: extrudersList + visible: extrudersModel.items.length > 1 + property var index: 0 + + height: UM.Theme.getSize("sidebar_header_mode_tabs").height + boundsBehavior: Flickable.StopAtBounds + + anchors + { + left: parent.left + right: parent.right + top: parent.top + margins: UM.Theme.getSize("sidebar_margin").width + } + + ExclusiveGroup { id: extruderMenuGroup; } + + orientation: ListView.Horizontal + + model: extrudersModel + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + } + + delegate: Button + { + height: parent.height + width: Math.round(ListView.view.width / extrudersModel.rowCount()) + + text: model.name + tooltip: model.name + exclusiveGroup: extruderMenuGroup + checked: Cura.ExtruderManager.activeExtruderIndex == index + + property bool extruder_enabled: true + + MouseArea // TODO; This really should be fixed. It makes absolutely no sense to have a button AND a mouse area. + { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + switch (mouse.button) { + case Qt.LeftButton: + extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled + if (extruder_enabled) + { + forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + Cura.ExtruderManager.setActiveExtruderIndex(index); + } + break; + case Qt.RightButton: + extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled + extruderMenu.popup(); + break; + } + + } + } + + Menu + { + id: extruderMenu + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Enable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) + visible: !extruder_enabled // using an intermediate variable prevents an empty popup that occured now and then + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Disable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) + visible: extruder_enabled + enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + } + } + + style: ButtonStyle + { + background: Rectangle + { + anchors.fill: parent + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border") + } + return UM.Theme.getColor("action_button_border") + } + return UM.Theme.getColor("action_button_disabled_border") + } + color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered") + } + return UM.Theme.getColor("action_button") + } + return UM.Theme.getColor("action_button_disabled") + } + Behavior on color { ColorAnimation { duration: 50; } } + + Item + { + id: extruderButtonFace + anchors.centerIn: parent + width: childrenRect.width + + Label + { + // Static text that holds the "Extruder" label + id: extruderStaticText + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + + color: { + if (Cura.MachineManager.getExtruder(index).isEnabled) + { + if(control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text") + } + return UM.Theme.getColor("action_button_text") + } + return UM.Theme.getColor("action_button_disabled_text") + } + + font: UM.Theme.getFont("large_nonbold") + text: catalog.i18nc("@label", "Extruder") + visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width) + elide: Text.ElideRight + } + + ExtruderIcon + { + // Round icon with the extruder number and material color indicator. + anchors.verticalCenter: parent.verticalCenter + anchors.left: extruderStaticText.right + width: control.height - Math.round(UM.Theme.getSize("default_margin").width / 2) + height: width + + checked: control.checked + material_color: model.color + text_color: extruderStaticText.color + } + } + } + + label: Item {} + } + } + } + + Item + { + id: materialRow + height: UM.Theme.getSize("sidebar_setup").height + visible: Cura.MachineManager.hasMaterials + + anchors + { + left: parent.left + right: parent.right + top: extrudersList.bottom + margins: UM.Theme.getSize("sidebar_margin").width + } + + Label + { + id: materialLabel + text: catalog.i18nc("@label", "Material"); + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) + height: parent.height + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + ToolButton + { + id: materialSelection + + property var activeExtruder: Cura.MachineManager.activeStack + property var hasActiveExtruder: activeExtruder != null + property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" + + text: currentRootMaterialName + tooltip: currentRootMaterialName + visible: Cura.MachineManager.hasMaterials + + enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 + + height: UM.Theme.getSize("setting_control").height + width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width + anchors.right: parent.right + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + menu: MaterialMenu + { + extruderIndex: Cura.ExtruderManager.activeExtruderIndex + } + + property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true + property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported + } + } + + Item + { + id: variantRow + height: UM.Theme.getSize("sidebar_setup").height + visible: Cura.MachineManager.hasVariants + + anchors + { + left: parent.left + right: parent.right + top: materialRow.bottom + margins: UM.Theme.getSize("sidebar_margin").width + } + + Label + { + id: variantLabel + text: Cura.MachineManager.activeDefinitionVariantsName; + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) + height: parent.height + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + ToolButton + { + id: variantSelection + text: Cura.MachineManager.activeVariantName + tooltip: Cura.MachineManager.activeVariantName; + visible: Cura.MachineManager.hasVariants + + height: UM.Theme.getSize("setting_control").height + width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width) + anchors.right: parent.right + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + + menu: NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } + } + } + + Item + { + id: materialCompatibilityLink + height: UM.Theme.getSize("sidebar_setup").height + + anchors.right: parent.right + anchors.top: variantRow.bottom + anchors.margins: UM.Theme.getSize("sidebar_margin").width + UM.RecolorImage + { + id: warningImage + + anchors.right: materialInfoLabel.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + source: UM.Theme.getIcon("warning") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: UM.Theme.getColor("material_compatibility_warning") + + visible: !Cura.MachineManager.isCurrentSetupSupported + } + + Label + { + id: materialInfoLabel + wrapMode: Text.WordWrap + text: "" + catalog.i18nc("@label", "Check compatibility") + "" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + linkColor: UM.Theme.getColor("text_link") + + verticalAlignment: Text.AlignTop + + anchors.right: parent.right + + MouseArea + { + anchors.fill: parent + + onClicked: { + // open the material URL with web browser + Qt.openUrlExternally("https://ultimaker.com/incoming-links/cura/material-compatibilty"); + } + } + } + } + +} \ No newline at end of file From bb7582159910728976e4e020d0b61de2b0b08ce2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 11 Oct 2018 13:44:10 +0200 Subject: [PATCH 019/558] Fix some code style Contributes to issue CURA-5784. --- resources/qml/Cura.qml | 22 ++++++++++++--------- resources/qml/Skeleton/ApplicationMenu.qml | 12 +++++------ resources/qml/Skeleton/ApplicationViews.qml | 16 ++++++++------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f040469916..8369c2a743 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -27,21 +27,25 @@ UM.MainWindow UM.I18nCatalog { id: catalog - name:"cura" + name: "cura" } onWidthChanged: { // If slidebar is collapsed then it should be invisible // otherwise after the main_window resize the sidebar will be fully re-drawn - if (sidebar.collapsed){ - if (sidebar.visible == true){ + if (sidebar.collapsed) + { + if (sidebar.visible == true) + { sidebar.visible = false sidebar.initialWidth = 0 } } - else{ - if (sidebar.visible == false){ + else + { + if (sidebar.visible == false) + { sidebar.visible = true sidebar.initialWidth = UM.Theme.getSize("sidebar").width } @@ -156,7 +160,7 @@ UM.MainWindow Button { id: openFileButton - text: catalog.i18nc("@action:button","Open File") + text: catalog.i18nc("@action:button", "Open File") iconSource: UM.Theme.getIcon("load") style: UM.Theme.styles.tool_button tooltip: "" @@ -352,10 +356,10 @@ UM.MainWindow { //; Remove & re-add the general page as we want to use our own instead of uranium standard. removePage(0); - insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml")); + insertPage(0, catalog.i18nc("@title:tab", "General"), Qt.resolvedUrl("Preferences/GeneralPage.qml")); removePage(1); - insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml")); + insertPage(1, catalog.i18nc("@title:tab", "Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml")); insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml")); @@ -528,7 +532,7 @@ UM.MainWindow id: openDialog; //: File open dialog title - title: catalog.i18nc("@title:window","Open file(s)") + title: catalog.i18nc("@title:window", "Open file(s)") modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal; selectMultiple: true nameFilters: UM.MeshFileHandler.supportedReadFileTypes; diff --git a/resources/qml/Skeleton/ApplicationMenu.qml b/resources/qml/Skeleton/ApplicationMenu.qml index a8774e8ceb..00859e2a45 100644 --- a/resources/qml/Skeleton/ApplicationMenu.qml +++ b/resources/qml/Skeleton/ApplicationMenu.qml @@ -27,7 +27,7 @@ Item Menu { id: fileMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&File") + title: catalog.i18nc("@title:menu menubar:toplevel", "&File") MenuItem { @@ -46,7 +46,7 @@ Item MenuItem { id: saveWorkspaceMenu - text: catalog.i18nc("@title:menu menubar:file","&Save...") + text: catalog.i18nc("@title:menu menubar:file", "&Save...") onTriggered: { var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; @@ -99,7 +99,7 @@ Item Menu { - title: catalog.i18nc("@title:menu menubar:toplevel","&Edit") + title: catalog.i18nc("@title:menu menubar:toplevel", "&Edit") MenuItem { action: Cura.Actions.undo } MenuItem { action: Cura.Actions.redo } @@ -181,7 +181,7 @@ Item Menu { id: extensionMenu - title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions") + title: catalog.i18nc("@title:menu menubar:toplevel", "E&xtensions") Instantiator { @@ -223,7 +223,7 @@ Item Menu { id: preferencesMenu - title: catalog.i18nc("@title:menu menubar:toplevel","P&references") + title: catalog.i18nc("@title:menu menubar:toplevel", "P&references") MenuItem { action: Cura.Actions.preferences } } @@ -231,7 +231,7 @@ Item Menu { id: helpMenu - title: catalog.i18nc("@title:menu menubar:toplevel","&Help") + title: catalog.i18nc("@title:menu menubar:toplevel", "&Help") MenuItem { action: Cura.Actions.showProfileFolder } MenuItem { action: Cura.Actions.documentation } diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index 94315a73fb..eb8ab16fae 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -11,9 +11,9 @@ import Cura 1.0 as Cura import "../components" -// This item contains the views selector, a combobox that is dinamically created from -// the list of available Views (packages that create different visualizactions of the -// scene. Aside the selector, there is a row of buttons that change the orientation of the view. +// This item contains the views selector, a combobox that is dynamically created from +// the list of available Views (packages that create different visualizations of the +// scene). Aside from the selector, there is a row of buttons that change the orientation of the view. Item { id: applicationViewsSelector @@ -25,7 +25,8 @@ Item { id: viewModeButton - anchors { + anchors + { verticalCenter: parent.verticalCenter right: parent.right rightMargin: UM.Theme.getSize("default_margin").width @@ -51,15 +52,16 @@ Item { for (var i = 0; i < model.rowCount(); i++) { - if (model.getItem(i).active) { - return i + if (model.getItem(i).active) + { + return i; } } return 0 } // set the active index - function setActiveIndex (index) + function setActiveIndex(index) { UM.Controller.setActiveView(index) // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here From 10de312647a1e38db0ae6c24b0d06b3e807f7f37 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 12 Oct 2018 13:28:08 +0200 Subject: [PATCH 020/558] Added QMLDIR so we can specify cura specific QML components for plugins This ensures that we can be way more explicit with what QML components we see as re-usable CURA-5772 --- resources/qml/qmldir | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 resources/qml/qmldir diff --git a/resources/qml/qmldir b/resources/qml/qmldir new file mode 100644 index 0000000000..5083b5e80a --- /dev/null +++ b/resources/qml/qmldir @@ -0,0 +1,5 @@ +module Cura + +MachineAndConfigurationSelector 1.0 components/MachineAndConfigurationSelector.qml +MaterialAndVariantSelector 1.0 MaterialAndVariantSelector.qml +ProfileAndSettingComponent 1.0 ProfileAndSettingComponent.qml \ No newline at end of file From 7d5472b09fe0a0fc524b36ab9c9d85e54c68d241 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 12 Oct 2018 13:29:57 +0200 Subject: [PATCH 021/558] Moved the prepareMenu into the prepare stage plugin CURA-5772 --- plugins/PrepareStage/PrepareMenu.qml | 42 ++++++++++++++++++++++++++++ plugins/PrepareStage/PrepareStage.py | 6 +++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/PrepareStage/PrepareMenu.qml diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml new file mode 100644 index 0000000000..eb09326524 --- /dev/null +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -0,0 +1,42 @@ +import QtQuick 2.7 + +import QtQuick.Controls 1.4 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +Row +{ + spacing: UM.Theme.getSize("default_margin").width + + UM.I18nCatalog + { + id: catalog + name:"cura" + } + + Button + { + id: openFileButton; + text: catalog.i18nc("@action:button", "Open File"); + iconSource: UM.Theme.getIcon("load") + style: UM.Theme.styles.tool_button + tooltip: "" + action: Cura.Actions.open; + } + + Cura.MachineAndConfigurationSelector + { + } + + Cura.MaterialAndVariantSelector + { + width: UM.Theme.getSize("sidebar").width + } + + Cura.ProfileAndSettingComponent + { + width: UM.Theme.getSize("sidebar").width + } +} \ No newline at end of file diff --git a/plugins/PrepareStage/PrepareStage.py b/plugins/PrepareStage/PrepareStage.py index c3c9f0a1f8..b22f3385b8 100644 --- a/plugins/PrepareStage/PrepareStage.py +++ b/plugins/PrepareStage/PrepareStage.py @@ -2,13 +2,14 @@ # 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 + ## Stage for preparing model (slicing). class PrepareStage(CuraStage): - def __init__(self, parent = None): super().__init__(parent) Application.getInstance().engineCreatedSignal.connect(self._engineCreated) @@ -16,4 +17,7 @@ class PrepareStage(CuraStage): def _engineCreated(self): sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles), "PrepareSidebar.qml") + + menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("PrepareStage"), "PrepareMenu.qml") + self.addDisplayComponent("menu", menu_component_path) self.addDisplayComponent("sidebar", sidebar_component_path) From 11a08d0e472612b7c5377273cf2435c1a17cb3c4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 12 Oct 2018 13:32:23 +0200 Subject: [PATCH 022/558] Move whole bunch of QML components to their new locations The tooltips are still not working correctly, it might be that it needs rework CURA-5772 --- resources/qml/Cura.qml | 149 +++++--- resources/qml/ExtruderIcon.qml | 1 - resources/qml/MaterialAndVariantSelector.qml | 2 +- ...bar.qml => ProfileAndSettingComponent.qml} | 330 ++++++------------ resources/qml/ProgressAndSaveWidget.qml | 237 +++++++++++++ resources/qml/SaveButton.qml | 165 +++++---- resources/qml/Settings/SettingView.qml | 9 +- resources/qml/SidebarHeader.qml | 3 +- resources/qml/Skeleton/TopHeader.qml | 3 +- 9 files changed, 536 insertions(+), 363 deletions(-) rename resources/qml/{PrepareSidebar.qml => ProfileAndSettingComponent.qml} (66%) create mode 100644 resources/qml/ProgressAndSaveWidget.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 8369c2a743..f89f8d63dd 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -21,36 +21,45 @@ UM.MainWindow // Cura application window title title: catalog.i18nc("@title:window", "Ultimaker Cura") - viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) + //viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) + viewportRect: Qt.rect(0, 0, 1.0, 1.0) backgroundColor: UM.Theme.getColor("viewport_background") UM.I18nCatalog { id: catalog - name: "cura" + name:"cura" } - onWidthChanged: + function showTooltip(item, position, text) + { + tooltip.text = text; + position = item.mapToItem(backgroundItem, position.x - UM.Theme.getSize("default_arrow").width, position.y); + tooltip.show(position); + } + + function hideTooltip() + { + tooltip.hide(); + } + + /*onWidthChanged: { // If slidebar is collapsed then it should be invisible // otherwise after the main_window resize the sidebar will be fully re-drawn - if (sidebar.collapsed) - { - if (sidebar.visible == true) - { + if (sidebar.collapsed){ + if (sidebar.visible == true){ sidebar.visible = false sidebar.initialWidth = 0 } } - else - { - if (sidebar.visible == false) - { + else{ + if (sidebar.visible == false){ sidebar.visible = true sidebar.initialWidth = UM.Theme.getSize("sidebar").width } } - } + }*/ Component.onCompleted: { @@ -69,11 +78,16 @@ UM.MainWindow CuraApplication.purgeWindows() } - Column + Item { id: backgroundItem anchors.fill: parent + SidebarTooltip + { + id: tooltip + } + signal hasMesh(string name) //this signal sends the filebase name so it can be used for the JobSpecs.qml function getMeshName(path) { @@ -94,26 +108,34 @@ UM.MainWindow ApplicationMenu { - id: menu + id: applicationMenu window: base } TopHeader { id: topHeader - anchors.left: parent.left - anchors.right: parent.right + anchors + { + left: parent.left + right: parent.right + top: applicationMenu.bottom + } } Item { id: contentItem - width: parent.width - height: parent.height - menu.height - topHeader.height - z: topHeader.z - 1 + anchors + { + top: topHeader.bottom + bottom: parent.bottom + left: parent.left + right: parent.right + } - Keys.forwardTo: menu + Keys.forwardTo: applicationMenu DropArea { @@ -145,41 +167,39 @@ UM.MainWindow } } + Loader + { + // The stage menu is, as the name implies, a menu that is defined by the active stage. + // Note that this menu does not need to be set at all! It's perfectly acceptable to have a stage + // without this menu! + id: stageMenu + + anchors + { + left: parent.left + right: parent.right + top: parent.top + margins: UM.Theme.getSize("default_margin").height + } + + height: 50 + + source: UM.Controller.activeStage.stageMenuComponent + } + JobSpecs { id: jobSpecs anchors { bottom: parent.bottom - right: sidebar.left + //right: sidebar.left bottomMargin: UM.Theme.getSize("default_margin").height rightMargin: UM.Theme.getSize("default_margin").width } } - Button - { - id: openFileButton - text: catalog.i18nc("@action:button", "Open File") - iconSource: UM.Theme.getIcon("load") - style: UM.Theme.styles.tool_button - tooltip: "" - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - } - action: Cura.Actions.open - } - MachineAndConfigurationSelector - { - anchors.left: openFileButton.right - //anchors.right: sidebar.left - anchors.leftMargin: UM.Theme.getSize("default_margin").height - anchors.top: openFileButton.top - } Toolbar { @@ -189,7 +209,7 @@ UM.MainWindow property int mouseY: base.mouseY anchors { - top: openFileButton.bottom + top: stageMenu.bottom topMargin: UM.Theme.getSize("window_margin").height left: parent.left } @@ -206,7 +226,7 @@ UM.MainWindow } } - ApplicationViews + /*ApplicationViews { id: applicationViews @@ -216,7 +236,7 @@ UM.MainWindow top: parent.top right: sidebar.left } - } + }*/ Loader { @@ -227,7 +247,7 @@ UM.MainWindow top: parent.top bottom: parent.bottom left: parent.left - right: sidebar.left + right: parent.right } MouseArea @@ -241,7 +261,7 @@ UM.MainWindow source: UM.Controller.activeStage.mainComponent } - Loader + /*Loader { id: sidebar @@ -311,7 +331,7 @@ UM.MainWindow acceptedButtons: Qt.AllButtons onWheel: wheel.accepted = true } - } + }*/ UM.MessageStack { @@ -338,15 +358,33 @@ UM.MainWindow bottom: parent.bottom } } + + + ProgressAndSaveWidget + { + anchors.right: parent.right + anchors.bottom: parent.bottom + width: UM.Theme.getSize("sidebar").width + anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + onShowTooltip: + { + base.showTooltip(item, location, text) + } + onHideTooltip: + { + base.hideTooltip() + } + } } } // Expand or collapse sidebar - Connections + /*Connections { target: Cura.Actions.expandSidebar onTriggered: sidebar.callExpandOrCollapse() - } + }*/ UM.PreferencesDialog { @@ -356,10 +394,10 @@ UM.MainWindow { //; Remove & re-add the general page as we want to use our own instead of uranium standard. removePage(0); - insertPage(0, catalog.i18nc("@title:tab", "General"), Qt.resolvedUrl("Preferences/GeneralPage.qml")); + insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml")); removePage(1); - insertPage(1, catalog.i18nc("@title:tab", "Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml")); + insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml")); insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml")); @@ -532,7 +570,7 @@ UM.MainWindow id: openDialog; //: File open dialog title - title: catalog.i18nc("@title:window", "Open file(s)") + title: catalog.i18nc("@title:window","Open file(s)") modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal; selectMultiple: true nameFilters: UM.MeshFileHandler.supportedReadFileTypes; @@ -638,7 +676,8 @@ UM.MainWindow modality: Qt.ApplicationModal } - MessageDialog { + MessageDialog + { id: infoMultipleFilesWithGcodeDialog title: catalog.i18nc("@title:window", "Open File(s)") icon: StandardIcon.Information diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 2c2edcb492..580ff5dce9 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -4,7 +4,6 @@ import UM 1.2 as UM Item { - id: extruderIconItem implicitWidth: UM.Theme.getSize("button").width diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/MaterialAndVariantSelector.qml index 325ffa85a5..fff3ef1100 100644 --- a/resources/qml/MaterialAndVariantSelector.qml +++ b/resources/qml/MaterialAndVariantSelector.qml @@ -17,7 +17,7 @@ Rectangle id: base color: UM.Theme.getColor("sidebar") - + // Height has an extra 2x margin for the top & bottom margin. height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrepareSidebar.qml b/resources/qml/ProfileAndSettingComponent.qml similarity index 66% rename from resources/qml/PrepareSidebar.qml rename to resources/qml/ProfileAndSettingComponent.qml index 7c99e6e145..33c2f37fb1 100644 --- a/resources/qml/PrepareSidebar.qml +++ b/resources/qml/ProfileAndSettingComponent.qml @@ -16,14 +16,10 @@ Rectangle { id: base + height: childrenRect.height + property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced - property bool hideView: Cura.MachineManager.activeMachineName == "" - - // Is there an output device for this printer? - property bool printerConnected: Cura.MachineManager.printerConnected - property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands - property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null property variant printDuration: PrintInformation.currentPrintTime property variant printMaterialLengths: PrintInformation.materialLengths @@ -34,7 +30,8 @@ Rectangle color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} - Timer { + Timer + { id: tooltipDelayTimer interval: 500 repeat: false @@ -59,7 +56,8 @@ Rectangle tooltip.hide(); } - function strPadLeft(string, pad, length) { + function strPadLeft(string, pad, length) + { return (new Array(length + 1).join(pad) + string).slice(-length); } @@ -86,35 +84,9 @@ Rectangle } } - SidebarHeader - { - id: header - width: parent.width - visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants) - anchors.top: parent.top - - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - - Rectangle - { - id: headerSeparator - width: parent.width - visible: settingsModeSelection.visible && header.visible - height: visible ? UM.Theme.getSize("sidebar_lining").height : 0 - color: UM.Theme.getColor("sidebar_lining") - anchors.top: header.bottom - anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0 - } - onCurrentModeIndexChanged: { UM.Preferences.setValue("cura/active_mode", currentModeIndex); - if(modesListModel.count > base.currentModeIndex) - { - sidebarContents.replace(modesListModel.get(base.currentModeIndex).item, { "replace": true }) - } } Label @@ -122,176 +94,129 @@ Rectangle id: settingsModeLabel text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified") renderType: Text.NativeRendering - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width - anchors.top: hideSettings ? machineSelection.bottom : headerSeparator.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + + anchors + { + left: parent.left + top: parent.top + margins: UM.Theme.getSize("sidebar_margin").width + } + width: Math.round(parent.width * 0.45) + height: contentHeight font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") - visible: !hideView } - // Settings mode selection toggle - Item - { - id: settingsModeSelection + ListView + { + // Settings mode selection toggle + id: settingsModeSelection + model: modesListModel width: Math.round(parent.width * 0.55) height: UM.Theme.getSize("sidebar_header_mode_toggle").height anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height - anchors.top: - { - if (settingsModeLabel.contentWidth >= parent.width - width - UM.Theme.getSize("sidebar_margin").width * 2) - { - return settingsModeLabel.bottom; - } - else - { - return headerSeparator.bottom; - } - } - visible: !hideSettings && !hideView - - Component - { - id: wizardDelegate - - Button - { - id: control - - height: settingsModeSelection.height - width: Math.round(parent.width / 2) - - anchors.left: parent.left - anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2) - anchors.verticalCenter: parent.verticalCenter - - ButtonGroup.group: modeMenuGroup - - checkable: true - checked: base.currentModeIndex == index - onClicked: base.currentModeIndex = index - - onHoveredChanged: - { - if (hovered) - { - tooltipDelayTimer.item = settingsModeSelection - tooltipDelayTimer.text = model.tooltipText - tooltipDelayTimer.start() - } - else - { - tooltipDelayTimer.stop() - base.hideTooltip() - } - } - - background: Rectangle - { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border"): UM.Theme.getColor("action_button_border") - - // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - - contentItem: Label - { - text: model.text - font: UM.Theme.getFont("default") - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - elide: Text.ElideRight - color: - { - if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - } - } - } + anchors.top: settingsModeLabel.top ButtonGroup { id: modeMenuGroup } - ListView + delegate: Button { - id: modesList - model: modesListModel - delegate: wizardDelegate - anchors.top: parent.top + id: control + + height: settingsModeSelection.height + width: Math.round(parent.width / 2) + anchors.left: parent.left - width: parent.width - } - } + anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2) + anchors.verticalCenter: parent.verticalCenter - StackView - { - id: sidebarContents + ButtonGroup.group: modeMenuGroup - anchors.bottom: footerSeparator.top - anchors.top: settingsModeSelection.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height - anchors.left: base.left - anchors.right: base.right - visible: !hideSettings + checkable: true + checked: base.currentModeIndex == index + onClicked: base.currentModeIndex = index - replaceEnter: Transition { - PropertyAnimation { - property: "opacity" - from: 0 - to:1 - duration: 100 + onHoveredChanged: + { + if (hovered) + { + tooltipDelayTimer.item = settingsModeSelection + tooltipDelayTimer.text = model.tooltipText + tooltipDelayTimer.start() + } + else + { + tooltipDelayTimer.stop() + base.hideTooltip() + } + } + + background: Rectangle + { + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border"): UM.Theme.getColor("action_button_border") + + // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + } + + contentItem: Label + { + text: model.text + font: UM.Theme.getFont("default") + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + renderType: Text.NativeRendering + elide: Text.ElideRight + color: + { + if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } } } - - replaceExit: Transition { - PropertyAnimation { - property: "opacity" - from: 1 - to:0 - duration: 100 - } - } - } - - Loader - { - anchors.bottom: footerSeparator.top - anchors.top: headerSeparator.bottom - anchors.left: base.left - anchors.right: base.right - source: "SidebarContents.qml" - } - - Rectangle - { - id: footerSeparator - width: parent.width - height: UM.Theme.getSize("sidebar_lining").height - color: UM.Theme.getColor("sidebar_lining") - anchors.bottom: printSpecs.top - anchors.bottomMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize) } Item + { + id: sidebarContents + anchors.top: settingsModeSelection.bottom + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.left: parent.left + anchors.right: parent.right + height: 500 + + // We load both of them at once (instead of using a loader) because the advanced sidebar can take + // quite some time to load. So in this case we sacrifice memory for speed. + SidebarAdvanced + { + anchors.fill: parent + visible: currentModeIndex == 1 + } + + SidebarSimple + { + anchors.fill: parent + visible: currentModeIndex != 1 + } + } + + /*Item { id: printSpecs anchors.left: parent.left @@ -499,22 +424,23 @@ Rectangle } } } - } + }*/ // SaveButton is actually the bottom footer panel. - SaveButton + /*SaveButton { id: saveButton implicitWidth: base.width anchors.top: footerSeparator.bottom anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.bottom: parent.bottom - } + }*/ + /* SidebarTooltip { id: tooltip - } + }*/ // Setting mode: Recommended or Custom ListModel @@ -522,35 +448,15 @@ Rectangle id: modesListModel } - SidebarSimple - { - id: sidebarSimple - visible: false - - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - - SidebarAdvanced - { - id: sidebarAdvanced - visible: false - - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - Component.onCompleted: { modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), - tooltipText: catalog.i18nc("@tooltip", "Recommended Print Setup

Print with the recommended settings for the selected printer, material and quality."), - item: sidebarSimple + tooltipText: catalog.i18nc("@tooltip", "Recommended Print Setup

Print with the recommended settings for the selected printer, material and quality.") }) modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), - tooltipText: catalog.i18nc("@tooltip", "Custom Print Setup

Print with finegrained control over every last bit of the slicing process."), - item: sidebarAdvanced + tooltipText: catalog.i18nc("@tooltip", "Custom Print Setup

Print with finegrained control over every last bit of the slicing process.") }) var index = Math.round(UM.Preferences.getValue("cura/active_mode")) @@ -564,24 +470,4 @@ Rectangle currentModeIndex = 0; } } - - UM.SettingPropertyProvider - { - id: machineExtruderCount - - containerStack: Cura.MachineManager.activeMachine - key: "machine_extruder_count" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: machineHeatedBed - - containerStack: Cura.MachineManager.activeMachine - key: "machine_heated_bed" - watchedProperties: [ "value" ] - storeIndex: 0 - } } diff --git a/resources/qml/ProgressAndSaveWidget.qml b/resources/qml/ProgressAndSaveWidget.qml new file mode 100644 index 0000000000..88819af759 --- /dev/null +++ b/resources/qml/ProgressAndSaveWidget.qml @@ -0,0 +1,237 @@ +// Copyright (c) 2017 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.Layouts 1.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Rectangle +{ + id: base + + // We need a whole lot of print duration information. + property variant printDuration: PrintInformation.currentPrintTime + + // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + + // Also add an extra margin, as we ant some breathing room around the edges. + height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height + Label + { + id: timeDetails + anchors.left: parent.left + anchors.bottom: costSpec.top + anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text_subtext") + text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + renderType: Text.NativeRendering + + MouseArea + { + id: timeDetailsMouseArea + anchors.fill: parent + hoverEnabled: true + + onEntered: + { + if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) + { + // All the time information for the different features is achieved + var print_time = PrintInformation.getFeaturePrintTimes(); + var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) + + // A message is created and displayed when the user hover the time label + var tooltip_html = "%1
".arg(catalog.i18nc("@tooltip", "Time specification")); + for(var feature in print_time) + { + if(!print_time[feature].isTotalDurationZero) + { + tooltip_html += "" + + "".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + + "".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) + + ""; + } + } + tooltip_html += "
" + feature + ":  %1  %1%
"; + //print("trying to show tooltip", base, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html) + base.showTooltip(parent, Qt.point(0, 0), tooltip_html); + } + } + onExited: + { + base.hideTooltip(); + } + } + } + + Label + { + function formatRow(items) + { + var row_html = ""; + for(var item = 0; item < items.length; item++) + { + if (item == 0) + { + row_html += "%1".arg(items[item]); + } + else + { + row_html += "  %1".arg(items[item]); + } + } + row_html += ""; + return row_html; + } + + function getSpecsData() + { + var lengths = []; + var total_length = 0; + var weights = []; + var total_weight = 0; + var costs = []; + var total_cost = 0; + var some_costs_known = false; + var names = []; + if(base.printMaterialLengths) + { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) + { + names.push(base.printMaterialNames[index]); + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.round(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) + { + some_costs_known = true; + } + + total_length += base.printMaterialLengths[index]; + total_weight += base.printMaterialWeights[index]; + total_cost += base.printMaterialCosts[index]; + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + + var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification")); + for(var index = 0; index < lengths.length; index++) + { + tooltip_html += formatRow([ + "%1:".arg(names[index]), + catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), + catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), + "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), + ]); + } + if(lengths.length > 1) + { + tooltip_html += formatRow([ + catalog.i18nc("@label", "Total:"), + catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)), + catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)), + "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)), + ]); + } + tooltip_html += "
"; + tooltipText = tooltip_html; + + return tooltipText + } + + id: costSpec + + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + + font: UM.Theme.getFont("very_small") + renderType: Text.NativeRendering + color: UM.Theme.getColor("text_subtext") + elide: Text.ElideMiddle + width: parent.width + property string tooltipText + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) + { + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.round(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) + { + someCostsKnown = true; + } + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + var result = lengths.join(" + ") + "m / ~ " + weights.join(" + ") + "g"; + if(someCostsKnown) + { + result += " / ~ " + costs.join(" + ") + " " + UM.Preferences.getValue("cura/currency"); + } + return result; + } + + MouseArea + { + id: costSpecMouseArea + anchors.fill: parent + hoverEnabled: true + + onEntered: + { + + if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) + { + var show_data = costSpec.getSpecsData() + + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), show_data); + } + } + onExited: + { + base.hideTooltip(); + } + } + } + + SaveButton + { + id: saveButton + width: parent.width + height: 100 + anchors.bottom: parent.bottom + } +} \ No newline at end of file diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 2a0a523026..8c561b0d00 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -9,7 +9,9 @@ import QtQuick.Layouts 1.1 import UM 1.1 as UM import Cura 1.0 as Cura -Item { +// This widget does so much more than "just" being a save button, so it should be refactored at some point in time. +Item +{ id: base; UM.I18nCatalog { id: catalog; name:"cura"} @@ -27,10 +29,6 @@ Item { return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model"); } - if (base.backendState == "undefined") { - return "" - } - switch(base.backendState) { case 1: @@ -48,19 +46,23 @@ Item { } } - function sliceOrStopSlicing() { + function sliceOrStopSlicing() + { try { - if ([1, 5].indexOf(base.backendState) != -1) { + if ([1, 5].indexOf(base.backendState) != -1) + { CuraApplication.backend.forceSlice(); } else { CuraApplication.backend.stopSlicing(); } - } catch (e) { + } catch (e) + { console.log('Could not start or stop slicing', e) } } - Label { + Label + { id: statusLabel width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width anchors.top: parent.top @@ -72,7 +74,8 @@ Item { text: statusText; } - Rectangle { + Rectangle + { id: progressBar width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width height: UM.Theme.getSize("progressbar").height @@ -83,32 +86,37 @@ Item { radius: UM.Theme.getSize("progressbar_radius").width color: UM.Theme.getColor("progressbar_background") - Rectangle { + Rectangle + { width: Math.max(parent.width * base.progress) height: parent.height color: UM.Theme.getColor("progressbar_control") radius: UM.Theme.getSize("progressbar_radius").width - visible: (base.backendState != "undefined" && base.backendState == 2) ? true : false + visible: base.backendState == 2 } } // Shortcut for "save as/print/..." - Action { + Action + { shortcut: "Ctrl+P" onTriggered: { // only work when the button is enabled - if (saveToButton.enabled) { + if (saveToButton.enabled) + { saveToButton.clicked(); } // prepare button - if (prepareButton.enabled) { + if (prepareButton.enabled) + { sliceOrStopSlicing(); } } } - Item { + Item + { id: saveRow width: { // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect @@ -129,7 +137,8 @@ Item { anchors.right: parent.right clip: true - Row { + Row + { id: additionalComponentsRow anchors.top: parent.top anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right) @@ -138,24 +147,30 @@ Item { spacing: UM.Theme.getSize("default_margin").width } - Component.onCompleted: { + Component.onCompleted: + { saveRow.addAdditionalComponents("saveButton") } - Connections { + Connections + { target: CuraApplication onAdditionalComponentsChanged: saveRow.addAdditionalComponents("saveButton") } - function addAdditionalComponents (areaId) { - if(areaId == "saveButton") { - for (var component in CuraApplication.additionalComponents["saveButton"]) { + function addAdditionalComponents (areaId) + { + if(areaId == "saveButton") + { + for (var component in CuraApplication.additionalComponents["saveButton"]) + { CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow } } } - Connections { + Connections + { target: UM.Preferences onPreferenceChanged: { @@ -166,13 +181,14 @@ Item { } // Prepare button, only shows if auto_slice is off - Button { + Button + { id: prepareButton tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process") // 1 = not started, 2 = Processing - enabled: base.backendState != "undefined" && ([1, 2].indexOf(base.backendState) != -1) && base.activity - visible: base.backendState != "undefined" && !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity + enabled: ([1, 2].indexOf(base.backendState) != -1) && base.activity + visible: !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity property bool autoSlice height: UM.Theme.getSize("save_button_save_to_button").height @@ -236,11 +252,12 @@ Item { text: control.text; } } - label: Item { } + label: Item {} } } - Button { + Button + { id: saveToButton tooltip: UM.OutputDeviceManager.activeDeviceDescription; @@ -262,7 +279,8 @@ Item { { "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats }); } - style: ButtonStyle { + style: ButtonStyle + { background: Rectangle { border.width: UM.Theme.getSize("default_lining").width @@ -296,17 +314,7 @@ Item { Label { id: actualLabel anchors.centerIn: parent - color: - { - if(!control.enabled) - return UM.Theme.getColor("action_button_disabled_text"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_text"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_text"); - else - return UM.Theme.getColor("print_button_ready_text"); - } + color:control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") font: UM.Theme.getFont("action_button") text: control.text; } @@ -324,36 +332,49 @@ Item { anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width width: UM.Theme.getSize("save_button_save_to_button").height height: UM.Theme.getSize("save_button_save_to_button").height + // 3 = Done, 5 = Disabled - enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true - visible: base.backendState != "undefined" && (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true + enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true + visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true - style: ButtonStyle { - background: Rectangle { + style: ButtonStyle + { + background: Rectangle + { id: deviceSelectionIcon border.width: UM.Theme.getSize("default_lining").width border.color: { if(!control.enabled) - return UM.Theme.getColor("action_button_disabled_border"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_pressed_border"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_hovered_border"); - else - return UM.Theme.getColor("print_button_ready_border"); + { + return UM.Theme.getColor("action_button_disabled_border") + } else if(control.pressed) + { + return UM.Theme.getColor("print_button_ready_pressed_border") + } else if(control.hovered) + { + return UM.Theme.getColor("print_button_ready_hovered_border") + } else + { + return UM.Theme.getColor("print_button_ready_border") + } } color: { if(!control.enabled) - return UM.Theme.getColor("action_button_disabled"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_pressed"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_hovered"); - else - return UM.Theme.getColor("print_button_ready"); + { + return UM.Theme.getColor("action_button_disabled") + } else if(control.pressed) + { + return UM.Theme.getColor("print_button_ready_pressed") + } else if(control.hovered) + { + return UM.Theme.getColor("print_button_ready_hovered") + } else + { + return UM.Theme.getColor("print_button_ready") + } } Behavior on color { ColorAnimation { duration: 50; } } anchors.left: parent.left @@ -361,40 +382,34 @@ Item { width: parent.height height: parent.height - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: height - color: - { - if(!control.enabled) - return UM.Theme.getColor("action_button_disabled_text"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_text"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_text"); - else - return UM.Theme.getColor("print_button_ready_text"); - } + color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") source: UM.Theme.getIcon("arrow_bottom"); } } - label: Label{ } } - menu: Menu { + menu: Menu + { id: devicesMenu; - Instantiator { + Instantiator + { model: devicesModel; - MenuItem { + MenuItem + { text: model.description checkable: true; checked: model.id == UM.OutputDeviceManager.activeDevice; exclusiveGroup: devicesMenuGroup; - onTriggered: { + onTriggered: + { UM.OutputDeviceManager.setActiveDevice(model.id); } } diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index da50b430ac..5a6811926e 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -25,7 +25,6 @@ Item { id: globalProfileRow height: UM.Theme.getSize("sidebar_setup").height - visible: !sidebar.hideSettings anchors { @@ -54,7 +53,6 @@ Item id: globalProfileSelection text: generateActiveQualityText() - enabled: !header.currentExtruderVisible || header.currentExtruderIndex > -1 width: Math.round(parent.width * 0.55) height: UM.Theme.getSize("setting_control").height anchors.left: globalProfileLabel.right @@ -177,9 +175,7 @@ Item right: settingVisibilityMenu.left rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2) } - height: visible ? UM.Theme.getSize("setting_control").height : 0 - Behavior on height { NumberAnimation { duration: 100 } } - + height: UM.Theme.getSize("setting_control").height Timer { id: settingsSearchTimer @@ -292,8 +288,7 @@ Item anchors.bottom: parent.bottom; anchors.right: parent.right; anchors.left: parent.left; - anchors.topMargin: filterContainer.visible ? UM.Theme.getSize("sidebar_margin").height : 0 - Behavior on anchors.topMargin { NumberAnimation { duration: 100 } } + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height style: UM.Theme.styles.scrollview; flickableItem.flickableDirection: Flickable.VerticalFlick; diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index df4f493ea5..15ca60e6e3 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -90,7 +90,8 @@ Column } } - Rectangle { + Rectangle + { id: headerSeparator width: parent.width visible: printerTypeSelectionRow.visible diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index c24fe86af0..f08a0aaca3 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -15,7 +15,8 @@ Rectangle { id: base - height: UM.Theme.getSize("topheader").height + implicitHeight: UM.Theme.getSize("topheader").height + implicitWidth: UM.Theme.getSize("topheader").width color: UM.Theme.getColor("topheader_background") Image From 2fce1e433a4c732462310c24c63970752e6fcd43 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 09:49:08 +0200 Subject: [PATCH 023/558] Fix the tooltips for time estimations CURA-5772 --- resources/qml/ProgressAndSaveWidget.qml | 3 +-- resources/qml/SidebarTooltip.qml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/ProgressAndSaveWidget.qml b/resources/qml/ProgressAndSaveWidget.qml index 88819af759..2fa5cf6149 100644 --- a/resources/qml/ProgressAndSaveWidget.qml +++ b/resources/qml/ProgressAndSaveWidget.qml @@ -60,8 +60,7 @@ Rectangle } } tooltip_html += ""; - //print("trying to show tooltip", base, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html) - base.showTooltip(parent, Qt.point(0, 0), tooltip_html); + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html); } } onExited: diff --git a/resources/qml/SidebarTooltip.qml b/resources/qml/SidebarTooltip.qml index 29199481f6..4fa4ef9dd7 100644 --- a/resources/qml/SidebarTooltip.qml +++ b/resources/qml/SidebarTooltip.qml @@ -36,7 +36,7 @@ UM.PointingRectangle { } } base.opacity = 1; - target = Qt.point(40 , position.y + Math.round(UM.Theme.getSize("tooltip_arrow_margins").height / 2)) + target = Qt.point(position.x + 1, position.y + Math.round(UM.Theme.getSize("tooltip_arrow_margins").height / 2)) } function hide() { From fc1faf79f5dec5dc9271e5ee7fe89079161dae5a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 09:52:48 +0200 Subject: [PATCH 024/558] Cleanup unused code CURA-5772 --- resources/qml/Cura.qml | 118 +---------------------------------------- 1 file changed, 2 insertions(+), 116 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f89f8d63dd..8955cb9598 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -21,7 +21,6 @@ UM.MainWindow // Cura application window title title: catalog.i18nc("@title:window", "Ultimaker Cura") - //viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) viewportRect: Qt.rect(0, 0, 1.0, 1.0) backgroundColor: UM.Theme.getColor("viewport_background") @@ -43,24 +42,6 @@ UM.MainWindow tooltip.hide(); } - /*onWidthChanged: - { - // If slidebar is collapsed then it should be invisible - // otherwise after the main_window resize the sidebar will be fully re-drawn - if (sidebar.collapsed){ - if (sidebar.visible == true){ - sidebar.visible = false - sidebar.initialWidth = 0 - } - } - else{ - if (sidebar.visible == false){ - sidebar.visible = true - sidebar.initialWidth = UM.Theme.getSize("sidebar").width - } - } - }*/ - Component.onCompleted: { CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) @@ -193,14 +174,11 @@ UM.MainWindow anchors { bottom: parent.bottom - //right: sidebar.left bottomMargin: UM.Theme.getSize("default_margin").height rightMargin: UM.Theme.getSize("default_margin").width } } - - Toolbar { id: toolbar @@ -226,18 +204,6 @@ UM.MainWindow } } - /*ApplicationViews - { - id: applicationViews - - - anchors - { - top: parent.top - right: sidebar.left - } - }*/ - Loader { id: main @@ -261,78 +227,6 @@ UM.MainWindow source: UM.Controller.activeStage.mainComponent } - /*Loader - { - id: sidebar - - property bool collapsed: false - property var initialWidth: UM.Theme.getSize("sidebar").width - - function callExpandOrCollapse() - { - if (collapsed) - { - sidebar.visible = true - sidebar.initialWidth = UM.Theme.getSize("sidebar").width - viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) - expandSidebarAnimation.start(); - } - else - { - viewportRect = Qt.rect(0, 0, 1, 1.0) - collapseSidebarAnimation.start() - } - collapsed = !collapsed - UM.Preferences.setValue("cura/sidebar_collapsed", collapsed) - } - - anchors - { - top: parent.top - bottom: parent.bottom - } - - width: initialWidth - x: base.width - sidebar.width - source: UM.Controller.activeStage.sidebarComponent - - NumberAnimation { - id: collapseSidebarAnimation - target: sidebar - properties: "x" - to: base.width - duration: 100 - } - - NumberAnimation { - id: expandSidebarAnimation - target: sidebar - properties: "x" - to: base.width - sidebar.width - duration: 100 - } - - Component.onCompleted: - { - var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed") - - if (sidebar_collapsed) - { - sidebar.collapsed = true - viewportRect = Qt.rect(0, 0, 1, 1.0) - collapseSidebarAnimation.start() - } - } - - MouseArea - { - visible: UM.Controller.activeStage.sidebarComponent != "" - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true - } - }*/ - UM.MessageStack { anchors @@ -345,7 +239,6 @@ UM.MainWindow } } - ViewOrientationControls { id: viewOrientationControls @@ -359,7 +252,6 @@ UM.MainWindow } } - ProgressAndSaveWidget { anchors.right: parent.right @@ -379,13 +271,6 @@ UM.MainWindow } } - // Expand or collapse sidebar - /*Connections - { - target: Cura.Actions.expandSidebar - onTriggered: sidebar.callExpandOrCollapse() - }*/ - UM.PreferencesDialog { id: preferences @@ -509,7 +394,8 @@ UM.MainWindow } } - ContextMenu { + ContextMenu + { id: contextMenu } From 8cac5e1de214b34ad39328fe93b29a9bfe270afe Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 10:26:27 +0200 Subject: [PATCH 025/558] Removed the components qml dir We can consider putting components into their own folder, but we first should have a clear definition of what they are / should be. CURA-5772 --- resources/qml/Account/AccountDetails.qml | 2 -- resources/qml/Account/GeneralOperations.qml | 6 ++---- resources/qml/Account/UserOperations.qml | 6 ++---- resources/qml/{components => }/ActionButton.qml | 0 resources/qml/Cura.qml | 1 - .../{components => }/MachineAndConfigurationSelector.qml | 5 ++--- resources/qml/ProfileAndSettingComponent.qml | 2 -- resources/qml/Skeleton/ApplicationViews.qml | 1 - resources/qml/Skeleton/TopHeader.qml | 1 - resources/qml/{components => }/ViewOrientationControls.qml | 0 resources/qml/qmldir | 5 +++-- 11 files changed, 9 insertions(+), 20 deletions(-) rename resources/qml/{components => }/ActionButton.qml (100%) rename resources/qml/{components => }/MachineAndConfigurationSelector.qml (94%) rename resources/qml/{components => }/ViewOrientationControls.qml (100%) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index ab1ccc15df..4d6b0a314b 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -7,8 +7,6 @@ import QtQuick.Controls 2.1 import UM 1.4 as UM import Cura 1.1 as Cura -import "../components" - Column { property var profile: null diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index d224de44bb..1f3cd51f26 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -7,13 +7,11 @@ import QtQuick.Controls 1.1 import UM 1.4 as UM import Cura 1.1 as Cura -import "../components" - Row { spacing: UM.Theme.getSize("default_margin").width - ActionButton + Cura.ActionButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height @@ -25,7 +23,7 @@ Row onClicked: Qt.openUrlExternally("https://account.ultimaker.com") } - ActionButton + Cura.ActionButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index 1704254ed3..ffcf518b6e 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -7,13 +7,11 @@ import QtQuick.Controls 1.1 import UM 1.4 as UM import Cura 1.1 as Cura -import "../components" - Row { spacing: UM.Theme.getSize("default_margin").width - ActionButton + Cura.ActionButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height @@ -25,7 +23,7 @@ Row onClicked: Qt.openUrlExternally("https://account.ultimaker.com") } - ActionButton + Cura.ActionButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height diff --git a/resources/qml/components/ActionButton.qml b/resources/qml/ActionButton.qml similarity index 100% rename from resources/qml/components/ActionButton.qml rename to resources/qml/ActionButton.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 8955cb9598..304f78e633 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -13,7 +13,6 @@ import Cura 1.1 as Cura import "Dialogs" import "Menus" import "Skeleton" -import "components" UM.MainWindow { diff --git a/resources/qml/components/MachineAndConfigurationSelector.qml b/resources/qml/MachineAndConfigurationSelector.qml similarity index 94% rename from resources/qml/components/MachineAndConfigurationSelector.qml rename to resources/qml/MachineAndConfigurationSelector.qml index 5b919c42d8..15b9ca6dd6 100644 --- a/resources/qml/components/MachineAndConfigurationSelector.qml +++ b/resources/qml/MachineAndConfigurationSelector.qml @@ -5,9 +5,8 @@ import QtQuick 2.7 import UM 1.2 as UM import Cura 1.0 as Cura -import "../Menus" -import "../Menus/ConfigurationMenu" -import ".." +import "Menus" +import "Menus/ConfigurationMenu" Rectangle { diff --git a/resources/qml/ProfileAndSettingComponent.qml b/resources/qml/ProfileAndSettingComponent.qml index 33c2f37fb1..dbded90576 100644 --- a/resources/qml/ProfileAndSettingComponent.qml +++ b/resources/qml/ProfileAndSettingComponent.qml @@ -9,8 +9,6 @@ import UM 1.2 as UM import Cura 1.0 as Cura import "Menus" import "Menus/ConfigurationMenu" -import "components" - Rectangle { diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index eb8ab16fae..d91837a2db 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -9,7 +9,6 @@ import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "../components" // This item contains the views selector, a combobox that is dynamically created from // the list of available Views (packages that create different visualizations of the diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index f08a0aaca3..7344d01436 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -8,7 +8,6 @@ import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura -import "../components" import "../Account" Rectangle diff --git a/resources/qml/components/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml similarity index 100% rename from resources/qml/components/ViewOrientationControls.qml rename to resources/qml/ViewOrientationControls.qml diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 5083b5e80a..b9306b14bc 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -1,5 +1,6 @@ module Cura -MachineAndConfigurationSelector 1.0 components/MachineAndConfigurationSelector.qml +MachineAndConfigurationSelector 1.0 MachineAndConfigurationSelector.qml MaterialAndVariantSelector 1.0 MaterialAndVariantSelector.qml -ProfileAndSettingComponent 1.0 ProfileAndSettingComponent.qml \ No newline at end of file +ProfileAndSettingComponent 1.0 ProfileAndSettingComponent.qml +ActionButton 1.0 ActionButton.qml \ No newline at end of file From d2baef97c4e2d014884e22537330e4ecc4b34cf5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 11:07:03 +0200 Subject: [PATCH 026/558] Fix tooltips for settings CURA-5772 --- plugins/PrepareStage/PrepareMenu.qml | 12 +- resources/qml/Cura.qml | 8 +- resources/qml/ProfileAndSettingComponent.qml | 246 +------------------ 3 files changed, 24 insertions(+), 242 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index eb09326524..353c4df51a 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -10,6 +10,10 @@ Row { spacing: UM.Theme.getSize("default_margin").width + // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + UM.I18nCatalog { id: catalog @@ -18,12 +22,12 @@ Row Button { - id: openFileButton; - text: catalog.i18nc("@action:button", "Open File"); + id: openFileButton + text: catalog.i18nc("@action:button", "Open File") iconSource: UM.Theme.getIcon("load") style: UM.Theme.styles.tool_button tooltip: "" - action: Cura.Actions.open; + action: Cura.Actions.open } Cura.MachineAndConfigurationSelector @@ -38,5 +42,7 @@ Row Cura.ProfileAndSettingComponent { width: UM.Theme.getSize("sidebar").width + onShowTooltip: parent.showTooltip(item, location, text) + onHideTooltip: parent.hideTooltip() } } \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 304f78e633..97cdc94d64 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -163,10 +163,16 @@ UM.MainWindow } height: 50 - source: UM.Controller.activeStage.stageMenuComponent } + Connections + { + target: stageMenu.item + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltop: base.hideTooltip() + } + JobSpecs { id: jobSpecs diff --git a/resources/qml/ProfileAndSettingComponent.qml b/resources/qml/ProfileAndSettingComponent.qml index dbded90576..b367c1130f 100644 --- a/resources/qml/ProfileAndSettingComponent.qml +++ b/resources/qml/ProfileAndSettingComponent.qml @@ -28,6 +28,10 @@ Rectangle color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} + // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + Timer { id: tooltipDelayTimer @@ -42,18 +46,6 @@ Rectangle } } - function showTooltip(item, position, text) - { - tooltip.text = text; - position = item.mapToItem(base, position.x - UM.Theme.getSize("default_arrow").width, position.y); - tooltip.show(position); - } - - function hideTooltip() - { - tooltip.hide(); - } - function strPadLeft(string, pad, length) { return (new Array(length + 1).join(pad) + string).slice(-length); @@ -205,241 +197,19 @@ Rectangle { anchors.fill: parent visible: currentModeIndex == 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() } SidebarSimple { anchors.fill: parent visible: currentModeIndex != 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() } } - /*Item - { - id: printSpecs - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - height: timeDetails.height + costSpec.height - width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width) - - Label - { - id: timeDetails - anchors.left: parent.left - anchors.bottom: costSpec.top - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) - renderType: Text.NativeRendering - - MouseArea - { - id: timeDetailsMouseArea - anchors.fill: parent - hoverEnabled: true - - onEntered: - { - if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) - { - // All the time information for the different features is achieved - var print_time = PrintInformation.getFeaturePrintTimes(); - var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) - - // A message is created and displayed when the user hover the time label - var tooltip_html = "%1
".arg(catalog.i18nc("@tooltip", "Time specification")); - for(var feature in print_time) - { - if(!print_time[feature].isTotalDurationZero) - { - tooltip_html += "" + - "".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + - "".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) + - ""; - } - } - tooltip_html += "
" + feature + ":  %1  %1%
"; - - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html); - } - } - onExited: - { - base.hideTooltip(); - } - } - } - - Label - { - function formatRow(items) - { - var row_html = ""; - for(var item = 0; item < items.length; item++) - { - if (item == 0) - { - row_html += "%1".arg(items[item]); - } - else - { - row_html += "  %1".arg(items[item]); - } - } - row_html += ""; - return row_html; - } - - function getSpecsData() - { - var lengths = []; - var total_length = 0; - var weights = []; - var total_weight = 0; - var costs = []; - var total_cost = 0; - var some_costs_known = false; - var names = []; - if(base.printMaterialLengths) - { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) - { - names.push(base.printMaterialNames[index]); - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.round(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - some_costs_known = true; - } - - total_length += base.printMaterialLengths[index]; - total_weight += base.printMaterialWeights[index]; - total_cost += base.printMaterialCosts[index]; - } - } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - - var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification")); - for(var index = 0; index < lengths.length; index++) - { - tooltip_html += formatRow([ - "%1:".arg(names[index]), - catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), - catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), - "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), - ]); - } - if(lengths.length > 1) - { - tooltip_html += formatRow([ - catalog.i18nc("@label", "Total:"), - catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)), - catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)), - "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)), - ]); - } - tooltip_html += "
"; - tooltipText = tooltip_html; - - return tooltipText - } - - id: costSpec - anchors.left: parent.left - anchors.bottom: parent.bottom - font: UM.Theme.getFont("very_small") - renderType: Text.NativeRendering - color: UM.Theme.getColor("text_subtext") - elide: Text.ElideMiddle - width: parent.width - property string tooltipText - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) - { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.round(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - someCostsKnown = true; - } - } - } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - var result = lengths.join(" + ") + "m / ~ " + weights.join(" + ") + "g"; - if(someCostsKnown) - { - result += " / ~ " + costs.join(" + ") + " " + UM.Preferences.getValue("cura/currency"); - } - return result; - } - MouseArea - { - id: costSpecMouseArea - anchors.fill: parent - hoverEnabled: true - - onEntered: - { - - if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) - { - var show_data = costSpec.getSpecsData() - - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), show_data); - } - } - onExited: - { - base.hideTooltip(); - } - } - } - }*/ - - // SaveButton is actually the bottom footer panel. - /*SaveButton - { - id: saveButton - implicitWidth: base.width - anchors.top: footerSeparator.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height - anchors.bottom: parent.bottom - }*/ - - /* - SidebarTooltip - { - id: tooltip - }*/ - // Setting mode: Recommended or Custom ListModel { From 0a1dad92ea50beeab3bdf7fc487e4d48e1169142 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 13:41:44 +0200 Subject: [PATCH 027/558] Change AvatarImage so it uses aliases instead of properties I've changed this because it makes for much cleaner QML CURA-5772 --- resources/qml/Account/AvatarImage.qml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 96c3cd2330..0e0d182018 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -7,19 +7,19 @@ import UM 1.4 as UM Item { + // This item shows the provided image while applying a round mask to it. + // It also shows a round border around it. The color is defined by the outlineColor property. + id: avatar - property var source - property var fallbackSource: UM.Theme.getImage("avatar_default") - property var outlineColor: UM.Theme.getColor("account_widget_ouline_active") + property alias source: profileImage.source + property alias outlineColor: profileImageOutline.color Image { id: profileImage - source: avatar.source ? avatar.source : UM.Theme.getImage("avatar_default") - sourceSize: Qt.size(parent.width, parent.height) - width: parent.width - height: parent.height + source: UM.Theme.getImage("avatar_default") + anchors.fill: parent fillMode: Image.PreserveAspectCrop visible: false } @@ -29,8 +29,7 @@ Item id: profileImageMask source: UM.Theme.getIcon("circle_mask") sourceSize: Qt.size(parent.width, parent.height) - width: parent.width - height: parent.height + anchors.fill: parent color: UM.Theme.getColor("topheader_background") visible: false } @@ -49,8 +48,7 @@ Item id: profileImageOutline source: UM.Theme.getIcon("circle_outline") sourceSize: Qt.size(parent.width, parent.height) - width: parent.width - height: parent.height - color: avatar.outlineColor + anchors.fill: parent + color: UM.Theme.getColor("account_widget_ouline_active") } } \ No newline at end of file From 62c99804381a0d8647791b888cf163499a22a5ca Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 14:07:01 +0200 Subject: [PATCH 028/558] Move SidebarTooltip so that it's no longer ocluded by other objects CURA-5772 --- resources/qml/Cura.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 97cdc94d64..bf71bd8d94 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -63,11 +63,6 @@ UM.MainWindow id: backgroundItem anchors.fill: parent - SidebarTooltip - { - id: tooltip - } - signal hasMesh(string name) //this signal sends the filebase name so it can be used for the JobSpecs.qml function getMeshName(path) { @@ -274,6 +269,11 @@ UM.MainWindow } } } + + SidebarTooltip + { + id: tooltip + } } UM.PreferencesDialog From f6ae19003ba77a5da9d8a8a90016422f0b9ef297 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 14:07:30 +0200 Subject: [PATCH 029/558] The AccountDetails Panel is now an actual popup This ensures that it's always visible (previously it was ocluded by the StageMenu) CURA-5772 --- resources/qml/Account/AccountWidget.qml | 65 ++++++++++++------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 1d9541de2c..1b4e6de1b2 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -7,62 +7,59 @@ import QtQuick.Controls 2.1 import UM 1.4 as UM import Cura 1.1 as Cura -Item +Button { id: accountWidget property var profile: Cura.API.account.userProfile property var loggedIn: Cura.API.account.isLoggedIn - height: UM.Theme.getSize("topheader").height - width: UM.Theme.getSize("topheader").height + + implicitHeight: UM.Theme.getSize("topheader").height + implicitWidth: UM.Theme.getSize("topheader").height + AvatarImage { id: avatar + + width: Math.round(0.8 * parent.width) height: Math.round(0.8 * parent.height) anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter + source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") } - MouseArea + background: Item {} + + onClicked: popup.open() + + Popup { - anchors.fill: parent - onClicked: accountManagementPanel.visible = !accountManagementPanel.visible // Collapse/Expand the dropdown panel - } + id: popup - UM.PointingRectangle - { - id: accountManagementPanel + y: parent.height + UM.Theme.getSize("default_arrow").height + x: (parent.width - width) - width: panel.width - height: panel.height - - anchors - { - top: parent.bottom - topMargin: UM.Theme.getSize("default_margin").height - right: parent.right - } - - target: Qt.point(parent.width / 2, parent.bottom) - arrowSize: UM.Theme.getSize("default_arrow").width - - visible: false - opacity: visible ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } - - color: UM.Theme.getColor("tool_panel_background") - borderColor: UM.Theme.getColor("lining") - borderWidth: UM.Theme.getSize("default_lining").width - - // Shows the user management options or general options to create account - AccountDetails + contentItem: AccountDetails { id: panel profile: Cura.API.account.userProfile loggedIn: Cura.API.account.isLoggedIn } + + background: UM.PointingRectangle + { + opacity: visible ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + color: UM.Theme.getColor("tool_panel_background") + borderColor: UM.Theme.getColor("lining") + borderWidth: UM.Theme.getSize("default_lining").width + + target: Qt.point(width - (accountWidget.width / 2), -10) + + arrowSize: UM.Theme.getSize("default_arrow").width + } } -} \ No newline at end of file +} From 4e432a5f06c5726f4c83e8127636470867274631 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 14:21:03 +0200 Subject: [PATCH 030/558] Remove SidebarHeader It has been replaced by others, so we don't need it anymore CURA-5772 --- resources/qml/SidebarHeader.qml | 618 -------------------------------- 1 file changed, 618 deletions(-) delete mode 100644 resources/qml/SidebarHeader.qml diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml deleted file mode 100644 index 15ca60e6e3..0000000000 --- a/resources/qml/SidebarHeader.qml +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -import "Menus" - -Column -{ - id: base; - - property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex; - property bool currentExtruderVisible: extrudersList.visible; - property bool printerConnected: Cura.MachineManager.printerConnected - property bool hasManyPrinterTypes: - { - if (printerConnected) - { - if (Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount != null) - { - return Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount.length > 1; - } - } - return false; - } - property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable - property bool buildplateCompatibilityWarning: Cura.MachineManager.variantBuildplateUsable - - spacing: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.9) - - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - - Item - { - id: initialSeparator - anchors - { - left: parent.left - right: parent.right - } - visible: printerTypeSelectionRow.visible || buildplateRow.visible || extruderSelectionRow.visible - height: UM.Theme.getSize("default_lining").height - width: height - } - - // Printer Type Row - Item - { - id: printerTypeSelectionRow - height: UM.Theme.getSize("sidebar_setup").height - visible: printerConnected && hasManyPrinterTypes && !sidebar.hideSettings - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width - } - - Label - { - id: configurationLabel - text: catalog.i18nc("@label", "Printer type"); - width: Math.round(parent.width * 0.4 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: printerTypeSelection - text: Cura.MachineManager.activeMachineDefinitionName - tooltip: Cura.MachineManager.activeMachineDefinitionName - height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - - menu: PrinterTypeMenu { } - } - } - - Rectangle - { - id: headerSeparator - width: parent.width - visible: printerTypeSelectionRow.visible - height: visible ? UM.Theme.getSize("sidebar_lining").height : 0 - color: UM.Theme.getColor("sidebar_lining") - } - - // Extruder Row - Item - { - id: extruderSelectionRow - width: parent.width - height: Math.round(UM.Theme.getSize("sidebar_tabs").height * 2 / 3) - visible: machineExtruderCount.properties.value > 1 - - anchors - { - left: parent.left - leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.7) - right: parent.right - rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.7) - topMargin: UM.Theme.getSize("sidebar_margin").height - } - - ListView - { - id: extrudersList - property var index: 0 - - height: UM.Theme.getSize("sidebar_header_mode_tabs").height - width: Math.round(parent.width) - boundsBehavior: Flickable.StopAtBounds - - anchors - { - left: parent.left - leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) - right: parent.right - rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) - verticalCenter: parent.verticalCenter - } - - ExclusiveGroup { id: extruderMenuGroup; } - - orientation: ListView.Horizontal - - model: Cura.ExtrudersModel { id: extrudersModel; } - - Connections - { - target: Cura.MachineManager - onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - } - - delegate: Button - { - height: ListView.view.height - width: Math.round(ListView.view.width / extrudersModel.rowCount()) - - text: model.name - tooltip: model.name - exclusiveGroup: extruderMenuGroup - checked: base.currentExtruderIndex == index - - property bool extruder_enabled: true - - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - switch (mouse.button) { - case Qt.LeftButton: - extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled - if (extruder_enabled) - { - forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - Cura.ExtruderManager.setActiveExtruderIndex(index); - } - break; - case Qt.RightButton: - extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled - extruderMenu.popup(); - break; - } - - } - } - - Menu - { - id: extruderMenu - - MenuItem { - text: catalog.i18nc("@action:inmenu", "Enable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) - visible: !extruder_enabled // using an intermediate variable prevents an empty popup that occured now and then - } - - MenuItem { - text: catalog.i18nc("@action:inmenu", "Disable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) - visible: extruder_enabled - enabled: Cura.MachineManager.numberExtrudersEnabled > 1 - } - } - - style: ButtonStyle - { - background: Item - { - function buttonBackgroundColor(index) - { - var extruder = Cura.MachineManager.getExtruder(index) - if (extruder.isEnabled) { - return (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : - UM.Theme.getColor("action_button") - } else { - return UM.Theme.getColor("action_button_disabled") - } - } - - function buttonBorderColor(index) - { - var extruder = Cura.MachineManager.getExtruder(index) - if (extruder.isEnabled) { - return (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : - UM.Theme.getColor("action_button_border") - } else { - return UM.Theme.getColor("action_button_disabled_border") - } - } - - function buttonColor(index) { - var extruder = Cura.MachineManager.getExtruder(index); - if (extruder.isEnabled) - { - return ( - control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : - control.hovered ? UM.Theme.getColor("action_button_hovered_text") : - UM.Theme.getColor("action_button_text"); - } else { - return UM.Theme.getColor("action_button_disabled_text"); - } - } - - Rectangle - { - anchors.fill: parent - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: buttonBorderColor(index) - color: buttonBackgroundColor(index) - Behavior on color { ColorAnimation { duration: 50; } } - } - - Item - { - id: extruderButtonFace - anchors.centerIn: parent - - width: { - var extruderTextWidth = extruderStaticText.visible ? extruderStaticText.width : 0; - var iconWidth = extruderIconItem.width; - return Math.round(extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 2); - } - - // Static text "Extruder" - Label - { - id: extruderStaticText - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - - color: buttonColor(index) - - font: UM.Theme.getFont("large_nonbold") - text: catalog.i18nc("@label", "Extruder") - visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width) - elide: Text.ElideRight - } - - // Everything for the extruder icon - Item - { - id: extruderIconItem - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - property var sizeToUse: - { - var minimumWidth = control.width < UM.Theme.getSize("button").width ? control.width : UM.Theme.getSize("button").width; - var minimumHeight = control.height < UM.Theme.getSize("button").height ? control.height : UM.Theme.getSize("button").height; - var minimumSize = minimumWidth < minimumHeight ? minimumWidth : minimumHeight; - minimumSize -= Math.round(UM.Theme.getSize("default_margin").width / 2); - return minimumSize; - } - - width: sizeToUse - height: sizeToUse - - UM.RecolorImage { - id: mainCircle - anchors.fill: parent - - sourceSize.width: parent.width - sourceSize.height: parent.width - source: UM.Theme.getIcon("extruder_button") - - color: extruderNumberText.color - } - - Label - { - id: extruderNumberText - anchors.centerIn: parent - text: index + 1; - color: buttonColor(index) - font: UM.Theme.getFont("default_bold") - } - - // Material colour circle - // Only draw the filling colour of the material inside the SVG border. - Rectangle - { - id: materialColorCircle - - anchors - { - right: parent.right - top: parent.top - rightMargin: Math.round(parent.sizeToUse * 0.01) - topMargin: Math.round(parent.sizeToUse * 0.05) - } - - color: model.color - - width: Math.round(parent.width * 0.35) - height: Math.round(parent.height * 0.35) - radius: Math.round(width / 2) - - border.width: 1 - border.color: UM.Theme.getColor("extruder_button_material_border") - - opacity: !control.checked ? 0.6 : 1.0 - } - } - } - } - label: Item {} - } - } - } - } - - Item - { - id: variantRowSpacer - height: Math.round(UM.Theme.getSize("sidebar_margin").height / 4) - width: height - visible: !extruderSelectionRow.visible && !initialSeparator.visible - } - - // Material Row - Item - { - id: materialRow - height: UM.Theme.getSize("sidebar_setup").height - visible: Cura.MachineManager.hasMaterials && !sidebar.hideSettings - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width - } - - Label - { - id: materialLabel - text: catalog.i18nc("@label", "Material"); - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: materialSelection - - property var activeExtruder: Cura.MachineManager.activeStack - property var hasActiveExtruder: activeExtruder != null - property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" - - text: currentRootMaterialName - tooltip: currentRootMaterialName - visible: Cura.MachineManager.hasMaterials - enabled: !extrudersList.visible || base.currentExtruderIndex > -1 - height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - menu: MaterialMenu - { - extruderIndex: base.currentExtruderIndex - } - - property var valueError: !isMaterialSupported() - property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported - - function isMaterialSupported () - { - if (!hasActiveExtruder) - { - return false; - } - return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") == "True" - } - } - } - - //Variant row - Item - { - id: variantRow - height: UM.Theme.getSize("sidebar_setup").height - visible: Cura.MachineManager.hasVariants && !sidebar.hideSettings - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width - } - - Label - { - id: variantLabel - text: Cura.MachineManager.activeDefinitionVariantsName; - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: variantSelection - text: Cura.MachineManager.activeVariantName - tooltip: Cura.MachineManager.activeVariantName; - visible: Cura.MachineManager.hasVariants - - height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width) - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - - menu: NozzleMenu { extruderIndex: base.currentExtruderIndex } - } - } - - Rectangle - { - id: buildplateSeparator - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width - width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width - visible: buildplateRow.visible - height: visible ? UM.Theme.getSize("sidebar_lining_thin").height : 0 - color: UM.Theme.getColor("sidebar_lining") - } - - //Buildplate row - Item - { - id: buildplateRow - height: UM.Theme.getSize("sidebar_setup").height - // TODO Only show in dev mode. Remove check when feature ready - visible: CuraSDKVersion == "dev" ? Cura.MachineManager.hasVariantBuildplates && !sidebar.hideSettings : false - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width - } - - Label - { - id: bulidplateLabel - text: catalog.i18nc("@label", "Build plate"); - width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: buildplateSelection - text: Cura.MachineManager.activeVariantBuildplateName - tooltip: Cura.MachineManager.activeVariantBuildplateName - visible: Cura.MachineManager.hasVariantBuildplates - - height: UM.Theme.getSize("setting_control").height - width: Math.floor(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width) - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - - menu: BuildplateMenu {} - - property var valueError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable - property var valueWarning: Cura.MachineManager.variantBuildplateUsable - } - } - - // Material info row - Item - { - id: materialInfoRow - height: Math.round(UM.Theme.getSize("sidebar_setup").height / 2) - visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariantBuildplates) && !sidebar.hideSettings - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width - } - - // TODO This was added to replace the buildplate selector. Remove this component when the feature is ready - Label - { - id: materialCompatibilityLabel - y: -Math.round(UM.Theme.getSize("sidebar_margin").height / 3) - anchors.left: parent.left - width: parent.width - materialCompatibilityLink.width - text: catalog.i18nc("@label", "Use glue with this material combination") - font: UM.Theme.getFont("very_small") - color: UM.Theme.getColor("text") - visible: CuraSDKVersion == "dev" ? false : buildplateCompatibilityError || buildplateCompatibilityWarning - wrapMode: Text.WordWrap - opacity: 0.5 - } - - Item - { - id: materialCompatibilityLink - height: UM.Theme.getSize("sidebar_setup").height - anchors.right: parent.right - width: childrenRect.width + UM.Theme.getSize("default_margin").width - - UM.RecolorImage { - id: warningImage - anchors.right: materialInfoLabel.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.Bottom - source: UM.Theme.getIcon("warning") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - sourceSize.width: width - sourceSize.height: height - color: UM.Theme.getColor("material_compatibility_warning") - visible: !Cura.MachineManager.isCurrentSetupSupported || buildplateCompatibilityError || buildplateCompatibilityWarning - } - - Label { - id: materialInfoLabel - wrapMode: Text.WordWrap - text: "" + catalog.i18nc("@label", "Check compatibility") + "" - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - linkColor: UM.Theme.getColor("text_link") - verticalAlignment: Text.AlignTop - anchors.top: parent.top - anchors.right: parent.right - anchors.bottom: parent.bottom - - MouseArea { - anchors.fill: parent - hoverEnabled: true - onClicked: { - // open the material URL with web browser - var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" - Qt.openUrlExternally(url); - } - onEntered: { - var content = catalog.i18nc("@tooltip", "Click to check the material compatibility on Ultimaker.com."); - base.showTooltip( - materialInfoRow, - Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), - catalog.i18nc("@tooltip", content) - ); - } - onExited: base.hideTooltip(); - } - } - } - } - - UM.SettingPropertyProvider - { - id: machineExtruderCount - - containerStack: Cura.MachineManager.activeMachine - key: "machine_extruder_count" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.I18nCatalog { id: catalog; name:"cura" } -} From 1e3a9ff57cabc85ef2cea5c0346d620e57f48493 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 14:23:42 +0200 Subject: [PATCH 031/558] Removed the expandSidebar action Since we don't even have a sidebar anymore, there is no point in expanding it. --- resources/qml/Actions.qml | 9 --------- resources/qml/Menus/ViewMenu.qml | 6 ++---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 1b1881ab76..30295f6e9b 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -23,8 +23,6 @@ Item property alias viewLeftSideCamera: viewLeftSideCameraAction; property alias viewRightSideCamera: viewRightSideCameraAction; - property alias expandSidebar: expandSidebarAction; - property alias deleteSelection: deleteSelectionAction; property alias centerSelection: centerSelectionAction; property alias multiplySelection: multiplySelectionAction; @@ -415,11 +413,4 @@ Item text: catalog.i18nc("@action:menu", "Browse packages...") iconName: "plugins_browse" } - - Action - { - id: expandSidebarAction; - text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse Sidebar"); - shortcut: "Ctrl+E"; - } } diff --git a/resources/qml/Menus/ViewMenu.qml b/resources/qml/Menus/ViewMenu.qml index 9a2e603673..593bd63bcc 100644 --- a/resources/qml/Menus/ViewMenu.qml +++ b/resources/qml/Menus/ViewMenu.qml @@ -44,7 +44,8 @@ Menu MenuItem { action: Cura.Actions.viewRightSideCamera; } } - MenuSeparator { + MenuSeparator + { visible: UM.Preferences.getValue("cura/use_multi_build_plate") } @@ -72,8 +73,5 @@ Menu MenuSeparator {} - MenuItem { action: Cura.Actions.expandSidebar; } - - MenuSeparator {} MenuItem { action: Cura.Actions.toggleFullScreen; } } From a473a46a35c360605226c0cf71f7efed51ced0fc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:07:46 +0200 Subject: [PATCH 032/558] Add a bit more documentation to explain what the elements do CURA-5772 --- resources/qml/Cura.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index bf71bd8d94..df5995de39 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -114,6 +114,7 @@ UM.MainWindow DropArea { + // The drop area is here to handle files being dropped onto Cura. anchors.fill: parent onDropped: { @@ -181,6 +182,8 @@ UM.MainWindow Toolbar { + // The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by + // plugins) id: toolbar property int mouseX: base.mouseX @@ -206,6 +209,7 @@ UM.MainWindow Loader { + // A stage can control this area. If nothing is set, it will therefor show the 3D view. id: main anchors From a7edd893d796df3c9537ca58c4794f1aaac7b43e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:08:58 +0200 Subject: [PATCH 033/558] Change the order in which ViewOrientationControls and ProgressAndSaveWidget are drawn. This will ensure that if a stage sets a mainComponent that it won't have any other items drawn over it. CURA-5772 --- resources/qml/Cura.qml | 60 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index df5995de39..39443f9b0b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -207,6 +207,36 @@ UM.MainWindow } } + ViewOrientationControls + { + id: viewOrientationControls + + anchors + { + left: parent.left + margins: UM.Theme.getSize("default_margin").width + + bottom: parent.bottom + } + } + + ProgressAndSaveWidget + { + anchors.right: parent.right + anchors.bottom: parent.bottom + width: UM.Theme.getSize("sidebar").width + anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + onShowTooltip: + { + base.showTooltip(item, location, text) + } + onHideTooltip: + { + base.hideTooltip() + } + } + Loader { // A stage can control this area. If nothing is set, it will therefor show the 3D view. @@ -242,36 +272,6 @@ UM.MainWindow bottomMargin: UM.Theme.getSize("default_margin").height } } - - ViewOrientationControls - { - id: viewOrientationControls - - anchors - { - left: parent.left - margins: UM.Theme.getSize("default_margin").width - - bottom: parent.bottom - } - } - - ProgressAndSaveWidget - { - anchors.right: parent.right - anchors.bottom: parent.bottom - width: UM.Theme.getSize("sidebar").width - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - onShowTooltip: - { - base.showTooltip(item, location, text) - } - onHideTooltip: - { - base.hideTooltip() - } - } } SidebarTooltip From 1c70a62df67918acb63ff233daa650c506f2ec7c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:10:50 +0200 Subject: [PATCH 034/558] Fix typo Derp. CURA-5772 --- 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 39443f9b0b..517affe1b1 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -166,7 +166,7 @@ UM.MainWindow { target: stageMenu.item onShowTooltip: base.showTooltip(item, location, text) - onHideTooltop: base.hideTooltip() + onHideTooltip: base.hideTooltip() } JobSpecs From cd5a0a84a80ae0de2ed518cc18e3e19a67c88f79 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:14:05 +0200 Subject: [PATCH 035/558] Horizontally align the prepare menu bar CURA-5772 --- plugins/PrepareStage/PrepareMenu.qml | 51 +++++++++++++++------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 353c4df51a..ea247bf258 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -6,10 +6,9 @@ import UM 1.3 as UM import Cura 1.1 as Cura -Row +Item { - spacing: UM.Theme.getSize("default_margin").width - + id: prepareMenu // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. signal showTooltip(Item item, point location, string text) signal hideTooltip() @@ -20,29 +19,35 @@ Row name:"cura" } - Button + Row { - id: openFileButton - text: catalog.i18nc("@action:button", "Open File") - iconSource: UM.Theme.getIcon("load") - style: UM.Theme.styles.tool_button - tooltip: "" - action: Cura.Actions.open - } + spacing: UM.Theme.getSize("default_margin").width + anchors.horizontalCenter: parent.horizontalCenter - Cura.MachineAndConfigurationSelector - { - } + Button + { + id: openFileButton + text: catalog.i18nc("@action:button", "Open File") + iconSource: UM.Theme.getIcon("load") + style: UM.Theme.styles.tool_button + tooltip: "" + action: Cura.Actions.open + } - Cura.MaterialAndVariantSelector - { - width: UM.Theme.getSize("sidebar").width - } + Cura.MachineAndConfigurationSelector + { + } - Cura.ProfileAndSettingComponent - { - width: UM.Theme.getSize("sidebar").width - onShowTooltip: parent.showTooltip(item, location, text) - onHideTooltip: parent.hideTooltip() + Cura.MaterialAndVariantSelector + { + width: UM.Theme.getSize("sidebar").width + } + + Cura.ProfileAndSettingComponent + { + width: UM.Theme.getSize("sidebar").width + onShowTooltip: prepareMenu.showTooltip(item, location, text) + onHideTooltip: prepareMenu.hideTooltip() + } } } \ No newline at end of file From 2455961ac7c63dba6fa5970506fd0b3e79310c91 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:16:28 +0200 Subject: [PATCH 036/558] Vertically allign the toolbar CURA-5772 --- resources/qml/Cura.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 517affe1b1..bb94435c69 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -189,9 +189,9 @@ UM.MainWindow property int mouseX: base.mouseX property int mouseY: base.mouseY - anchors { - top: stageMenu.bottom - topMargin: UM.Theme.getSize("window_margin").height + anchors + { + verticalCenter: parent.verticalCenter left: parent.left } } From 553e29b9b801d8c6679382f2fe29b4a17a4da72d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 15 Oct 2018 15:32:50 +0200 Subject: [PATCH 037/558] Fix QML warnings CURA-5772 --- resources/qml/Cura.qml | 6 +++--- resources/qml/MaterialAndVariantSelector.qml | 5 ++++- resources/qml/ProgressAndSaveWidget.qml | 2 +- resources/qml/Skeleton/TopHeader.qml | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index bb94435c69..a3746a557b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -159,7 +159,7 @@ UM.MainWindow } height: 50 - source: UM.Controller.activeStage.stageMenuComponent + source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" } Connections @@ -252,13 +252,13 @@ UM.MainWindow MouseArea { - visible: UM.Controller.activeStage.mainComponent != "" + visible: parent.source != "" anchors.fill: parent acceptedButtons: Qt.AllButtons onWheel: wheel.accepted = true } - source: UM.Controller.activeStage.mainComponent + source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : "" } UM.MessageStack diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/MaterialAndVariantSelector.qml index fff3ef1100..31a898f8ae 100644 --- a/resources/qml/MaterialAndVariantSelector.qml +++ b/resources/qml/MaterialAndVariantSelector.qml @@ -174,15 +174,18 @@ Rectangle font: UM.Theme.getFont("large_nonbold") text: catalog.i18nc("@label", "Extruder") - visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width) + visible: width < (control.width - extruderIcon.width - UM.Theme.getSize("default_margin").width) elide: Text.ElideRight } ExtruderIcon { // Round icon with the extruder number and material color indicator. + id: extruderIcon + anchors.verticalCenter: parent.verticalCenter anchors.left: extruderStaticText.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width width: control.height - Math.round(UM.Theme.getSize("default_margin").width / 2) height: width diff --git a/resources/qml/ProgressAndSaveWidget.qml b/resources/qml/ProgressAndSaveWidget.qml index 2fa5cf6149..1e82681164 100644 --- a/resources/qml/ProgressAndSaveWidget.qml +++ b/resources/qml/ProgressAndSaveWidget.qml @@ -20,7 +20,7 @@ Rectangle signal hideTooltip() // Also add an extra margin, as we ant some breathing room around the edges. - height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height + height: saveButton.height + UM.Theme.getSize("sidebar_margin").height Label { id: timeDetails diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index 7344d01436..867a6bafbb 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -93,7 +93,6 @@ Rectangle color: UM.Theme.getColor("topheader_button_text_active") font: UM.Theme.getFont("action_button") renderType: Text.NativeRendering - anchors.verticalCenter: control.verticalCenter } } From 304a9e11f3978dd4f2a30c649598583e0ddee5ee Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 17 Oct 2018 09:50:24 +0200 Subject: [PATCH 038/558] Moved view selection back into Cura QML It didn't make a whole lot of sense for it to be a seperate component, since it's probably going to change in the future CURA-5772 --- resources/qml/Cura.qml | 77 +++++++++++++++ resources/qml/Skeleton/ApplicationViews.qml | 101 -------------------- 2 files changed, 77 insertions(+), 101 deletions(-) delete mode 100644 resources/qml/Skeleton/ApplicationViews.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a3746a557b..a999e7deac 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -220,6 +220,83 @@ UM.MainWindow } } + ComboBox + { + // This item contains the views selector, a combobox that is dynamically created from + // the list of available Views (packages that create different visualizations of the + // scene). + id: viewModeButton + + anchors.left: viewOrientationControls.right + anchors.bottom: viewOrientationControls.bottom + + style: UM.Theme.styles.combobox + + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags () + { + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) + { + model.getItem(i).active = (i == currentIndex) + } + } + + // get the index of the active model item on start + function getActiveIndex () + { + for (var i = 0; i < model.rowCount(); i++) + { + if (model.getItem(i).active) + { + return i; + } + } + return 0 + } + + // set the active index + function setActiveIndex(index) + { + UM.Controller.setActiveView(index) + // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here + } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + viewModeButton.setActiveIndex(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() + + // watch the active view proxy for changes made from the menu item + Connections + { + target: UM.ActiveView + onActiveViewChanged: viewModeButton.updateItemActiveFlags() + } + } + Loader + { + id: viewPanel + + anchors.bottom: viewModeButton.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: viewModeButton.right + + property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + + height: childrenRect.height + width: childrenRect.width + + source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" + } + ProgressAndSaveWidget { anchors.right: parent.right diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml deleted file mode 100644 index d91837a2db..0000000000 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2018 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.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 - -import UM 1.4 as UM -import Cura 1.0 as Cura - - -// This item contains the views selector, a combobox that is dynamically created from -// the list of available Views (packages that create different visualizations of the -// scene). Aside from the selector, there is a row of buttons that change the orientation of the view. -Item -{ - id: applicationViewsSelector - - height: UM.Theme.getSize("views_selector").height - - - ComboBox - { - id: viewModeButton - - anchors - { - verticalCenter: parent.verticalCenter - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - } - - style: UM.Theme.styles.combobox - - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags () - { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) - { - model.getItem(i).active = (i == currentIndex) - } - } - - // get the index of the active model item on start - function getActiveIndex () - { - for (var i = 0; i < model.rowCount(); i++) - { - if (model.getItem(i).active) - { - return i; - } - } - return 0 - } - - // set the active index - function setActiveIndex(index) - { - UM.Controller.setActiveView(index) - // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here - } - - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) - { - viewModeButton.setActiveIndex(model.getItem(currentIndex).id) - } - } - currentIndex: getActiveIndex() - - // watch the active view proxy for changes made from the menu item - Connections - { - target: UM.ActiveView - onActiveViewChanged: viewModeButton.updateItemActiveFlags() - } - } - - Loader - { - id: viewPanel - - anchors.top: viewModeButton.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: viewModeButton.right - - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - - height: childrenRect.height - width: childrenRect.width - - source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" - } -} From 7fb72a1a58ad0d7522f53dbd00f57e44f829590c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 17 Oct 2018 16:13:43 +0200 Subject: [PATCH 039/558] Change Skeleton folder name to MainWindow. This folder is intended to store the files that construct the main window. All the parts. The rest of the components are stored in more specific folders. Contributes to CURA-5784. --- resources/qml/Cura.qml | 2 +- resources/qml/{Skeleton => MainWindow}/ApplicationMenu.qml | 0 resources/qml/{Skeleton => MainWindow}/TopHeader.qml | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename resources/qml/{Skeleton => MainWindow}/ApplicationMenu.qml (100%) rename resources/qml/{Skeleton => MainWindow}/TopHeader.qml (100%) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a999e7deac..a58e7ef6fc 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -12,7 +12,7 @@ import Cura 1.1 as Cura import "Dialogs" import "Menus" -import "Skeleton" +import "MainWindow" UM.MainWindow { diff --git a/resources/qml/Skeleton/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml similarity index 100% rename from resources/qml/Skeleton/ApplicationMenu.qml rename to resources/qml/MainWindow/ApplicationMenu.qml diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/MainWindow/TopHeader.qml similarity index 100% rename from resources/qml/Skeleton/TopHeader.qml rename to resources/qml/MainWindow/TopHeader.qml From 54554bff8920ee3e9ab85df0302a4d9e0d030722 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 09:51:04 +0200 Subject: [PATCH 040/558] Adjust colors to work with dark theme. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 3 + .../cura-dark/icons/tab_status_unknown.svg | 13 ---- resources/themes/cura-dark/images/logo.svg | 72 ------------------- resources/themes/cura-dark/theme.json | 2 +- 4 files changed, 4 insertions(+), 86 deletions(-) delete mode 100644 resources/themes/cura-dark/icons/tab_status_unknown.svg delete mode 100644 resources/themes/cura-dark/images/logo.svg diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 4d6b0a314b..0ce82570a5 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -31,6 +31,7 @@ Column anchors.horizontalCenter: parent.horizontalCenter visible: !loggedIn text: catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura") + color: UM.Theme.getColor("text") } Column @@ -44,6 +45,7 @@ Column anchors.horizontalCenter: parent.horizontalCenter text: loggedIn ? profile["username"] : "" font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") } Label @@ -51,6 +53,7 @@ Column anchors.horizontalCenter: parent.horizontalCenter text: "email.address@hardcoded.is" font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") } } diff --git a/resources/themes/cura-dark/icons/tab_status_unknown.svg b/resources/themes/cura-dark/icons/tab_status_unknown.svg deleted file mode 100644 index d20218bc00..0000000000 --- a/resources/themes/cura-dark/icons/tab_status_unknown.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Unknown - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-dark/images/logo.svg b/resources/themes/cura-dark/images/logo.svg deleted file mode 100644 index 92ffe4ca0c..0000000000 --- a/resources/themes/cura-dark/images/logo.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index fa0da2851e..99737ff8bf 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -17,7 +17,7 @@ "topheader_background": [31, 36, 39, 255], - "topheader_button_text_active": [255, 255, 255, 255], + "topheader_button_text_active": [31, 36, 39, 255], "topheader_button_text_inactive": [128, 128, 128, 255], "topheader_button_text_hovered": [255, 255, 255, 255], From 11693aad36a86ca56843f9bcf5bbbd787f8685b7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 09:51:42 +0200 Subject: [PATCH 041/558] Change the behaviour of the Popup, that now closes when clicking the widget if it is open. Contributes to CURA-5784. --- resources/qml/Account/AccountWidget.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 1b4e6de1b2..d1e285e1da 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -33,7 +33,7 @@ Button background: Item {} - onClicked: popup.open() + onClicked: popup.opened ? popup.close() : popup.open() Popup { @@ -42,6 +42,8 @@ Button y: parent.height + UM.Theme.getSize("default_arrow").height x: (parent.width - width) + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + contentItem: AccountDetails { id: panel From a4c609d514a7687b318613d862894c67dce83b1d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 14:28:00 +0200 Subject: [PATCH 042/558] Remove email label from the account widget. It's not needed and it's not currently public data that is published with the user token. Contributes to CURA-5784. --- cura/OAuth2/Models.py | 2 ++ resources/qml/Account/AccountDetails.qml | 28 +++--------------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/cura/OAuth2/Models.py b/cura/OAuth2/Models.py index 83fc22554f..0515e789e6 100644 --- a/cura/OAuth2/Models.py +++ b/cura/OAuth2/Models.py @@ -1,4 +1,6 @@ # Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + from typing import Optional diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 0ce82570a5..27860cfae5 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -27,36 +27,14 @@ Column Label { - id: message + id: information anchors.horizontalCenter: parent.horizontalCenter visible: !loggedIn - text: catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura") + text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura") + font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default") color: UM.Theme.getColor("text") } - Column - { - id: userInformation - anchors.horizontalCenter: parent.horizontalCenter - visible: loggedIn - - Label - { - anchors.horizontalCenter: parent.horizontalCenter - text: loggedIn ? profile["username"] : "" - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - } - - Label - { - anchors.horizontalCenter: parent.horizontalCenter - text: "email.address@hardcoded.is" - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - } - Loader { id: accountEntryPoints From 1bcd134f85c2f70df31f8e61706cec8636ed3790 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 18 Oct 2018 14:30:11 +0200 Subject: [PATCH 043/558] Fix code style Most stuff here was recently changed. Some of it was where I found a pattern in something that was likely copy-pasted from somewhere else, so I did a global search and replace on that. Contributes to issue CURA-5784. --- .../FirmwareUpdaterMachineAction.qml | 2 +- plugins/ImageReader/ConfigUI.qml | 2 +- plugins/ModelChecker/ModelChecker.qml | 2 +- .../PostProcessingPlugin.qml | 2 +- plugins/PrepareStage/PrepareMenu.qml | 2 +- plugins/Toolbox/resources/qml/Toolbox.qml | 2 +- .../resources/qml/DiscoverUM3Action.qml | 2 +- .../resources/qml/UM3InfoComponents.qml | 2 +- .../UMOCheckupMachineAction.qml | 2 +- plugins/UserAgreement/UserAgreement.qml | 2 +- resources/qml/Account/AccountWidget.qml | 2 +- resources/qml/Actions.qml | 4 +- resources/qml/Cura.qml | 6 +- resources/qml/Dialogs/AboutDialog.qml | 52 +-- resources/qml/JobSpecs.qml | 4 +- resources/qml/MainWindow/ApplicationMenu.qml | 9 +- resources/qml/MaterialAndVariantSelector.qml | 25 +- resources/qml/MonitorButton.qml | 2 +- resources/qml/MonitorSidebar.qml | 6 +- resources/qml/Preferences/GeneralPage.qml | 4 +- resources/qml/ProfileAndSettingComponent.qml | 8 +- resources/qml/ProgressAndSaveWidget.qml | 5 +- resources/qml/SaveButton.qml | 100 +++- resources/themes/cura-light/styles.qml | 429 +++++++++++------- 24 files changed, 433 insertions(+), 243 deletions(-) diff --git a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml index 9a56dbb20a..b5b6c15f50 100644 --- a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml +++ b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml @@ -22,7 +22,7 @@ Cura.MachineAction { id: firmwareUpdaterMachineAction anchors.fill: parent; - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} spacing: UM.Theme.getSize("default_margin").height Label diff --git a/plugins/ImageReader/ConfigUI.qml b/plugins/ImageReader/ConfigUI.qml index 12c6aa8dde..b9ff2e4453 100644 --- a/plugins/ImageReader/ConfigUI.qml +++ b/plugins/ImageReader/ConfigUI.qml @@ -20,7 +20,7 @@ UM.Dialog GridLayout { - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} anchors.fill: parent; Layout.fillWidth: true columnSpacing: 16 * screenScaleFactor diff --git a/plugins/ModelChecker/ModelChecker.qml b/plugins/ModelChecker/ModelChecker.qml index 98db233bf8..5e41591d6b 100644 --- a/plugins/ModelChecker/ModelChecker.qml +++ b/plugins/ModelChecker/ModelChecker.qml @@ -16,7 +16,7 @@ Button { id: modelCheckerButton - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} visible: manager.hasWarnings tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.") diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index d492e06462..10cc4cc082 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -31,7 +31,7 @@ UM.Dialog Item { - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} id: base property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width) property int textMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ea247bf258..208e7d18df 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -16,7 +16,7 @@ Item UM.I18nCatalog { id: catalog - name:"cura" + name: "cura" } Row diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 4fb8192d81..29b026058c 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -24,7 +24,7 @@ Window UM.I18nCatalog { id: catalog - name:"cura" + name: "cura" } Item { diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index b5b80a3010..773c38a454 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -54,7 +54,7 @@ Cura.MachineAction spacing: UM.Theme.getSize("default_margin").height SystemPalette { id: palette } - UM.I18nCatalog { id: catalog; name:"cura" } + UM.I18nCatalog { id: catalog; name: "cura" } Label { id: pageTitle diff --git a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml index a19d1be60d..d84c58daef 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml @@ -121,5 +121,5 @@ Item } } - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} } diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml index 4a1d42e248..2a01cfaa40 100644 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml +++ b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml @@ -19,7 +19,7 @@ Cura.MachineAction property bool heatupBedStarted: false property bool printerConnected: Cura.MachineManager.printerConnected - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} Label { id: pageTitle diff --git a/plugins/UserAgreement/UserAgreement.qml b/plugins/UserAgreement/UserAgreement.qml index 4ee03f4ad5..2e5893fc41 100644 --- a/plugins/UserAgreement/UserAgreement.qml +++ b/plugins/UserAgreement/UserAgreement.qml @@ -36,7 +36,7 @@ UM.Dialog width: parent.width anchors.bottomMargin: UM.Theme.getSize("default_margin").height - UM.I18nCatalog { id: catalog; name:"cura" } + UM.I18nCatalog { id: catalog; name: "cura" } Button { diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index d1e285e1da..a6a79a7d29 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -40,7 +40,7 @@ Button id: popup y: parent.height + UM.Theme.getSize("default_arrow").height - x: (parent.width - width) + x: parent.width - width closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 30295f6e9b..a2b58063b4 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. pragma Singleton @@ -67,7 +67,7 @@ Item property alias browsePackages: browsePackagesAction - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} Action { diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a58e7ef6fc..2654eb3c20 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -26,7 +26,7 @@ UM.MainWindow UM.I18nCatalog { id: catalog - name:"cura" + name: "cura" } function showTooltip(item, position, text) @@ -236,7 +236,7 @@ UM.MainWindow textRole: "name" // update the model's active index - function updateItemActiveFlags () + function updateItemActiveFlags() { currentIndex = getActiveIndex() for (var i = 0; i < model.rowCount(); i++) @@ -316,7 +316,7 @@ UM.MainWindow Loader { - // A stage can control this area. If nothing is set, it will therefor show the 3D view. + // A stage can control this area. If nothing is set, it will therefore show the 3D view. id: main anchors diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 9a7e53260b..25c9bbf74b 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -45,7 +45,7 @@ UM.Dialog anchors.topMargin: ((base.minimumWidth - width) / 2) | 0 anchors.horizontalCenter: parent.horizontalCenter - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} } Label @@ -129,32 +129,32 @@ UM.Dialog } Component.onCompleted: { - projectsModel.append({ name:"Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" }); - projectsModel.append({ name:"Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" }); - projectsModel.append({ name:"CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" }); - projectsModel.append({ name:"libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" }); + projectsModel.append({ name: "Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" }); + projectsModel.append({ name: "Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" }); + projectsModel.append({ name: "CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" }); + projectsModel.append({ name: "libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" }); - projectsModel.append({ name:"Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" }); - projectsModel.append({ name:"Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" }); - projectsModel.append({ name:"PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" }); - projectsModel.append({ name:"SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" }); - projectsModel.append({ name:"Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" }); - projectsModel.append({ name:"SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" }); - projectsModel.append({ name:"NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" }); - projectsModel.append({ name:"NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" }); - projectsModel.append({ name:"Shapely", description: catalog.i18nc("@label", "Support library for handling planar objects"), license: "BSD", url: "https://github.com/Toblerity/Shapely" }); - projectsModel.append({ name:"Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" }); - projectsModel.append({ name:"NetworkX", description: catalog.i18nc("@label", "Support library for analysis of complex networks"), license: "3-clause BSD", url: "https://networkx.github.io/" }); - projectsModel.append({ name:"libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" }); - projectsModel.append({ name:"libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" }); - projectsModel.append({ name:"PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" }); - projectsModel.append({ name:"python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" }); - projectsModel.append({ name:"Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" }); - projectsModel.append({ name:"Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.org" }); + projectsModel.append({ name: "Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" }); + projectsModel.append({ name: "Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" }); + projectsModel.append({ name: "PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" }); + projectsModel.append({ name: "SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" }); + projectsModel.append({ name: "Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" }); + projectsModel.append({ name: "SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" }); + projectsModel.append({ name: "NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" }); + projectsModel.append({ name: "NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" }); + projectsModel.append({ name: "Shapely", description: catalog.i18nc("@label", "Support library for handling planar objects"), license: "BSD", url: "https://github.com/Toblerity/Shapely" }); + projectsModel.append({ name: "Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" }); + projectsModel.append({ name: "NetworkX", description: catalog.i18nc("@label", "Support library for analysis of complex networks"), license: "3-clause BSD", url: "https://networkx.github.io/" }); + projectsModel.append({ name: "libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" }); + projectsModel.append({ name: "libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" }); + projectsModel.append({ name: "PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" }); + projectsModel.append({ name: "python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" }); + projectsModel.append({ name: "Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" }); + projectsModel.append({ name: "Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.org" }); - projectsModel.append({ name:"Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" }); - projectsModel.append({ name:"Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" }); - projectsModel.append({ name:"AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" }); + projectsModel.append({ name: "Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" }); + projectsModel.append({ name: "Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" }); + projectsModel.append({ name: "AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" }); } } } diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 1a5b604886..45111992c1 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -15,7 +15,7 @@ Item { property bool activity: CuraApplication.platformActivity property string fileBaseName: PrintInformation.baseName - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} height: childrenRect.height diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 00859e2a45..e538e966fc 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -128,7 +128,8 @@ Item Instantiator { model: Cura.ExtrudersModel { simpleNames: true } - Menu { + Menu + { title: model.name NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } @@ -267,7 +268,8 @@ Item } } - UM.ExtensionModel { + UM.ExtensionModel + { id: curaExtensions } @@ -291,7 +293,8 @@ Item Connections { target: Cura.Actions.browsePackages - onTriggered: { + onTriggered: + { curaExtensions.callExtensionMethod("Toolbox", "browsePackages") } } diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/MaterialAndVariantSelector.qml index 31a898f8ae..7dfc3737c0 100644 --- a/resources/qml/MaterialAndVariantSelector.qml +++ b/resources/qml/MaterialAndVariantSelector.qml @@ -21,7 +21,7 @@ Rectangle // Height has an extra 2x margin for the top & bottom margin. height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width - Cura.ExtrudersModel { id: extrudersModel; } + Cura.ExtrudersModel { id: extrudersModel } ListView { @@ -41,7 +41,7 @@ Rectangle margins: UM.Theme.getSize("sidebar_margin").width } - ExclusiveGroup { id: extruderMenuGroup; } + ExclusiveGroup { id: extruderMenuGroup } orientation: ListView.Horizontal @@ -69,8 +69,10 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - switch (mouse.button) { + onClicked: + { + switch (mouse.button) + { case Qt.LeftButton: extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled if (extruder_enabled) @@ -114,7 +116,8 @@ Rectangle { anchors.fill: parent border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: { + border.color: + { if (Cura.MachineManager.getExtruder(index).isEnabled) { if(control.checked || control.pressed) @@ -128,13 +131,15 @@ Rectangle } return UM.Theme.getColor("action_button_disabled_border") } - color: { + color: + { if (Cura.MachineManager.getExtruder(index).isEnabled) { if(control.checked || control.pressed) { return UM.Theme.getColor("action_button_active"); - } else if (control.hovered) + } + else if (control.hovered) { return UM.Theme.getColor("action_button_hovered") } @@ -157,13 +162,15 @@ Rectangle anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - color: { + color: + { if (Cura.MachineManager.getExtruder(index).isEnabled) { if(control.checked || control.pressed) { return UM.Theme.getColor("action_button_active_text"); - } else if (control.hovered) + } + else if (control.hovered) { return UM.Theme.getColor("action_button_hovered_text") } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index aa40de11e4..efee50a2b3 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -13,7 +13,7 @@ import Cura 1.0 as Cura Item { id: base; - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index 80bd5c1a2e..179fcafb53 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -31,7 +31,7 @@ Rectangle property variant printMaterialNames: PrintInformation.materialNames color: UM.Theme.getColor("sidebar") - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} Timer { id: tooltipDelayTimer @@ -70,7 +70,7 @@ Rectangle time -= minutes * 60 var seconds = Math.floor(time); - var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); + var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2); return finalTime; } diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 64c1246929..0e8dd1b426 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 @@ -134,7 +134,7 @@ UM.PreferencesPage UM.PluginsModel { id: plugins } //: Language selection label - UM.I18nCatalog{id: catalog; name:"cura"} + UM.I18nCatalog{id: catalog; name: "cura"} Label { diff --git a/resources/qml/ProfileAndSettingComponent.qml b/resources/qml/ProfileAndSettingComponent.qml index b367c1130f..e5a29dffad 100644 --- a/resources/qml/ProfileAndSettingComponent.qml +++ b/resources/qml/ProfileAndSettingComponent.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -26,7 +26,7 @@ Rectangle property variant printMaterialNames: PrintInformation.materialNames color: UM.Theme.getColor("sidebar") - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. signal showTooltip(Item item, point location, string text) @@ -59,7 +59,7 @@ Rectangle time -= minutes * 60 var seconds = Math.floor(time); - var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); + var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2); return finalTime; } @@ -152,7 +152,7 @@ Rectangle background: Rectangle { border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border"): UM.Theme.getColor("action_button_border") + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") diff --git a/resources/qml/ProgressAndSaveWidget.qml b/resources/qml/ProgressAndSaveWidget.qml index 1e82681164..6e8eb59482 100644 --- a/resources/qml/ProgressAndSaveWidget.qml +++ b/resources/qml/ProgressAndSaveWidget.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -173,7 +173,8 @@ Rectangle var weights = []; var costs = []; var someCostsKnown = false; - if(base.printMaterialLengths) { + if(base.printMaterialLengths) + { for(var index = 0; index < base.printMaterialLengths.length; index++) { if(base.printMaterialLengths[index] > 0) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 8c561b0d00..5e41dd3007 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -13,7 +13,7 @@ import Cura 1.0 as Cura Item { id: base; - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name: "cura"} property real progress: UM.Backend.progress property int backendState: UM.Backend.state @@ -36,7 +36,7 @@ Item case 2: return catalog.i18nc("@label:PrintjobStatus", "Slicing..."); case 3: - return catalog.i18nc("@label:PrintjobStatus %1 is target operation","Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription); + return catalog.i18nc("@label:PrintjobStatus %1 is target operation", "Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription); case 4: return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice"); case 5: @@ -48,16 +48,20 @@ Item function sliceOrStopSlicing() { - try { + try + { if ([1, 5].indexOf(base.backendState) != -1) { CuraApplication.backend.forceSlice(); - } else { + } + else + { CuraApplication.backend.stopSlicing(); } - } catch (e) + } + catch (e) { - console.log('Could not start or stop slicing', e) + console.log("Could not start or stop slicing.", e) } } @@ -203,50 +207,76 @@ Item sliceOrStopSlicing(); } - style: ButtonStyle { + style: ButtonStyle + { background: Rectangle { border.width: UM.Theme.getSize("default_lining").width border.color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled_border"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active_border"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered_border"); + } else + { return UM.Theme.getColor("action_button_border"); + } } color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered"); + } else + { return UM.Theme.getColor("action_button"); + } } Behavior on color { ColorAnimation { duration: 50; } } implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) - Label { + Label + { id: actualLabel anchors.centerIn: parent color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled_text"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active_text"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered_text"); + } else + { return UM.Theme.getColor("action_button_text"); + } } font: UM.Theme.getFont("action_button") text: control.text; @@ -287,43 +317,61 @@ Item border.color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled_border"); + } else if(control.pressed) + { return UM.Theme.getColor("print_button_ready_pressed_border"); + } else if(control.hovered) + { return UM.Theme.getColor("print_button_ready_hovered_border"); + } else + { return UM.Theme.getColor("print_button_ready_border"); + } } color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled"); + } else if(control.pressed) + { return UM.Theme.getColor("print_button_ready_pressed"); + } else if(control.hovered) + { return UM.Theme.getColor("print_button_ready_hovered"); + } else + { return UM.Theme.getColor("print_button_ready"); + } } Behavior on color { ColorAnimation { duration: 50; } } implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) - Label { + Label + { id: actualLabel anchors.centerIn: parent - color:control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") + color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") font: UM.Theme.getFont("action_button") - text: control.text; + text: control.text } } label: Item { } } } - Button { + Button + { id: deviceSelectionMenu tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); anchors.top: parent.top @@ -349,13 +397,16 @@ Item if(!control.enabled) { return UM.Theme.getColor("action_button_disabled_border") - } else if(control.pressed) + } + else if(control.pressed) { return UM.Theme.getColor("print_button_ready_pressed_border") - } else if(control.hovered) + } + else if(control.hovered) { return UM.Theme.getColor("print_button_ready_hovered_border") - } else + } + else { return UM.Theme.getColor("print_button_ready_border") } @@ -365,13 +416,16 @@ Item if(!control.enabled) { return UM.Theme.getColor("action_button_disabled") - } else if(control.pressed) + } + else if(control.pressed) { return UM.Theme.getColor("print_button_ready_pressed") - } else if(control.hovered) + } + else if(control.hovered) { return UM.Theme.getColor("print_button_ready_hovered") - } else + } + else { return UM.Theme.getColor("print_button_ready") } @@ -391,7 +445,7 @@ Item sourceSize.width: width sourceSize.height: height color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") - source: UM.Theme.getIcon("arrow_bottom"); + source: UM.Theme.getIcon("arrow_bottom") } } } @@ -406,8 +460,8 @@ Item { text: model.description checkable: true; - checked: model.id == UM.OutputDeviceManager.activeDevice; - exclusiveGroup: devicesMenuGroup; + checked: model.id == UM.OutputDeviceManager.activeDevice + exclusiveGroup: devicesMenuGroup onTriggered: { UM.OutputDeviceManager.setActiveDevice(model.id); @@ -416,9 +470,9 @@ Item onObjectAdded: devicesMenu.insertItem(index, object) onObjectRemoved: devicesMenu.removeItem(object) } - ExclusiveGroup { id: devicesMenuGroup; } + ExclusiveGroup { id: devicesMenuGroup } } } - UM.OutputDevicesModel { id: devicesModel; } + UM.OutputDevicesModel { id: devicesModel } } } diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 939399efc8..58e6d2cf4d 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 @@ -7,10 +7,14 @@ import QtQuick.Controls.Styles 1.1 import UM 1.1 as UM -QtObject { - property Component sidebar_header_button: Component { - ButtonStyle { - background: Rectangle { +QtObject +{ + property Component sidebar_header_button: Component + { + ButtonStyle + { + background: Rectangle + { color: { if(control.enabled) @@ -61,7 +65,8 @@ QtObject { return Theme.getColor("setting_control_disabled_border"); } } - UM.RecolorImage { + UM.RecolorImage + { id: downArrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right @@ -73,7 +78,8 @@ QtObject { color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text") source: Theme.getIcon("arrow_bottom") } - Label { + Label + { id: sidebarComboBoxLabel color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text") text: control.text; @@ -158,33 +164,37 @@ QtObject { { if (control.checked) { - return UM.Theme.getColor("topheader_button_text_active") + return UM.Theme.getColor("topheader_button_text_active"); } else { if (control.hovered) { - return UM.Theme.getColor("topheader_button_text_hovered") + return UM.Theme.getColor("topheader_button_text_hovered"); } - return UM.Theme.getColor("topheader_button_text_inactive") + return UM.Theme.getColor("topheader_button_text_inactive"); } } } Component.onCompleted: { - buttonWidth = width + buttonWidth = width; } } } } - property Component tool_button: Component { - ButtonStyle { - background: Item { + property Component tool_button: Component + { + ButtonStyle + { + background: Item + { implicitWidth: Theme.getSize("button").width; implicitHeight: Theme.getSize("button").height; - UM.PointingRectangle { + UM.PointingRectangle + { id: button_tooltip anchors.left: parent.right @@ -203,7 +213,8 @@ QtObject { Behavior on width { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } } - Label { + Label + { id: button_tip anchors.horizontalCenter: parent.horizontalCenter @@ -215,7 +226,8 @@ QtObject { } } - Rectangle { + Rectangle + { id: buttonFace; anchors.fill: parent; @@ -249,7 +261,8 @@ QtObject { border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 border.color: Theme.getColor("tool_button_border") - UM.RecolorImage { + UM.RecolorImage + { id: tool_button_arrow anchors.right: parent.right; anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4) @@ -284,8 +297,10 @@ QtObject { } } - label: Item { - UM.RecolorImage { + label: Item + { + UM.RecolorImage + { anchors.centerIn: parent; opacity: !control.enabled ? 0.2 : 1.0 source: control.iconSource; @@ -317,13 +332,17 @@ QtObject { } } - property Component small_tool_button: Component { - ButtonStyle { - background: Item { + property Component small_tool_button: Component + { + ButtonStyle + { + background: Item + { implicitWidth: Theme.getSize("small_button").width; implicitHeight: Theme.getSize("small_button").height; - Rectangle { + Rectangle + { id: smallButtonFace; anchors.fill: parent; @@ -357,7 +376,8 @@ QtObject { border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 border.color: Theme.getColor("tool_button_border") - UM.RecolorImage { + UM.RecolorImage + { id: smallToolButtonArrow width: 5 @@ -389,13 +409,15 @@ QtObject { } } - label: Item { - UM.RecolorImage { - anchors.centerIn: parent; + label: Item + { + UM.RecolorImage + { + anchors.centerIn: parent opacity: !control.enabled ? 0.2 : 1.0 source: control.iconSource; - width: Theme.getSize("small_button_icon").width; - height: Theme.getSize("small_button_icon").height; + width: Theme.getSize("small_button_icon").width + height: Theme.getSize("small_button_icon").height color: { if(control.checkable && control.checked && control.hovered) @@ -422,14 +444,18 @@ QtObject { } } - property Component progressbar: Component{ - ProgressBarStyle { - background: Rectangle { + property Component progressbar: Component + { + ProgressBarStyle + { + background: Rectangle + { implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) implicitHeight: Theme.getSize("progressbar").height color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background") } - progress: Rectangle { + progress: Rectangle + { color: { if(control.indeterminate) @@ -446,14 +472,16 @@ QtObject { } } radius: Theme.getSize("progressbar_radius").width - Rectangle{ + Rectangle + { radius: Theme.getSize("progressbar_radius").width color: control.hasOwnProperty("controlColor") ? control.controlColor : Theme.getColor("progressbar_control") width: Theme.getSize("progressbar_control").width height: Theme.getSize("progressbar_control").height visible: control.indeterminate - SequentialAnimation on x { + SequentialAnimation on x + { id: xAnim property int animEndPoint: Theme.getSize("message").width - Math.round((Theme.getSize("default_margin").width * 2.5)) - Theme.getSize("progressbar_control").width running: control.indeterminate && control.visible @@ -466,59 +494,88 @@ QtObject { } } - property Component sidebar_category: Component { - ButtonStyle { - background: Rectangle { - anchors.fill: parent; + property Component sidebar_category: Component + { + ButtonStyle + { + background: Rectangle + { + anchors.fill: parent anchors.left: parent.left anchors.leftMargin: Theme.getSize("sidebar_margin").width anchors.right: parent.right anchors.rightMargin: Theme.getSize("sidebar_margin").width - implicitHeight: Theme.getSize("section").height; - color: { - if(control.color) { + implicitHeight: Theme.getSize("section").height + color: + { + if(control.color) + { return control.color; - } else if(!control.enabled) { + } + else if(!control.enabled) + { return Theme.getColor("setting_category_disabled"); - } else if(control.hovered && control.checkable && control.checked) { + } + else if(control.hovered && control.checkable && control.checked) + { return Theme.getColor("setting_category_active_hover"); - } else if(control.pressed || (control.checkable && control.checked)) { + } + else if(control.pressed || (control.checkable && control.checked)) + { return Theme.getColor("setting_category_active"); - } else if(control.hovered) { + } + else if(control.hovered) + { return Theme.getColor("setting_category_hover"); - } else { + } + else + { return Theme.getColor("setting_category"); } } Behavior on color { ColorAnimation { duration: 50; } } - Rectangle { + Rectangle + { height: Theme.getSize("default_lining").height width: parent.width anchors.bottom: parent.bottom - color: { - if(!control.enabled) { + color: + { + if(!control.enabled) + { return Theme.getColor("setting_category_disabled_border"); - } else if((control.hovered || control.activeFocus) && control.checkable && control.checked) { + } + else if((control.hovered || control.activeFocus) && control.checkable && control.checked) + { return Theme.getColor("setting_category_active_hover_border"); - } else if(control.pressed || (control.checkable && control.checked)) { + } + else if(control.pressed || (control.checkable && control.checked)) + { return Theme.getColor("setting_category_active_border"); - } else if(control.hovered || control.activeFocus) { + } + else if(control.hovered || control.activeFocus) + { return Theme.getColor("setting_category_hover_border"); - } else { + } + else + { return Theme.getColor("setting_category_border"); } } } } - label: Item { - anchors.fill: parent; + label: Item + { + anchors.fill: parent anchors.left: parent.left - Item{ - id: icon; + Item + { + id: icon anchors.left: parent.left height: parent.height width: Theme.getSize("section_icon_column").width - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: Theme.getSize("sidebar_margin").width @@ -553,15 +610,17 @@ QtObject { } } - Label { - anchors { - left: icon.right; - leftMargin: Theme.getSize("default_margin").width; - right: parent.right; - verticalCenter: parent.verticalCenter; + Label + { + anchors + { + left: icon.right + leftMargin: Theme.getSize("default_margin").width + right: parent.right + verticalCenter: parent.verticalCenter } - text: control.text; - font: Theme.getFont("setting_category"); + text: control.text + font: Theme.getFont("setting_category") color: { if(!control.enabled) @@ -585,10 +644,11 @@ QtObject { return Theme.getColor("setting_category_text"); } } - fontSizeMode: Text.HorizontalFit; + fontSizeMode: Text.HorizontalFit minimumPointSize: 8 } - UM.RecolorImage { + UM.RecolorImage + { id: category_arrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right @@ -626,20 +686,24 @@ QtObject { } } - property Component scrollview: Component { - ScrollViewStyle { + property Component scrollview: Component + { + ScrollViewStyle + { decrementControl: Item { } incrementControl: Item { } transientScrollBars: false - scrollBarBackground: Rectangle { + scrollBarBackground: Rectangle + { implicitWidth: Theme.getSize("scrollbar").width radius: Math.round(implicitWidth / 2) color: Theme.getColor("scrollbar_background"); } - handle: Rectangle { + handle: Rectangle + { id: scrollViewHandle implicitWidth: Theme.getSize("scrollbar").width; radius: Math.round(implicitWidth / 2) @@ -650,10 +714,13 @@ QtObject { } } - property Component combobox: Component { - ComboBoxStyle { + property Component combobox: Component + { + ComboBoxStyle + { - background: Rectangle { + background: Rectangle + { implicitHeight: Theme.getSize("setting_control").height; implicitWidth: Theme.getSize("setting_control").width; @@ -664,28 +731,31 @@ QtObject { border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); } - label: Item { + label: Item + { - Label { - anchors.left: parent.left; + Label + { + anchors.left: parent.left anchors.leftMargin: Theme.getSize("default_lining").width - anchors.right: downArrow.left; - anchors.rightMargin: Theme.getSize("default_lining").width; - anchors.verticalCenter: parent.verticalCenter; + anchors.right: downArrow.left + anchors.rightMargin: Theme.getSize("default_lining").width + anchors.verticalCenter: parent.verticalCenter - text: control.currentText; + text: control.currentText font: Theme.getFont("default"); - color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text"); + color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text") - elide: Text.ElideRight; - verticalAlignment: Text.AlignVCenter; + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter } - UM.RecolorImage { + UM.RecolorImage + { id: downArrow - anchors.right: parent.right; - anchors.rightMargin: Theme.getSize("default_lining").width * 2; - anchors.verticalCenter: parent.verticalCenter; + anchors.right: parent.right + anchors.rightMargin: Theme.getSize("default_lining").width * 2 + anchors.verticalCenter: parent.verticalCenter source: Theme.getIcon("arrow_bottom") width: Theme.getSize("standard_arrow").width @@ -700,19 +770,24 @@ QtObject { } // Combobox with items with colored rectangles - property Component combobox_color: Component { + property Component combobox_color: Component + { - ComboBoxStyle { + ComboBoxStyle + { - background: Rectangle { + background: Rectangle + { color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") border.width: UM.Theme.getSize("default_lining").width border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") } - label: Item { + label: Item + { - Label { + Label + { anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_lining").width anchors.right: swatch.left @@ -727,7 +802,8 @@ QtObject { verticalAlignment: Text.AlignVCenter } - Rectangle { + Rectangle + { id: swatch height: Math.round(UM.Theme.getSize("setting_control").height / 2) width: height @@ -740,7 +816,8 @@ QtObject { color: (control.color_override !== "") ? control.color_override : control.color } - UM.RecolorImage { + UM.RecolorImage + { id: downArrow anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 @@ -758,22 +835,26 @@ QtObject { } } - property Component checkbox: Component { - CheckBoxStyle { + property Component checkbox: Component + { + CheckBoxStyle + { background: Item { } - indicator: Rectangle { - implicitWidth: Theme.getSize("checkbox").width; - implicitHeight: Theme.getSize("checkbox").height; + indicator: Rectangle + { + implicitWidth: Theme.getSize("checkbox").width + implicitHeight: Theme.getSize("checkbox").height - color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); + color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox") Behavior on color { ColorAnimation { duration: 50; } } radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 - border.width: Theme.getSize("default_lining").width; - border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); + border.width: Theme.getSize("default_lining").width + border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border") - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2.5) @@ -786,7 +867,8 @@ QtObject { Behavior on opacity { NumberAnimation { duration: 100; } } } } - label: Label { + label: Label + { text: control.text color: Theme.getColor("checkbox_text") font: Theme.getFont("default") @@ -795,12 +877,15 @@ QtObject { } } - property Component partially_checkbox: Component { - CheckBoxStyle { + property Component partially_checkbox: Component + { + CheckBoxStyle + { background: Item { } - indicator: Rectangle { - implicitWidth: Theme.getSize("checkbox").width; - implicitHeight: Theme.getSize("checkbox").height; + indicator: Rectangle + { + implicitWidth: Theme.getSize("checkbox").width + implicitHeight: Theme.getSize("checkbox").height color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); Behavior on color { ColorAnimation { duration: 50; } } @@ -810,7 +895,8 @@ QtObject { border.width: Theme.getSize("default_lining").width; border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2.5) @@ -818,50 +904,60 @@ QtObject { sourceSize.width: width sourceSize.height: width color: Theme.getColor("checkbox_mark") - source: { - if (control.checkbox_state == 2){ - return Theme.getIcon("solid") + source: + { + if (control.checkbox_state == 2) + { + return Theme.getIcon("solid"); } - else{ - return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check") + else + { + return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check"); } } opacity: control.checked Behavior on opacity { NumberAnimation { duration: 100; } } } } - label: Label { - text: control.text; - color: Theme.getColor("checkbox_text"); - font: Theme.getFont("default"); + label: Label + { + text: control.text + color: Theme.getColor("checkbox_text") + font: Theme.getFont("default") } } } - property Component slider: Component { - SliderStyle { - groove: Rectangle { - implicitWidth: control.width; - implicitHeight: Theme.getSize("slider_groove").height; + property Component slider: Component + { + SliderStyle + { + groove: Rectangle + { + implicitWidth: control.width + implicitHeight: Theme.getSize("slider_groove").height - color: Theme.getColor("slider_groove"); - border.width: Theme.getSize("default_lining").width; - border.color: Theme.getColor("slider_groove_border"); + color: Theme.getColor("slider_groove") + border.width: Theme.getSize("default_lining").width + border.color: Theme.getColor("slider_groove_border") - radius: Math.round(width / 2); + radius: Math.round(width / 2) - Rectangle { - anchors { - left: parent.left; - top: parent.top; - bottom: parent.bottom; + Rectangle + { + anchors + { + left: parent.left + top: parent.top + bottom: parent.bottom } color: Theme.getColor("slider_groove_fill"); width: Math.round((control.value / (control.maximumValue - control.minimumValue)) * parent.width); radius: Math.round(width / 2); } } - handle: Rectangle { + handle: Rectangle + { width: Theme.getSize("slider_handle").width; height: Theme.getSize("slider_handle").height; color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); @@ -873,11 +969,13 @@ QtObject { } } - property Component text_field: Component { - TextFieldStyle { - textColor: Theme.getColor("setting_control_text"); + property Component text_field: Component + { + TextFieldStyle + { + textColor: Theme.getColor("setting_control_text") placeholderTextColor: Theme.getColor("setting_control_text") - font: Theme.getFont("default"); + font: Theme.getFont("default") background: Rectangle { @@ -889,7 +987,8 @@ QtObject { color: Theme.getColor("setting_validation_ok"); - Label { + Label + { anchors.right: parent.right; anchors.rightMargin: Theme.getSize("setting_unit_margin").width; anchors.verticalCenter: parent.verticalCenter; @@ -902,7 +1001,8 @@ QtObject { } } - property Component sidebar_action_button: Component { + property Component sidebar_action_button: Component + { ButtonStyle { background: Rectangle @@ -911,26 +1011,42 @@ QtObject { border.color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled_border"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active_border"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered_border"); + } else + { return UM.Theme.getColor("action_button_border"); + } } color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered"); + } else + { return UM.Theme.getColor("action_button"); + } } - Behavior on color { ColorAnimation { duration: 50; } } + Behavior on color { ColorAnimation { duration: 50 } } implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) @@ -941,13 +1057,21 @@ QtObject { color: { if(!control.enabled) + { return UM.Theme.getColor("action_button_disabled_text"); + } else if(control.pressed) + { return UM.Theme.getColor("action_button_active_text"); + } else if(control.hovered) + { return UM.Theme.getColor("action_button_hovered_text"); + } else + { return UM.Theme.getColor("action_button_text"); + } } font: UM.Theme.getFont("action_button") text: control.text @@ -957,7 +1081,8 @@ QtObject { } } - property Component toolbox_action_button: Component { + property Component toolbox_action_button: Component + { ButtonStyle { background: Rectangle @@ -968,17 +1093,17 @@ QtObject { { if (control.installed) { - return UM.Theme.getColor("action_button_disabled") + return UM.Theme.getColor("action_button_disabled"); } else { if (control.hovered) { - return UM.Theme.getColor("primary_hover") + return UM.Theme.getColor("primary_hover"); } else { - return UM.Theme.getColor("primary") + return UM.Theme.getColor("primary"); } } @@ -991,17 +1116,17 @@ QtObject { { if (control.installed) { - return UM.Theme.getColor("action_button_disabled_text") + return UM.Theme.getColor("action_button_disabled_text"); } else { if (control.hovered) { - return UM.Theme.getColor("button_text_hover") + return UM.Theme.getColor("button_text_hover"); } else { - return UM.Theme.getColor("button_text") + return UM.Theme.getColor("button_text"); } } } From 237c360a88897a34ea7abf365c584b9ee04180a9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 15:18:00 +0200 Subject: [PATCH 044/558] The size of the avatar image is now themed. Some other small fixes in the AccountDetails componenent were done. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 8 ++++---- resources/qml/Account/AvatarImage.qml | 2 ++ resources/themes/cura-light/styles.qml | 2 +- resources/themes/cura-light/theme.json | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 27860cfae5..10ee5016cd 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -18,8 +18,8 @@ Column AvatarImage { id: avatar - width: 75 * screenScaleFactor - height: 75 * screenScaleFactor + width: UM.Theme.getSize("avatar_image").width + height: UM.Theme.getSize("avatar_image").height anchors.horizontalCenter: parent.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") @@ -29,8 +29,8 @@ Column { id: information anchors.horizontalCenter: parent.horizontalCenter - visible: !loggedIn - text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura") + horizontalAlignment: Text.AlignHCenter + text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please log in or create an account to\nenjoy all features of Ultimaker Cura.") font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default") color: UM.Theme.getColor("text") } diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 0e0d182018..333bce29d7 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -1,4 +1,6 @@ // 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 QtGraphicalEffects 1.0 diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 939399efc8..1164b84332 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 285d2724a0..43a0b628b5 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -488,6 +488,8 @@ "toolbox_action_button": [8.0, 2.5], "toolbox_loader": [2.0, 2.0], + "avatar_image": [6.8, 6.8], + "drop_shadow_radius": [1.0, 1.0] } } From 119638efa1fa71492648b0305df87bdea23bad12 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 15:35:21 +0200 Subject: [PATCH 045/558] Adjust outline color for the avatar image. Following the colors in the designs. Contributes to CURA-5784. --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 43a0b628b5..16cb17756d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -88,7 +88,7 @@ "topheader_button_background_inactive": [255, 255, 255, 0], "account_widget_ouline_active": [9, 140, 188, 255], - "account_widget_ouline_inactive": [175, 175, 175, 255], + "account_widget_ouline_inactive": [229, 229, 229, 255], "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], From 0a07f48375bb47976d32194ece31c0d5c7038dbe Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 15:38:24 +0200 Subject: [PATCH 046/558] Fix typo in a theme's key. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 2 +- resources/qml/Account/AccountWidget.qml | 2 +- resources/themes/cura-light/theme.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 10ee5016cd..18f11622fd 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -22,7 +22,7 @@ Column height: UM.Theme.getSize("avatar_image").height anchors.horizontalCenter: parent.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") - outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } Label diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index a6a79a7d29..6374aaad69 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -28,7 +28,7 @@ Button anchors.horizontalCenter: parent.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") - outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } background: Item {} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 16cb17756d..07eab72afb 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -87,8 +87,8 @@ "topheader_button_background_active": [255, 255, 255, 255], "topheader_button_background_inactive": [255, 255, 255, 0], - "account_widget_ouline_active": [9, 140, 188, 255], - "account_widget_ouline_inactive": [229, 229, 229, 255], + "account_widget_outline_active": [9, 140, 188, 255], + "account_widget_outline_inactive": [229, 229, 229, 255], "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], From fdfa81b2b8cf69d78897961f6985bf6ed8b941e0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 16:06:21 +0200 Subject: [PATCH 047/558] Make some items' size dependent on parent's. Also make the ActionButton more themable. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 1 + resources/qml/Account/AccountWidget.qml | 1 - resources/qml/ActionButton.qml | 21 +++++++++++---------- resources/themes/cura-light/theme.json | 2 ++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 18f11622fd..cc065fc0dd 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -30,6 +30,7 @@ Column id: information anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter + renderType: Text.NativeRendering text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please log in or create an account to\nenjoy all features of Ultimaker Cura.") font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default") color: UM.Theme.getColor("text") diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 6374aaad69..70ee6c86da 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -21,7 +21,6 @@ Button { id: avatar - width: Math.round(0.8 * parent.width) height: Math.round(0.8 * parent.height) anchors.verticalCenter: parent.verticalCenter diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index b49e3f1dcb..44299d3734 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -11,28 +11,28 @@ Button { id: button property alias cursorShape: mouseArea.cursorShape - property var iconSource: "" + property alias iconSource: buttonIcon.source + property alias textFont: buttonText.font + property alias cornerRadius: backgroundRect.radius property var color: UM.Theme.getColor("primary") property var hoverColor: UM.Theme.getColor("primary_hover") property var disabledColor: color property var textColor: UM.Theme.getColor("button_text") property var textHoverColor: UM.Theme.getColor("button_text_hover") property var textDisabledColor: textColor - property var textFont: UM.Theme.getFont("action_button") - property var cornerRadius: 2 * screenScaleFactor contentItem: Row { UM.RecolorImage { id: buttonIcon - source: button.iconSource - width: 16 * screenScaleFactor - height: 16 * screenScaleFactor + source: "" + height: Math.round(0.6 * parent.height) + width: height sourceSize.width: width sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor - visible: button.iconSource != "" + visible: source != "" anchors.verticalCenter: parent.verticalCenter } @@ -41,8 +41,8 @@ Button id: buttonText text: button.text color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor - font: button.textFont - visible: button.text != "" + font: UM.Theme.getFont("action_button") + visible: text != "" renderType: Text.NativeRendering anchors.verticalCenter: parent.verticalCenter } @@ -50,8 +50,9 @@ Button background: Rectangle { + id: backgroundRect color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor - radius: cornerRadius + radius: UM.Theme.getSize("action_button_radius").width } MouseArea diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 07eab72afb..3325312e8b 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -490,6 +490,8 @@ "avatar_image": [6.8, 6.8], + "action_button_radius": [0.25, 0.25], + "drop_shadow_radius": [1.0, 1.0] } } From 1cc7e0e586604ddf16b2931e1bcffbadb53c7f80 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 16:33:13 +0200 Subject: [PATCH 048/558] Set the height of the stage menu in the theme instead of hardcoded. I also adjusted a bit the design to fulfill the requirments from UX/UI team. Contributes to CURA-5772. --- cura/Stages/CuraStage.py | 5 +++-- plugins/PrepareStage/PrepareMenu.qml | 8 +++++++- resources/qml/Cura.qml | 17 ++++++++++++++--- resources/themes/cura-light/theme.json | 2 ++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/cura/Stages/CuraStage.py b/cura/Stages/CuraStage.py index 774a5a6e76..e8537fb6b9 100644 --- a/cura/Stages/CuraStage.py +++ b/cura/Stages/CuraStage.py @@ -1,5 +1,6 @@ -# Copyright (c) 2017 Ultimaker B.V. +# 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 @@ -27,6 +28,6 @@ class CuraStage(Stage): def sidebarComponent(self) -> QUrl: return self.getDisplayComponent("sidebar") - @pyqtProperty(QUrl, constant=True) + @pyqtProperty(QUrl, constant = True) def stageMenuComponent(self) -> QUrl: return self.getDisplayComponent("menu") \ No newline at end of file diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 208e7d18df..10ff0b2310 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -21,7 +21,6 @@ Item Row { - spacing: UM.Theme.getSize("default_margin").width anchors.horizontalCenter: parent.horizontalCenter Button @@ -34,6 +33,13 @@ Item action: Cura.Actions.open } + Item + { + id: spacing + width: UM.Theme.getSize("default_margin").width + height: parent.height + } + Cura.MachineAndConfigurationSelector { } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2654eb3c20..d9113ca448 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -20,7 +20,6 @@ UM.MainWindow // Cura application window title title: catalog.i18nc("@title:window", "Ultimaker Cura") - viewportRect: Qt.rect(0, 0, 1.0, 1.0) backgroundColor: UM.Theme.getColor("viewport_background") UM.I18nCatalog @@ -143,6 +142,19 @@ UM.MainWindow } } + Rectangle + { + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + visible: stageMenu.source != "" + height: Math.round(UM.Theme.getSize("stage_menu").height / 2) + color: UM.Theme.getColor("topheader_background") + } + Loader { // The stage menu is, as the name implies, a menu that is defined by the active stage. @@ -155,10 +167,9 @@ UM.MainWindow left: parent.left right: parent.right top: parent.top - margins: UM.Theme.getSize("default_margin").height } - height: 50 + height: UM.Theme.getSize("stage_menu").height source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 3325312e8b..d26c872b00 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -344,6 +344,8 @@ "topheader_button": [8, 4], "topheader_button_icon": [1.2, 1.2], + "stage_menu": [0.0, 4.5], + "account_button": [12, 3], "views_selector": [0.0, 4.0], From 8df3eb33d45fd89bc4e7b0789ba03cfdc1020c4f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 16:51:32 +0200 Subject: [PATCH 049/558] Minor changes: remove empty lines, small changes in the anchors, ... Contributes to CURA-5772. --- resources/qml/Account/AccountDetails.qml | 2 +- resources/qml/Account/AccountWidget.qml | 1 - resources/qml/Cura.qml | 9 +-------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index cc065fc0dd..9cd9b91949 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -38,7 +38,7 @@ Column Loader { - id: accountEntryPoints + id: accountOperations anchors.horizontalCenter: parent.horizontalCenter sourceComponent: loggedIn ? userOperations : generalOperations } diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 70ee6c86da..d6d4728e7e 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -16,7 +16,6 @@ Button implicitHeight: UM.Theme.getSize("topheader").height implicitWidth: UM.Theme.getSize("topheader").height - AvatarImage { id: avatar diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index d9113ca448..52ff99ad9b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -187,7 +187,6 @@ UM.MainWindow { bottom: parent.bottom bottomMargin: UM.Theme.getSize("default_margin").height - rightMargin: UM.Theme.getSize("default_margin").width } } @@ -330,13 +329,7 @@ UM.MainWindow // A stage can control this area. If nothing is set, it will therefore show the 3D view. id: main - anchors - { - top: parent.top - bottom: parent.bottom - left: parent.left - right: parent.right - } + anchors.fill: parent MouseArea { From 93b04190f803b16e8409ac94f843f2605a347ed8 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:13:15 +0200 Subject: [PATCH 050/558] Change name of some components to make them more indicative of what they do. Contributes to CURA-5772. --- plugins/PrepareStage/PrepareMenu.qml | 23 +++++++-- ...or.qml => CustomConfigurationSelector.qml} | 0 .../qml/MachineAndConfigurationSelector.qml | 47 ------------------- ...chineSelection.qml => MachineSelector.qml} | 0 ...ion.qml => QuickConfigurationSelector.qml} | 0 ...ngComponent.qml => PrintSetupSelector.qml} | 0 resources/qml/qmldir | 7 +-- 7 files changed, 23 insertions(+), 54 deletions(-) rename resources/qml/{MaterialAndVariantSelector.qml => CustomConfigurationSelector.qml} (100%) delete mode 100644 resources/qml/MachineAndConfigurationSelector.qml rename resources/qml/{MachineSelection.qml => MachineSelector.qml} (100%) rename resources/qml/Menus/ConfigurationMenu/{ConfigurationSelection.qml => QuickConfigurationSelector.qml} (100%) rename resources/qml/{ProfileAndSettingComponent.qml => PrintSetupSelector.qml} (100%) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 10ff0b2310..8d0f03ec2f 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -13,6 +13,9 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() + property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property bool printerConnected: Cura.MachineManager.printerConnected + UM.I18nCatalog { id: catalog @@ -37,19 +40,31 @@ Item { id: spacing width: UM.Theme.getSize("default_margin").width - height: parent.height + height: prepareMenu.height } - Cura.MachineAndConfigurationSelector + Cura.MachineSelector { + id: machineSelection + width: UM.Theme.getSize("sidebar").width + height: prepareMenu.height } - Cura.MaterialAndVariantSelector + Cura.QuickConfigurationSelector + { + id: configSelection + visible: isNetworkPrinter && printerConnected + width: visible ? Math.round(machineSelection.width * 0.15) : 0 + panelWidth: machineSelection.width + height: prepareMenu.height + } + + Cura.CustomConfigurationSelector { width: UM.Theme.getSize("sidebar").width } - Cura.ProfileAndSettingComponent + Cura.PrintSetupSelector { width: UM.Theme.getSize("sidebar").width onShowTooltip: prepareMenu.showTooltip(item, location, text) diff --git a/resources/qml/MaterialAndVariantSelector.qml b/resources/qml/CustomConfigurationSelector.qml similarity index 100% rename from resources/qml/MaterialAndVariantSelector.qml rename to resources/qml/CustomConfigurationSelector.qml diff --git a/resources/qml/MachineAndConfigurationSelector.qml b/resources/qml/MachineAndConfigurationSelector.qml deleted file mode 100644 index 15b9ca6dd6..0000000000 --- a/resources/qml/MachineAndConfigurationSelector.qml +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 - -import UM 1.2 as UM -import Cura 1.0 as Cura -import "Menus" -import "Menus/ConfigurationMenu" - -Rectangle -{ - color: UM.Theme.getColor("sidebar_lining_thin") - - implicitHeight: UM.Theme.getSize("sidebar_header").height - implicitWidth: UM.Theme.getSize("sidebar").width - - property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" - property bool printerConnected: Cura.MachineManager.printerConnected - - MachineSelection - { - id: machineSelection - anchors - { - left: parent.left - right: configSelection.left - rightMargin: UM.Theme.getSize("sidebar_lining_thin").height / 2 - top: parent.top - bottom: parent.bottom - } - } - - ConfigurationSelection - { - id: configSelection - visible: isNetworkPrinter && printerConnected - width: visible ? Math.round(parent.width * 0.15) : 0 - panelWidth: parent.width - anchors - { - right: parent.right - top: parent.top - bottom: parent.bottom - } - } -} \ No newline at end of file diff --git a/resources/qml/MachineSelection.qml b/resources/qml/MachineSelector.qml similarity index 100% rename from resources/qml/MachineSelection.qml rename to resources/qml/MachineSelector.qml diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationSelection.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml similarity index 100% rename from resources/qml/Menus/ConfigurationMenu/ConfigurationSelection.qml rename to resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml diff --git a/resources/qml/ProfileAndSettingComponent.qml b/resources/qml/PrintSetupSelector.qml similarity index 100% rename from resources/qml/ProfileAndSettingComponent.qml rename to resources/qml/PrintSetupSelector.qml diff --git a/resources/qml/qmldir b/resources/qml/qmldir index b9306b14bc..10e103d9ef 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -1,6 +1,7 @@ module Cura -MachineAndConfigurationSelector 1.0 MachineAndConfigurationSelector.qml -MaterialAndVariantSelector 1.0 MaterialAndVariantSelector.qml -ProfileAndSettingComponent 1.0 ProfileAndSettingComponent.qml +MachineSelector 1.0 MachineSelector.qml +QuickConfigurationSelector 1.0 QuickConfigurationSelector.qml +CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml +PrintSetupSelector 1.0 PrintSetupSelector.qml ActionButton 1.0 ActionButton.qml \ No newline at end of file From 84adfa14ee73ef09831197c464ca847b5543f1de Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:26:10 +0200 Subject: [PATCH 051/558] Add license to the top of a file Contributes to CURA-5772. --- resources/qml/ExtruderIcon.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 580ff5dce9..e4161e0058 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -1,3 +1,6 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.7 import QtQuick.Controls 1.1 import UM 1.2 as UM @@ -47,7 +50,7 @@ Item height: Math.round(parent.height * 0.35) radius: Math.round(width / 2) - border.width: 1 + border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("extruder_button_material_border") opacity: !extruderIconItem.checked ? 0.6 : 1.0 From bf6817ce7a68c2e7f0b347ca98062e913a7a35e4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:38:23 +0200 Subject: [PATCH 052/558] Reduce the size of the ApplicationMenu.qml file by moving some components out to different files. Contributes to CURA-5772. --- resources/qml/MainWindow/ApplicationMenu.qml | 136 +------------------ resources/qml/Menus/FileMenu.qml | 81 +++++++++++ resources/qml/Menus/SettingsMenu.qml | 69 ++++++++++ 3 files changed, 153 insertions(+), 133 deletions(-) create mode 100644 resources/qml/Menus/FileMenu.qml create mode 100644 resources/qml/Menus/SettingsMenu.qml diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index e538e966fc..d3bc115419 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -24,78 +24,7 @@ Item { id: applicationMenu - Menu - { - id: fileMenu - title: catalog.i18nc("@title:menu menubar:toplevel", "&File") - - MenuItem - { - id: newProjectMenu - action: Cura.Actions.newProject - } - - MenuItem - { - id: openMenu - action: Cura.Actions.open - } - - RecentFilesMenu { } - - MenuItem - { - id: saveWorkspaceMenu - text: catalog.i18nc("@title:menu menubar:file", "&Save...") - onTriggered: - { - var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; - if(UM.Preferences.getValue("cura/dialog_on_project_save")) - { - saveWorkspaceDialog.args = args - saveWorkspaceDialog.open() - } - else - { - UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) - } - } - } - - MenuSeparator { } - - MenuItem - { - id: saveAsMenu - text: catalog.i18nc("@title:menu menubar:file", "&Export...") - onTriggered: - { - var localDeviceId = "local_file" - UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) - } - } - - MenuItem - { - id: exportSelectionMenu - text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") - enabled: UM.Selection.hasSelection - iconName: "document-save-as" - onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) - } - - MenuSeparator { } - - MenuItem - { - id: reloadAllMenu - action: Cura.Actions.reloadAll - } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.quit } - } + FileMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&File") } Menu { @@ -116,68 +45,9 @@ Item MenuItem { action: Cura.Actions.unGroupObjects } } - ViewMenu { title: catalog.i18nc("@title:menu", "&View") } + ViewMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&View") } - Menu - { - id: settingsMenu - title: catalog.i18nc("@title:menu", "&Settings") - - PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } - - Instantiator - { - model: Cura.ExtrudersModel { simpleNames: true } - Menu - { - title: model.name - - NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } - MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } - - MenuSeparator - { - visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") - onTriggered: Cura.MachineManager.setExtruderIndex(model.index) - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Enable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) - visible: !Cura.MachineManager.getExtruder(model.index).isEnabled - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Disable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) - visible: Cura.MachineManager.getExtruder(model.index).isEnabled - enabled: Cura.MachineManager.numberExtrudersEnabled > 1 - } - - } - onObjectAdded: settingsMenu.insertItem(index, object) - onObjectRemoved: settingsMenu.removeItem(object) - } - - // TODO Only show in dev mode. Remove check when feature ready - BuildplateMenu - { - title: catalog.i18nc("@title:menu", "&Build plate") - visible: CuraSDKVersion == "dev" && Cura.MachineManager.hasVariantBuildplates - } - ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile") } - - MenuSeparator { } - - MenuItem { action: Cura.Actions.configureSettingVisibility } - } + SettingsMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings") } Menu { diff --git a/resources/qml/Menus/FileMenu.qml b/resources/qml/Menus/FileMenu.qml new file mode 100644 index 0000000000..955ac89693 --- /dev/null +++ b/resources/qml/Menus/FileMenu.qml @@ -0,0 +1,81 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Menu +{ + id: base + title: catalog.i18nc("@title:menu menubar:toplevel", "&File") + + MenuItem + { + id: newProjectMenu + action: Cura.Actions.newProject + } + + MenuItem + { + id: openMenu + action: Cura.Actions.open + } + + RecentFilesMenu { } + + MenuItem + { + id: saveWorkspaceMenu + text: catalog.i18nc("@title:menu menubar:file", "&Save...") + onTriggered: + { + var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; + if(UM.Preferences.getValue("cura/dialog_on_project_save")) + { + saveWorkspaceDialog.args = args + saveWorkspaceDialog.open() + } + else + { + UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + } + } + } + + MenuSeparator { } + + MenuItem + { + id: saveAsMenu + text: catalog.i18nc("@title:menu menubar:file", "&Export...") + onTriggered: + { + var localDeviceId = "local_file" + UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } + } + + MenuItem + { + id: exportSelectionMenu + text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") + enabled: UM.Selection.hasSelection + iconName: "document-save-as" + onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) + } + + MenuSeparator { } + + MenuItem + { + id: reloadAllMenu + action: Cura.Actions.reloadAll + } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.quit } +} \ No newline at end of file diff --git a/resources/qml/Menus/SettingsMenu.qml b/resources/qml/Menus/SettingsMenu.qml new file mode 100644 index 0000000000..79f8c5b7bf --- /dev/null +++ b/resources/qml/Menus/SettingsMenu.qml @@ -0,0 +1,69 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Menu +{ + id: base + title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings") + + PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } + + Instantiator + { + model: Cura.ExtrudersModel { simpleNames: true } + Menu + { + title: model.name + + NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } + MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } + + MenuSeparator + { + visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") + onTriggered: Cura.MachineManager.setExtruderIndex(model.index) + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Enable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) + visible: !Cura.MachineManager.getExtruder(model.index).isEnabled + } + + MenuItem + { + text: catalog.i18nc("@action:inmenu", "Disable Extruder") + onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) + visible: Cura.MachineManager.getExtruder(model.index).isEnabled + enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + } + + } + onObjectAdded: base.insertItem(index, object) + onObjectRemoved: base.removeItem(object) + } + + // TODO Only show in dev mode. Remove check when feature ready + BuildplateMenu + { + title: catalog.i18nc("@title:menu", "&Build plate") + visible: CuraSDKVersion == "dev" && Cura.MachineManager.hasVariantBuildplates + } + ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile") } + + MenuSeparator { } + + MenuItem { action: Cura.Actions.configureSettingVisibility } +} \ No newline at end of file From 176c7bfc22ea4972ce194c07301b9e75ca28331f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:48:03 +0200 Subject: [PATCH 053/558] Small fixes in the CustomConfigurationSelector file Contributes to CURA-5772. --- resources/qml/CustomConfigurationSelector.qml | 26 +++++++++---------- resources/qml/qmldir | 4 ++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/resources/qml/CustomConfigurationSelector.qml b/resources/qml/CustomConfigurationSelector.qml index 7dfc3737c0..9a3f91e6a3 100644 --- a/resources/qml/CustomConfigurationSelector.qml +++ b/resources/qml/CustomConfigurationSelector.qml @@ -8,8 +8,6 @@ import QtQuick.Controls.Styles 1.1 import UM 1.2 as UM import Cura 1.0 as Cura -import "Menus" // TODO: This needs to be fixed in the qmldir! - Rectangle { implicitWidth: parent.width @@ -77,16 +75,15 @@ Rectangle extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled if (extruder_enabled) { - forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - Cura.ExtruderManager.setActiveExtruderIndex(index); + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + Cura.ExtruderManager.setActiveExtruderIndex(index) } - break; + break case Qt.RightButton: extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled - extruderMenu.popup(); - break; + extruderMenu.popup() + break } - } } @@ -122,8 +119,9 @@ Rectangle { if(control.checked || control.pressed) { - return UM.Theme.getColor("action_button_active_border"); - } else if (control.hovered) + return UM.Theme.getColor("action_button_active_border") + } + else if (control.hovered) { return UM.Theme.getColor("action_button_hovered_border") } @@ -252,7 +250,7 @@ Rectangle anchors.right: parent.right style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; - menu: MaterialMenu + menu: Cura.MaterialMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } @@ -300,7 +298,7 @@ Rectangle style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; - menu: NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } + menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } } } @@ -348,12 +346,12 @@ Rectangle { anchors.fill: parent - onClicked: { + onClicked: + { // open the material URL with web browser Qt.openUrlExternally("https://ultimaker.com/incoming-links/cura/material-compatibilty"); } } } } - } diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 10e103d9ef..2681da00e1 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -4,4 +4,6 @@ MachineSelector 1.0 MachineSelector.qml QuickConfigurationSelector 1.0 QuickConfigurationSelector.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml -ActionButton 1.0 ActionButton.qml \ No newline at end of file +ActionButton 1.0 ActionButton.qml +MaterialMenu 1.0 MaterialMenu.qml +NozzleMenu 1.0 NozzleMenu.qml \ No newline at end of file From 66147f4172f1162a5a5a604742186f91e3025c4a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:49:56 +0200 Subject: [PATCH 054/558] Remove unused style button. Contributes to CURA-5772. --- resources/themes/cura-light/styles.qml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 58e6d2cf4d..074ceb4200 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -96,14 +96,6 @@ QtObject } } - property Component action_button: Component - { - ButtonStyle - { - - } - } - property Component topheader_tab: Component { ButtonStyle From 405e4c5bbd73eb60b8b27822e3e30890ecdb97aa Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 18 Oct 2018 17:52:42 +0200 Subject: [PATCH 055/558] Correct year, we live now in 2018 (keep it in mind) Contributes to CURA-5772. --- resources/qml/MachineSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 7a8a6b476b..49fbf16e19 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 From 6f12197cead700d53666f0f9007b895f830e0fd5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 19 Oct 2018 13:41:32 +0200 Subject: [PATCH 056/558] Don't use an image to create a mask but a circle. Contributes to CURA-5772. --- resources/qml/Account/AvatarImage.qml | 12 ++-- .../themes/cura-light/icons/circle_mask.svg | 64 ----------------- .../cura-light/icons/circle_outline.svg | 68 ++----------------- 3 files changed, 8 insertions(+), 136 deletions(-) delete mode 100644 resources/themes/cura-light/icons/circle_mask.svg diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 333bce29d7..21adbcb7c3 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -26,31 +26,27 @@ Item visible: false } - UM.RecolorImage + Rectangle { id: profileImageMask - source: UM.Theme.getIcon("circle_mask") - sourceSize: Qt.size(parent.width, parent.height) anchors.fill: parent - color: UM.Theme.getColor("topheader_background") - visible: false + radius: width } OpacityMask { - anchors.fill: profileImage + anchors.fill: parent source: profileImage maskSource: profileImageMask cached: true - invert: false } UM.RecolorImage { id: profileImageOutline + anchors.fill: parent source: UM.Theme.getIcon("circle_outline") sourceSize: Qt.size(parent.width, parent.height) - anchors.fill: parent color: UM.Theme.getColor("account_widget_ouline_active") } } \ No newline at end of file diff --git a/resources/themes/cura-light/icons/circle_mask.svg b/resources/themes/cura-light/icons/circle_mask.svg deleted file mode 100644 index d5bfe53a97..0000000000 --- a/resources/themes/cura-light/icons/circle_mask.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/resources/themes/cura-light/icons/circle_outline.svg b/resources/themes/cura-light/icons/circle_outline.svg index 4d0b0e4eb0..3a8fb197f3 100644 --- a/resources/themes/cura-light/icons/circle_outline.svg +++ b/resources/themes/cura-light/icons/circle_outline.svg @@ -1,64 +1,4 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + \ No newline at end of file From 15b35da612e773bb78827ae7bd5940c33cd85717 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 19 Oct 2018 16:40:21 +0200 Subject: [PATCH 057/558] Change the TopHeader name to MainWindowHeader, since there is nothing more on the top than the header. Contributes to CURA-5784. --- resources/qml/Account/AccountWidget.qml | 4 ++-- resources/qml/Account/GeneralOperations.qml | 4 ++-- resources/qml/Account/UserOperations.qml | 4 ++-- resources/qml/Cura.qml | 8 +++---- .../{TopHeader.qml => MainWindowHeader.qml} | 22 +++++++++---------- .../ConfigurationMenu/ConfigurationItem.qml | 4 ++-- resources/themes/cura-dark/theme.json | 9 ++++---- resources/themes/cura-light/styles.qml | 14 ++++++------ resources/themes/cura-light/theme.json | 19 ++++++++-------- 9 files changed, 43 insertions(+), 45 deletions(-) rename resources/qml/MainWindow/{TopHeader.qml => MainWindowHeader.qml} (76%) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index d6d4728e7e..fc99273119 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -13,8 +13,8 @@ Button property var profile: Cura.API.account.userProfile property var loggedIn: Cura.API.account.isLoggedIn - implicitHeight: UM.Theme.getSize("topheader").height - implicitWidth: UM.Theme.getSize("topheader").height + implicitHeight: UM.Theme.getSize("main_window_header").height + implicitWidth: UM.Theme.getSize("main_window_header").height AvatarImage { diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 1f3cd51f26..6bc94dd830 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -18,8 +18,8 @@ Row text: catalog.i18nc("@button", "Create account") color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("text_link") - textHoverColor: UM.Theme.getColor("text") + textColor: UM.Theme.getColor("main_window_header_button_text_active") + textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com") } diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index ffcf518b6e..a12bfbf6d7 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -18,8 +18,8 @@ Row text: catalog.i18nc("@button", "Manage account") color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("text_link") - textHoverColor: UM.Theme.getColor("text") + textColor: UM.Theme.getColor("main_window_header_button_text_active") + textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com") } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 52ff99ad9b..474f93afa4 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -86,9 +86,9 @@ UM.MainWindow window: base } - TopHeader + MainWindowHeader { - id: topHeader + id: mainWindowHeader anchors { left: parent.left @@ -103,7 +103,7 @@ UM.MainWindow anchors { - top: topHeader.bottom + top: mainWindowHeader.bottom bottom: parent.bottom left: parent.left right: parent.right @@ -152,7 +152,7 @@ UM.MainWindow } visible: stageMenu.source != "" height: Math.round(UM.Theme.getSize("stage_menu").height / 2) - color: UM.Theme.getColor("topheader_background") + color: UM.Theme.getColor("main_window_header_background") } Loader diff --git a/resources/qml/MainWindow/TopHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml similarity index 76% rename from resources/qml/MainWindow/TopHeader.qml rename to resources/qml/MainWindow/MainWindowHeader.qml index 867a6bafbb..b90968c606 100644 --- a/resources/qml/MainWindow/TopHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM @@ -14,9 +14,9 @@ Rectangle { id: base - implicitHeight: UM.Theme.getSize("topheader").height - implicitWidth: UM.Theme.getSize("topheader").width - color: UM.Theme.getColor("topheader_background") + implicitHeight: UM.Theme.getSize("main_window_header").height + implicitWidth: UM.Theme.getSize("main_window_header").width + color: UM.Theme.getColor("main_window_header_background") Image { @@ -43,7 +43,7 @@ Rectangle leftMargin: UM.Theme.getSize("default_margin").width } - // The topheader is dynamically filled with all available stages + // The main window header is dynamically filled with all available stages Repeater { id: stagesHeader @@ -55,9 +55,9 @@ Rectangle text: model.name.toUpperCase() checkable: true checked: model.active - exclusiveGroup: topheaderMenuGroup - style: UM.Theme.styles.topheader_tab - height: UM.Theme.getSize("topheader").height + exclusiveGroup: mainWindowHeaderMenuGroup + style: UM.Theme.styles.main_window_header_tab + height: UM.Theme.getSize("main_window_header").height onClicked: UM.Controller.setActiveStage(model.id) iconSource: model.stage.iconSource @@ -66,7 +66,7 @@ Rectangle } } - ExclusiveGroup { id: topheaderMenuGroup } + ExclusiveGroup { id: mainWindowHeaderMenuGroup } } // Shortcut button to quick access the Toolbox @@ -83,14 +83,14 @@ Rectangle { background: Rectangle { - color: control.hovered ? UM.Theme.getColor("secondary") : UM.Theme.getColor("topheader_button_background_active") + color: control.hovered ? UM.Theme.getColor("secondary") : UM.Theme.getColor("main_window_header_button_background_active") radius: 2 * screenScaleFactor } label: Label { text: catalog.i18nc("@action:button", "Toolbox") - color: UM.Theme.getColor("topheader_button_text_active") + color: UM.Theme.getColor("main_window_header_button_text_active") font: UM.Theme.getFont("action_button") renderType: Text.NativeRendering } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 517b69428e..37d851a35d 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -77,8 +77,8 @@ Rectangle UM.RecolorImage { id: buildplateIcon anchors.left: parent.left - width: UM.Theme.getSize("topheader_button_icon").width - height: UM.Theme.getSize("topheader_button_icon").height + width: UM.Theme.getSize("main_window_header_button_icon").width + height: UM.Theme.getSize("main_window_header_button_icon").height sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("buildplate") diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 99737ff8bf..897d09ccf2 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -15,11 +15,10 @@ "border": [127, 127, 127, 255], "secondary": [241, 242, 242, 255], - "topheader_background": [31, 36, 39, 255], - - "topheader_button_text_active": [31, 36, 39, 255], - "topheader_button_text_inactive": [128, 128, 128, 255], - "topheader_button_text_hovered": [255, 255, 255, 255], + "main_window_header_background": [31, 36, 39, 255], + "main_window_header_button_text_active": [31, 36, 39, 255], + "main_window_header_button_text_inactive": [128, 128, 128, 255], + "main_window_header_button_text_hovered": [255, 255, 255, 255], "text": [255, 255, 255, 204], "text_detail": [255, 255, 255, 172], diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 074ceb4200..e6e5bd7fda 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -96,7 +96,7 @@ QtObject } } - property Component topheader_tab: Component + property Component main_window_header_tab: Component { ButtonStyle { @@ -114,7 +114,7 @@ QtObject anchors.verticalCenter: parent.verticalCenter implicitHeight: parent.height - 2 * UM.Theme.getSize("default_margin").width implicitWidth: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("topheader_button_background_active") + color: UM.Theme.getColor("main_window_header_button_background_active") visible: !control.checked } Rectangle @@ -122,7 +122,7 @@ QtObject id: buttonFace implicitHeight: parent.height implicitWidth: parent.width - color: control.checked ? UM.Theme.getColor("topheader_button_background_active") : UM.Theme.getColor("topheader_button_background_inactive") + color: control.checked ? UM.Theme.getColor("main_window_header_button_background_active") : UM.Theme.getColor("main_window_header_button_background_inactive") Behavior on color { ColorAnimation { duration: 50 } } } @@ -132,7 +132,7 @@ QtObject anchors.verticalCenter: parent.verticalCenter implicitHeight: parent.height - 2 * UM.Theme.getSize("default_margin").width implicitWidth: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("topheader_button_background_active") + color: UM.Theme.getColor("main_window_header_button_background_active") visible: !control.checked } } @@ -156,15 +156,15 @@ QtObject { if (control.checked) { - return UM.Theme.getColor("topheader_button_text_active"); + return UM.Theme.getColor("main_window_header_button_text_active"); } else { if (control.hovered) { - return UM.Theme.getColor("topheader_button_text_hovered"); + return UM.Theme.getColor("main_window_header_button_text_hovered"); } - return UM.Theme.getColor("topheader_button_text_inactive"); + return UM.Theme.getColor("main_window_header_button_text_inactive"); } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d26c872b00..d72493ec89 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -79,13 +79,12 @@ "border": [127, 127, 127, 255], "secondary": [245, 245, 245, 255], - "topheader_background": [12, 169, 227, 255], - - "topheader_button_text_active": [12, 169, 227, 255], - "topheader_button_text_inactive": [255, 255, 255, 255], - "topheader_button_text_hovered": [0, 0, 0, 255], - "topheader_button_background_active": [255, 255, 255, 255], - "topheader_button_background_inactive": [255, 255, 255, 0], + "main_window_header_background": [12, 169, 227, 255], + "main_window_header_button_text_active": [12, 169, 227, 255], + "main_window_header_button_text_inactive": [255, 255, 255, 255], + "main_window_header_button_text_hovered": [0, 0, 0, 255], + "main_window_header_button_background_active": [255, 255, 255, 255], + "main_window_header_button_background_inactive": [255, 255, 255, 0], "account_widget_outline_active": [9, 140, 188, 255], "account_widget_outline_inactive": [229, 229, 229, 255], @@ -340,9 +339,9 @@ "sizes": { "window_minimum_size": [70, 50], - "topheader": [0.0, 4.5], - "topheader_button": [8, 4], - "topheader_button_icon": [1.2, 1.2], + "main_window_header": [0.0, 4.5], + "main_window_header_button": [8, 4], + "main_window_header_button_icon": [1.2, 1.2], "stage_menu": [0.0, 4.5], From 17b77c58eff28e52f9d070cbc5a80c3dd5fcc4ec Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 19 Oct 2018 17:03:48 +0200 Subject: [PATCH 058/558] Make the spacing between the orientation controls be dependent on the theme. --- resources/qml/ViewOrientationControls.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index bf56ef2997..acf75b1b48 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -12,9 +12,10 @@ Row { id: viewOrientationControl - spacing: 2 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").width height: childrenRect.height width: childrenRect.width + // #1 3d view Button { From 17732b116935eabf8e61accec56b44f324ea73db Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 19 Oct 2018 17:03:48 +0200 Subject: [PATCH 059/558] Make the spacing between the orientation controls be dependent on the theme. Contributes to CURA-5772. --- resources/qml/ViewOrientationControls.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index bf56ef2997..acf75b1b48 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -12,9 +12,10 @@ Row { id: viewOrientationControl - spacing: 2 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").width height: childrenRect.height width: childrenRect.width + // #1 3d view Button { From 69fc1e5bfb85b7fc71c1b50b24a03b8ceae54981 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Oct 2018 10:30:06 +0200 Subject: [PATCH 060/558] Reuse ActionButton component to create the toolbox shortcut. Contributes to CURA-5784. --- resources/qml/MainWindow/MainWindowHeader.qml | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index b90968c606..3de4dc7865 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -70,33 +70,20 @@ Rectangle } // Shortcut button to quick access the Toolbox - Button + Cura.ActionButton { - id: toolboxShortcutButton anchors { right: accountWidget.left rightMargin: UM.Theme.getSize("default_margin").width verticalCenter: parent.verticalCenter } - style: ButtonStyle - { - background: Rectangle - { - color: control.hovered ? UM.Theme.getColor("secondary") : UM.Theme.getColor("main_window_header_button_background_active") - radius: 2 * screenScaleFactor - } - - label: Label - { - text: catalog.i18nc("@action:button", "Toolbox") - color: UM.Theme.getColor("main_window_header_button_text_active") - font: UM.Theme.getFont("action_button") - renderType: Text.NativeRendering - } - - } - action: Cura.Actions.browsePackages + text: catalog.i18nc("@action:button", "Toolbox") + color: UM.Theme.getColor("main_window_header_button_background_active") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("main_window_header_button_text_active") + textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") + onClicked: Cura.Actions.browsePackages.trigger() } AccountWidget From dbb62f2490c76e482320bbbfe419b91498eee147 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Oct 2018 11:31:19 +0200 Subject: [PATCH 061/558] Add default icons for the avatar. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 2 +- resources/qml/Account/AccountWidget.qml | 2 +- resources/qml/Account/AvatarImage.qml | 2 +- .../cura-light/images/avatar_default.png | Bin 3115 -> 0 bytes .../cura-light/images/avatar_default.svg | 76 ++++++++++++++++++ .../cura-light/images/avatar_no_user.svg | 76 ++++++++++++++++++ 6 files changed, 155 insertions(+), 3 deletions(-) delete mode 100644 resources/themes/cura-light/images/avatar_default.png create mode 100644 resources/themes/cura-light/images/avatar_default.svg create mode 100644 resources/themes/cura-light/images/avatar_no_user.svg diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index 9cd9b91949..a88fb77956 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -21,7 +21,7 @@ Column width: UM.Theme.getSize("avatar_image").width height: UM.Theme.getSize("avatar_image").height anchors.horizontalCenter: parent.horizontalCenter - source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") + source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index fc99273119..f54cf366e0 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -25,7 +25,7 @@ Button anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default") + source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 21adbcb7c3..c730ef428f 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -20,8 +20,8 @@ Item Image { id: profileImage - source: UM.Theme.getImage("avatar_default") anchors.fill: parent + source: UM.Theme.getImage("avatar_default") fillMode: Image.PreserveAspectCrop visible: false } diff --git a/resources/themes/cura-light/images/avatar_default.png b/resources/themes/cura-light/images/avatar_default.png deleted file mode 100644 index 0c306680f721dba0de73fb7be90fe5c548608692..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3115 zcmbVOX*iS%8y@?FGN>;UW^hD^kmA@)wk*+Nt%xutWD5~v3CY&j$IjT-F&O*4hwKUE z94T3j?C-quPWgQQzF+4%*LPp{bv?_E`&q8%$MgEOiQZ{;0d^P+cG^H6Z4QGmp16!K zIMa#gEfyO(2~=(y-Mu-mK<{6mcg{kT38-cisu+e!2WiFqw8CCm*DTcYfleBQa=K}W z6fmrs>RSxBWCM@Vj~=ESx#R%hHPqgDdjCgy-55mZ0NwL}%npz|24!@BLFH5j!qLkL zYV#yS8iV2+LAQLsJr9VdfK8Lo(>x%t3GDqyFX*KOlmd^^jtcr{9kWn!Gnm{0woE~< z$>3wckweDO8#35B4Yf@}F=Ws_{mA|#QxCSyK;0kc*}S| z044`$nu0n`l;`O_ML=*R6<0}(sR!fg!TcT?c^vATgRr?kSQRy|hvr`fWOjm%nMY5u zfY54c?K{Yu2xN7FIbAf@93Z<3^e6zH6#!*}v=?Q-i*lfO3QC}Wr318xT51%D8eIoA zyob`;z~BmMNF~)N3uv5x^15kp4Pamy;G6}t&p;`y;Ojatq>Aca3fN^FJ;?-~mjHgn zfKM?Hc`^bCta%4zcY?WHG(tNV+W@xDLd63#$1I?77%CZ{74^~byJ^IJT2Vi(d=PTV z2HsLm8V2x9U{VX{Nd!__KrbRt{SK-gfjkO&Kz8A*gl~BKFY~dyFwK*r`ebwANjJhOPID+-Nx%tm}=cC;EG* z#j=W=110?DuK3Bl{ogFoz#k(fe^#n1(1$%vfMY>V7)@S@FQ#q&H)`@+?Kl-^bK z5*Dlcm!jhhSB~R0IFIg|H0dW=j%nAldy31hybBvnzOL2Nhpo2Lx~EFOMGUNdm2NsG zh5GY$-DN#CudgzRh^Efe_!*-p%e97Y-;K7pxgIY#RIJYs`VqZz>L!Eb3rHt5GlMlR zQ|+fCHHETsYbaK?(h^f8C9P3RP)rBLBZ4o9U@Sal3%goW8s4#y#d6j0{<)Wp7=^xA zmh6KEYa-FyaSHr6f((MUB~<}oa|_ApZ>oS?RMp?fvA6pb)@8uYR4>Sov~I;JL1qfY zZ)bDPZ0*AFPaV2)ZsLd;p^LA&^e44huViRzijg8&Riki2?u3b0&7l<`LTw4RR^mee zvpAUkg(`gwuH9@(n$uHbP5OOZokpFY)MW!5*L_4tyXKuEt)SUG5##ky9r^)JoMbpv zf|NUO5l3~A9#e+zzDE)E<@>IarxY*!Wbc!$naWc}B=jn-Bm0DFCW*d? zNA(92M74lu;TX(}eY9}=MCk`q@I1Ou1*L9jK#uQG3kY)(3=j0ma%yJ)hzU+=XVzAk zPfLYi&2@V}M_}t>BimU%5OX4ba@i&&DOR$_4@(l1gx!bt6|2s=533TC&aBK~2+svp z?rRuhaZQIx#+$F2d?Slzb(T~#rx#G}ZUq=Y1cm0ZU=VF%K$v6l#7Y`pz%`{5V^RPapBoiInb0l{pRd3o5KK;rtv`vVp?zlnlPr52w` zS>uLVnewJ0`RejxSbY>x$UTPBd>pU6;flx`=H|UPK?yA!(FYegvW@Et&~D;nND}3| ztq~?JW5b{R+MD|ZW@#Ab;~vW3b)dt#lFcipr9L7L%TVG&rFkEGnj*>R4BVS?PO-3y z4ze|P^z~c!+2)pHb%7>U2gj$89m7G4-m7$98nNIk>u_bpLH{ocJG{?_X*St}D6^H> z$%caxp)Gucn$HILak_Zsa*+(jvK>}iD_Z~S}J(c6PmtYBo}LxjmnoK3eG!M|T8dU$L@T2I>M z=d~V_7THE`bO%9R=q*yuV{1+B<$mWS1j=h=en2`(g1oyziM}Xl1?>z7eeQL>pmFTN zQ()LuP*JtGkVHQ{d_?iEmDxjHmFqm%sqRdX-PEvn@Ul9@3M4&Oafbsl;`-=Zmd+PyK-FW)M+61ViY?&|~d%7+HD z%C(8V!oP4UezbjFEk1@La&c~3W|KRD9O$sJV z<`iFDZ})Yu{v%7Z5z6O`v!)*0dh=(z|Ju7n%#wxowrLl`u(0j%4W0b*;}TVNL-BLR zZBeKxzfCU=cJy9aMG|NBD&Vl6Xm+dq5V%ULzP@Cnsrv=}fKA73t=t18I&(0E*6rHh zc)+KQX>Ca4eyi%o+biNHRBBJWm_EhKU;c=e6r1JPYdD1P|1u|6FmAiMGf3QAG10YL zOXi`gW9SEhy0*)4GE_IbwMG};&_T%#7H^&AV6@752f;Mx@s)kZLC-5TV`=lvZpi9* zIj4h!ck3zKYKg70(Y>uBL}0%HzXQZ2`q`XI{#%X-s>9lv9NRv+uKIW*$(numCzf09 z!uH;>W9=!@K5!lsuG<&wyJewqoJq`;)QVkN9zND{N)=Ix|4NmTmpixnY|ZVLc*aBo zU;6!b%cyIe$i0ClV5``j*k}kfrh!ZuL_7fxlLIYRP;~?)^X>KgE9jZXbIB;nPZ9b8 zomui?yg!g(Er5CC_boxR32;6cwb;VIt+4*!Ot@;A9#QOtvh<#U$dhwX2G-oDAKvqh z=S98$;z_d+JJJ+79UM>+` zZEH_9OHbEqx^_qRt3w3gdZzqkh!;+lN;YeWmHYh`e~|*5l$mTMb&n05Oo)P-Yx;HFQ2VR8c z;?Slc3;~iRk;A?|gGJ;GLO00@xhLA=BEx}p7m2MVX|BrkxCs3=$02g;ns!G2 + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/resources/themes/cura-light/images/avatar_no_user.svg b/resources/themes/cura-light/images/avatar_no_user.svg new file mode 100644 index 0000000000..bef9cb52db --- /dev/null +++ b/resources/themes/cura-light/images/avatar_no_user.svg @@ -0,0 +1,76 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + From bf1c23243e3c46a465121b8248483c272be61830 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 24 Oct 2018 09:55:51 +0200 Subject: [PATCH 062/558] Modify the styles to match the requirements. Contributes to CURA-5784. --- resources/qml/ActionButton.qml | 7 +++ resources/qml/MainWindow/MainWindowHeader.qml | 18 +++++-- resources/themes/cura-dark/theme.json | 2 - resources/themes/cura-light/images/logo.svg | 12 ++--- resources/themes/cura-light/styles.qml | 47 +++++++++---------- resources/themes/cura-light/theme.json | 18 +++++-- 6 files changed, 61 insertions(+), 43 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 44299d3734..a8ad94474e 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -20,6 +20,9 @@ Button property var textColor: UM.Theme.getColor("button_text") property var textHoverColor: UM.Theme.getColor("button_text_hover") property var textDisabledColor: textColor + property var outlineColor: color + property var outlineHoverColor: hoverColor + property var outlineDisabledColor: outlineColor contentItem: Row { @@ -34,6 +37,7 @@ Button color: button.hovered ? button.textHoverColor : button.textColor visible: source != "" anchors.verticalCenter: parent.verticalCenter + Behavior on color { ColorAnimation { duration: 50 } } } Label @@ -53,6 +57,9 @@ Button id: backgroundRect color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor radius: UM.Theme.getSize("action_button_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor + Behavior on color { ColorAnimation { duration: 50 } } } MouseArea diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 3de4dc7865..92d9d8ee26 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -36,10 +36,12 @@ Rectangle Row { id: stagesListContainer + spacing: Math.round(UM.Theme.getSize("default_margin").width / 2) anchors { horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter leftMargin: UM.Theme.getSize("default_margin").width } @@ -55,9 +57,10 @@ Rectangle text: model.name.toUpperCase() checkable: true checked: model.active + anchors.verticalCenter: parent.verticalCenter exclusiveGroup: mainWindowHeaderMenuGroup style: UM.Theme.styles.main_window_header_tab - height: UM.Theme.getSize("main_window_header").height + height: Math.round(0.56 * UM.Theme.getSize("main_window_header").height) onClicked: UM.Controller.setActiveStage(model.id) iconSource: model.stage.iconSource @@ -78,11 +81,16 @@ Rectangle rightMargin: UM.Theme.getSize("default_margin").width verticalCenter: parent.verticalCenter } + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@action:button", "Toolbox") - color: UM.Theme.getColor("main_window_header_button_background_active") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("main_window_header_button_text_active") - textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") + height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) + color: UM.Theme.getColor("main_window_header_secondary_button_background_active") + hoverColor: UM.Theme.getColor("main_window_header_secondary_button_background_hovered") + outlineColor: UM.Theme.getColor("main_window_header_secondary_button_outline_active") + outlineHoverColor: UM.Theme.getColor("main_window_header_secondary_button_outline_hovered") + textColor: UM.Theme.getColor("main_window_header_secondary_button_text_active") + textHoverColor: UM.Theme.getColor("main_window_header_secondary_button_text_hovered") onClicked: Cura.Actions.browsePackages.trigger() } diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 897d09ccf2..1625750a19 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -15,8 +15,6 @@ "border": [127, 127, 127, 255], "secondary": [241, 242, 242, 255], - "main_window_header_background": [31, 36, 39, 255], - "main_window_header_button_text_active": [31, 36, 39, 255], "main_window_header_button_text_inactive": [128, 128, 128, 255], "main_window_header_button_text_hovered": [255, 255, 255, 255], diff --git a/resources/themes/cura-light/images/logo.svg b/resources/themes/cura-light/images/logo.svg index 89692f8295..55842ef530 100644 --- a/resources/themes/cura-light/images/logo.svg +++ b/resources/themes/cura-light/images/logo.svg @@ -25,11 +25,11 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.35" - inkscape:cx="-64.285714" - inkscape:cy="560" + inkscape:zoom="1.979899" + inkscape:cx="97.165681" + inkscape:cy="69.313647" inkscape:document-units="mm" - inkscape:current-layer="layer1" + inkscape:current-layer="g4570" showgrid="false" inkscape:window-width="1920" inkscape:window-height="1137" @@ -45,7 +45,7 @@ image/svg+xml - + @@ -61,7 +61,7 @@ id="polygon4506" points="741.8,410.8 781.7,410.8 801.9,390.6 801.9,350.7 762,350.7 741.8,370.9 " class="st0" - style="fill:#333333" /> + style="fill:#3282ff;fill-opacity:1" /> Date: Wed, 24 Oct 2018 11:28:52 +0200 Subject: [PATCH 063/558] Add pointing hand cursor shape when hovering the AccountWidget. Contributes to CURA-5784. --- resources/qml/Account/AccountWidget.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index f54cf366e0..eb58d66773 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -29,6 +29,15 @@ Button outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } + MouseArea + { + id: mouseArea + anchors.fill: parent + onPressed: mouse.accepted = false + hoverEnabled: true + cursorShape: accountWidget.enabled ? (hovered ? Qt.PointingHandCursor : Qt.ArrowCursor) : Qt.ForbiddenCursor + } + background: Item {} onClicked: popup.opened ? popup.close() : popup.open() From e64698209c22b65bb556a042f935db73fcb2df0f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 25 Oct 2018 17:41:35 +0200 Subject: [PATCH 064/558] Adjust the minimum size to be something around 1280x1024. Also adjust some colors color for the dark theme. Contributes to CURA-5772. --- plugins/PrepareStage/PrepareMenu.qml | 6 +++--- .../{ProgressAndSaveWidget.qml => ActionPanelWidget.qml} | 6 ++++-- resources/qml/Cura.qml | 3 ++- resources/qml/qmldir | 3 ++- resources/themes/cura-light/theme.json | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) rename resources/qml/{ProgressAndSaveWidget.qml => ActionPanelWidget.qml} (98%) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 8d0f03ec2f..f08de9d317 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -46,7 +46,7 @@ Item Cura.MachineSelector { id: machineSelection - width: UM.Theme.getSize("sidebar").width + width: Math.round(0.8 * UM.Theme.getSize("sidebar").width) - configSelection.width height: prepareMenu.height } @@ -54,8 +54,8 @@ Item { id: configSelection visible: isNetworkPrinter && printerConnected - width: visible ? Math.round(machineSelection.width * 0.15) : 0 - panelWidth: machineSelection.width + width: visible ? Math.round(UM.Theme.getSize("sidebar").width * 0.15) : 0 + panelWidth: Math.round(0.8 * UM.Theme.getSize("sidebar").width) height: prepareMenu.height } diff --git a/resources/qml/ProgressAndSaveWidget.qml b/resources/qml/ActionPanelWidget.qml similarity index 98% rename from resources/qml/ProgressAndSaveWidget.qml rename to resources/qml/ActionPanelWidget.qml index 6e8eb59482..02ac154178 100644 --- a/resources/qml/ProgressAndSaveWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -19,7 +19,9 @@ Rectangle signal showTooltip(Item item, point location, string text) signal hideTooltip() - // Also add an extra margin, as we ant some breathing room around the edges. + color: UM.Theme.getColor("sidebar") + + // Also add an extra margin, as we want some breathing room around the edges. height: saveButton.height + UM.Theme.getSize("sidebar_margin").height Label { @@ -231,7 +233,7 @@ Rectangle { id: saveButton width: parent.width - height: 100 + height: 100 * screenScaleFactor anchors.bottom: parent.bottom } } \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 474f93afa4..c5abb0f107 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -291,6 +291,7 @@ UM.MainWindow onActiveViewChanged: viewModeButton.updateItemActiveFlags() } } + Loader { id: viewPanel @@ -307,7 +308,7 @@ UM.MainWindow source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" } - ProgressAndSaveWidget + Cura.ActionPanelWidget { anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 2681da00e1..0e5e316409 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -6,4 +6,5 @@ CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml ActionButton 1.0 ActionButton.qml MaterialMenu 1.0 MaterialMenu.qml -NozzleMenu 1.0 NozzleMenu.qml \ No newline at end of file +NozzleMenu 1.0 NozzleMenu.qml +ActionPanelWidget 1.0 ActionPanelWidget.qml \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 68ea9b88f8..1820ead338 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -345,7 +345,7 @@ }, "sizes": { - "window_minimum_size": [70, 50], + "window_minimum_size": [106, 85], "main_window_header": [0.0, 4.5], "main_window_header_button": [8, 4], From a8531a335dda730bc07b71620f1123d73b1c939e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 09:52:02 +0200 Subject: [PATCH 065/558] Fix the alignments for the sliders in the simulation view. Contributes to CURA-5772. --- plugins/SimulationView/LayerSlider.qml | 6 ++--- plugins/SimulationView/SimulationView.qml | 29 ++++++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 1552506969..c30ea621c4 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -167,7 +167,7 @@ Item id: rangleHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - width - UM.Theme.getSize("default_margin").width + x: parent.x + parent.width + UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent @@ -275,7 +275,7 @@ Item id: upperHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - width - UM.Theme.getSize("default_margin").width + x: parent.x + parent.width + UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent @@ -385,7 +385,7 @@ Item id: lowerHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - width - UM.Theme.getSize("default_margin").width + x: parent.x + parent.width + UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent diff --git a/plugins/SimulationView/SimulationView.qml b/plugins/SimulationView/SimulationView.qml index be124157fb..7a83a07ac1 100644 --- a/plugins/SimulationView/SimulationView.qml +++ b/plugins/SimulationView/SimulationView.qml @@ -588,13 +588,14 @@ Item id: slidersBox width: parent.width + height: parent.height visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity anchors { - top: parent.bottom - topMargin: UM.Theme.getSize("slider_layerview_margin").height - left: parent.left + top: parent.top + leftMargin: UM.Theme.getSize("slider_layerview_margin").height + left: parent.right } PathSlider @@ -602,9 +603,13 @@ Item id: pathSlider height: UM.Theme.getSize("slider_handle").width - anchors.left: playButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right + anchors + { + verticalCenter: playButton.verticalCenter + left: playButton.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + } visible: !UM.SimulationView.compatibilityMode // custom properties @@ -650,10 +655,11 @@ Item anchors { - top: !UM.SimulationView.compatibilityMode ? pathSlider.bottom : parent.top - topMargin: !UM.SimulationView.compatibilityMode ? UM.Theme.getSize("default_margin").height : 0 - right: parent.right - rightMargin: UM.Theme.getSize("slider_layerview_margin").width + bottom: !UM.SimulationView.compatibilityMode ? pathSlider.top : parent.bottom + top: parent.top + bottomMargin: !UM.SimulationView.compatibilityMode ? UM.Theme.getSize("default_margin").height : 0 + left: parent.left + leftMargin: Math.round(UM.Theme.getSize("slider_layerview_margin").width / 2) } // custom properties @@ -704,7 +710,8 @@ Item visible: !UM.SimulationView.compatibilityMode anchors { - verticalCenter: pathSlider.verticalCenter + left: parent.left + bottom: parent.bottom } property var status: 0 // indicates if it's stopped (0) or playing (1) From 54518bdc82221950ed63d1e7bde2e4dbf26b47cf Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 11:14:39 +0200 Subject: [PATCH 066/558] Change the minimum window size to be 1280x800. Contributes to CURA-5784. --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 1820ead338..6a83c2c566 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -345,7 +345,7 @@ }, "sizes": { - "window_minimum_size": [106, 85], + "window_minimum_size": [106, 66], "main_window_header": [0.0, 4.5], "main_window_header_button": [8, 4], From a277bd9f3b8ee3383be53e805e47058b49a7d3f9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 11:29:05 +0200 Subject: [PATCH 067/558] Don't use the hand cursor in the action buttons by default. Contributes to CURA-5784. --- resources/qml/Account/AccountWidget.qml | 21 +++++---------------- resources/qml/ActionButton.qml | 1 - 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index eb58d66773..46092e4153 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -16,30 +16,19 @@ Button implicitHeight: UM.Theme.getSize("main_window_header").height implicitWidth: UM.Theme.getSize("main_window_header").height - AvatarImage + background: AvatarImage { id: avatar - width: Math.round(0.8 * parent.width) - height: Math.round(0.8 * parent.height) - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter + width: Math.round(0.8 * accountWidget.width) + height: Math.round(0.8 * accountWidget.height) + anchors.verticalCenter: accountWidget.verticalCenter + anchors.horizontalCenter: accountWidget.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") } - MouseArea - { - id: mouseArea - anchors.fill: parent - onPressed: mouse.accepted = false - hoverEnabled: true - cursorShape: accountWidget.enabled ? (hovered ? Qt.PointingHandCursor : Qt.ArrowCursor) : Qt.ForbiddenCursor - } - - background: Item {} - onClicked: popup.opened ? popup.close() : popup.open() Popup diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index a8ad94474e..a1c03af143 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -68,6 +68,5 @@ Button anchors.fill: parent onPressed: mouse.accepted = false hoverEnabled: true - cursorShape: button.enabled ? (hovered ? Qt.PointingHandCursor : Qt.ArrowCursor) : Qt.ForbiddenCursor } } From 3eb71021e24b7af44626e5b4ffe1a91915f88072 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 15:53:20 +0200 Subject: [PATCH 068/558] Change the way the string for the tooltip is formatted. Contributes to CURA-5772. --- resources/qml/PrintSetupSelector.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index e5a29dffad..e4cb852d89 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -220,11 +220,11 @@ Rectangle { modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), - tooltipText: catalog.i18nc("@tooltip", "Recommended Print Setup

Print with the recommended settings for the selected printer, material and quality.") + tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Recommended Print Setup")).arg(catalog.i18nc("@tooltip", "Print with the recommended settings for the selected printer, material and quality.")) }) modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), - tooltipText: catalog.i18nc("@tooltip", "Custom Print Setup

Print with finegrained control over every last bit of the slicing process.") + tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Custom Print Setup")).arg(catalog.i18nc("@tooltip", "Print with finegrained control over every last bit of the slicing process.")) }) var index = Math.round(UM.Preferences.getValue("cura/active_mode")) From 5a5adb71cd159c2e7b7204aa40b42472db4d9995 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 16:16:33 +0200 Subject: [PATCH 069/558] Make the height of the Print setup selector themable. Contributes to CURA-5772. --- plugins/PrepareStage/PrepareMenu.qml | 4 ++-- resources/qml/PrintSetupSelector.qml | 2 +- resources/themes/cura-light/theme.json | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index f08de9d317..27d068e909 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -61,12 +61,12 @@ Item Cura.CustomConfigurationSelector { - width: UM.Theme.getSize("sidebar").width + width: UM.Theme.getSize("configuration_selector_widget").width } Cura.PrintSetupSelector { - width: UM.Theme.getSize("sidebar").width + width: UM.Theme.getSize("print_setup_widget").width onShowTooltip: prepareMenu.showTooltip(item, location, text) onHideTooltip: prepareMenu.hideTooltip() } diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index e4cb852d89..d9b2337c96 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -189,7 +189,7 @@ Rectangle anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.left: parent.left anchors.right: parent.right - height: 500 + height: UM.Theme.getSize("print_setup_widget").height // We load both of them at once (instead of using a loader) because the advanced sidebar can take // quite some time to load. So in this case we sacrifice memory for speed. diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 6a83c2c566..38d4f5372f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -355,6 +355,9 @@ "account_button": [12, 3], + "print_setup_widget": [35.0, 42.0], + "configuration_selector_widget": [35.0, 0.0], + "views_selector": [0.0, 4.0], "default_lining": [0.08, 0.08], From c8bdf7321c4a888025001064f11c852097404264 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 16:31:03 +0200 Subject: [PATCH 070/558] Move the visible check within the component. Contributes to CURA-5772. --- plugins/PrepareStage/PrepareMenu.qml | 4 ---- .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 27d068e909..c7f8a3b0f1 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -13,9 +13,6 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() - property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" - property bool printerConnected: Cura.MachineManager.printerConnected - UM.I18nCatalog { id: catalog @@ -53,7 +50,6 @@ Item Cura.QuickConfigurationSelector { id: configSelection - visible: isNetworkPrinter && printerConnected width: visible ? Math.round(UM.Theme.getSize("sidebar").width * 0.15) : 0 panelWidth: Math.round(0.8 * UM.Theme.getSize("sidebar").width) height: prepareMenu.height diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index d7ee2c68ee..740c12d340 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -14,6 +14,9 @@ Item property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null property var panelWidth: control.width + // Make this component only visible when it's a network printer and it is connected + visible: Cura.MachineManager.activeMachineNetworkKey != "" && Cura.MachineManager.printerConnected + function switchPopupState() { popup.visible ? popup.close() : popup.open() From 90e8a05aab63d5d16a2431571f6e9b6791ccd192 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 26 Oct 2018 17:51:28 +0200 Subject: [PATCH 071/558] Remove all the entries in the theme that make reference to the sidebar, because there is no sidebar anymore. Several different margins and linings were created depending on the side, not depending on where it belongs. Contributes to CURA-5784. --- .../PostProcessingPlugin.qml | 2 +- plugins/PrepareStage/PrepareMenu.qml | 6 +- plugins/Toolbox/resources/qml/Toolbox.qml | 2 +- .../qml/ToolboxCompatibilityChart.qml | 2 +- .../resources/qml/ToolboxTabButton.qml | 4 +- resources/qml/ActionPanelWidget.qml | 14 ++-- resources/qml/Cura.qml | 7 +- resources/qml/CustomConfigurationSelector.qml | 22 +++--- resources/qml/MachineSelector.qml | 12 +-- .../ConfigurationMenu/ConfigurationItem.qml | 4 +- .../Menus/ConfigurationMenu/SyncButton.qml | 6 +- resources/qml/MonitorButton.qml | 16 ++-- resources/qml/MonitorSidebar.qml | 18 ++--- resources/qml/PrintMonitor.qml | 12 +-- resources/qml/PrintSetupSelector.qml | 10 +-- resources/qml/PrinterOutput/ExtruderBox.qml | 2 +- resources/qml/PrinterOutput/HeatedBedBox.qml | 4 +- resources/qml/SaveButton.qml | 24 +++--- resources/qml/Settings/SettingCategory.qml | 4 +- resources/qml/Settings/SettingItem.qml | 6 +- resources/qml/Settings/SettingView.qml | 26 +++---- resources/qml/SidebarSimple.qml | 78 +++++++++---------- resources/themes/cura-dark/theme.json | 17 ++-- resources/themes/cura-light/styles.qml | 8 +- resources/themes/cura-light/theme.json | 51 ++++++------ 25 files changed, 174 insertions(+), 183 deletions(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 10cc4cc082..bd4d361d35 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -260,7 +260,7 @@ UM.Dialog Rectangle { - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") anchors.left: activeScripts.right anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index c7f8a3b0f1..cdcc1384a2 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -43,15 +43,15 @@ Item Cura.MachineSelector { id: machineSelection - width: Math.round(0.8 * UM.Theme.getSize("sidebar").width) - configSelection.width + width: UM.Theme.getSize("machine_selector_widget").width - configSelection.width height: prepareMenu.height } Cura.QuickConfigurationSelector { id: configSelection - width: visible ? Math.round(UM.Theme.getSize("sidebar").width * 0.15) : 0 - panelWidth: Math.round(0.8 * UM.Theme.getSize("sidebar").width) + width: visible ? UM.Theme.getSize("machine_selector_widget").width * 0.2 : 0 + panelWidth: UM.Theme.getSize("machine_selector_widget").width height: prepareMenu.height } diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 29b026058c..a5fd2be370 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -20,7 +20,7 @@ Window maximumWidth: minimumWidth minimumHeight: height maximumHeight: minimumHeight - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") UM.I18nCatalog { id: catalog diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml index 58fea079e9..4d27489d7a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -54,7 +54,7 @@ Item model: packageData.supported_configs headerDelegate: Rectangle { - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") height: UM.Theme.getSize("toolbox_chart_row").height Label { diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml index 58149e419a..b671d779f8 100644 --- a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml @@ -19,10 +19,10 @@ Button Rectangle { visible: control.active - color: UM.Theme.getColor("sidebar_header_highlight_hover") + color: UM.Theme.getColor("toolbox_header_highlight_hover") anchors.bottom: parent.bottom width: parent.width - height: UM.Theme.getSize("sidebar_header_highlight").height + height: UM.Theme.getSize("toolbox_header_highlight").height } } label: Label diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index 02ac154178..b5dc7f83c9 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -19,16 +19,16 @@ Rectangle signal showTooltip(Item item, point location, string text) signal hideTooltip() - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") // Also add an extra margin, as we want some breathing room around the edges. - height: saveButton.height + UM.Theme.getSize("sidebar_margin").height + height: saveButton.height + UM.Theme.getSize("thick_margin").height Label { id: timeDetails anchors.left: parent.left anchors.bottom: costSpec.top - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width font: UM.Theme.getFont("large") color: UM.Theme.getColor("text_subtext") @@ -62,7 +62,7 @@ Rectangle } } tooltip_html += ""; - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html); + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltip_html); } } onExited: @@ -160,8 +160,8 @@ Rectangle anchors.left: parent.left anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height + anchors.leftMargin: UM.Theme.getSize("thick_margin").width font: UM.Theme.getFont("very_small") renderType: Text.NativeRendering @@ -219,7 +219,7 @@ Rectangle { var show_data = costSpec.getSpecsData() - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), show_data); + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), show_data); } } onExited: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c5abb0f107..3e2515cb3e 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -312,9 +312,9 @@ UM.MainWindow { anchors.right: parent.right anchors.bottom: parent.bottom - width: UM.Theme.getSize("sidebar").width - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + width: UM.Theme.getSize("action_panel_widget").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height onShowTooltip: { base.showTooltip(item, location, text) @@ -348,7 +348,6 @@ UM.MainWindow anchors { horizontalCenter: parent.horizontalCenter - horizontalCenterOffset: -(Math.round(UM.Theme.getSize("sidebar").width / 2)) top: parent.verticalCenter bottom: parent.bottom bottomMargin: UM.Theme.getSize("default_margin").height diff --git a/resources/qml/CustomConfigurationSelector.qml b/resources/qml/CustomConfigurationSelector.qml index 9a3f91e6a3..17b652e8d8 100644 --- a/resources/qml/CustomConfigurationSelector.qml +++ b/resources/qml/CustomConfigurationSelector.qml @@ -14,7 +14,7 @@ Rectangle implicitHeight: parent.height id: base - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") // Height has an extra 2x margin for the top & bottom margin. height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width @@ -28,7 +28,7 @@ Rectangle visible: extrudersModel.items.length > 1 property var index: 0 - height: UM.Theme.getSize("sidebar_header_mode_tabs").height + height: UM.Theme.getSize("configuration_selector_mode_tabs").height boundsBehavior: Flickable.StopAtBounds anchors @@ -36,7 +36,7 @@ Rectangle left: parent.left right: parent.right top: parent.top - margins: UM.Theme.getSize("sidebar_margin").width + margins: UM.Theme.getSize("thick_margin").width } ExclusiveGroup { id: extruderMenuGroup } @@ -209,7 +209,7 @@ Rectangle Item { id: materialRow - height: UM.Theme.getSize("sidebar_setup").height + height: UM.Theme.getSize("print_setup_item").height visible: Cura.MachineManager.hasMaterials anchors @@ -217,7 +217,7 @@ Rectangle left: parent.left right: parent.right top: extrudersList.bottom - margins: UM.Theme.getSize("sidebar_margin").width + margins: UM.Theme.getSize("thick_margin").width } Label @@ -246,7 +246,7 @@ Rectangle enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width + width: Math.round(parent.width * 0.7) + UM.Theme.getSize("thick_margin").width anchors.right: parent.right style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; @@ -263,7 +263,7 @@ Rectangle Item { id: variantRow - height: UM.Theme.getSize("sidebar_setup").height + height: UM.Theme.getSize("print_setup_item").height visible: Cura.MachineManager.hasVariants anchors @@ -271,7 +271,7 @@ Rectangle left: parent.left right: parent.right top: materialRow.bottom - margins: UM.Theme.getSize("sidebar_margin").width + margins: UM.Theme.getSize("thick_margin").width } Label @@ -293,7 +293,7 @@ Rectangle visible: Cura.MachineManager.hasVariants height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width) + width: Math.round(parent.width * 0.7 + UM.Theme.getSize("thick_margin").width) anchors.right: parent.right style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; @@ -305,11 +305,11 @@ Rectangle Item { id: materialCompatibilityLink - height: UM.Theme.getSize("sidebar_setup").height + height: UM.Theme.getSize("print_setup_item").height anchors.right: parent.right anchors.top: variantRow.bottom - anchors.margins: UM.Theme.getSize("sidebar_margin").width + anchors.margins: UM.Theme.getSize("thick_margin").width UM.RecolorImage { id: warningImage diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 49fbf16e19..d82211af3a 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -27,13 +27,13 @@ ToolButton color: { if (control.pressed) { - return UM.Theme.getColor("sidebar_header_active"); + return UM.Theme.getColor("machine_selector_active"); } else if (control.hovered) { - return UM.Theme.getColor("sidebar_header_hover"); + return UM.Theme.getColor("machine_selector_hover"); } else { - return UM.Theme.getColor("sidebar_header_bar"); + return UM.Theme.getColor("machine_selector_bar"); } } Behavior on color { ColorAnimation { duration: 50; } } @@ -61,18 +61,18 @@ ToolButton { verticalCenter: parent.verticalCenter left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width + leftMargin: UM.Theme.getSize("thick_margin").width } } Label { id: sidebarComboBoxLabel - color: UM.Theme.getColor("sidebar_header_text_active") + color: UM.Theme.getColor("machine_selector_text_active") text: control.text; elide: Text.ElideRight; anchors.left: printerStatusIcon.visible ? printerStatusIcon.right : parent.left; - anchors.leftMargin: printerStatusIcon.visible ? UM.Theme.getSize("sidebar_lining").width : UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: printerStatusIcon.visible ? UM.Theme.getSize("narrow_margin").width : UM.Theme.getSize("thick_margin").width anchors.right: downArrow.left; anchors.rightMargin: control.rightMargin; anchors.verticalCenter: parent.verticalCenter; diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 37d851a35d..7427b5ddff 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -63,7 +63,7 @@ Rectangle visible: buildplateInformation.visible width: parent.width - 2 * parent.padding - height: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 + height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 color: textColor } @@ -110,7 +110,7 @@ Rectangle parent.border.color = UM.Theme.getColor("configuration_item_border_hover") if (configurationItem.selected == false) { - configurationItem.color = UM.Theme.getColor("sidebar_lining") + configurationItem.color = UM.Theme.getColor("wide_lining") } } onExited: diff --git a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml index 3099d684c1..558ae1e477 100644 --- a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml +++ b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml @@ -42,15 +42,15 @@ Button { if(control.pressed) { - return UM.Theme.getColor("sidebar_header_active"); + return UM.Theme.getColor("machine_selector_active"); } else if(control.hovered) { - return UM.Theme.getColor("sidebar_header_hover"); + return UM.Theme.getColor("machine_selector_hover"); } else { - return UM.Theme.getColor("sidebar_header_bar"); + return UM.Theme.getColor("machine_selector_bar"); } } Behavior on color { ColorAnimation { duration: 50; } } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index efee50a2b3..eef76bcb09 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -15,7 +15,7 @@ Item id: base; UM.I18nCatalog { id: catalog; name: "cura"} - height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height + height: childrenRect.height + UM.Theme.getSize("thick_margin").height property bool printerConnected: Cura.MachineManager.printerConnected property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands @@ -162,10 +162,10 @@ Item Label { id: statusLabel - width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width + width: parent.width - 2 * UM.Theme.getSize("thick_margin").width anchors.top: parent.top anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width color: base.statusColor font: UM.Theme.getFont("large") @@ -224,12 +224,12 @@ Item property string backgroundColor: UM.Theme.getColor("progressbar_background"); property string controlColor: base.statusColor; - width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width; + width: parent.width - 2 * UM.Theme.getSize("thick_margin").width; height: UM.Theme.getSize("progressbar").height; anchors.top: statusLabel.bottom; - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 4); + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4); anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width; + anchors.leftMargin: UM.Theme.getSize("thick_margin").width; } Row @@ -237,9 +237,9 @@ Item id: buttonsRow height: abortButton.height anchors.top: progressBar.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width spacing: UM.Theme.getSize("default_margin").width Row diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index 179fcafb53..2282034739 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -30,7 +30,7 @@ Rectangle property variant printMaterialCosts: PrintInformation.materialCosts property variant printMaterialNames: PrintInformation.materialNames - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") UM.I18nCatalog { id: catalog; name: "cura"} Timer { @@ -89,7 +89,7 @@ Rectangle { id: machineSelection width: base.width - configSelection.width - separator.width - height: UM.Theme.getSize("sidebar_header").height + height: UM.Theme.getSize("stage_menu").height anchors.top: base.top anchors.left: parent.left } @@ -98,9 +98,9 @@ Rectangle { id: separator visible: configSelection.visible - width: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 - height: UM.Theme.getSize("sidebar_header").height - color: UM.Theme.getColor("sidebar_lining_thin") + width: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 + height: UM.Theme.getSize("stage_menu").height + color: UM.Theme.getColor("thick_lining") anchors.left: machineSelection.right } @@ -109,7 +109,7 @@ Rectangle id: configSelection visible: isNetworkPrinter && printerConnected width: visible ? Math.round(base.width * 0.15) : 0 - height: UM.Theme.getSize("sidebar_header").height + height: UM.Theme.getSize("stage_menu").height anchors.top: base.top anchors.right: parent.right panelWidth: base.width @@ -158,10 +158,10 @@ Rectangle { id: footerSeparator width: parent.width - height: UM.Theme.getSize("sidebar_lining").height - color: UM.Theme.getColor("sidebar_lining") + height: UM.Theme.getSize("wide_lining").height + color: UM.Theme.getColor("wide_lining") anchors.bottom: monitorButton.top - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height } // MonitorButton is actually the bottom footer panel. diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 12e95d1e89..723279847a 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -31,14 +31,14 @@ Column Rectangle { - color: UM.Theme.getColor("sidebar_lining") + color: UM.Theme.getColor("wide_lining") width: parent.width height: childrenRect.height Flow { id: extrudersGrid - spacing: UM.Theme.getSize("sidebar_lining_thin").width + spacing: UM.Theme.getSize("thick_lining").width width: parent.width Repeater @@ -48,8 +48,8 @@ Column ExtruderBox { - color: UM.Theme.getColor("sidebar") - width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2) + color: UM.Theme.getColor("main_background") + width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("thick_lining").width / 2) extruderModel: modelData } } @@ -58,9 +58,9 @@ Column Rectangle { - color: UM.Theme.getColor("sidebar_lining") + color: UM.Theme.getColor("wide_lining") width: parent.width - height: UM.Theme.getSize("sidebar_lining_thin").width + height: UM.Theme.getSize("thick_lining").width } HeatedBedBox diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index d9b2337c96..987e3ecce9 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -25,7 +25,7 @@ Rectangle property variant printMaterialCosts: PrintInformation.materialCosts property variant printMaterialNames: PrintInformation.materialNames - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") UM.I18nCatalog { id: catalog; name: "cura"} // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. @@ -89,7 +89,7 @@ Rectangle { left: parent.left top: parent.top - margins: UM.Theme.getSize("sidebar_margin").width + margins: UM.Theme.getSize("thick_margin").width } width: Math.round(parent.width * 0.45) @@ -105,10 +105,10 @@ Rectangle id: settingsModeSelection model: modesListModel width: Math.round(parent.width * 0.55) - height: UM.Theme.getSize("sidebar_header_mode_toggle").height + height: UM.Theme.getSize("print_setup_mode_toggle").height anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.top: settingsModeLabel.top @@ -186,7 +186,7 @@ Rectangle { id: sidebarContents anchors.top: settingsModeSelection.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: parent.left anchors.right: parent.right height: UM.Theme.getSize("print_setup_widget").height diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index f0abd4cd6c..510a44f9da 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -13,7 +13,7 @@ Item property var extruderModel property var position: index implicitWidth: parent.width - implicitHeight: UM.Theme.getSize("sidebar_extruder_box").height + implicitHeight: UM.Theme.getSize("print_setup_extruder_box").height UM.SettingPropertyProvider { diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 9de66ad0be..962ffa9b01 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -12,12 +12,12 @@ import Cura 1.0 as Cura Item { implicitWidth: parent.width - height: visible ? UM.Theme.getSize("sidebar_extruder_box").height : 0 + height: visible ? UM.Theme.getSize("print_setup_extruder_box").height : 0 property var printerModel Rectangle { - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") anchors.fill: parent Label //Build plate label. diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 5e41dd3007..c2d310e30c 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -68,10 +68,10 @@ Item Label { id: statusLabel - width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width + width: parent.width - 2 * UM.Theme.getSize("thick_margin").width anchors.top: parent.top anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width color: UM.Theme.getColor("text") font: UM.Theme.getFont("default_bold") @@ -81,12 +81,12 @@ Item Rectangle { id: progressBar - width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width + width: parent.width - 2 * UM.Theme.getSize("thick_margin").width height: UM.Theme.getSize("progressbar").height anchors.top: statusLabel.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 4) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4) anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width radius: UM.Theme.getSize("progressbar_radius").width color: UM.Theme.getColor("progressbar_background") @@ -133,11 +133,11 @@ Item children_width += child.width + child.anchors.rightMargin; } } - return Math.min(children_width, base.width - UM.Theme.getSize("sidebar_margin").width); + return Math.min(children_width, base.width - UM.Theme.getSize("thick_margin").width); } height: saveToButton.height anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height anchors.right: parent.right clip: true @@ -198,7 +198,7 @@ Item anchors.top: parent.top anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width // 1 = not started, 4 = error, 5 = disabled text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel") @@ -253,7 +253,7 @@ Item Behavior on color { ColorAnimation { duration: 50; } } - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) Label { @@ -299,7 +299,7 @@ Item anchors.top: parent.top anchors.right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right - anchors.rightMargin: deviceSelectionMenu.visible ? -3 * UM.Theme.getSize("default_lining").width : UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: deviceSelectionMenu.visible ? -3 * UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thick_margin").width text: UM.OutputDeviceManager.activeDeviceShortDescription onClicked: @@ -355,7 +355,7 @@ Item Behavior on color { ColorAnimation { duration: 50; } } - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) Label { @@ -377,7 +377,7 @@ Item anchors.top: parent.top anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width width: UM.Theme.getSize("save_button_save_to_button").height height: UM.Theme.getSize("save_button_save_to_button").height diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index e3202323eb..7995619af0 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -12,8 +12,8 @@ Button id: base anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width background: Rectangle { id: backgroundRectangle diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 785562cff5..cad6a28bd6 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -128,11 +128,11 @@ Item { id: settingControls height: Math.round(parent.height / 2) - spacing: Math.round(UM.Theme.getSize("sidebar_margin").height / 2) + spacing: Math.round(UM.Theme.getSize("thick_margin").height / 2) anchors { right: controlContainer.left - rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2) + rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) verticalCenter: parent.verticalCenter } @@ -290,7 +290,7 @@ Item { enabled: propertyProvider.isValueUsed anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.verticalCenter: parent.verticalCenter; width: UM.Theme.getSize("setting_control").width; height: UM.Theme.getSize("setting_control").height diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 5a6811926e..cd9701aab6 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -24,15 +24,15 @@ Item Item { id: globalProfileRow - height: UM.Theme.getSize("sidebar_setup").height + height: UM.Theme.getSize("print_setup_item").height anchors { top: parent.top left: parent.left - leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width) + leftMargin: Math.round(UM.Theme.getSize("thick_margin").width) right: parent.right - rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width) + rightMargin: Math.round(UM.Theme.getSize("thick_margin").width) } Label @@ -40,7 +40,7 @@ Item id: globalProfileLabel text: catalog.i18nc("@label","Profile:") textFormat: Text.PlainText - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2) + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2) font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter @@ -87,7 +87,7 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("sidebar_margin").width) + anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width) color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); iconSource: UM.Theme.getIcon("star"); @@ -100,7 +100,7 @@ Item onEntered: { var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.") - base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content) + base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content) } onExited: base.hideTooltip() } @@ -116,9 +116,9 @@ Item anchors { top: globalProfileRow.bottom - topMargin: UM.Theme.getSize("sidebar_margin").height + topMargin: UM.Theme.getSize("thick_margin").height right: parent.right - rightMargin: UM.Theme.getSize("sidebar_margin").width + rightMargin: UM.Theme.getSize("thick_margin").width } style: ButtonStyle { @@ -169,9 +169,9 @@ Item anchors { top: globalProfileRow.bottom - topMargin: UM.Theme.getSize("sidebar_margin").height + topMargin: UM.Theme.getSize("thick_margin").height left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width + leftMargin: UM.Theme.getSize("thick_margin").width right: settingVisibilityMenu.left rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2) } @@ -191,7 +191,7 @@ Item height: parent.height anchors.left: parent.left anchors.right: clearFilterButton.left - anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width) + anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width) placeholderText: catalog.i18nc("@label:textbox", "Search...") @@ -288,7 +288,7 @@ Item anchors.bottom: parent.bottom; anchors.right: parent.right; anchors.left: parent.left; - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height style: UM.Theme.styles.scrollview; flickableItem.flickableDirection: Flickable.VerticalFlick; @@ -325,7 +325,7 @@ Item { id: delegate - width: Math.round(UM.Theme.getSize("sidebar").width); + width: Math.round(UM.Theme.getSize("print_setup_widget").width); height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing Behavior on height { NumberAnimation { duration: 100 } } opacity: provider.properties.enabled == "True" ? 1 : 0 diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index ec673f2823..b5c94c3f82 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -35,7 +35,7 @@ Item { width: childrenRect.width height: childrenRect.height - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") // // Quality profile @@ -44,10 +44,10 @@ Item { id: qualityRow - height: UM.Theme.getSize("sidebar_margin").height - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + height: UM.Theme.getSize("thick_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.right: parent.right Timer @@ -207,7 +207,7 @@ Item { anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") text: { @@ -262,10 +262,10 @@ Item { id: speedSlider width: Math.round(base.width * 0.55) - height: UM.Theme.getSize("sidebar_margin").height + height: UM.Theme.getSize("thick_margin").height anchors.right: parent.right anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height // This Item is used only for tooltip, for slider area which is unavailable Item @@ -275,7 +275,7 @@ Item if (showTooltip) { var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content) + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) } else { @@ -380,7 +380,7 @@ Item Slider { id: qualitySlider - height: UM.Theme.getSize("sidebar_margin").height + height: UM.Theme.getSize("thick_margin").height anchors.bottom: speedSlider.bottom enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized visible: qualityModel.availableTotalTicks > 0 @@ -448,7 +448,7 @@ Item onEntered: { var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content) + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) } onExited: { @@ -467,7 +467,7 @@ Item text: catalog.i18nc("@label", "Print Speed") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") - width: Math.round(UM.Theme.getSize("sidebar").width * 0.35) + width: Math.round(UM.Theme.getSize("print_setup_widget").width * 0.35) elide: Text.ElideRight } @@ -503,7 +503,7 @@ Item anchors.verticalCenter: speedSlider.verticalCenter anchors.right: speedSlider.left - anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2) + anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); iconSource: UM.Theme.getIcon("reset"); @@ -516,7 +516,7 @@ Item onEntered: { var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content) + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) } onExited: base.hideTooltip() } @@ -530,10 +530,10 @@ Item id: infillCellLeft anchors.top: qualityRow.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 + anchors.topMargin: UM.Theme.getSize("thick_margin").height * 2 anchors.left: parent.left - width: Math.round(UM.Theme.getSize("sidebar").width * .45) - UM.Theme.getSize("sidebar_margin").width + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width Label { @@ -543,9 +543,9 @@ Item color: UM.Theme.getColor("text") anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 1.7) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width } } @@ -553,12 +553,12 @@ Item { id: infillCellRight - height: infillSlider.height + UM.Theme.getSize("sidebar_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("sidebar_margin").height) - width: Math.round(UM.Theme.getSize("sidebar").width * .55) + height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) anchors.left: infillCellLeft.right anchors.top: infillCellLeft.top - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height Label { id: selectedInfillRateText @@ -588,10 +588,10 @@ Item anchors.top: selectedInfillRateText.bottom anchors.left: parent.left anchors.right: infillIcon.left - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width - height: UM.Theme.getSize("sidebar_margin").height - width: parseInt(infillCellRight.width - UM.Theme.getSize("sidebar_margin").width - style.handleWidth) + height: UM.Theme.getSize("thick_margin").height + width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) minimumValue: 0 maximumValue: 100 @@ -679,12 +679,12 @@ Item { id: infillIcon - width: Math.round((parent.width / 5) - (UM.Theme.getSize("sidebar_margin").width)) + width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) height: width anchors.right: parent.right anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // we loop over all density icons and only show the one that has the current density and steps Repeater @@ -737,7 +737,7 @@ Item property alias _hovered: enableGradualInfillMouseArea.containsMouse anchors.top: infillSlider.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category anchors.left: infillCellRight.left style: UM.Theme.styles.checkbox @@ -786,7 +786,7 @@ Item id: gradualInfillLabel height: parent.height anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2) + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) verticalAlignment: Text.AlignVCenter; text: catalog.i18nc("@label", "Enable gradual") font: UM.Theme.getFont("default") @@ -848,11 +848,11 @@ Item visible: enableSupportCheckBox.visible anchors.top: infillCellRight.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 1.5) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.right: infillCellLeft.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.verticalCenter: enableSupportCheckBox.verticalCenter text: catalog.i18nc("@label", "Generate Support"); @@ -916,11 +916,11 @@ Item textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started anchors.top: enableSupportCheckBox.top - //anchors.topMargin: ((supportEnabled.properties.value === "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("sidebar_margin").height : 0 + //anchors.topMargin: ((supportEnabled.properties.value === "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("thick_margin").height : 0 anchors.left: enableSupportCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2) + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - width: Math.round(UM.Theme.getSize("sidebar").width * .55) - Math.round(UM.Theme.getSize("sidebar_margin").width / 2) - enableSupportCheckBox.width + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 Behavior on height { NumberAnimation { duration: 100 } } @@ -991,9 +991,9 @@ Item anchors { left: parent.left - leftMargin: UM.Theme.getSize("sidebar_margin").width + leftMargin: UM.Theme.getSize("thick_margin").width right: infillCellLeft.right - rightMargin: UM.Theme.getSize("sidebar_margin").width + rightMargin: UM.Theme.getSize("thick_margin").width verticalCenter: adhesionCheckBox.verticalCenter } } @@ -1004,7 +1004,7 @@ Item property alias _hovered: adhesionMouseArea.containsMouse anchors.top: enableSupportCheckBox.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: infillCellRight.left //: Setting enable printing build-plate adhesion helper checkbox @@ -1065,7 +1065,7 @@ Item { id: tipsCell anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) - anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 2) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 2) anchors.left: parent.left width: parent.width height: tipsText.contentHeight * tipsText.lineCount @@ -1074,9 +1074,9 @@ Item { id: tipsText anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width + anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.top: parent.top wrapMode: Text.WordWrap text: catalog.i18nc("@label", "Need help improving your prints?
Read the Ultimaker Troubleshooting Guides").arg("https://ultimaker.com/en/troubleshooting") diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 1625750a19..571e1acbe4 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -5,7 +5,9 @@ }, "colors": { - "sidebar": [39, 44, 48, 255], + "main_background": [39, 44, 48, 255], + "wide_lining": [31, 36, 39, 255], + "thick_lining": [255, 255, 255, 30], "lining": [64, 69, 72, 255], "viewport_overlay": [0, 6, 9, 222], @@ -18,6 +20,9 @@ "main_window_header_button_text_inactive": [128, 128, 128, 255], "main_window_header_button_text_hovered": [255, 255, 255, 255], + "machine_selector_bar": [39, 44, 48, 255], + "machine_selector_active": [39, 44, 48, 255], + "text": [255, 255, 255, 204], "text_detail": [255, 255, 255, 172], "text_link": [255, 255, 255, 127], @@ -30,16 +35,6 @@ "text_scene_hover": [255, 255, 255, 204], "error": [212, 31, 53, 255], - "sidebar_header_bar": [39, 44, 48, 255], - "sidebar_header_active": [39, 44, 48, 255], - "sidebar_header_hover": [68, 72, 75, 255], - "sidebar_header_highlight": [68, 192, 255, 255], - "sidebar_header_highlight_hover": [68, 192, 255, 255], - "sidebar_header_text_active": [255, 255, 255, 255], - "sidebar_header_text_hover": [255, 255, 255, 255], - "sidebar_header_text_inactive": [255, 255, 255, 127], - "sidebar_lining": [31, 36, 39, 255], - "sidebar_lining_thin": [255, 255, 255, 30], "button": [39, 44, 48, 255], "button_hover": [39, 44, 48, 255], diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 1bbb13ff26..43e8d29b57 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -491,9 +491,9 @@ QtObject { anchors.fill: parent anchors.left: parent.left - anchors.leftMargin: Theme.getSize("sidebar_margin").width + anchors.leftMargin: Theme.getSize("thick_margin").width anchors.right: parent.right - anchors.rightMargin: Theme.getSize("sidebar_margin").width + anchors.rightMargin: Theme.getSize("thick_margin").width implicitHeight: Theme.getSize("section").height color: { @@ -567,7 +567,7 @@ QtObject { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: Theme.getSize("sidebar_margin").width + anchors.leftMargin: Theme.getSize("thick_margin").width color: { if(!control.enabled) @@ -1037,7 +1037,7 @@ QtObject } Behavior on color { ColorAnimation { duration: 50 } } - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) Label { diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 38d4f5372f..4b1252abf4 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -69,7 +69,9 @@ "colors": { - "sidebar": [255, 255, 255, 255], + "main_background": [255, 255, 255, 255], + "wide_lining": [245, 245, 245, 255], + "thick_lining": [127, 127, 127, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], @@ -97,6 +99,11 @@ "account_widget_outline_active": [70, 66, 126, 255], "account_widget_outline_inactive": [229, 229, 229, 255], + "machine_selector_bar": [31, 36, 39, 255], + "machine_selector_active": [68, 72, 75, 255], + "machine_selector_hover": [68, 72, 75, 255], + "machine_selector_text_active": [255, 255, 255, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [12, 169, 227, 255], @@ -110,16 +117,6 @@ "text_scene_hover": [70, 84, 113, 255], "error": [255, 140, 0, 255], - "sidebar_header_bar": [31, 36, 39, 255], - "sidebar_header_active": [68, 72, 75, 255], - "sidebar_header_hover": [68, 72, 75, 255], - "sidebar_header_highlight": [68, 192, 255, 255], - "sidebar_header_highlight_hover": [68, 192, 255, 255], - "sidebar_header_text_inactive": [255, 255, 255, 255], - "sidebar_header_text_active": [255, 255, 255, 255], - "sidebar_header_text_hover": [255, 255, 255, 255], - "sidebar_lining": [245, 245, 245, 255], - "sidebar_lining_thin": [127, 127, 127, 255], "button": [31, 36, 39, 255], "button_hover": [68, 72, 75, 255], @@ -356,35 +353,34 @@ "account_button": [12, 3], "print_setup_widget": [35.0, 42.0], - "configuration_selector_widget": [35.0, 0.0], + "print_setup_mode_toggle": [0.0, 2.0], + "print_setup_item": [0.0, 2.0], + "print_setup_extruder_box": [0.0, 6.0], + + "configuration_selector_widget": [35.0, 4.5], + "configuration_selector_mode_tabs": [0.0, 3.0], + + "action_panel_widget": [35.0, 0.0], + "machine_selector_widget": [28.0, 4.5], "views_selector": [0.0, 4.0], + "wide_lining": [0.5, 0.5], + "thick_lining": [0.2, 0.2], "default_lining": [0.08, 0.08], + "default_arrow": [0.8, 0.8], "logo": [8, 2.4], - "default_margin": [1.0, 1.0], "wide_margin": [2.0, 2.0], + "thick_margin": [1.71, 1.43], + "default_margin": [1.0, 1.0], + "thin_margin": [0.71, 0.71], "narrow_margin": [0.5, 0.5], - "window_margin": [1.0, 1.0], "extruder_button_material_margin": [0.70, 0.9], "extruder_button_material": [0.75, 0.75], - "sidebar": [35.0, 10.0], - "sidebar_margin": [1.71, 1.43], - "sidebar_margin_thin": [0.71, 0.71], - "sidebar_header": [0.0, 4.0], - "sidebar_header_highlight": [0.25, 0.25], - "sidebar_header_mode_toggle": [0.0, 2.0], - "sidebar_header_mode_tabs": [0.0, 3.0], - "sidebar_lining": [0.5, 0.5], - "sidebar_lining_thin": [0.2, 0.2], - "sidebar_setup": [0.0, 2.0], - "sidebar_tabs": [0.0, 3.5], - "sidebar_inputfields": [0.0, 2.0], - "sidebar_extruder_box": [0.0, 6.0], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], @@ -495,6 +491,7 @@ "toolbox_property_label": [1.0, 2.0], "toolbox_heading_label": [1.0, 4.0], "toolbox_header": [1.0, 4.0], + "toolbox_header_highlight": [0.25, 0.25], "toolbox_progress_bar": [8.0, 0.5], "toolbox_chart_row": [1.0, 2.0], "toolbox_action_button": [8.0, 2.5], From 3248a05819fccd54f71f6765ff5846b15c22b181 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 11:28:08 +0100 Subject: [PATCH 072/558] Add PreviewStagePlugin stubs Since we are going to move all the views into a seperate stage, we need to add another stage to do that. CURA-5829 --- cura/CuraApplication.py | 1 + plugins/MonitorStage/__init__.py | 4 +++- plugins/PreviewStage/PreviewStage.py | 13 +++++++++++++ plugins/PreviewStage/__init__.py | 22 ++++++++++++++++++++++ plugins/PreviewStage/plugin.json | 8 ++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/PreviewStage/PreviewStage.py create mode 100644 plugins/PreviewStage/__init__.py create mode 100644 plugins/PreviewStage/plugin.json diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 5824d21b1c..8f9816e968 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -433,6 +433,7 @@ class CuraApplication(QtApplication): "XmlMaterialProfile", "Toolbox", "PrepareStage", + "PreviewStage", "MonitorStage", "LocalFileOutputDevice", "LocalContainerProvider", diff --git a/plugins/MonitorStage/__init__.py b/plugins/MonitorStage/__init__.py index bdaf53a36c..0468e6319b 100644 --- a/plugins/MonitorStage/__init__.py +++ b/plugins/MonitorStage/__init__.py @@ -7,14 +7,16 @@ from . import MonitorStage from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("cura") + def getMetaData(): return { "stage": { "name": i18n_catalog.i18nc("@item:inmenu", "Monitor"), - "weight": 1 + "weight": 2 } } + def register(app): return { "stage": MonitorStage.MonitorStage() diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py new file mode 100644 index 0000000000..a51bf766b6 --- /dev/null +++ b/plugins/PreviewStage/PreviewStage.py @@ -0,0 +1,13 @@ +# Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. +from UM.Application import Application +from cura.Stages.CuraStage import CuraStage + + +class PreviewStage(CuraStage): + def __init__(self, parent = None) -> None: + super().__init__(parent) + Application.getInstance().engineCreatedSignal.connect(self._engineCreated) + + def _engineCreated(self): + return \ No newline at end of file diff --git a/plugins/PreviewStage/__init__.py b/plugins/PreviewStage/__init__.py new file mode 100644 index 0000000000..e03992fc00 --- /dev/null +++ b/plugins/PreviewStage/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from . import PreviewStage + +from UM.i18n import i18nCatalog +i18n_catalog = i18nCatalog("cura") + + +def getMetaData(): + return { + "stage": { + "name": i18n_catalog.i18nc("@item:inmenu", "Preview"), + "weight": 1 + } + } + + +def register(app): + return { + "stage": PreviewStage.PreviewStage() + } diff --git a/plugins/PreviewStage/plugin.json b/plugins/PreviewStage/plugin.json new file mode 100644 index 0000000000..9349da2b0e --- /dev/null +++ b/plugins/PreviewStage/plugin.json @@ -0,0 +1,8 @@ +{ + "name": "Preview Stage", + "author": "Ultimaker B.V.", + "version": "1.0.0", + "description": "Provides a preview stage in Cura.", + "api": 5, + "i18n-catalog": "cura" +} \ No newline at end of file From 9cc7a7ca23df6427f5e921ca1594dfd8c3ed176a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 13:27:47 +0100 Subject: [PATCH 073/558] Moved view selection to previewStage CURA-5829 --- plugins/PreviewStage/PreviewMenu.qml | 77 ++++++++++++++++++++ plugins/PreviewStage/PreviewStage.py | 26 ++++++- plugins/PreviewStage/__init__.py | 2 +- resources/qml/Cura.qml | 62 ---------------- resources/qml/MainWindow/ApplicationMenu.qml | 2 - 5 files changed, 100 insertions(+), 69 deletions(-) create mode 100644 plugins/PreviewStage/PreviewMenu.qml diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml new file mode 100644 index 0000000000..c364c4c3d7 --- /dev/null +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -0,0 +1,77 @@ +import QtQuick 2.7 + +import QtQuick.Controls 1.4 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +Item +{ + id: previewMenu + // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + + Row + { + anchors.horizontalCenter: parent.horizontalCenter + ComboBox + { + // This item contains the views selector, a combobox that is dynamically created from + // the list of available Views (packages that create different visualizations of the + // scene). + id: viewModeButton + + style: UM.Theme.styles.combobox + + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags() + { + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) + { + model.getItem(i).active = (i == currentIndex) + } + } + + // get the index of the active model item on start + function getActiveIndex() + { + for (var i = 0; i < model.rowCount(); i++) + { + print(model.getItem(i).active) + if (model.getItem(i).active) + { + return i; + } + } + return 0 + } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + UM.Controller.setActiveView(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() + } + + Cura.PrintSetupSelector + { + width: UM.Theme.getSize("print_setup_widget").width + onShowTooltip: previewMenu.showTooltip(item, location, text) + onHideTooltip: previewMenu.hideTooltip() + } + } +} \ No newline at end of file diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index a51bf766b6..4c449e55f2 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -1,13 +1,31 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import os.path + from UM.Application import Application from cura.Stages.CuraStage import CuraStage +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from UM.View import View class PreviewStage(CuraStage): - def __init__(self, parent = None) -> None: + def __init__(self, application: Application, parent = None) -> None: super().__init__(parent) - Application.getInstance().engineCreatedSignal.connect(self._engineCreated) + self._application = application + self._application.engineCreatedSignal.connect(self._engineCreated) + self._previously_active_view = None # type: Optional[View] - def _engineCreated(self): - return \ No newline at end of file + def onStageSelected(self) -> None: + self._previously_active_view = self._application.getController().getActiveView() + + def onStageDeselected(self) -> None: + if self._previously_active_view is not None: + self._application.getController().setActiveView(self._previously_active_view.getPluginId()) + self._previously_active_view = None + + def _engineCreated(self) -> None: + menu_component_path = os.path.join(self._application.getPluginRegistry().getPluginPath(self.getPluginId()), + "PreviewMenu.qml") + self.addDisplayComponent("menu", menu_component_path) diff --git a/plugins/PreviewStage/__init__.py b/plugins/PreviewStage/__init__.py index e03992fc00..d58826934e 100644 --- a/plugins/PreviewStage/__init__.py +++ b/plugins/PreviewStage/__init__.py @@ -18,5 +18,5 @@ def getMetaData(): def register(app): return { - "stage": PreviewStage.PreviewStage() + "stage": PreviewStage.PreviewStage(app) } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3e2515cb3e..c3d2c98ecc 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -230,68 +230,6 @@ UM.MainWindow } } - ComboBox - { - // This item contains the views selector, a combobox that is dynamically created from - // the list of available Views (packages that create different visualizations of the - // scene). - id: viewModeButton - - anchors.left: viewOrientationControls.right - anchors.bottom: viewOrientationControls.bottom - - style: UM.Theme.styles.combobox - - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags() - { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) - { - model.getItem(i).active = (i == currentIndex) - } - } - - // get the index of the active model item on start - function getActiveIndex () - { - for (var i = 0; i < model.rowCount(); i++) - { - if (model.getItem(i).active) - { - return i; - } - } - return 0 - } - - // set the active index - function setActiveIndex(index) - { - UM.Controller.setActiveView(index) - // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here - } - - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) - { - viewModeButton.setActiveIndex(model.getItem(currentIndex).id) - } - } - currentIndex: getActiveIndex() - - // watch the active view proxy for changes made from the menu item - Connections - { - target: UM.ActiveView - onActiveViewChanged: viewModeButton.updateItemActiveFlags() - } - } - Loader { id: viewPanel diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index d3bc115419..884609deee 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -45,8 +45,6 @@ Item MenuItem { action: Cura.Actions.unGroupObjects } } - ViewMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&View") } - SettingsMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings") } Menu From ebe533bdc831c9872d3d0c352e73134656de253e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 13:39:00 +0100 Subject: [PATCH 074/558] Move active view panel to previewStage CURA-5829 --- plugins/PreviewStage/PreviewMenu.qml | 15 +++++++++++++++ resources/qml/Cura.qml | 16 ---------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index c364c4c3d7..0ab1c0be83 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -21,6 +21,8 @@ Item Row { anchors.horizontalCenter: parent.horizontalCenter + spacing: UM.Theme.getSize("default_margin").width + ComboBox { // This item contains the views selector, a combobox that is dynamically created from @@ -67,6 +69,19 @@ Item currentIndex: getActiveIndex() } + Loader + { + // TODO: Make this panel collapsable and ensure it has a standardised background. + id: viewPanel + + property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + + height: childrenRect.height + width: childrenRect.width + + source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" + } + Cura.PrintSetupSelector { width: UM.Theme.getSize("print_setup_widget").width diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c3d2c98ecc..9f53b75dd1 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -230,22 +230,6 @@ UM.MainWindow } } - Loader - { - id: viewPanel - - anchors.bottom: viewModeButton.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: viewModeButton.right - - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - - height: childrenRect.height - width: childrenRect.width - - source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" - } - Cura.ActionPanelWidget { anchors.right: parent.right From fc6ad4f6233833a2b59d4086306a21e1de3427f4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 13:41:46 +0100 Subject: [PATCH 075/558] Put back the view menu, since it did more than just show the views CURA-5829 --- resources/qml/MainWindow/ApplicationMenu.qml | 2 ++ resources/qml/Menus/ViewMenu.qml | 19 ------------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 884609deee..d3bc115419 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -45,6 +45,8 @@ Item MenuItem { action: Cura.Actions.unGroupObjects } } + ViewMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&View") } + SettingsMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings") } Menu diff --git a/resources/qml/Menus/ViewMenu.qml b/resources/qml/Menus/ViewMenu.qml index 593bd63bcc..33e8764cd8 100644 --- a/resources/qml/Menus/ViewMenu.qml +++ b/resources/qml/Menus/ViewMenu.qml @@ -15,25 +15,6 @@ Menu property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() - // main views - Instantiator - { - model: UM.ViewModel{} - MenuItem - { - text: model.name - checkable: true - checked: model.active - exclusiveGroup: group - onTriggered: UM.Controller.setActiveView(model.id) - } - onObjectAdded: base.insertItem(index, object) - onObjectRemoved: base.removeItem(object) - } - ExclusiveGroup { id: group } - - MenuSeparator {} - Menu { title: catalog.i18nc("@action:inmenu menubar:view","&Camera position"); From cfa962311bb45476fcc9e65dd24933bb9f2aa397 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 13:54:20 +0100 Subject: [PATCH 076/558] Fixed typing CURA-5829 --- plugins/PreviewStage/PreviewStage.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index 4c449e55f2..e41d4a592f 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -2,16 +2,17 @@ # Cura is released under the terms of the LGPLv3 or higher. import os.path -from UM.Application import Application +from UM.Qt.QtApplication import QtApplication from cura.Stages.CuraStage import CuraStage from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: - from UM.View import View + from UM.View.View import View + class PreviewStage(CuraStage): - def __init__(self, application: Application, parent = None) -> None: + def __init__(self, application: QtApplication, parent = None) -> None: super().__init__(parent) self._application = application self._application.engineCreatedSignal.connect(self._engineCreated) @@ -26,6 +27,7 @@ class PreviewStage(CuraStage): self._previously_active_view = None def _engineCreated(self) -> None: - menu_component_path = os.path.join(self._application.getPluginRegistry().getPluginPath(self.getPluginId()), - "PreviewMenu.qml") - self.addDisplayComponent("menu", menu_component_path) + plugin_path = self._application.getPluginRegistry().getPluginPath(self.getPluginId()) + if plugin_path is not None: + menu_component_path = os.path.join(plugin_path, "PreviewMenu.qml") + self.addDisplayComponent("menu", menu_component_path) From d8dd9bf3631bcfd5cd77d11cb41688127dd31e60 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 14:54:42 +0100 Subject: [PATCH 077/558] Set SolidView to invisible. Since we don't have a selector in the prepare stage anymore, solidview must be invisible CURA-5829 --- plugins/PreviewStage/PreviewMenu.qml | 1 - plugins/SolidView/__init__.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 0ab1c0be83..ae875fb0a2 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -50,7 +50,6 @@ Item { for (var i = 0; i < model.rowCount(); i++) { - print(model.getItem(i).active) if (model.getItem(i).active) { return i; diff --git a/plugins/SolidView/__init__.py b/plugins/SolidView/__init__.py index db2e48f489..34148fcf05 100644 --- a/plugins/SolidView/__init__.py +++ b/plugins/SolidView/__init__.py @@ -10,7 +10,8 @@ def getMetaData(): return { "view": { "name": i18n_catalog.i18nc("@item:inmenu", "Solid view"), - "weight": 0 + "weight": 0, + "visible": False } } From bf59097320d7f5eaf4bd072cde2d8a841d27c550 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 29 Oct 2018 15:18:34 +0100 Subject: [PATCH 078/558] Split the action button panel in two different components that are loaded in different moments. The SliceProcessWidget is loaded once there is something to slice and it also shows the process of slicing. The OutputProcessWidget will show the print information and the actions to do to output the results, such as Print over network, Save to file, ... Contributes to CURA-5786. --- resources/qml/ActionPanelWidget.qml | 239 +++---------------------- resources/qml/Cura.qml | 17 +- resources/qml/OutputProcessWidget.qml | 72 ++++++++ resources/qml/SliceProcessWidget.qml | 62 +++++++ resources/themes/cura-light/theme.json | 4 + 5 files changed, 172 insertions(+), 222 deletions(-) create mode 100644 resources/qml/OutputProcessWidget.qml create mode 100644 resources/qml/SliceProcessWidget.qml diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index b5dc7f83c9..d1fe999731 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 import UM 1.2 as UM @@ -10,230 +10,43 @@ import Cura 1.0 as Cura Rectangle { - id: base + id: actionPanelWidget - // We need a whole lot of print duration information. - property variant printDuration: PrintInformation.currentPrintTime - - // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. - signal showTooltip(Item item, point location, string text) - signal hideTooltip() + width: childrenRect.width + 2 * UM.Theme.getSize("thick_margin").width + height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height color: UM.Theme.getColor("main_background") + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + radius: UM.Theme.getSize("default_radius").width + visible: CuraApplication.platformActivity - // Also add an extra margin, as we want some breathing room around the edges. - height: saveButton.height + UM.Theme.getSize("thick_margin").height - Label + property bool backendStatusDone: UM.Backend.state == 3 + + Loader { - id: timeDetails - anchors.left: parent.left - anchors.bottom: costSpec.top - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) - renderType: Text.NativeRendering - - MouseArea + id: loader + anchors { - id: timeDetailsMouseArea - anchors.fill: parent - hoverEnabled: true - - onEntered: - { - if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) - { - // All the time information for the different features is achieved - var print_time = PrintInformation.getFeaturePrintTimes(); - var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) - - // A message is created and displayed when the user hover the time label - var tooltip_html = "%1
".arg(catalog.i18nc("@tooltip", "Time specification")); - for(var feature in print_time) - { - if(!print_time[feature].isTotalDurationZero) - { - tooltip_html += "" + - "".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + - "".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) + - ""; - } - } - tooltip_html += "
" + feature + ":  %1  %1%
"; - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltip_html); - } - } - onExited: - { - base.hideTooltip(); - } + top: parent.top + topMargin: UM.Theme.getSize("thick_margin").height + left: parent.left + leftMargin: UM.Theme.getSize("thick_margin").width } + sourceComponent: backendStatusDone ? outputProcessWidget : sliceProcessWidget } - Label + Behavior on height { NumberAnimation { duration: 100 } } + + Component { - function formatRow(items) - { - var row_html = ""; - for(var item = 0; item < items.length; item++) - { - if (item == 0) - { - row_html += "%1".arg(items[item]); - } - else - { - row_html += "  %1".arg(items[item]); - } - } - row_html += ""; - return row_html; - } - - function getSpecsData() - { - var lengths = []; - var total_length = 0; - var weights = []; - var total_weight = 0; - var costs = []; - var total_cost = 0; - var some_costs_known = false; - var names = []; - if(base.printMaterialLengths) - { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) - { - names.push(base.printMaterialNames[index]); - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.round(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - some_costs_known = true; - } - - total_length += base.printMaterialLengths[index]; - total_weight += base.printMaterialWeights[index]; - total_cost += base.printMaterialCosts[index]; - } - } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - - var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification")); - for(var index = 0; index < lengths.length; index++) - { - tooltip_html += formatRow([ - "%1:".arg(names[index]), - catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), - catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), - "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), - ]); - } - if(lengths.length > 1) - { - tooltip_html += formatRow([ - catalog.i18nc("@label", "Total:"), - catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)), - catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)), - "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)), - ]); - } - tooltip_html += "
"; - tooltipText = tooltip_html; - - return tooltipText - } - - id: costSpec - - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("thick_margin").height - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - - font: UM.Theme.getFont("very_small") - renderType: Text.NativeRendering - color: UM.Theme.getColor("text_subtext") - elide: Text.ElideMiddle - width: parent.width - property string tooltipText - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) - { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) - { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.round(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - someCostsKnown = true; - } - } - } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - var result = lengths.join(" + ") + "m / ~ " + weights.join(" + ") + "g"; - if(someCostsKnown) - { - result += " / ~ " + costs.join(" + ") + " " + UM.Preferences.getValue("cura/currency"); - } - return result; - } - - MouseArea - { - id: costSpecMouseArea - anchors.fill: parent - hoverEnabled: true - - onEntered: - { - - if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) - { - var show_data = costSpec.getSpecsData() - - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), show_data); - } - } - onExited: - { - base.hideTooltip(); - } - } + id: sliceProcessWidget + SliceProcessWidget { } } - SaveButton + Component { - id: saveButton - width: parent.width - height: 100 * screenScaleFactor - anchors.bottom: parent.bottom + id: outputProcessWidget + OutputProcessWidget { } } } \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3e2515cb3e..1f4d71e460 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -312,17 +312,16 @@ UM.MainWindow { anchors.right: parent.right anchors.bottom: parent.bottom - width: UM.Theme.getSize("action_panel_widget").width anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.bottomMargin: UM.Theme.getSize("thick_margin").height - onShowTooltip: - { - base.showTooltip(item, location, text) - } - onHideTooltip: - { - base.hideTooltip() - } +// onShowTooltip: +// { +// base.showTooltip(item, location, text) +// } +// onHideTooltip: +// { +// base.hideTooltip() +// } } Loader diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/OutputProcessWidget.qml new file mode 100644 index 0000000000..612e4f286f --- /dev/null +++ b/resources/qml/OutputProcessWidget.qml @@ -0,0 +1,72 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM + +Button +{ + id: button + property alias cursorShape: mouseArea.cursorShape + property alias iconSource: buttonIcon.source + property alias textFont: buttonText.font + property alias cornerRadius: backgroundRect.radius + property var color: UM.Theme.getColor("primary") + property var hoverColor: UM.Theme.getColor("primary_hover") + property var disabledColor: color + property var textColor: UM.Theme.getColor("button_text") + property var textHoverColor: UM.Theme.getColor("button_text_hover") + property var textDisabledColor: textColor + property var outlineColor: color + property var outlineHoverColor: hoverColor + property var outlineDisabledColor: outlineColor + + contentItem: Row + { + UM.RecolorImage + { + id: buttonIcon + source: "" + height: Math.round(0.6 * parent.height) + width: height + sourceSize.width: width + sourceSize.height: height + color: button.hovered ? button.textHoverColor : button.textColor + visible: source != "" + anchors.verticalCenter: parent.verticalCenter + Behavior on color { ColorAnimation { duration: 50 } } + } + + Label + { + id: buttonText + text: "Preview" + color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor + font: UM.Theme.getFont("action_button") + visible: text != "" + renderType: Text.NativeRendering + anchors.verticalCenter: parent.verticalCenter + } + } + + background: Rectangle + { + id: backgroundRect + color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor + radius: UM.Theme.getSize("action_button_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor + Behavior on color { ColorAnimation { duration: 50 } } + } + + MouseArea + { + id: mouseArea + anchors.fill: parent + onPressed: mouse.accepted = false + hoverEnabled: true + } +} diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml new file mode 100644 index 0000000000..67005cb133 --- /dev/null +++ b/resources/qml/SliceProcessWidget.qml @@ -0,0 +1,62 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM +import Cura 1.0 as Cura + +Column +{ + id: widget + + spacing: UM.Theme.getSize("default_margin").height + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + + property real progress: UM.Backend.progress + property int backendState: UM.Backend.state + + Rectangle + { + id: progressBar + width: parent.width + height: UM.Theme.getSize("progressbar").height + visible: widget.backendState == 2 + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_background") + + Rectangle + { + width: Math.max(parent.width * base.progress) + height: parent.height + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_control") + } + } + + Cura.ActionButton + { + id: prepareButton + width: UM.Theme.getSize("action_panel_button").width + height: UM.Theme.getSize("action_panel_button").height + text: widget.backendState == 1 ? catalog.i18nc("@button", "Prepare") : catalog.i18nc("@button", "Cancel") + onClicked: + { + if ([1, 5].indexOf(widget.backendState) != -1) + { + CuraApplication.backend.forceSlice() + } + else + { + CuraApplication.backend.stopSlicing() + } + } + } +} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 29e3774e1f..e840a08a75 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -378,10 +378,14 @@ "configuration_selector_mode_tabs": [0.0, 3.0], "action_panel_widget": [35.0, 0.0], + "action_panel_button": [15.0, 3.0], + "machine_selector_widget": [28.0, 4.5], "views_selector": [0.0, 4.0], + "default_radius": [0.25, 0.25], + "wide_lining": [0.5, 0.5], "thick_lining": [0.2, 0.2], "default_lining": [0.08, 0.08], From e486bf8b440dd3a392779821e4720f53537f66c3 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 29 Oct 2018 15:55:16 +0100 Subject: [PATCH 079/558] Change the primary color to a slightly different kind of blue. Contributes to CURA-5786. --- resources/themes/cura-light/theme.json | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e840a08a75..cbd5b29e87 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -75,7 +75,7 @@ "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], - "primary": [12, 169, 227, 255], + "primary": [50, 130, 255, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], @@ -106,10 +106,10 @@ "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], - "text_link": [12, 169, 227, 255], + "text_link": [50, 130, 255, 255], "text_inactive": [174, 174, 174, 255], "text_hover": [70, 84, 113, 255], - "text_pressed": [12, 169, 227, 255], + "text_pressed": [50, 130, 255, 255], "text_subtext": [0, 0, 0, 255], "text_medium": [128, 128, 128, 255], "text_emphasis": [255, 255, 255, 255], @@ -152,16 +152,16 @@ "action_button_border": [127, 127, 127, 255], "action_button_hovered": [255, 255, 255, 255], "action_button_hovered_text": [31, 36, 39, 255], - "action_button_hovered_border": [12, 169, 227, 255], + "action_button_hovered_border": [50, 130, 255, 255], "action_button_active": [255, 255, 255, 255], "action_button_active_text": [0, 0, 0, 255], - "action_button_active_border": [12, 169, 227, 255], + "action_button_active_border": [50, 130, 255, 255], "action_button_disabled": [245, 245, 245, 255], "action_button_disabled_text": [127, 127, 127, 255], "action_button_disabled_border": [245, 245, 245, 255], - "print_button_ready": [12, 169, 227, 255], - "print_button_ready_border": [12, 169, 227, 255], + "print_button_ready": [50, 130, 255, 255], + "print_button_ready_border": [50, 130, 255, 255], "print_button_ready_text": [255, 255, 255, 255], "print_button_ready_hovered": [30, 186, 245, 243], "print_button_ready_hovered_border": [30, 186, 245, 243], @@ -193,7 +193,7 @@ "setting_control_selected": [31, 36, 39, 255], "setting_control_highlight": [255, 255, 255, 255], "setting_control_border": [127, 127, 127, 255], - "setting_control_border_highlight": [12, 169, 227, 255], + "setting_control_border_highlight": [50, 130, 255, 255], "setting_control_text": [27, 27, 27, 255], "setting_control_depth_line": [127, 127, 127, 255], "setting_control_button": [127, 127, 127, 255], @@ -231,18 +231,18 @@ "checkbox": [255, 255, 255, 255], "checkbox_hover": [255, 255, 255, 255], "checkbox_border": [64, 69, 72, 255], - "checkbox_border_hover": [12, 169, 227, 255], + "checkbox_border_hover": [50, 130, 255, 255], "checkbox_mark": [119, 122, 124, 255], "checkbox_text": [27, 27, 27, 255], "mode_switch": [255, 255, 255, 255], "mode_switch_hover": [255, 255, 255, 255], "mode_switch_border": [127, 127, 127, 255], - "mode_switch_border_hover": [12, 169, 227, 255], + "mode_switch_border_hover": [50, 130, 255, 255], "mode_switch_handle": [31, 36, 39, 255], "mode_switch_text": [31, 36, 39, 255], "mode_switch_text_hover": [31, 36, 39, 255], - "mode_switch_text_checked": [12, 169, 227, 255], + "mode_switch_text_checked": [50, 130, 255, 255], "tooltip": [68, 192, 255, 255], "tooltip_text": [255, 255, 255, 255], @@ -253,9 +253,9 @@ "message_shadow": [0, 0, 0, 120], "message_border": [127, 127, 127, 255], "message_text": [0, 0, 0, 255], - "message_button": [12, 169, 227, 255], - "message_button_hover": [12, 169, 227, 255], - "message_button_active": [12, 169, 227, 255], + "message_button": [50, 130, 255, 255], + "message_button_hover": [50, 130, 255, 255], + "message_button_active": [50, 130, 255, 255], "message_button_text": [255, 255, 255, 255], "message_button_text_hover": [255, 255, 255, 255], "message_button_text_active": [255, 255, 255, 255], @@ -266,7 +266,7 @@ "status_offline": [0, 0, 0, 255], "status_ready": [0, 205, 0, 255], - "status_busy": [12, 169, 227, 255], + "status_busy": [50, 130, 255, 255], "status_paused": [255, 140, 0, 255], "status_stopped": [236, 82, 80, 255], "status_unknown": [127, 127, 127, 255], @@ -278,7 +278,7 @@ "all_axis": [255, 255, 255, 255], "viewport_background": [245, 245, 245, 255], - "volume_outline": [12, 169, 227, 255], + "volume_outline": [50, 130, 255, 255], "buildplate": [244, 244, 244, 255], "buildplate_grid": [129, 131, 134, 255], "buildplate_grid_minor": [230, 230, 231, 255], @@ -291,7 +291,7 @@ "model_overhang": [255, 0, 0, 255], "model_unslicable": [122, 122, 122, 255], "model_unslicable_alt": [172, 172, 127, 255], - "model_selection_outline": [12, 169, 227, 255], + "model_selection_outline": [50, 130, 255, 255], "model_non_printing": [122, 122, 122, 255], "xray": [26, 26, 62, 255], @@ -317,12 +317,12 @@ "configuration_item_text_active": [0, 0, 0, 255], "configuration_item_border": [127, 127, 127, 255], "configuration_item_border_active": [12, 169, 227, 32], - "configuration_item_border_hover": [12, 169, 227, 255], + "configuration_item_border_hover": [50, 130, 255, 255], - "tab_status_connected": [12, 169, 227, 255], + "tab_status_connected": [50, 130, 255, 255], "tab_status_disconnected": [200, 200, 200, 255], - "printer_config_matched": [12, 169, 227, 255], + "printer_config_matched": [50, 130, 255, 255], "printer_config_mismatch": [127, 127, 127, 255], "toolbox_header_button_text_active": [0, 0, 0, 255], @@ -346,12 +346,12 @@ "monitor_pill_background": [245, 245, 245, 255], "monitor_placeholder_image": [230, 230, 230, 255], "monitor_printer_icon_inactive": [154, 154, 154, 255], - "monitor_printer_icon": [12, 169, 227, 255], + "monitor_printer_icon": [50, 130, 255, 255], "monitor_progress_background_text": [0,0,0,255], "monitor_progress_background": [245, 245, 245, 255], "monitor_progress_fill_inactive": [154, 154, 154, 255], "monitor_progress_fill_text": [255,255,255,255], - "monitor_progress_fill": [12, 169, 227, 255], + "monitor_progress_fill": [50, 130, 255, 255], "monitor_shadow": [0, 0, 0, 63], "monitor_skeleton_fill": [245, 245, 245, 255], "monitor_skeleton_fill_dark": [216, 216, 216, 255], @@ -440,8 +440,8 @@ "tool_button_border": [1.0, 0], - "progressbar": [26.0, 0.4], - "progressbar_radius": [0, 0], + "progressbar": [26.0, 0.75], + "progressbar_radius": [0.15, 0.15], "progressbar_control": [8.0, 0.4], "scrollbar": [0.75, 0.5], From 0a3803d6651c66cb81fb9d2b82187fe79736aac3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 29 Oct 2018 16:21:16 +0100 Subject: [PATCH 080/558] Add CuraView, which does something similar to CuraStage So instead of relying on strange activeViewProxy, it's up to the CuraView to provide a set of components. These can subsequently be used by the active stage again. CURA-5829 --- cura/CuraView.py | 24 ++++++++++++++++++++++++ plugins/PreviewStage/PreviewMenu.qml | 2 +- plugins/SimulationView/SimulationView.py | 15 +++++++++++---- plugins/SimulationView/__init__.py | 3 +++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 cura/CuraView.py diff --git a/cura/CuraView.py b/cura/CuraView.py new file mode 100644 index 0000000000..978c651b43 --- /dev/null +++ b/cura/CuraView.py @@ -0,0 +1,24 @@ +# 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.View.View import View + + +# Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure +# to indicate this. +# MainComponent works in the same way the MainComponent of a stage. +# the stageMenuComponent returns an item that should be used somehwere in the stage menu. It's up to the active stage +# to actually do something with this. +class CuraView(View): + def __init__(self, parent = None) -> None: + super().__init__(parent) + + @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 diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index ae875fb0a2..5ed0e697a9 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -78,7 +78,7 @@ Item height: childrenRect.height width: childrenRect.width - source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" + source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" } Cura.PrintSetupSelector diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 0ae8b4d9e4..0ef08b22d7 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -26,8 +26,8 @@ from UM.View.GL.OpenGL import OpenGL from UM.View.GL.OpenGLContext import OpenGLContext from UM.View.GL.ShaderProgram import ShaderProgram -from UM.View.View import View from UM.i18n import i18nCatalog +from cura.CuraView import CuraView from cura.Scene.ConvexHullNode import ConvexHullNode from cura.CuraApplication import CuraApplication @@ -48,15 +48,15 @@ catalog = i18nCatalog("cura") ## View used to display g-code paths. -class SimulationView(View): +class SimulationView(CuraView): # Must match SimulationView.qml LAYER_VIEW_TYPE_MATERIAL_TYPE = 0 LAYER_VIEW_TYPE_LINE_TYPE = 1 LAYER_VIEW_TYPE_FEEDRATE = 2 LAYER_VIEW_TYPE_THICKNESS = 3 - def __init__(self) -> None: - super().__init__() + def __init__(self, parent = None) -> None: + super().__init__(parent) self._max_layers = 0 self._current_layer_num = 0 @@ -113,6 +113,13 @@ class SimulationView(View): self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled"), title = catalog.i18nc("@info:title", "Simulation View")) + Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) + + def _onEngineCreated(self) -> None: + menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), + "SimulationView.qml") + self.addDisplayComponent("menu", menu_component_path) + def _evaluateCompatibilityMode(self) -> bool: return OpenGLContext.isLegacyOpenGL() or bool(Application.getInstance().getPreferences().getValue("view/force_layer_view_compatibility_mode")) diff --git a/plugins/SimulationView/__init__.py b/plugins/SimulationView/__init__.py index 360fdc1de9..3f89ee490f 100644 --- a/plugins/SimulationView/__init__.py +++ b/plugins/SimulationView/__init__.py @@ -8,6 +8,7 @@ from . import SimulationViewProxy, SimulationView catalog = i18nCatalog("cura") + def getMetaData(): return { "view": { @@ -17,9 +18,11 @@ def getMetaData(): } } + def createSimulationViewProxy(engine, script_engine): return SimulationViewProxy.SimulationViewProxy() + def register(app): simulation_view = SimulationView.SimulationView() qmlRegisterSingletonType(SimulationViewProxy.SimulationViewProxy, "UM", 1, 0, "SimulationView", simulation_view.getProxy) From aa75b64b5bf121c2908ebdf550e89969945e8fb0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 09:48:56 +0100 Subject: [PATCH 081/558] Use the lining color to the default ouline color for the account widget. Contributes to CURA-5784. --- resources/qml/Account/AccountDetails.qml | 2 +- resources/qml/Account/AccountWidget.qml | 2 +- resources/themes/cura-light/theme.json | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index a88fb77956..c723ca20fb 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -22,7 +22,7 @@ Column height: UM.Theme.getSize("avatar_image").height anchors.horizontalCenter: parent.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") - outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining") } Label diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index 46092e4153..cdae457ac8 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -26,7 +26,7 @@ Button anchors.horizontalCenter: accountWidget.horizontalCenter source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") - outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("account_widget_outline_inactive") + outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining") } onClicked: popup.opened ? popup.close() : popup.open() diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 29e3774e1f..40c776ecf1 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -97,7 +97,6 @@ "main_window_header_secondary_button_outline_hovered": [255, 255, 255, 255], "account_widget_outline_active": [70, 66, 126, 255], - "account_widget_outline_inactive": [229, 229, 229, 255], "machine_selector_bar": [31, 36, 39, 255], "machine_selector_active": [68, 72, 75, 255], From b6ea0e638578daa32fcf383335b112e8efcce7e8 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 10:38:53 +0100 Subject: [PATCH 082/558] Make the height of the stage buttons themable. Now the height has to be 28px as indicated by the UXers. Contributes to CURA-5784. --- resources/qml/MainWindow/MainWindowHeader.qml | 2 +- resources/themes/cura-light/theme.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 92d9d8ee26..3f088e782f 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -60,7 +60,7 @@ Rectangle anchors.verticalCenter: parent.verticalCenter exclusiveGroup: mainWindowHeaderMenuGroup style: UM.Theme.styles.main_window_header_tab - height: Math.round(0.56 * UM.Theme.getSize("main_window_header").height) + height: UM.Theme.getSize("main_window_header_button").height onClicked: UM.Controller.setActiveStage(model.id) iconSource: model.stage.iconSource diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 40c776ecf1..e8de7c98ac 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -361,7 +361,7 @@ "window_minimum_size": [106, 66], "main_window_header": [0.0, 4.5], - "main_window_header_button": [8, 4], + "main_window_header_button": [8, 2.35], "main_window_header_button_icon": [1.2, 1.2], "stage_menu": [0.0, 4.5], From 79ed15aee19a757a3c09cd8ad0c634b57d34a527 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 11:52:08 +0100 Subject: [PATCH 083/558] Add the label and the icon indicating when Cura is unable to slice. Contributes to CURA-5786. --- resources/qml/ActionPanelWidget.qml | 1 + resources/qml/SliceProcessWidget.qml | 87 +++++++++++++++++++++++--- resources/themes/cura-light/theme.json | 3 +- 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index d1fe999731..b4a9b4e4ec 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -37,6 +37,7 @@ Rectangle } Behavior on height { NumberAnimation { duration: 100 } } + Behavior on width { NumberAnimation { duration: 100 } } Component { diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index 67005cb133..561e38c372 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -12,7 +12,9 @@ Column { id: widget - spacing: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("action_panel_button").width + + spacing: UM.Theme.getSize("thin_margin").height UM.I18nCatalog { @@ -23,30 +25,84 @@ Column property real progress: UM.Backend.progress property int backendState: UM.Backend.state - Rectangle + Item + { + id: message + width: parent.width + height: childrenRect.height + visible: widget.backendState == 4 + + UM.RecolorImage + { + id: warningImage + + anchors.left: parent.left + + source: UM.Theme.getIcon("warning") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: UM.Theme.getColor("warning") + } + + Label + { + id: unableToSliceLabel + anchors.left: warningImage.right + anchors.leftMargin: UM.Theme.getSize("thin_margin").width + text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") + color: UM.Theme.getColor("warning") + font: UM.Theme.getFont("very_small") + } + } + + // Progress bar, only visible when the backend is in the process of slice the printjob + ProgressBar { id: progressBar width: parent.width height: UM.Theme.getSize("progressbar").height + value: progress visible: widget.backendState == 2 - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - Rectangle + background: Rectangle { - width: Math.max(parent.width * base.progress) - height: parent.height + anchors.fill: parent radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_control") + 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") + } } } Cura.ActionButton { id: prepareButton - width: UM.Theme.getSize("action_panel_button").width + width: parent.width height: UM.Theme.getSize("action_panel_button").height - text: widget.backendState == 1 ? catalog.i18nc("@button", "Prepare") : catalog.i18nc("@button", "Cancel") + text: autoSlice ? catalog.i18nc("@button", "Auto slicing...") : (widget.backendState == 1 ? catalog.i18nc("@button", "Slice") : catalog.i18nc("@button", "Cancel")) + enabled: !autoSlice + + // Get the current value from the preferences + property bool autoSlice: UM.Preferences.getValue("general/auto_slice") + + disabledColor: "transparent" + textDisabledColor: UM.Theme.getColor("primary") + outlineDisabledColor: "transparent" + onClicked: { if ([1, 5].indexOf(widget.backendState) != -1) @@ -59,4 +115,15 @@ Column } } } + + // React when the user changes the preference of having the auto slice enabled + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + var autoSlice = UM.Preferences.getValue("general/auto_slice") + prepareButton.autoSlice = autoSlice + } + } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d695ba12cf..1473a75eec 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -116,6 +116,7 @@ "text_scene_hover": [70, 84, 113, 255], "error": [255, 140, 0, 255], + "warning": [255, 190, 35, 255], "button": [31, 36, 39, 255], "button_hover": [68, 72, 75, 255], @@ -210,7 +211,7 @@ "material_compatibility_warning": [0, 0, 0, 255], "progressbar_background": [245, 245, 245, 255], - "progressbar_control": [31, 36, 39, 255], + "progressbar_control": [50, 130, 255, 255], "slider_groove": [245, 245, 245, 255], "slider_groove_border": [127, 127, 127, 255], From 45af4eec907a0113145cc15f14b11fa1b5185a51 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 12:08:17 +0100 Subject: [PATCH 084/558] Add Shortcut action Ctrl+P to slice or stop slicing. Contributes to CURA-5786. --- resources/qml/SliceProcessWidget.qml | 58 +++++++++++++++++++++------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index 561e38c372..c9ff7178fd 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -4,6 +4,7 @@ import QtQuick 2.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 Cura 1.0 as Cura @@ -25,12 +26,24 @@ Column property real progress: UM.Backend.progress property int backendState: UM.Backend.state + function sliceOrStopSlicing() + { + if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled + { + CuraApplication.backend.forceSlice() + } + else + { + CuraApplication.backend.stopSlicing() + } + } + Item { id: message width: parent.width height: childrenRect.height - visible: widget.backendState == 4 + visible: widget.backendState == 4 // == BackendState.Error UM.RecolorImage { @@ -66,7 +79,7 @@ Column width: parent.width height: UM.Theme.getSize("progressbar").height value: progress - visible: widget.backendState == 2 + visible: widget.backendState == 2 // == BackendState.Processing background: Rectangle { @@ -93,7 +106,21 @@ Column id: prepareButton width: parent.width height: UM.Theme.getSize("action_panel_button").height - text: autoSlice ? catalog.i18nc("@button", "Auto slicing...") : (widget.backendState == 1 ? catalog.i18nc("@button", "Slice") : catalog.i18nc("@button", "Cancel")) + text: + { + if (autoSlice) + { + return catalog.i18nc("@button", "Auto slicing...") + } + else if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled + { + return catalog.i18nc("@button", "Slice") + } + else + { + return catalog.i18nc("@button", "Cancel") + } + } enabled: !autoSlice // Get the current value from the preferences @@ -103,17 +130,7 @@ Column textDisabledColor: UM.Theme.getColor("primary") outlineDisabledColor: "transparent" - onClicked: - { - if ([1, 5].indexOf(widget.backendState) != -1) - { - CuraApplication.backend.forceSlice() - } - else - { - CuraApplication.backend.stopSlicing() - } - } + onClicked: sliceOrStopSlicing() } // React when the user changes the preference of having the auto slice enabled @@ -126,4 +143,17 @@ Column prepareButton.autoSlice = autoSlice } } + + // Shortcut for "slice/stop" + Controls1.Action + { + shortcut: "Ctrl+P" + onTriggered: + { + if (prepareButton.enabled) + { + sliceOrStopSlicing() + } + } + } } From 00d75cd4d600866933147e9a0ae75e790ebf95e6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 12:28:51 +0100 Subject: [PATCH 085/558] Tweak the colors of the disabled state. Contributes to CURA-5786. --- resources/qml/SliceProcessWidget.qml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index c9ff7178fd..98f708a9b0 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -108,27 +108,24 @@ Column height: UM.Theme.getSize("action_panel_button").height text: { + if ([1, 4, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Error or BackendState.Disabled + { + return catalog.i18nc("@button", "Slice") + } if (autoSlice) { return catalog.i18nc("@button", "Auto slicing...") } - else if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled - { - return catalog.i18nc("@button", "Slice") - } - else - { - return catalog.i18nc("@button", "Cancel") - } + return catalog.i18nc("@button", "Cancel") } - enabled: !autoSlice + enabled: !autoSlice && ([1, 2].indexOf(widget.backendState) != -1) // Get the current value from the preferences property bool autoSlice: UM.Preferences.getValue("general/auto_slice") - disabledColor: "transparent" - textDisabledColor: UM.Theme.getColor("primary") - outlineDisabledColor: "transparent" + disabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled") : "transparent" + textDisabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") + outlineDisabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled_border") : "transparent" onClicked: sliceOrStopSlicing() } From 027bf204cd1ff6dba53b9e386e183d2251718020 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 15:12:03 +0100 Subject: [PATCH 086/558] Use the BackendState enumeration in QML to not use integers but use the enumeration literals. Contributes to CURA-5786. --- resources/qml/SliceProcessWidget.qml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index 98f708a9b0..b9c0dc39f9 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -28,7 +28,7 @@ Column function sliceOrStopSlicing() { - if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled + if ([UM.Backend.NotStarted, UM.Backend.Disabled].indexOf(widget.backendState) != -1) { CuraApplication.backend.forceSlice() } @@ -43,7 +43,7 @@ Column id: message width: parent.width height: childrenRect.height - visible: widget.backendState == 4 // == BackendState.Error + visible: widget.backendState == UM.Backend.Error UM.RecolorImage { @@ -79,7 +79,7 @@ Column width: parent.width height: UM.Theme.getSize("progressbar").height value: progress - visible: widget.backendState == 2 // == BackendState.Processing + visible: widget.backendState == UM.Backend.Processing background: Rectangle { @@ -108,7 +108,7 @@ Column height: UM.Theme.getSize("action_panel_button").height text: { - if ([1, 4, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Error or BackendState.Disabled + if ([UM.Backend.NotStarted, UM.Backend.Error, UM.Backend.Disabled].indexOf(widget.backendState) != -1) { return catalog.i18nc("@button", "Slice") } @@ -118,14 +118,16 @@ Column } return catalog.i18nc("@button", "Cancel") } - enabled: !autoSlice && ([1, 2].indexOf(widget.backendState) != -1) + enabled: !autoSlice && !disabledSlice // Get the current value from the preferences property bool autoSlice: UM.Preferences.getValue("general/auto_slice") + // Disable the slice process when + property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error, UM.Backend.Disabled].indexOf(widget.backendState) != -1 - disabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled") : "transparent" - textDisabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") - outlineDisabledColor: ([1, 2].indexOf(widget.backendState) == -1) ? UM.Theme.getColor("action_button_disabled_border") : "transparent" + disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent" + textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") + outlineDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_border") : "transparent" onClicked: sliceOrStopSlicing() } From eabd7c6b5eac0fa4fd63b2f8bb9177dd115b0767 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 30 Oct 2018 17:07:07 +0100 Subject: [PATCH 087/558] Start mocking up the panel the user gets after slicing. Also the IconLabel component was created with the aim to be reused in several places. Contributes to CURA-5786. --- resources/qml/ActionPanelWidget.qml | 2 +- resources/qml/IconLabel.qml | 48 +++++++ resources/qml/OutputProcessWidget.qml | 139 ++++++++++++-------- resources/qml/SliceProcessWidget.qml | 32 +---- resources/qml/qmldir | 3 +- resources/themes/cura-light/icons/clock.svg | 53 ++++++++ resources/themes/cura-light/icons/info.svg | 48 +++++++ resources/themes/cura-light/icons/spool.svg | 7 + 8 files changed, 251 insertions(+), 81 deletions(-) create mode 100644 resources/qml/IconLabel.qml create mode 100644 resources/themes/cura-light/icons/clock.svg create mode 100644 resources/themes/cura-light/icons/info.svg create mode 100644 resources/themes/cura-light/icons/spool.svg diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index b4a9b4e4ec..6c76c31f1b 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -21,7 +21,7 @@ Rectangle radius: UM.Theme.getSize("default_radius").width visible: CuraApplication.platformActivity - property bool backendStatusDone: UM.Backend.state == 3 + property bool backendStatusDone: UM.Backend.state == UM.Backend.Done Loader { diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml new file mode 100644 index 0000000000..2e765e2dbc --- /dev/null +++ b/resources/qml/IconLabel.qml @@ -0,0 +1,48 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM + +// This item will show a label with a squared icon in the left +Item +{ + id: container + + property alias text: label.text + property alias source: icon.source + property alias color: label.color + property alias font: label.font + + height: childrenRect.height + + UM.RecolorImage + { + id: icon + + anchors.left: parent.left + + source: UM.Theme.getIcon("dot") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: label.color + } + + Label + { + id: label + anchors.left: icon.right + anchors.leftMargin: UM.Theme.getSize("thin_margin").width + text: "Empty label" + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("very_small") + renderType: Text.NativeRendering + } +} \ No newline at end of file diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/OutputProcessWidget.qml index 612e4f286f..244fba57ef 100644 --- a/resources/qml/OutputProcessWidget.qml +++ b/resources/qml/OutputProcessWidget.qml @@ -4,69 +4,104 @@ import QtQuick 2.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 Cura 1.0 as Cura -Button +Column { - id: button - property alias cursorShape: mouseArea.cursorShape - property alias iconSource: buttonIcon.source - property alias textFont: buttonText.font - property alias cornerRadius: backgroundRect.radius - property var color: UM.Theme.getColor("primary") - property var hoverColor: UM.Theme.getColor("primary_hover") - property var disabledColor: color - property var textColor: UM.Theme.getColor("button_text") - property var textHoverColor: UM.Theme.getColor("button_text_hover") - property var textDisabledColor: textColor - property var outlineColor: color - property var outlineHoverColor: hoverColor - property var outlineDisabledColor: outlineColor + id: widget - contentItem: Row + spacing: UM.Theme.getSize("thin_margin").height + + UM.I18nCatalog { + id: catalog + name: "cura" + } + + Item + { + id: information + width: parent.width + height: childrenRect.height + + Column + { + id: timeAndCostsInformation + + anchors + { + left: parent.left + right: moreInformationIcon.left + rightMargin: UM.Theme.getSize("thin_margin").height + } + + Cura.IconLabel + { + id: estimatedTime + width: parent.width + + text: "Time" + source: UM.Theme.getIcon("clock") + font: UM.Theme.getFont("small") + } + + Cura.IconLabel + { + id: estimatedCosts + width: parent.width + + text: "Material costs" + source: UM.Theme.getIcon("spool") + font: UM.Theme.getFont("very_small") + } + } + UM.RecolorImage { - id: buttonIcon - source: "" - height: Math.round(0.6 * parent.height) - width: height + id: moreInformationIcon + + anchors + { + right: parent.right + verticalCenter: timeAndCostsInformation.verticalCenter + } + + source: UM.Theme.getIcon("info") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + sourceSize.width: width sourceSize.height: height - color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" - anchors.verticalCenter: parent.verticalCenter - Behavior on color { ColorAnimation { duration: 50 } } - } - Label + color: UM.Theme.getColor("text_medium") + } + } + + Row + { + id: buttonRow + spacing: UM.Theme.getSize("default_margin").width + + Cura.ActionButton { - id: buttonText - text: "Preview" - color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor - font: UM.Theme.getFont("action_button") - visible: text != "" - renderType: Text.NativeRendering - anchors.verticalCenter: parent.verticalCenter + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Preview") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + onClicked: console.log("Clicking preview") + } + + Cura.ActionButton + { + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Save to file") + onClicked: console.log("Clicking action button") } } - - background: Rectangle - { - id: backgroundRect - color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor - radius: UM.Theme.getSize("action_button_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor - Behavior on color { ColorAnimation { duration: 50 } } - } - - MouseArea - { - id: mouseArea - anchors.fill: parent - onPressed: mouse.accepted = false - hoverEnabled: true - } -} +} \ No newline at end of file diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index b9c0dc39f9..38a529b04e 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -38,38 +38,16 @@ Column } } - Item + Cura.IconLabel { id: message width: parent.width - height: childrenRect.height visible: widget.backendState == UM.Backend.Error - UM.RecolorImage - { - id: warningImage - - anchors.left: parent.left - - source: UM.Theme.getIcon("warning") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - - sourceSize.width: width - sourceSize.height: height - - color: UM.Theme.getColor("warning") - } - - Label - { - id: unableToSliceLabel - anchors.left: warningImage.right - anchors.leftMargin: UM.Theme.getSize("thin_margin").width - text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") - color: UM.Theme.getColor("warning") - font: UM.Theme.getFont("very_small") - } + text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") + source: UM.Theme.getIcon("warning") + color: UM.Theme.getColor("warning") + font: UM.Theme.getFont("very_small") } // Progress bar, only visible when the backend is in the process of slice the printjob diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 0e5e316409..22e3ff1303 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -7,4 +7,5 @@ PrintSetupSelector 1.0 PrintSetupSelector.qml ActionButton 1.0 ActionButton.qml MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml -ActionPanelWidget 1.0 ActionPanelWidget.qml \ No newline at end of file +ActionPanelWidget 1.0 ActionPanelWidget.qml +IconLabel 1.0 IconLabel.qml \ No newline at end of file diff --git a/resources/themes/cura-light/icons/clock.svg b/resources/themes/cura-light/icons/clock.svg new file mode 100644 index 0000000000..0b6cb78881 --- /dev/null +++ b/resources/themes/cura-light/icons/clock.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/cura-light/icons/info.svg b/resources/themes/cura-light/icons/info.svg new file mode 100644 index 0000000000..97e4fc4f35 --- /dev/null +++ b/resources/themes/cura-light/icons/info.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/cura-light/icons/spool.svg b/resources/themes/cura-light/icons/spool.svg new file mode 100644 index 0000000000..0d8ae42d9d --- /dev/null +++ b/resources/themes/cura-light/icons/spool.svg @@ -0,0 +1,7 @@ + + + + + + + From f7730302187667e74a883e061f237440a0b90521 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 31 Oct 2018 09:37:21 +0100 Subject: [PATCH 088/558] Add main stage to previewStage so that SimulationView can use it CURA-5829 --- plugins/PreviewStage/PreviewMain.qml | 19 ++ plugins/PreviewStage/PreviewStage.py | 2 + plugins/SimulationView/SimulationView.py | 7 +- .../SimulationViewMainComponent.qml | 212 +++++++++++++++++ ...ew.qml => SimulationViewMenuComponent.qml} | 224 ------------------ plugins/SimulationView/__init__.py | 1 - resources/qml/Cura.qml | 57 +++-- 7 files changed, 272 insertions(+), 250 deletions(-) create mode 100644 plugins/PreviewStage/PreviewMain.qml create mode 100644 plugins/SimulationView/SimulationViewMainComponent.qml rename plugins/SimulationView/{SimulationView.qml => SimulationViewMenuComponent.qml} (75%) diff --git a/plugins/PreviewStage/PreviewMain.qml b/plugins/PreviewStage/PreviewMain.qml new file mode 100644 index 0000000000..df7e09225f --- /dev/null +++ b/plugins/PreviewStage/PreviewMain.qml @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.4 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls.Styles 1.1 + +import UM 1.0 as UM +import Cura 1.0 as Cura + + +Loader +{ + id: previewMain + + source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : "" + onSourceChanged: print("THE SOURCE IS", source) +} \ No newline at end of file diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index e41d4a592f..1aed95162a 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -30,4 +30,6 @@ class PreviewStage(CuraStage): plugin_path = self._application.getPluginRegistry().getPluginPath(self.getPluginId()) if plugin_path is not None: menu_component_path = os.path.join(plugin_path, "PreviewMenu.qml") + main_component_path = os.path.join(plugin_path, "PreviewMain.qml") self.addDisplayComponent("menu", menu_component_path) + self.addDisplayComponent("main", main_component_path) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 0ef08b22d7..f1bff5f3f7 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -117,7 +117,12 @@ class SimulationView(CuraView): def _onEngineCreated(self) -> None: menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), - "SimulationView.qml") + "SimulationViewMenuComponent.qml") + + main_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), + "SimulationViewMainComponent.qml") + + self.addDisplayComponent("main", main_component_path) self.addDisplayComponent("menu", menu_component_path) def _evaluateCompatibilityMode(self) -> bool: diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml new file mode 100644 index 0000000000..a4ec411124 --- /dev/null +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -0,0 +1,212 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.4 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls.Styles 1.1 + +import UM 1.0 as UM +import Cura 1.0 as Cura + +Item +{ + property bool is_simulation_playing: false + visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity + + PathSlider + { + id: pathSlider + height: UM.Theme.getSize("slider_handle").width + width: 250 + + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + + anchors.horizontalCenter: parent.horizontalCenter + + visible: !UM.SimulationView.compatibilityMode + + // Custom properties + handleValue: UM.SimulationView.currentPath + maximumValue: UM.SimulationView.numPaths + handleSize: UM.Theme.getSize("slider_handle").width + trackThickness: UM.Theme.getSize("slider_groove").width + trackColor: UM.Theme.getColor("slider_groove") + trackBorderColor: UM.Theme.getColor("slider_groove_border") + handleColor: UM.Theme.getColor("slider_handle") + handleActiveColor: UM.Theme.getColor("slider_handle_active") + rangeColor: UM.Theme.getColor("slider_groove_fill") + + // Update values when layer data changes. + Connections + { + target: UM.SimulationView + onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath) + onCurrentPathChanged: + { + // Only pause the simulation when the layer was changed manually, not when the simulation is running + if (pathSlider.manuallyChanged) + { + playButton.pauseSimulation() + } + pathSlider.setHandleValue(UM.SimulationView.currentPath) + } + } + + // Ensure that the slider handlers show the correct value after switching views. + Component.onCompleted: + { + pathSlider.setHandleValue(UM.SimulationView.currentPath) + } + + } + + Button + { + id: playButton + iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg" + style: UM.Theme.styles.small_tool_button + visible: !UM.SimulationView.compatibilityMode + anchors + { + right: pathSlider.left + verticalCenter: pathSlider.verticalCenter + } + + onClicked: + { + if(is_simulation_playing) + { + pauseSimulation() + } else + { + resumeSimulation() + } + } + + function pauseSimulation() + { + UM.SimulationView.setSimulationRunning(false) + simulationTimer.stop() + is_simulation_playing = false + layerSlider.manuallyChanged = true + pathSlider.manuallyChanged = true + } + + function resumeSimulation() + { + UM.SimulationView.setSimulationRunning(true) + simulationTimer.start() + layerSlider.manuallyChanged = false + pathSlider.manuallyChanged = false + } + } + + Timer + { + id: simulationTimer + interval: 100 + running: false + repeat: true + onTriggered: + { + var currentPath = UM.SimulationView.currentPath + var numPaths = UM.SimulationView.numPaths + var currentLayer = UM.SimulationView.currentLayer + var numLayers = UM.SimulationView.numLayers + + // When the user plays the simulation, if the path slider is at the end of this layer, we start + // the simulation at the beginning of the current layer. + if (!is_simulation_playing) + { + if (currentPath >= numPaths) + { + UM.SimulationView.setCurrentPath(0) + } + else + { + UM.SimulationView.setCurrentPath(currentPath + 1) + } + } + // If the simulation is already playing and we reach the end of a layer, then it automatically + // starts at the beginning of the next layer. + else + { + if (currentPath >= numPaths) + { + // At the end of the model, the simulation stops + if (currentLayer >= numLayers) + { + playButton.pauseSimulation() + } + else + { + UM.SimulationView.setCurrentLayer(currentLayer+1) + UM.SimulationView.setCurrentPath(0) + } + } + else + { + UM.SimulationView.setCurrentPath(currentPath+1) + } + } + // The status must be set here instead of in the resumeSimulation function otherwise it won't work + // correctly, because part of the logic is in this trigger function. + is_simulation_playing = true + } + } + + LayerSlider + { + id: layerSlider + + width: UM.Theme.getSize("slider_handle").width + height: UM.Theme.getSize("layerview_menu_size").height + + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + rightMargin: UM.Theme.getSize("default_margin").width + } + + // Custom properties + upperValue: UM.SimulationView.currentLayer + lowerValue: UM.SimulationView.minimumLayer + maximumValue: UM.SimulationView.numLayers + handleSize: UM.Theme.getSize("slider_handle").width + trackThickness: UM.Theme.getSize("slider_groove").width + trackColor: UM.Theme.getColor("slider_groove") + trackBorderColor: UM.Theme.getColor("slider_groove_border") + upperHandleColor: UM.Theme.getColor("slider_handle") + lowerHandleColor: UM.Theme.getColor("slider_handle") + rangeHandleColor: UM.Theme.getColor("slider_groove_fill") + handleActiveColor: UM.Theme.getColor("slider_handle_active") + handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width + + // Update values when layer data changes + Connections + { + target: UM.SimulationView + onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer) + onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer) + onCurrentLayerChanged: + { + // Only pause the simulation when the layer was changed manually, not when the simulation is running + if (layerSlider.manuallyChanged) + { + playButton.pauseSimulation() + } + layerSlider.setUpperValue(UM.SimulationView.currentLayer) + } + } + + // Make sure the slider handlers show the correct value after switching views + Component.onCompleted: + { + layerSlider.setLowerValue(UM.SimulationView.minimumLayer) + layerSlider.setUpperValue(UM.SimulationView.currentLayer) + } + } +} \ No newline at end of file diff --git a/plugins/SimulationView/SimulationView.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml similarity index 75% rename from plugins/SimulationView/SimulationView.qml rename to plugins/SimulationView/SimulationViewMenuComponent.qml index 7a83a07ac1..91ef7a2794 100644 --- a/plugins/SimulationView/SimulationView.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -583,230 +583,6 @@ Item } } - Item - { - id: slidersBox - - width: parent.width - height: parent.height - visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity - - anchors - { - top: parent.top - leftMargin: UM.Theme.getSize("slider_layerview_margin").height - left: parent.right - } - - PathSlider - { - id: pathSlider - - height: UM.Theme.getSize("slider_handle").width - anchors - { - verticalCenter: playButton.verticalCenter - left: playButton.right - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - } - visible: !UM.SimulationView.compatibilityMode - - // custom properties - handleValue: UM.SimulationView.currentPath - maximumValue: UM.SimulationView.numPaths - handleSize: UM.Theme.getSize("slider_handle").width - trackThickness: UM.Theme.getSize("slider_groove").width - trackColor: UM.Theme.getColor("slider_groove") - trackBorderColor: UM.Theme.getColor("slider_groove_border") - handleColor: UM.Theme.getColor("slider_handle") - handleActiveColor: UM.Theme.getColor("slider_handle_active") - rangeColor: UM.Theme.getColor("slider_groove_fill") - - // update values when layer data changes - Connections - { - target: UM.SimulationView - onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath) - onCurrentPathChanged: - { - // Only pause the simulation when the layer was changed manually, not when the simulation is running - if (pathSlider.manuallyChanged) - { - playButton.pauseSimulation() - } - pathSlider.setHandleValue(UM.SimulationView.currentPath) - } - } - - // make sure the slider handlers show the correct value after switching views - Component.onCompleted: - { - pathSlider.setHandleValue(UM.SimulationView.currentPath) - } - } - - LayerSlider - { - id: layerSlider - - width: UM.Theme.getSize("slider_handle").width - height: UM.Theme.getSize("layerview_menu_size").height - - anchors - { - bottom: !UM.SimulationView.compatibilityMode ? pathSlider.top : parent.bottom - top: parent.top - bottomMargin: !UM.SimulationView.compatibilityMode ? UM.Theme.getSize("default_margin").height : 0 - left: parent.left - leftMargin: Math.round(UM.Theme.getSize("slider_layerview_margin").width / 2) - } - - // custom properties - upperValue: UM.SimulationView.currentLayer - lowerValue: UM.SimulationView.minimumLayer - maximumValue: UM.SimulationView.numLayers - handleSize: UM.Theme.getSize("slider_handle").width - trackThickness: UM.Theme.getSize("slider_groove").width - trackColor: UM.Theme.getColor("slider_groove") - trackBorderColor: UM.Theme.getColor("slider_groove_border") - upperHandleColor: UM.Theme.getColor("slider_handle") - lowerHandleColor: UM.Theme.getColor("slider_handle") - rangeHandleColor: UM.Theme.getColor("slider_groove_fill") - handleActiveColor: UM.Theme.getColor("slider_handle_active") - handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width - - // update values when layer data changes - Connections - { - target: UM.SimulationView - onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer) - onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer) - onCurrentLayerChanged: - { - // Only pause the simulation when the layer was changed manually, not when the simulation is running - if (layerSlider.manuallyChanged) - { - playButton.pauseSimulation() - } - layerSlider.setUpperValue(UM.SimulationView.currentLayer) - } - } - - // make sure the slider handlers show the correct value after switching views - Component.onCompleted: - { - layerSlider.setLowerValue(UM.SimulationView.minimumLayer) - layerSlider.setUpperValue(UM.SimulationView.currentLayer) - } - } - - // Play simulation button - Button - { - id: playButton - iconSource: "./resources/simulation_resume.svg" - style: UM.Theme.styles.small_tool_button - visible: !UM.SimulationView.compatibilityMode - anchors - { - left: parent.left - bottom: parent.bottom - } - - property var status: 0 // indicates if it's stopped (0) or playing (1) - - onClicked: - { - switch(status) - { - case 0: - { - resumeSimulation() - break - } - case 1: - { - pauseSimulation() - break - } - } - } - - function pauseSimulation() - { - UM.SimulationView.setSimulationRunning(false) - iconSource = "./resources/simulation_resume.svg" - simulationTimer.stop() - status = 0 - layerSlider.manuallyChanged = true - pathSlider.manuallyChanged = true - } - - function resumeSimulation() - { - UM.SimulationView.setSimulationRunning(true) - iconSource = "./resources/simulation_pause.svg" - simulationTimer.start() - layerSlider.manuallyChanged = false - pathSlider.manuallyChanged = false - } - } - - Timer - { - id: simulationTimer - interval: 100 - running: false - repeat: true - onTriggered: - { - var currentPath = UM.SimulationView.currentPath - var numPaths = UM.SimulationView.numPaths - var currentLayer = UM.SimulationView.currentLayer - var numLayers = UM.SimulationView.numLayers - // When the user plays the simulation, if the path slider is at the end of this layer, we start - // the simulation at the beginning of the current layer. - if (playButton.status == 0) - { - if (currentPath >= numPaths) - { - UM.SimulationView.setCurrentPath(0) - } - else - { - UM.SimulationView.setCurrentPath(currentPath+1) - } - } - // If the simulation is already playing and we reach the end of a layer, then it automatically - // starts at the beginning of the next layer. - else - { - if (currentPath >= numPaths) - { - // At the end of the model, the simulation stops - if (currentLayer >= numLayers) - { - playButton.pauseSimulation() - } - else - { - UM.SimulationView.setCurrentLayer(currentLayer+1) - UM.SimulationView.setCurrentPath(0) - } - } - else - { - UM.SimulationView.setCurrentPath(currentPath+1) - } - } - // The status must be set here instead of in the resumeSimulation function otherwise it won't work - // correctly, because part of the logic is in this trigger function. - playButton.status = 1 - } - } - } - FontMetrics { id: fontMetrics diff --git a/plugins/SimulationView/__init__.py b/plugins/SimulationView/__init__.py index 3f89ee490f..b12e582441 100644 --- a/plugins/SimulationView/__init__.py +++ b/plugins/SimulationView/__init__.py @@ -13,7 +13,6 @@ def getMetaData(): return { "view": { "name": catalog.i18nc("@item:inlistbox", "Layer view"), - "view_panel": "SimulationView.qml", "weight": 2 } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 9f53b75dd1..e49683cb8e 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -155,24 +155,6 @@ UM.MainWindow color: UM.Theme.getColor("main_window_header_background") } - Loader - { - // The stage menu is, as the name implies, a menu that is defined by the active stage. - // Note that this menu does not need to be set at all! It's perfectly acceptable to have a stage - // without this menu! - id: stageMenu - - anchors - { - left: parent.left - right: parent.right - top: parent.top - } - - height: UM.Theme.getSize("stage_menu").height - source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" - } - Connections { target: stageMenu.item @@ -230,6 +212,22 @@ UM.MainWindow } } + Loader + { + id: viewPanel + + anchors.bottom: viewModeButton.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: viewModeButton.right + + property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + + height: childrenRect.height + width: childrenRect.width + + source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" + } + Cura.ActionPanelWidget { anchors.right: parent.right @@ -254,15 +252,26 @@ UM.MainWindow anchors.fill: parent - MouseArea + source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : "" + } + + + Loader + { + // The stage menu is, as the name implies, a menu that is defined by the active stage. + // Note that this menu does not need to be set at all! It's perfectly acceptable to have a stage + // without this menu! + id: stageMenu + + anchors { - visible: parent.source != "" - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true + left: parent.left + right: parent.right + top: parent.top } - source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : "" + height: UM.Theme.getSize("stage_menu").height + source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" } UM.MessageStack From 3fc399a6443ffa0caf7fef0288c14b7b59c50cfe Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 31 Oct 2018 09:46:41 +0100 Subject: [PATCH 089/558] Moved default values into components CURA-5829 --- plugins/SimulationView/LayerSlider.qml | 22 +++++++++---------- plugins/SimulationView/PathSlider.qml | 14 ++++++------ .../SimulationViewMainComponent.qml | 16 -------------- .../SimulationViewMenuComponent.qml | 17 +++++++------- 4 files changed, 26 insertions(+), 43 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index c30ea621c4..7a7aaa0649 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -13,22 +13,22 @@ Item { id: sliderRoot - // handle properties - property real handleSize: 10 + // Handle properties + property real handleSize: UM.Theme.getSize("slider_handle").width property real handleRadius: handleSize / 2 property real minimumRangeHandleSize: handleSize / 2 - property color upperHandleColor: "black" - property color lowerHandleColor: "black" - property color rangeHandleColor: "black" - property color handleActiveColor: "white" - property real handleLabelWidth: width + property color upperHandleColor: UM.Theme.getColor("slider_handle") + property color lowerHandleColor: UM.Theme.getColor("slider_handle") + property color rangeHandleColor: UM.Theme.getColor("slider_groove_fill") + property color handleActiveColor: UM.Theme.getColor("slider_handle_active") + property real handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width property var activeHandle: upperHandle - // track properties - property real trackThickness: 4 // width of the slider track + // Track properties + property real trackThickness: UM.Theme.getSize("slider_groove").width // width of the slider track property real trackRadius: trackThickness / 2 - property color trackColor: "white" - property real trackBorderWidth: 1 // width of the slider track border + property color trackColor: UM.Theme.getColor("slider_groove") + property real trackBorderWidth: UM.Theme.getColor("slider_groove_border") property color trackBorderColor: "black" // value properties diff --git a/plugins/SimulationView/PathSlider.qml b/plugins/SimulationView/PathSlider.qml index f3c28fb5f7..701e54e398 100644 --- a/plugins/SimulationView/PathSlider.qml +++ b/plugins/SimulationView/PathSlider.qml @@ -14,19 +14,19 @@ Item id: sliderRoot // handle properties - property real handleSize: 10 + property real handleSize: UM.Theme.getSize("slider_handle").width property real handleRadius: handleSize / 2 - property color handleColor: "black" - property color handleActiveColor: "white" - property color rangeColor: "black" + property color handleColor: UM.Theme.getColor("slider_handle") + property color handleActiveColor: UM.Theme.getColor("slider_handle_active") + property color rangeColor: UM.Theme.getColor("slider_groove_fill") property real handleLabelWidth: width // track properties - property real trackThickness: 4 // width of the slider track + property real trackThickness: UM.Theme.getSize("slider_groove").width property real trackRadius: trackThickness / 2 - property color trackColor: "white" + property color trackColor: UM.Theme.getColor("slider_groove") property real trackBorderWidth: 1 // width of the slider track border - property color trackBorderColor: "black" + property color trackBorderColor: UM.Theme.getColor("slider_groove_border") // value properties property real maximumValue: 100 diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index a4ec411124..2484ec25ba 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -30,13 +30,6 @@ Item // Custom properties handleValue: UM.SimulationView.currentPath maximumValue: UM.SimulationView.numPaths - handleSize: UM.Theme.getSize("slider_handle").width - trackThickness: UM.Theme.getSize("slider_groove").width - trackColor: UM.Theme.getColor("slider_groove") - trackBorderColor: UM.Theme.getColor("slider_groove_border") - handleColor: UM.Theme.getColor("slider_handle") - handleActiveColor: UM.Theme.getColor("slider_handle_active") - rangeColor: UM.Theme.getColor("slider_groove_fill") // Update values when layer data changes. Connections @@ -175,15 +168,6 @@ Item upperValue: UM.SimulationView.currentLayer lowerValue: UM.SimulationView.minimumLayer maximumValue: UM.SimulationView.numLayers - handleSize: UM.Theme.getSize("slider_handle").width - trackThickness: UM.Theme.getSize("slider_groove").width - trackColor: UM.Theme.getColor("slider_groove") - trackBorderColor: UM.Theme.getColor("slider_groove_border") - upperHandleColor: UM.Theme.getColor("slider_handle") - lowerHandleColor: UM.Theme.getColor("slider_handle") - rangeHandleColor: UM.Theme.getColor("slider_groove_fill") - handleActiveColor: UM.Theme.getColor("slider_handle_active") - handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width // Update values when layer data changes Connections diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 91ef7a2794..a9c7305c17 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -216,15 +216,14 @@ Item onPreferenceChanged: { layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type"); - layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex); - playButton.pauseSimulation(); - viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|"); - viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves"); - viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers"); - viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin"); - viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill"); - viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers"); - viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count"); + layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex) + viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|") + viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves") + viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers") + viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin") + viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill") + viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers") + viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count") } } From 15f586ffae119c9f2e948ce8718095156f6275e9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 31 Oct 2018 10:30:11 +0100 Subject: [PATCH 090/558] Fix the location of the simulation slider label CURA-5829 --- plugins/SimulationView/LayerSlider.qml | 16 ++++++++-------- .../SimulationViewMainComponent.qml | 4 ++-- plugins/SimulationView/__init__.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 7a7aaa0649..7916cd62b3 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -28,8 +28,8 @@ Item property real trackThickness: UM.Theme.getSize("slider_groove").width // width of the slider track property real trackRadius: trackThickness / 2 property color trackColor: UM.Theme.getColor("slider_groove") - property real trackBorderWidth: UM.Theme.getColor("slider_groove_border") - property color trackBorderColor: "black" + property real trackBorderWidth: 1 + property color trackBorderColor: UM.Theme.getColor("slider_groove_border") // value properties property real maximumValue: 100 @@ -80,7 +80,7 @@ Item return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue) } - // slider track + // Slider track Rectangle { id: track @@ -106,7 +106,7 @@ Item anchors.horizontalCenter: sliderRoot.horizontalCenter visible: sliderRoot.layersVisible - // set the new value when dragging + // Set the new value when dragging function onHandleDragged() { sliderRoot.manuallyChanged = true @@ -169,7 +169,7 @@ Item height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height x: parent.x + parent.width + UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width, y + height / 2) + target: Qt.point(sliderRoot.width + width, y + height / 2) visible: sliderRoot.activeHandle == parent // custom properties @@ -275,7 +275,7 @@ Item id: upperHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x + parent.width + UM.Theme.getSize("default_margin").width + x: parent.x - parent.width - width anchors.verticalCenter: parent.verticalCenter target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent @@ -385,9 +385,9 @@ Item id: lowerHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x + parent.width + UM.Theme.getSize("default_margin").width + x: parent.x - parent.width - width anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width, y + height / 2) + target: Qt.point(sliderRoot.width + width, y + height / 2) visible: sliderRoot.activeHandle == parent // custom properties diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 2484ec25ba..5c45da6b45 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -135,13 +135,13 @@ Item } else { - UM.SimulationView.setCurrentLayer(currentLayer+1) + UM.SimulationView.setCurrentLayer(currentLayer + 1) UM.SimulationView.setCurrentPath(0) } } else { - UM.SimulationView.setCurrentPath(currentPath+1) + UM.SimulationView.setCurrentPath(currentPath + 1) } } // The status must be set here instead of in the resumeSimulation function otherwise it won't work diff --git a/plugins/SimulationView/__init__.py b/plugins/SimulationView/__init__.py index b12e582441..1efb7fd650 100644 --- a/plugins/SimulationView/__init__.py +++ b/plugins/SimulationView/__init__.py @@ -13,7 +13,7 @@ def getMetaData(): return { "view": { "name": catalog.i18nc("@item:inlistbox", "Layer view"), - "weight": 2 + "weight": 0 } } From 1e9aff44f635b37efc0365cce15b6f25bb980c80 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 31 Oct 2018 10:55:05 +0100 Subject: [PATCH 091/558] Fix QML warnings & errors CURA-5829 --- plugins/PreviewStage/PreviewMain.qml | 1 - .../SimulationViewMenuComponent.qml | 58 ++++++++----------- 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/plugins/PreviewStage/PreviewMain.qml b/plugins/PreviewStage/PreviewMain.qml index df7e09225f..04241783e9 100644 --- a/plugins/PreviewStage/PreviewMain.qml +++ b/plugins/PreviewStage/PreviewMain.qml @@ -15,5 +15,4 @@ Loader id: previewMain source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : "" - onSourceChanged: print("THE SOURCE IS", source) } \ No newline at end of file diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index a9c7305c17..5a146910e7 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -70,7 +70,8 @@ Item border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - Button { + Button + { id: collapseButton anchors.top: parent.top anchors.topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2) @@ -97,7 +98,7 @@ Item } } - ColumnLayout + Column { id: viewSettings @@ -126,11 +127,10 @@ Item Label { id: layerViewTypesLabel - anchors.left: parent.left text: catalog.i18nc("@label","Color scheme") font: UM.Theme.getFont("default"); visible: !UM.SimulationView.compatibilityMode - Layout.fillWidth: true + width: parent.width color: UM.Theme.getColor("setting_control_text") } @@ -162,13 +162,10 @@ Item ComboBox { id: layerTypeCombobox - anchors.left: parent.left - Layout.fillWidth: true - Layout.preferredWidth: UM.Theme.getSize("layerview_row").width + width: parent.width model: layerViewTypes visible: !UM.SimulationView.compatibilityMode style: UM.Theme.styles.combobox - anchors.right: parent.right onActivated: { @@ -194,14 +191,12 @@ Item Label { id: compatibilityModeLabel - anchors.left: parent.left text: catalog.i18nc("@label","Compatibility Mode") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") visible: UM.SimulationView.compatibilityMode - Layout.fillWidth: true - Layout.preferredHeight: UM.Theme.getSize("layerview_row").height - Layout.preferredWidth: UM.Theme.getSize("layerview_row").width + height: UM.Theme.getSize("layerview_row").height + width: parent.width } Item @@ -253,9 +248,9 @@ Item border.color: UM.Theme.getColor("lining") visible: !viewSettings.show_legend & !viewSettings.show_gradient } - Layout.fillWidth: true - Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - Layout.preferredWidth: UM.Theme.getSize("layerview_row").width + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height + width: parent.width + style: UM.Theme.styles.checkbox Label { @@ -264,9 +259,9 @@ Item color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") anchors.verticalCenter: parent.verticalCenter - anchors.left: extrudersModelCheckBox.left; - anchors.right: extrudersModelCheckBox.right; - anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width/2) + anchors.left: extrudersModelCheckBox.left + anchors.right: extrudersModelCheckBox.right + anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 } } @@ -325,9 +320,8 @@ Item border.color: UM.Theme.getColor("lining") visible: viewSettings.show_legend } - Layout.fillWidth: true - Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - Layout.preferredWidth: UM.Theme.getSize("layerview_row").width + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height + width: parent.width style: UM.Theme.styles.checkbox Label { @@ -336,9 +330,9 @@ Item elide: Text.ElideRight color: UM.Theme.getColor("setting_control_text") anchors.verticalCenter: parent.verticalCenter - anchors.left: legendModelCheckBox.left; - anchors.right: legendModelCheckBox.right; - anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width/2) + anchors.left: legendModelCheckBox.left + anchors.right: legendModelCheckBox.right + anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 } } @@ -349,7 +343,7 @@ Item checked: viewSettings.only_show_top_layers onClicked: { - UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0); + UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0) } text: catalog.i18nc("@label", "Only Show Top Layers") visible: UM.SimulationView.compatibilityMode @@ -360,7 +354,7 @@ Item checked: viewSettings.top_layer_count == 5 onClicked: { - UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1); + UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) } text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") visible: UM.SimulationView.compatibilityMode @@ -401,9 +395,8 @@ Item border.color: UM.Theme.getColor("lining") visible: viewSettings.show_legend } - Layout.fillWidth: true - Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - Layout.preferredWidth: UM.Theme.getSize("layerview_row").width + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height + width: parent.width color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") } @@ -416,11 +409,6 @@ Item visible: viewSettings.show_gradient width: parent.width height: UM.Theme.getSize("layerview_row").height - anchors - { - topMargin: UM.Theme.getSize("slider_layerview_margin").height - horizontalCenter: parent.horizontalCenter - } Label { @@ -503,7 +491,7 @@ Item // Gradient colors for feedrate Rectangle - { // In QML 5.9 can be changed by LinearGradient + { // In QML 5.9 can be changed by LinearGradient // Invert values because then the bar is rotated 90 degrees id: feedrateGradient visible: viewSettings.show_feedrate_gradient From 61442545cb99dc7379ea204f0496b1464c58da27 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 31 Oct 2018 13:56:55 +0100 Subject: [PATCH 092/558] Fix codestyle CURA-5829 --- plugins/SimulationView/SimulationView.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index f1bff5f3f7..6a0ffc1666 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -16,6 +16,7 @@ from UM.Mesh.MeshBuilder import MeshBuilder from UM.Message import Message from UM.Platform import Platform from UM.PluginRegistry import PluginRegistry +from UM.Qt.QtApplication import QtApplication from UM.Resources import Resources from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator @@ -113,17 +114,15 @@ class SimulationView(CuraView): self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled"), title = catalog.i18nc("@info:title", "Simulation View")) - Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) + QtApplication.getInstance().engineCreatedSignal.connect(self._onEngineCreated) def _onEngineCreated(self) -> None: - menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), - "SimulationViewMenuComponent.qml") - - main_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), - "SimulationViewMainComponent.qml") - - self.addDisplayComponent("main", main_component_path) - self.addDisplayComponent("menu", menu_component_path) + plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId()) + if plugin_path: + self.addDisplayComponent("main", os.path.join(plugin_path, "SimulationViewMainComponent.qml")) + self.addDisplayComponent("menu", os.path.join(plugin_path, "SimulationViewMenuComponent.qml")) + else: + Logger.log("e", "Unable to find the path for %s", self.getPluginId()) def _evaluateCompatibilityMode(self) -> bool: return OpenGLContext.isLegacyOpenGL() or bool(Application.getInstance().getPreferences().getValue("view/force_layer_view_compatibility_mode")) From ec0d9f09b7a800f073422c102f679d7a24d44a48 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 31 Oct 2018 17:03:09 +0100 Subject: [PATCH 093/558] Create a component for selecting the output device before output the file. Contributes to CURA-5786. --- resources/qml/ActionButton.qml | 9 ++ resources/qml/ActionPanelWidget.qml | 4 +- resources/qml/OutputDevicesActionButton.qml | 98 +++++++++++++++++++++ resources/qml/OutputProcessWidget.qml | 6 +- resources/qml/SliceProcessWidget.qml | 6 +- resources/qml/qmldir | 3 +- 6 files changed, 116 insertions(+), 10 deletions(-) create mode 100644 resources/qml/OutputDevicesActionButton.qml diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index a1c03af143..05e75ac8c5 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -14,6 +14,7 @@ Button property alias iconSource: buttonIcon.source property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius + property alias tooltip: tooltip.text property var color: UM.Theme.getColor("primary") property var hoverColor: UM.Theme.getColor("primary_hover") property var disabledColor: color @@ -62,6 +63,14 @@ Button Behavior on color { ColorAnimation { duration: 50 } } } + ToolTip + { + id: tooltip + text: "" + delay: 500 + visible: text != "" && button.hovered + } + MouseArea { id: mouseArea diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index 6c76c31f1b..417883af6f 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -21,7 +21,7 @@ Rectangle radius: UM.Theme.getSize("default_radius").width visible: CuraApplication.platformActivity - property bool backendStatusDone: UM.Backend.state == UM.Backend.Done + property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled Loader { @@ -33,7 +33,7 @@ Rectangle left: parent.left leftMargin: UM.Theme.getSize("thick_margin").width } - sourceComponent: backendStatusDone ? outputProcessWidget : sliceProcessWidget + sourceComponent: outputAvailable ? outputProcessWidget : sliceProcessWidget } Behavior on height { NumberAnimation { duration: 100 } } diff --git a/resources/qml/OutputDevicesActionButton.qml b/resources/qml/OutputDevicesActionButton.qml new file mode 100644 index 0000000000..b0cca0eba0 --- /dev/null +++ b/resources/qml/OutputDevicesActionButton.qml @@ -0,0 +1,98 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM +import Cura 1.0 as Cura + +Item +{ + id: widget + + Cura.ActionButton + { + id: saveToButton + height: parent.height + + anchors + { + top: parent.top + left: parent.left + right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right + } + + tooltip: UM.OutputDeviceManager.activeDeviceDescription + + text: UM.OutputDeviceManager.activeDeviceShortDescription + + onClicked: + { + forceActiveFocus(); + UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, + { "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats }); + } + } + + Cura.ActionButton + { + id: deviceSelectionMenu + height: parent.height + + anchors + { + top: parent.top + right: parent.right + } + + tooltip: catalog.i18nc("@info:tooltip", "Select the active output device") + iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom") + visible: (devicesModel.deviceCount > 1) + + onClicked: popup.opened ? popup.close() : popup.open() + + Popup + { + id: popup + + y: -height + x: parent.width - width + + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + + contentItem: Column + { + Repeater + { + model: devicesModel + + delegate: Cura.ActionButton + { + text: model.description + color: "transparent" + hoverColor: "red" + + onClicked: + { + UM.OutputDeviceManager.setActiveDevice(model.id) + popup.close() + } + } + } + } + + background: Rectangle + { + opacity: visible ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + color: UM.Theme.getColor("primary") + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + } + } + } + + UM.OutputDevicesModel { id: devicesModel } +} \ No newline at end of file diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/OutputProcessWidget.qml index 244fba57ef..d3f306fed5 100644 --- a/resources/qml/OutputProcessWidget.qml +++ b/resources/qml/OutputProcessWidget.qml @@ -96,12 +96,10 @@ Column onClicked: console.log("Clicking preview") } - Cura.ActionButton + Cura.OutputDevicesActionButton { - width: UM.Theme.getSize("account_button").width + width: UM.Theme.getSize("action_panel_button").width height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Save to file") - onClicked: console.log("Clicking action button") } } } \ No newline at end of file diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index 38a529b04e..3ea6e09975 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -28,7 +28,7 @@ Column function sliceOrStopSlicing() { - if ([UM.Backend.NotStarted, UM.Backend.Disabled].indexOf(widget.backendState) != -1) + if (widget.backendState == UM.Backend.NotStarted) { CuraApplication.backend.forceSlice() } @@ -86,7 +86,7 @@ Column height: UM.Theme.getSize("action_panel_button").height text: { - if ([UM.Backend.NotStarted, UM.Backend.Error, UM.Backend.Disabled].indexOf(widget.backendState) != -1) + if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) { return catalog.i18nc("@button", "Slice") } @@ -101,7 +101,7 @@ Column // Get the current value from the preferences property bool autoSlice: UM.Preferences.getValue("general/auto_slice") // Disable the slice process when - property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error, UM.Backend.Disabled].indexOf(widget.backendState) != -1 + property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent" textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 22e3ff1303..d5e4106d33 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -8,4 +8,5 @@ ActionButton 1.0 ActionButton.qml MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml ActionPanelWidget 1.0 ActionPanelWidget.qml -IconLabel 1.0 IconLabel.qml \ No newline at end of file +IconLabel 1.0 IconLabel.qml +OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml \ No newline at end of file From 3a7ae58563613088006fe0cb386d20e4dad76bd2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 31 Oct 2018 17:23:38 +0100 Subject: [PATCH 094/558] Small changes in the buttons to fit with the designs. Contributes to CURA-5786. --- resources/qml/OutputDevicesActionButton.qml | 9 +++++++-- resources/themes/cura-light/theme.json | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/OutputDevicesActionButton.qml b/resources/qml/OutputDevicesActionButton.qml index b0cca0eba0..11be11a2b0 100644 --- a/resources/qml/OutputDevicesActionButton.qml +++ b/resources/qml/OutputDevicesActionButton.qml @@ -49,6 +49,7 @@ Item tooltip: catalog.i18nc("@info:tooltip", "Select the active output device") iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom") + color: UM.Theme.getColor("action_panel_secondary") visible: (devicesModel.deviceCount > 1) onClicked: popup.opened ? popup.close() : popup.open() @@ -56,6 +57,7 @@ Item Popup { id: popup + padding: 0 y: -height x: parent.width - width @@ -72,7 +74,9 @@ Item { text: model.description color: "transparent" - hoverColor: "red" + outlineColor: "transparent" + cornerRadius: 0 + hoverColor: UM.Theme.getColor("primary") onClicked: { @@ -87,7 +91,8 @@ Item { opacity: visible ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } - color: UM.Theme.getColor("primary") + radius: UM.Theme.getSize("default_radius") + color: UM.Theme.getColor("action_panel_secondary") border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 1473a75eec..658fa00596 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -103,6 +103,8 @@ "machine_selector_hover": [68, 72, 75, 255], "machine_selector_text_active": [255, 255, 255, 255], + "action_panel_secondary": [27, 95, 202, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], From dcad95aab9cfb2ec215dc3cb22467fffff2918b7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 1 Nov 2018 12:44:14 +0100 Subject: [PATCH 095/558] Rename Toolbox button to Marketplace. Contributes to CURA-5784. --- resources/qml/MainWindow/MainWindowHeader.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 3f088e782f..59ec542e6b 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -83,7 +83,7 @@ Rectangle } leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:button", "Toolbox") + text: catalog.i18nc("@action:button", "Marketplace") height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) color: UM.Theme.getColor("main_window_header_secondary_button_background_active") hoverColor: UM.Theme.getColor("main_window_header_secondary_button_background_hovered") From b03695dec66ef5bb10a07222fb11d96e92eb1155 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 09:33:27 +0100 Subject: [PATCH 096/558] Add print time information and material costs to the action panel. Contributes to CURA-5786. --- resources/qml/OutputProcessWidget.qml | 33 +++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/OutputProcessWidget.qml index d3f306fed5..435cc6da79 100644 --- a/resources/qml/OutputProcessWidget.qml +++ b/resources/qml/OutputProcessWidget.qml @@ -30,6 +30,7 @@ Column Column { id: timeAndCostsInformation + spacing: UM.Theme.getSize("thin_margin").height anchors { @@ -43,7 +44,9 @@ Column id: estimatedTime width: parent.width - text: "Time" + property var printDuration: PrintInformation.currentPrintTime + + text: printDuration.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("small") } @@ -53,7 +56,33 @@ Column id: estimatedCosts width: parent.width - text: "Material costs" + property var printMaterialLengths: PrintInformation.materialLengths + property var printMaterialWeights: PrintInformation.materialWeights + + function getText() + { + var lengths = [] + var weights = [] + if(printMaterialLengths) + { + for(var index = 0; index < printMaterialLengths.length; index++) + { + if(printMaterialLengths[index] > 0) + { + lengths.push(printMaterialLengths[index].toFixed(2)) + weights.push(String(Math.round(printMaterialWeights[index]))) + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"] + weights = ["0"] + } + return weights.join(" + ") + "g · " + lengths.join(" + ") + "m" + } + + text: getText() source: UM.Theme.getIcon("spool") font: UM.Theme.getFont("very_small") } From 310539cb6dc84e0245a86d3e0b10aa79d413d536 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 09:58:35 +0100 Subject: [PATCH 097/558] In the main action panel, only show the total amount of material weight and length (addition of all extruders). The information panel will show each cost separately. Contributes to CURA-5786. --- .../{ => ActionPanel}/ActionPanelWidget.qml | 0 .../OutputDevicesActionButton.qml | 0 .../{ => ActionPanel}/OutputProcessWidget.qml | 21 ++++++++----------- .../{ => ActionPanel}/SliceProcessWidget.qml | 0 4 files changed, 9 insertions(+), 12 deletions(-) rename resources/qml/{ => ActionPanel}/ActionPanelWidget.qml (100%) rename resources/qml/{ => ActionPanel}/OutputDevicesActionButton.qml (100%) rename resources/qml/{ => ActionPanel}/OutputProcessWidget.qml (84%) rename resources/qml/{ => ActionPanel}/SliceProcessWidget.qml (100%) diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml similarity index 100% rename from resources/qml/ActionPanelWidget.qml rename to resources/qml/ActionPanel/ActionPanelWidget.qml diff --git a/resources/qml/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml similarity index 100% rename from resources/qml/OutputDevicesActionButton.qml rename to resources/qml/ActionPanel/OutputDevicesActionButton.qml diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml similarity index 84% rename from resources/qml/OutputProcessWidget.qml rename to resources/qml/ActionPanel/OutputProcessWidget.qml index 435cc6da79..bef40fdfca 100644 --- a/resources/qml/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -61,25 +61,20 @@ Column function getText() { - var lengths = [] - var weights = [] - if(printMaterialLengths) + var totalLengths = 0 + var totalWeights = 0 + if (printMaterialLengths) { for(var index = 0; index < printMaterialLengths.length; index++) { if(printMaterialLengths[index] > 0) { - lengths.push(printMaterialLengths[index].toFixed(2)) - weights.push(String(Math.round(printMaterialWeights[index]))) + totalLengths += printMaterialLengths[index] + totalWeights += Math.round(printMaterialWeights[index]) } } } - if(lengths.length == 0) - { - lengths = ["0.00"] - weights = ["0"] - } - return weights.join(" + ") + "g · " + lengths.join(" + ") + "m" + return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } text: getText() @@ -116,13 +111,15 @@ Column Cura.ActionButton { + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_panel_button").height text: catalog.i18nc("@button", "Preview") color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - onClicked: console.log("Clicking preview") + onClicked: UM.Controller.setActiveStage("MonitorStage") } Cura.OutputDevicesActionButton diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml similarity index 100% rename from resources/qml/SliceProcessWidget.qml rename to resources/qml/ActionPanel/SliceProcessWidget.qml From c862e72514230a7ed5eee59ca3257c5c58deb968 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 11:10:23 +0100 Subject: [PATCH 098/558] Add the print panel information as a popup that shows when the "i" icon is clicked. Contributes to CURA-5786. --- .../ActionPanel/OutputDevicesActionButton.qml | 2 +- .../qml/ActionPanel/OutputProcessWidget.qml | 16 +---- .../ActionPanel/PrintInformationWidget.qml | 62 +++++++++++++++++++ 3 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 resources/qml/ActionPanel/PrintInformationWidget.qml diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 11be11a2b0..32d5f8a73b 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -91,7 +91,7 @@ Item { opacity: visible ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } - radius: UM.Theme.getSize("default_radius") + radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("action_panel_secondary") border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index bef40fdfca..a2f9f13576 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -4,7 +4,6 @@ import QtQuick 2.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 Cura 1.0 as Cura @@ -35,7 +34,7 @@ Column anchors { left: parent.left - right: moreInformationIcon.left + right: printInformationPanel.left rightMargin: UM.Theme.getSize("thin_margin").height } @@ -83,24 +82,15 @@ Column } } - UM.RecolorImage + PrintInformationWidget { - id: moreInformationIcon + id: printInformationPanel anchors { right: parent.right verticalCenter: timeAndCostsInformation.verticalCenter } - - source: UM.Theme.getIcon("info") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - - sourceSize.width: width - sourceSize.height: height - - color: UM.Theme.getColor("text_medium") } } diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml new file mode 100644 index 0000000000..f8f91869aa --- /dev/null +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -0,0 +1,62 @@ +// 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 UM 1.1 as UM +import Cura 1.0 as Cura + +Button +{ + id: widget + + implicitHeight: UM.Theme.getSize("section_icon").height + implicitWidth: UM.Theme.getSize("section_icon").width + + background: UM.RecolorImage + { + id: moreInformationIcon + + source: UM.Theme.getIcon("info") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: widget.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text_medium") + } + + onClicked: popup.opened ? popup.close() : popup.open() + + Popup + { + id: popup + + y: -(height + UM.Theme.getSize("default_arrow").height + UM.Theme.getSize("thin_margin").height) + x: parent.width - width + UM.Theme.getSize("thin_margin").width + + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + + contentItem: Label + { + id: panel + text: "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, \nsed do eiusmod tempor incididunt \nut labore et dolore magna aliqua. \nUt enim ad minim veniam, ..." + } + + background: UM.PointingRectangle + { + opacity: visible ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + color: UM.Theme.getColor("tool_panel_background") + borderColor: UM.Theme.getColor("lining") + borderWidth: UM.Theme.getSize("default_lining").width + + target: Qt.point(width - (widget.width / 2) - UM.Theme.getSize("thin_margin").width, + height + UM.Theme.getSize("default_arrow").height - UM.Theme.getSize("thin_margin").height) + + arrowSize: UM.Theme.getSize("default_arrow").width + } + } +} \ No newline at end of file From ef7ac3b089cc51712c850c3d1688ecd25cdc55d7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 13:29:55 +0100 Subject: [PATCH 099/558] Create the new component that gathers all the printjob information (times and material usage) in a popup that is shown when the "i" icon is pressed. Contributes to CURA-5786. --- .../ActionPanel/PrintInformationWidget.qml | 6 +- .../qml/ActionPanel/PrintJobInformation.qml | 166 ++++++++++++++++++ resources/themes/cura-light/theme.json | 2 +- 3 files changed, 170 insertions(+), 4 deletions(-) create mode 100644 resources/qml/ActionPanel/PrintJobInformation.qml diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml index f8f91869aa..620c3a408c 100644 --- a/resources/qml/ActionPanel/PrintInformationWidget.qml +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -39,10 +39,10 @@ Button closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - contentItem: Label + contentItem: PrintJobInformation { - id: panel - text: "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, \nsed do eiusmod tempor incididunt \nut labore et dolore magna aliqua. \nUt enim ad minim veniam, ..." + id: printJobInformation + width: UM.Theme.getSize("action_panel_information_widget").width } background: UM.PointingRectangle diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml new file mode 100644 index 0000000000..0eaa0ca46f --- /dev/null +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -0,0 +1,166 @@ +// 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 UM 1.1 as UM +import Cura 1.0 as Cura + +Column +{ + id: base + spacing: UM.Theme.getSize("default_margin").width + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + + Column + { + id: timeSpecification + spacing: UM.Theme.getSize("thin_margin").width + width: parent.width + topPadding: UM.Theme.getSize("default_margin").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + + Label + { + text: catalog.i18nc("@label", "Time specification").toUpperCase() + color: UM.Theme.getColor("primary") + font: UM.Theme.getFont("small") + renderType: Text.NativeRendering + } + + Label + { + property var printDuration: PrintInformation.currentPrintTime + + function getTimeSpecifications() + { + // All the time information for the different features is achieved + var printTime = PrintInformation.getFeaturePrintTimes() + var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds)) + + // A message is created and displayed when the user hover the time label + var text = "" + for(var feature in printTime) + { + if(!printTime[feature].isTotalDurationZero) + { + text += "" + + "".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + + "".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)) + + "" + } + } + text += "
" + feature + ":  %1  %1%
" + print(text) + return text + } + + text: getTimeSpecifications() + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("very_small") + renderType: Text.NativeRendering + textFormat: Text.RichText + } + } + + Column + { + id: materialSpecification + spacing: UM.Theme.getSize("thin_margin").width + width: parent.width + bottomPadding: UM.Theme.getSize("default_margin").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + + Label + { + text: catalog.i18nc("@label", "Material specification").toUpperCase() + color: UM.Theme.getColor("primary") + font: UM.Theme.getFont("small") + renderType: Text.NativeRendering + } + + Label + { + property var printMaterialLengths: PrintInformation.materialLengths + property var printMaterialWeights: PrintInformation.materialWeights + property var printMaterialCosts: PrintInformation.materialCosts + property var printMaterialNames: PrintInformation.materialNames + + function formatRow(items) + { + var rowHTML = "" + for(var item = 0; item < items.length; item++) + { + if (item == 0) + { + rowHTML += "%1".arg(items[item]) + } + else + { + rowHTML += "  %1".arg(items[item]) + } + } + rowHTML += "" + return rowHTML + } + + function getMaterialSpecifications() + { + var lengths = [] + var weights = [] + var costs = [] + var names = [] + if(printMaterialLengths) + { + for(var index = 0; index < printMaterialLengths.length; index++) + { + if(printMaterialLengths[index] > 0) + { + names.push(printMaterialNames[index]) + lengths.push(printMaterialLengths[index].toFixed(2)) + weights.push(String(Math.round(printMaterialWeights[index]))) + var cost = printMaterialCosts[index] == undefined ? 0 : printMaterialCosts[index].toFixed(2) + costs.push(cost) + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"] + weights = ["0"] + costs = ["0.00"] + } + + var text = "" + for(var index = 0; index < lengths.length; index++) + { + text += formatRow([ + "%1:".arg(names[index]), + catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), + catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), + "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), + ]) + } + text += "
" + + return text + } + + text: getMaterialSpecifications() + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("very_small") + renderType: Text.NativeRendering + textFormat: Text.RichText + } + } +} \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 658fa00596..f354b521ee 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -379,7 +379,7 @@ "configuration_selector_widget": [35.0, 4.5], "configuration_selector_mode_tabs": [0.0, 3.0], - "action_panel_widget": [35.0, 0.0], + "action_panel_information_widget": [20.0, 0.0], "action_panel_button": [15.0, 3.0], "machine_selector_widget": [28.0, 4.5], From 300d109cfe45cd64665536e0113ade0e12ff0260 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 2 Nov 2018 13:37:57 +0100 Subject: [PATCH 100/558] Set the Z of the machine selector so the tooltip doesn't get hidden CURA-5772 --- plugins/PrepareStage/PrepareMenu.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index cdcc1384a2..e8514a9ef9 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -45,6 +45,7 @@ Item id: machineSelection width: UM.Theme.getSize("machine_selector_widget").width - configSelection.width height: prepareMenu.height + z: openFileButton.z - 1 } Cura.QuickConfigurationSelector From 20b3b6da79aca7c42f935e3e9b6259918c72e63a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 2 Nov 2018 15:11:49 +0100 Subject: [PATCH 101/558] Document PreviewStage.py Some stuff I had to ask the original implementer to explain to me. So I wrote that down so that the next guy doesn't have to do that. Contributes to issue CURA-5829. --- plugins/PreviewStage/PreviewMenu.qml | 3 +++ plugins/PreviewStage/PreviewStage.py | 16 ++++++++++++++++ plugins/PreviewStage/__init__.py | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 5ed0e697a9..66f7d527d9 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -1,3 +1,6 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.7 import QtQuick.Controls 1.4 diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index 1aed95162a..1c487c8340 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -1,5 +1,6 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. + import os.path from UM.Qt.QtApplication import QtApplication @@ -11,6 +12,11 @@ if TYPE_CHECKING: from UM.View.View import View +## Displays a preview of what you're about to print. +# +# The Python component of this stage just loads PreviewMain.qml for display +# when the stage is selected, and makes sure that it reverts to the previous +# view when the previous stage is activated. class PreviewStage(CuraStage): def __init__(self, application: QtApplication, parent = None) -> None: super().__init__(parent) @@ -18,14 +24,24 @@ class PreviewStage(CuraStage): self._application.engineCreatedSignal.connect(self._engineCreated) self._previously_active_view = None # type: Optional[View] + ## When selecting the stage, remember which was the previous view so that + # we can revert to that view when we go out of the stage later. def onStageSelected(self) -> None: self._previously_active_view = self._application.getController().getActiveView() + ## Called when going to a different stage (away from the Preview Stage). + # + # When going to a different stage, the view should be reverted to what it + # was before. Normally, that just reverts it to solid view. def onStageDeselected(self) -> None: if self._previously_active_view is not None: self._application.getController().setActiveView(self._previously_active_view.getPluginId()) self._previously_active_view = None + ## Delayed load of the QML files. + # + # We need to make sure that the QML engine is running before we can load + # these. def _engineCreated(self) -> None: plugin_path = self._application.getPluginRegistry().getPluginPath(self.getPluginId()) if plugin_path is not None: diff --git a/plugins/PreviewStage/__init__.py b/plugins/PreviewStage/__init__.py index d58826934e..424f573e4a 100644 --- a/plugins/PreviewStage/__init__.py +++ b/plugins/PreviewStage/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from . import PreviewStage From dba31c3af435202ef93363859017927d4a043bd2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 16:20:04 +0100 Subject: [PATCH 102/558] Add documentation. Contributes to CURA-5786. --- resources/qml/ActionPanel/ActionPanelWidget.qml | 4 ++++ resources/qml/ActionPanel/OutputProcessWidget.qml | 5 +++++ resources/qml/ActionPanel/SliceProcessWidget.qml | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/resources/qml/ActionPanel/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml index 417883af6f..1fc288af6a 100644 --- a/resources/qml/ActionPanel/ActionPanelWidget.qml +++ b/resources/qml/ActionPanel/ActionPanelWidget.qml @@ -8,6 +8,10 @@ import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura + +// This element hold all the elements needed for the user to trigger the slicing process, and later +// to get information about the printing times, material consumption and the output process (such as +// saving to a file, printing over network, ... Rectangle { id: actionPanelWidget diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index a2f9f13576..5d5e5bb66c 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -8,6 +8,11 @@ import QtQuick.Layouts 1.3 import UM 1.1 as UM import Cura 1.0 as Cura + +// This element contains all the elements the user needs to visualize the data +// that is gather after the slicing process, such as printint time, material usage, ... +// There are also two buttons: one to previsualize the output layers, and the other to +// select what to do with it (such as print over network, save to file, ...) Column { id: widget diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 3ea6e09975..e70ec45e43 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -9,6 +9,10 @@ import QtQuick.Controls 1.4 as Controls1 import UM 1.1 as UM import Cura 1.0 as Cura + +// 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 +// process and a progress bar to see the progress of the process. Column { id: widget From 059e681de59f073870d6858daac7b0cd85528be1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 16:44:50 +0100 Subject: [PATCH 103/558] Remove unused code. Contributes to CURA-5786. --- resources/qml/ActionPanel/OutputDevicesActionButton.qml | 1 - resources/qml/ActionPanel/PrintJobInformation.qml | 1 - resources/qml/Cura.qml | 8 -------- 3 files changed, 10 deletions(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 32d5f8a73b..87faa0a2bf 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -74,7 +74,6 @@ Item { text: model.description color: "transparent" - outlineColor: "transparent" cornerRadius: 0 hoverColor: UM.Theme.getColor("primary") diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml index 0eaa0ca46f..df90e81aaf 100644 --- a/resources/qml/ActionPanel/PrintJobInformation.qml +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -58,7 +58,6 @@ Column } } text += "" - print(text) return text } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 1f4d71e460..f7b4186515 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -314,14 +314,6 @@ UM.MainWindow anchors.bottom: parent.bottom anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.bottomMargin: UM.Theme.getSize("thick_margin").height -// onShowTooltip: -// { -// base.showTooltip(item, location, text) -// } -// onHideTooltip: -// { -// base.hideTooltip() -// } } Loader From 2dfd354b25e3187f403cc1cffc028d61eb7bae2e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 16:49:31 +0100 Subject: [PATCH 104/558] Remove function and property that are only used once. Contributes to CURA-5786. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 5d5e5bb66c..db9a23cdf3 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -48,9 +48,7 @@ Column id: estimatedTime width: parent.width - property var printDuration: PrintInformation.currentPrintTime - - text: printDuration.getDisplayString(UM.DurationFormat.Long) + text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("small") } @@ -63,7 +61,7 @@ Column property var printMaterialLengths: PrintInformation.materialLengths property var printMaterialWeights: PrintInformation.materialWeights - function getText() + text: { var totalLengths = 0 var totalWeights = 0 @@ -80,8 +78,6 @@ Column } return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } - - text: getText() source: UM.Theme.getIcon("spool") font: UM.Theme.getFont("very_small") } From 6f2e8d726dac8488f6547f39556844afbd3cf4db Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 16:52:17 +0100 Subject: [PATCH 105/558] Remove functions that are only used once. Contributes to CURA-5786. --- resources/qml/ActionPanel/PrintJobInformation.qml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml index df90e81aaf..e53a92a994 100644 --- a/resources/qml/ActionPanel/PrintJobInformation.qml +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -39,7 +39,7 @@ Column { property var printDuration: PrintInformation.currentPrintTime - function getTimeSpecifications() + text: { // All the time information for the different features is achieved var printTime = PrintInformation.getFeaturePrintTimes() @@ -60,8 +60,6 @@ Column text += "" return text } - - text: getTimeSpecifications() width: parent.width - 2 * UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") @@ -112,7 +110,7 @@ Column return rowHTML } - function getMaterialSpecifications() + text: { var lengths = [] var weights = [] @@ -153,8 +151,6 @@ Column return text } - - text: getMaterialSpecifications() width: parent.width - 2 * UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") From 4659b0d38717afb0b693545e19501831d5b79e06 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 11:36:58 +0100 Subject: [PATCH 106/558] Fix codestyle --- plugins/SimulationView/SimulationViewMainComponent.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 5c45da6b45..69984f85cb 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -72,7 +72,8 @@ Item if(is_simulation_playing) { pauseSimulation() - } else + } + else { resumeSimulation() } From f0e205423f24c4e10cb2d59f4b9ec98d69c58561 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 11:47:22 +0100 Subject: [PATCH 107/558] Pause simulation view when preferences have been changed. I accidentally removed this feature when working on CURA-5829, but it was spotted in the review. --- plugins/SimulationView/SimulationViewMainComponent.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 69984f85cb..f34208e1b5 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -61,6 +61,16 @@ Item iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg" style: UM.Theme.styles.small_tool_button visible: !UM.SimulationView.compatibilityMode + + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + playButton.pauseSimulation() + } + } + anchors { right: pathSlider.left From 9f13de9f0d07fde160fc49c7ca9f1f0a62b77336 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 11:48:19 +0100 Subject: [PATCH 108/558] No longer create two instances of the setting view. This caused a bunch of issues with the getPluginId, as one of the instances didn't got added to the registry (and as such, never got an ID) CURA-5829 --- plugins/SimulationView/SimulationViewMenuComponent.qml | 2 +- plugins/SimulationView/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 5a146910e7..b1613dff85 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -210,7 +210,7 @@ Item target: UM.Preferences onPreferenceChanged: { - layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type"); + layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type") layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex) viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|") viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves") diff --git a/plugins/SimulationView/__init__.py b/plugins/SimulationView/__init__.py index 1efb7fd650..420ee60660 100644 --- a/plugins/SimulationView/__init__.py +++ b/plugins/SimulationView/__init__.py @@ -25,4 +25,4 @@ def createSimulationViewProxy(engine, script_engine): def register(app): simulation_view = SimulationView.SimulationView() qmlRegisterSingletonType(SimulationViewProxy.SimulationViewProxy, "UM", 1, 0, "SimulationView", simulation_view.getProxy) - return { "view": SimulationView.SimulationView()} + return { "view": simulation_view} From 406dd68aa4151bdc40dde21f1b66e071038b9fbb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 11:54:55 +0100 Subject: [PATCH 109/558] Made path slider widht themable. CURA-5829 --- plugins/SimulationView/SimulationViewMainComponent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index f34208e1b5..784938e5c2 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -18,7 +18,7 @@ Item { id: pathSlider height: UM.Theme.getSize("slider_handle").width - width: 250 + width: UM.Theme.getSize("layerview_menu_size").width anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("default_margin").height From 2bb7b352efca961ca3f87a38251084e3a0b83914 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 13:25:47 +0100 Subject: [PATCH 110/558] Hide settings when pre-sliced g-code is loaded CURA-5772 --- resources/qml/PrintSetupSelector.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 987e3ecce9..8232e76a17 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -106,10 +106,10 @@ Rectangle model: modesListModel width: Math.round(parent.width * 0.55) height: UM.Theme.getSize("print_setup_mode_toggle").height + visible: !hideSettings anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("thick_margin").width - anchors.top: settingsModeLabel.top ButtonGroup @@ -191,6 +191,8 @@ Rectangle anchors.right: parent.right height: UM.Theme.getSize("print_setup_widget").height + visible: !hideSettings + // We load both of them at once (instead of using a loader) because the advanced sidebar can take // quite some time to load. So in this case we sacrifice memory for speed. SidebarAdvanced From 99bac25ab2d7a75ac5e6c9bcceebe75367babc28 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 14:55:22 +0100 Subject: [PATCH 111/558] Show default avatar if user has no avatar picture set CURA-5784 --- resources/qml/Account/AccountDetails.qml | 14 +++++++++++++- resources/qml/Account/AccountWidget.qml | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index c723ca20fb..a288426e0c 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -11,6 +11,7 @@ Column { property var profile: null property var loggedIn: false + property var profileImage: "" padding: 2 * UM.Theme.getSize("default_margin").height spacing: 2 * UM.Theme.getSize("default_margin").height @@ -21,7 +22,18 @@ Column width: UM.Theme.getSize("avatar_image").width height: UM.Theme.getSize("avatar_image").height anchors.horizontalCenter: parent.horizontalCenter - source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") + source: + { + if(loggedIn) + { + if(profileImage) + { + return profileImage + } + return UM.Theme.getImage("avatar_no_user") + } + return UM.Theme.getImage("avatar_no_user") + } outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining") } diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index cdae457ac8..e37523296f 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -25,7 +25,18 @@ Button anchors.verticalCenter: accountWidget.verticalCenter anchors.horizontalCenter: accountWidget.horizontalCenter - source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user") + source: + { + if(loggedIn) + { + if(profile["profile_image_url"]) + { + return profile["profile_image_url"] + } + return UM.Theme.getImage("avatar_no_user") + } + return UM.Theme.getImage("avatar_no_user") + } outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining") } @@ -45,6 +56,7 @@ Button id: panel profile: Cura.API.account.userProfile loggedIn: Cura.API.account.isLoggedIn + profileImage: Cura.API.account.profileImageUrl } background: UM.PointingRectangle From 8106df1ae2659da6cf460cb49a23e631be202f3b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 16:26:35 +0100 Subject: [PATCH 112/558] Bit of QML cleanup --- .../SimulationViewMenuComponent.qml | 922 +++++++++--------- resources/themes/cura-light/theme.json | 2 - 2 files changed, 454 insertions(+), 470 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index b1613dff85..62f353a241 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -9,32 +9,21 @@ import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura -Item +Rectangle { id: base - width: + + color: UM.Theme.getColor("tool_panel_background") + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + + width: UM.Theme.getSize("layerview_menu_size").width + + height: { - if (UM.SimulationView.compatibilityMode) - { - return UM.Theme.getSize("layerview_menu_size_compatibility").width; - } - else - { - return UM.Theme.getSize("layerview_menu_size").width; - } - } - height: { if (viewSettings.collapsed) { - if (UM.SimulationView.compatibilityMode) - { - return UM.Theme.getSize("layerview_menu_size_compatibility_collapsed").height; - } - return UM.Theme.getSize("layerview_menu_size_collapsed").height; - } - else if (UM.SimulationView.compatibilityMode) - { - return UM.Theme.getSize("layerview_menu_size_compatibility").height; + return UM.Theme.getSize("layerview_menu_size_collapsed").height } else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) { @@ -45,6 +34,7 @@ Item return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height) } } + Behavior on height { NumberAnimation { duration: 100 } } property var buttonTarget: @@ -57,514 +47,510 @@ Item return Qt.point(0,0) } - Rectangle + Connections { - id: layerViewMenu - anchors.right: parent.right - anchors.top: parent.top - width: parent.width - height: parent.height - clip: true - z: layerSlider.z - 1 - color: UM.Theme.getColor("tool_panel_background") - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - - Button + target: UM.Preferences + onPreferenceChanged: { - id: collapseButton - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2) - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width + layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type") + layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex) + viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|") + viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves") + viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers") + viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin") + viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill") + viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers") + viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count") + } + } - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + Button + { + id: collapseButton - onClicked: viewSettings.collapsed = !viewSettings.collapsed - - style: ButtonStyle - { - background: UM.RecolorImage - { - width: control.width - height: control.height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("setting_control_text") - source: viewSettings.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") - } - label: Label{ } - } + anchors + { + top: parent.top + topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2) + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width } - Column + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + + onClicked: viewSettings.collapsed = !viewSettings.collapsed + + style: ButtonStyle { - id: viewSettings - - property bool collapsed: false - property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|") - property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves") - property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers") - property bool show_skin: UM.Preferences.getValue("layerview/show_skin") - property bool show_infill: UM.Preferences.getValue("layerview/show_infill") - // if we are in compatibility mode, we only show the "line type" - property bool show_legend: UM.SimulationView.compatibilityMode ? true : UM.Preferences.getValue("layerview/layer_view_type") == 1 - property bool show_gradient: UM.SimulationView.compatibilityMode ? false : UM.Preferences.getValue("layerview/layer_view_type") == 2 || UM.Preferences.getValue("layerview/layer_view_type") == 3 - property bool show_feedrate_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 2 - property bool show_thickness_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 3 - property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers") - property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") - - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - spacing: UM.Theme.getSize("layerview_row_spacing").height - - Label + background: UM.RecolorImage { - id: layerViewTypesLabel - text: catalog.i18nc("@label","Color scheme") - font: UM.Theme.getFont("default"); - visible: !UM.SimulationView.compatibilityMode - width: parent.width - color: UM.Theme.getColor("setting_control_text") + width: control.width + height: control.height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("setting_control_text") + source: viewSettings.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") } + label: Label{ } + } + } - ListModel // matches SimulationView.py + Column + { + id: viewSettings + + property bool collapsed: false + property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|") + property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves") + property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers") + property bool show_skin: UM.Preferences.getValue("layerview/show_skin") + property bool show_infill: UM.Preferences.getValue("layerview/show_infill") + + // If we are in compatibility mode, we only show the "line type" + property bool show_legend: UM.SimulationView.compatibilityMode ? true : UM.Preferences.getValue("layerview/layer_view_type") == 1 + property bool show_gradient: UM.SimulationView.compatibilityMode ? false : UM.Preferences.getValue("layerview/layer_view_type") == 2 || UM.Preferences.getValue("layerview/layer_view_type") == 3 + property bool show_feedrate_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 2 + property bool show_thickness_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 3 + property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers") + property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") + + anchors + { + top: parent.top + left: parent.left + right: parent.right + margins: UM.Theme.getSize("default_margin").height + } + + spacing: UM.Theme.getSize("layerview_row_spacing").height + + Label + { + id: layerViewTypesLabel + text: catalog.i18nc("@label","Color scheme") + font: UM.Theme.getFont("default"); + visible: !UM.SimulationView.compatibilityMode + width: parent.width + color: UM.Theme.getColor("setting_control_text") + } + + ListModel // matches SimulationView.py + { + id: layerViewTypes + } + + Component.onCompleted: + { + layerViewTypes.append({ + text: catalog.i18nc("@label:listbox", "Material Color"), + type_id: 0 + }) + layerViewTypes.append({ + text: catalog.i18nc("@label:listbox", "Line Type"), + type_id: 1 + }) + layerViewTypes.append({ + text: catalog.i18nc("@label:listbox", "Feedrate"), + type_id: 2 + }) + layerViewTypes.append({ + text: catalog.i18nc("@label:listbox", "Layer thickness"), + type_id: 3 // these ids match the switching in the shader + }) + } + + ComboBox + { + id: layerTypeCombobox + width: parent.width + model: layerViewTypes + visible: !UM.SimulationView.compatibilityMode + style: UM.Theme.styles.combobox + + onActivated: { - id: layerViewTypes + UM.Preferences.setValue("layerview/layer_view_type", index); } Component.onCompleted: { - layerViewTypes.append({ - text: catalog.i18nc("@label:listbox", "Material Color"), - type_id: 0 - }) - layerViewTypes.append({ - text: catalog.i18nc("@label:listbox", "Line Type"), - type_id: 1 - }) - layerViewTypes.append({ - text: catalog.i18nc("@label:listbox", "Feedrate"), - type_id: 2 - }) - layerViewTypes.append({ - text: catalog.i18nc("@label:listbox", "Layer thickness"), - type_id: 3 // these ids match the switching in the shader - }) + currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type"); + updateLegends(currentIndex); } - ComboBox + function updateLegends(type_id) { - id: layerTypeCombobox - width: parent.width - model: layerViewTypes - visible: !UM.SimulationView.compatibilityMode - style: UM.Theme.styles.combobox + // Update the visibility of the legends. + viewSettings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1); + viewSettings.show_gradient = !UM.SimulationView.compatibilityMode && (type_id == 2 || type_id == 3); + viewSettings.show_feedrate_gradient = viewSettings.show_gradient && (type_id == 2); + viewSettings.show_thickness_gradient = viewSettings.show_gradient && (type_id == 3); + } + } - onActivated: + Label + { + id: compatibilityModeLabel + text: catalog.i18nc("@label","Compatibility Mode") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + visible: UM.SimulationView.compatibilityMode + height: UM.Theme.getSize("layerview_row").height + width: parent.width + } + + Item // Spacer + { + height: Math.round(UM.Theme.getSize("default_margin").width / 2) + width: width + } + + Repeater + { + model: Cura.ExtrudersModel{} + + CheckBox + { + id: extrudersModelCheckBox + checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == "" + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height + width: parent.width + visible: !UM.SimulationView.compatibilityMode + enabled: index < 4 + + onClicked: { - UM.Preferences.setValue("layerview/layer_view_type", index); + viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0 + UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|")); } + style: UM.Theme.styles.checkbox + + Rectangle + { + anchors.verticalCenter: parent.verticalCenter + anchors.right: extrudersModelCheckBox.right + width: UM.Theme.getSize("layerview_legend_size").width + height: UM.Theme.getSize("layerview_legend_size").height + color: model.color + radius: Math.round(width / 2) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + visible: !viewSettings.show_legend && !viewSettings.show_gradient + } + + Label + { + text: model.name + elide: Text.ElideRight + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + anchors + { + verticalCenter: parent.verticalCenter + left: extrudersModelCheckBox.left + right: extrudersModelCheckBox.right + leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) + rightMargin: UM.Theme.getSize("default_margin").width * 2 + } + + } + } + } + + Repeater + { + model: ListModel + { + id: typesLegendModel Component.onCompleted: { - currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type"); - updateLegends(currentIndex); - } - - function updateLegends(type_id) - { - // update visibility of legends - viewSettings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1); - viewSettings.show_gradient = !UM.SimulationView.compatibilityMode && (type_id == 2 || type_id == 3); - viewSettings.show_feedrate_gradient = viewSettings.show_gradient && (type_id == 2); - viewSettings.show_thickness_gradient = viewSettings.show_gradient && (type_id == 3); + typesLegendModel.append({ + label: catalog.i18nc("@label", "Show Travels"), + initialValue: viewSettings.show_travel_moves, + preference: "layerview/show_travel_moves", + colorId: "layerview_move_combing" + }); + typesLegendModel.append({ + label: catalog.i18nc("@label", "Show Helpers"), + initialValue: viewSettings.show_helpers, + preference: "layerview/show_helpers", + colorId: "layerview_support" + }); + typesLegendModel.append({ + label: catalog.i18nc("@label", "Show Shell"), + initialValue: viewSettings.show_skin, + preference: "layerview/show_skin", + colorId: "layerview_inset_0" + }); + typesLegendModel.append({ + label: catalog.i18nc("@label", "Show Infill"), + initialValue: viewSettings.show_infill, + preference: "layerview/show_infill", + colorId: "layerview_infill" + }); } } - Label + CheckBox { - id: compatibilityModeLabel - text: catalog.i18nc("@label","Compatibility Mode") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - visible: UM.SimulationView.compatibilityMode - height: UM.Theme.getSize("layerview_row").height + id: legendModelCheckBox + checked: model.initialValue + onClicked: UM.Preferences.setValue(model.preference, checked) + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height width: parent.width - } - Item - { - height: Math.round(UM.Theme.getSize("default_margin").width / 2) - width: width - } - - Connections - { - target: UM.Preferences - onPreferenceChanged: - { - layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type") - layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex) - viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|") - viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves") - viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers") - viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin") - viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill") - viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers") - viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count") - } - } - - Repeater - { - model: Cura.ExtrudersModel{} - CheckBox - { - id: extrudersModelCheckBox - checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == "" - onClicked: - { - viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0 - UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|")); - } - visible: !UM.SimulationView.compatibilityMode - enabled: index + 1 <= 4 - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - anchors.right: extrudersModelCheckBox.right - width: UM.Theme.getSize("layerview_legend_size").width - height: UM.Theme.getSize("layerview_legend_size").height - color: model.color - radius: Math.round(width / 2) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - visible: !viewSettings.show_legend & !viewSettings.show_gradient - } - height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - width: parent.width - - style: UM.Theme.styles.checkbox - Label - { - text: model.name - elide: Text.ElideRight - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - anchors.verticalCenter: parent.verticalCenter - anchors.left: extrudersModelCheckBox.left - anchors.right: extrudersModelCheckBox.right - anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) - anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 - } - } - } - - Repeater - { - model: ListModel - { - id: typesLegendModel - Component.onCompleted: - { - typesLegendModel.append({ - label: catalog.i18nc("@label", "Show Travels"), - initialValue: viewSettings.show_travel_moves, - preference: "layerview/show_travel_moves", - colorId: "layerview_move_combing" - }); - typesLegendModel.append({ - label: catalog.i18nc("@label", "Show Helpers"), - initialValue: viewSettings.show_helpers, - preference: "layerview/show_helpers", - colorId: "layerview_support" - }); - typesLegendModel.append({ - label: catalog.i18nc("@label", "Show Shell"), - initialValue: viewSettings.show_skin, - preference: "layerview/show_skin", - colorId: "layerview_inset_0" - }); - typesLegendModel.append({ - label: catalog.i18nc("@label", "Show Infill"), - initialValue: viewSettings.show_infill, - preference: "layerview/show_infill", - colorId: "layerview_infill" - }); - } - } - - CheckBox - { - id: legendModelCheckBox - checked: model.initialValue - onClicked: - { - UM.Preferences.setValue(model.preference, checked); - } - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - anchors.right: legendModelCheckBox.right - width: UM.Theme.getSize("layerview_legend_size").width - height: UM.Theme.getSize("layerview_legend_size").height - color: UM.Theme.getColor(model.colorId) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - visible: viewSettings.show_legend - } - height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - width: parent.width - style: UM.Theme.styles.checkbox - Label - { - text: label - font: UM.Theme.getFont("default") - elide: Text.ElideRight - color: UM.Theme.getColor("setting_control_text") - anchors.verticalCenter: parent.verticalCenter - anchors.left: legendModelCheckBox.left - anchors.right: legendModelCheckBox.right - anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) - anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 - } - } - } - - CheckBox - { - checked: viewSettings.only_show_top_layers - onClicked: - { - UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0) - } - text: catalog.i18nc("@label", "Only Show Top Layers") - visible: UM.SimulationView.compatibilityMode style: UM.Theme.styles.checkbox - } - CheckBox - { - checked: viewSettings.top_layer_count == 5 - onClicked: - { - UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) - } - text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") - visible: UM.SimulationView.compatibilityMode - style: UM.Theme.styles.checkbox - } - Repeater - { - model: ListModel + Rectangle { - id: typesLegendModelNoCheck - Component.onCompleted: - { - typesLegendModelNoCheck.append({ - label: catalog.i18nc("@label", "Top / Bottom"), - colorId: "layerview_skin", - }); - typesLegendModelNoCheck.append({ - label: catalog.i18nc("@label", "Inner Wall"), - colorId: "layerview_inset_x", - }); - } + anchors.verticalCenter: parent.verticalCenter + anchors.right: legendModelCheckBox.right + width: UM.Theme.getSize("layerview_legend_size").width + height: UM.Theme.getSize("layerview_legend_size").height + color: UM.Theme.getColor(model.colorId) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + visible: viewSettings.show_legend } Label { text: label - visible: viewSettings.show_legend - id: typesLegendModelLabel - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - anchors.right: typesLegendModelLabel.right - width: UM.Theme.getSize("layerview_legend_size").width - height: UM.Theme.getSize("layerview_legend_size").height - color: UM.Theme.getColor(model.colorId) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - visible: viewSettings.show_legend - } - height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height - width: parent.width - color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") + elide: Text.ElideRight + color: UM.Theme.getColor("setting_control_text") + anchors.verticalCenter: parent.verticalCenter + anchors.left: legendModelCheckBox.left + anchors.right: legendModelCheckBox.right + anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) + anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 + } + } + } + + CheckBox + { + checked: viewSettings.only_show_top_layers + onClicked: UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0) + text: catalog.i18nc("@label", "Only Show Top Layers") + visible: UM.SimulationView.compatibilityMode + style: UM.Theme.styles.checkbox + } + + CheckBox + { + checked: viewSettings.top_layer_count == 5 + onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) + text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") + visible: UM.SimulationView.compatibilityMode + style: UM.Theme.styles.checkbox + } + + Repeater + { + model: ListModel + { + id: typesLegendModelNoCheck + Component.onCompleted: + { + typesLegendModelNoCheck.append({ + label: catalog.i18nc("@label", "Top / Bottom"), + colorId: "layerview_skin", + }); + typesLegendModelNoCheck.append({ + label: catalog.i18nc("@label", "Inner Wall"), + colorId: "layerview_inset_x", + }); } } - // Text for the minimum, maximum and units for the feedrates and layer thickness - Item + Label { - id: gradientLegend - visible: viewSettings.show_gradient + text: label + visible: viewSettings.show_legend + id: typesLegendModelLabel + + height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height width: parent.width - height: UM.Theme.getSize("layerview_row").height + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") - Label + Rectangle { - text: minText() - anchors.left: parent.left - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") + anchors.verticalCenter: parent.verticalCenter + anchors.right: typesLegendModelLabel.right - function minText() - { - if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) - { - // Feedrate selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 2) - { - return parseFloat(UM.SimulationView.getMinFeedrate()).toFixed(2) - } - // Layer thickness selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 3) - { - return parseFloat(UM.SimulationView.getMinThickness()).toFixed(2) - } - } - return catalog.i18nc("@label","min") - } - } + width: UM.Theme.getSize("layerview_legend_size").width + height: UM.Theme.getSize("layerview_legend_size").height - Label - { - text: unitsText() - anchors.horizontalCenter: parent.horizontalCenter - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") + color: UM.Theme.getColor(model.colorId) - function unitsText() - { - if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) - { - // Feedrate selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 2) - { - return "mm/s" - } - // Layer thickness selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 3) - { - return "mm" - } - } - return "" - } - } - - Label - { - text: maxText() - anchors.right: parent.right - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - - function maxText() - { - if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) - { - // Feedrate selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 2) - { - return parseFloat(UM.SimulationView.getMaxFeedrate()).toFixed(2) - } - // Layer thickness selected - if (UM.Preferences.getValue("layerview/layer_view_type") == 3) - { - return parseFloat(UM.SimulationView.getMaxThickness()).toFixed(2) - } - } - return catalog.i18nc("@label","max") - } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") } } + } - // Gradient colors for feedrate - Rectangle - { // In QML 5.9 can be changed by LinearGradient - // Invert values because then the bar is rotated 90 degrees - id: feedrateGradient - visible: viewSettings.show_feedrate_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} - gradient: Gradient - { - GradientStop - { - position: 0.000 - color: Qt.rgba(1, 0.5, 0, 1) - } - GradientStop - { - position: 0.625 - color: Qt.rgba(0.375, 0.5, 0, 1) - } - GradientStop - { - position: 0.75 - color: Qt.rgba(0.25, 1, 0, 1) - } - GradientStop - { - position: 1.0 - color: Qt.rgba(0, 0, 1, 1) - } - } - } + // Text for the minimum, maximum and units for the feedrates and layer thickness + Item + { + id: gradientLegend + visible: viewSettings.show_gradient + width: parent.width + height: UM.Theme.getSize("layerview_row").height - // Gradient colors for layer thickness (similar to parula colormap) - Rectangle // In QML 5.9 can be changed by LinearGradient + Label { - // Invert values because then the bar is rotated 90 degrees - id: thicknessGradient - visible: viewSettings.show_thickness_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} - gradient: Gradient + text: { - GradientStop + if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) { - position: 0.000 - color: Qt.rgba(1, 1, 0, 1) + // Feedrate selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 2) + { + return parseFloat(UM.SimulationView.getMinFeedrate()).toFixed(2) + } + // Layer thickness selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 3) + { + return parseFloat(UM.SimulationView.getMinThickness()).toFixed(2) + } } - GradientStop + return catalog.i18nc("@label","min") + } + anchors.left: parent.left + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + } + + Label + { + text: { + if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) { - position: 0.25 - color: Qt.rgba(1, 0.75, 0.25, 1) + // Feedrate selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 2) + { + return "mm/s" + } + // Layer thickness selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 3) + { + return "mm" + } } - GradientStop + return "" + } + + anchors.horizontalCenter: parent.horizontalCenter + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + } + + Label + { + text: { + if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) { - position: 0.5 - color: Qt.rgba(0, 0.75, 0.5, 1) - } - GradientStop - { - position: 0.75 - color: Qt.rgba(0, 0.375, 0.75, 1) - } - GradientStop - { - position: 1.0 - color: Qt.rgba(0, 0, 0.5, 1) + // Feedrate selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 2) + { + return parseFloat(UM.SimulationView.getMaxFeedrate()).toFixed(2) + } + // Layer thickness selected + if (UM.Preferences.getValue("layerview/layer_view_type") == 3) + { + return parseFloat(UM.SimulationView.getMaxThickness()).toFixed(2) + } } + return catalog.i18nc("@label","max") + } + + anchors.right: parent.right + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + } + } + + // Gradient colors for feedrate + Rectangle + { // In QML 5.9 can be changed by LinearGradient + // Invert values because then the bar is rotated 90 degrees + id: feedrateGradient + visible: viewSettings.show_feedrate_gradient + anchors.left: parent.right + height: parent.width + width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} + gradient: Gradient + { + GradientStop + { + position: 0.000 + color: Qt.rgba(1, 0.5, 0, 1) + } + GradientStop + { + position: 0.625 + color: Qt.rgba(0.375, 0.5, 0, 1) + } + GradientStop + { + position: 0.75 + color: Qt.rgba(0.25, 1, 0, 1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0, 0, 1, 1) + } + } + } + + // Gradient colors for layer thickness (similar to parula colormap) + Rectangle // In QML 5.9 can be changed by LinearGradient + { + // Invert values because then the bar is rotated 90 degrees + id: thicknessGradient + visible: viewSettings.show_thickness_gradient + anchors.left: parent.right + height: parent.width + width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + + transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} + gradient: Gradient + { + GradientStop + { + position: 0.000 + color: Qt.rgba(1, 1, 0, 1) + } + GradientStop + { + position: 0.25 + color: Qt.rgba(1, 0.75, 0.25, 1) + } + GradientStop + { + position: 0.5 + color: Qt.rgba(0, 0.75, 0.5, 1) + } + GradientStop + { + position: 0.75 + color: Qt.rgba(0, 0.375, 0.75, 1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0, 0, 0.5, 1) } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e8de7c98ac..f1e0c08874 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -452,8 +452,6 @@ "layerview_menu_size": [15, 20], "layerview_menu_size_material_color_mode": [15, 16], "layerview_menu_size_collapsed": [15, 6], - "layerview_menu_size_compatibility": [22, 22.0], - "layerview_menu_size_compatibility_collapsed": [15, 3.5], "layerview_legend_size": [1.0, 1.0], "layerview_row": [11.0, 1.5], "layerview_row_spacing": [0.0, 0.5], From 319d52a2f9d6013a9261da8d0ec2aab61165a54f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 5 Nov 2018 16:59:06 +0100 Subject: [PATCH 113/558] Make collapsible simulation view collapse to right height CURA-5829 --- .../SimulationViewMenuComponent.qml | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 62f353a241..cb70d1d78e 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -19,21 +19,7 @@ Rectangle width: UM.Theme.getSize("layerview_menu_size").width - height: - { - if (viewSettings.collapsed) - { - return UM.Theme.getSize("layerview_menu_size_collapsed").height - } - else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) - { - return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height) - } - else - { - return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height) - } - } + height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height Behavior on height { NumberAnimation { duration: 100 } } @@ -64,6 +50,23 @@ Rectangle } } + Label + { + id: layerViewTypesLabel + text: catalog.i18nc("@label","Color scheme") + font: UM.Theme.getFont("default"); + visible: !UM.SimulationView.compatibilityMode + color: UM.Theme.getColor("setting_control_text") + height: contentHeight + anchors + { + top: parent.top + margins: UM.Theme.getSize("default_margin").height + right: collapseButton.left + left: parent.left + } + } + Button { id: collapseButton @@ -71,9 +74,8 @@ Rectangle anchors { top: parent.top - topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2) + margins: UM.Theme.getSize("default_margin").width right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width } width: UM.Theme.getSize("standard_arrow").width @@ -117,23 +119,16 @@ Rectangle anchors { - top: parent.top + top: layerViewTypesLabel.bottom left: parent.left right: parent.right margins: UM.Theme.getSize("default_margin").height + } spacing: UM.Theme.getSize("layerview_row_spacing").height - Label - { - id: layerViewTypesLabel - text: catalog.i18nc("@label","Color scheme") - font: UM.Theme.getFont("default"); - visible: !UM.SimulationView.compatibilityMode - width: parent.width - color: UM.Theme.getColor("setting_control_text") - } + visible: !collapsed ListModel // matches SimulationView.py { From 9f246910bc0e7334553490e8bacf0a7415cd487d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 6 Nov 2018 09:18:20 +0100 Subject: [PATCH 114/558] Make avatar image border a bit wider This prevents a white edge from showing CURA-5772 --- resources/qml/Account/AvatarImage.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index c730ef428f..436babe5a3 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -44,7 +44,10 @@ Item UM.RecolorImage { id: profileImageOutline - anchors.fill: parent + anchors.centerIn: parent + // Make it a bit bigger than it has to, otherwise it sometimes shows a white border. + width: parent.width + 2 + height: parent.height + 2 source: UM.Theme.getIcon("circle_outline") sourceSize: Qt.size(parent.width, parent.height) color: UM.Theme.getColor("account_widget_ouline_active") From 08917c37a11c8b089948c8eeffaaa2a4c780549b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 6 Nov 2018 09:20:36 +0100 Subject: [PATCH 115/558] Improve rendering of scaled avatar image CURA-5772 --- resources/qml/Account/AvatarImage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 436babe5a3..3be81aa155 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -24,6 +24,7 @@ Item source: UM.Theme.getImage("avatar_default") fillMode: Image.PreserveAspectCrop visible: false + mipmap: true } Rectangle From f1f1b9f168e30ddcc15fd890362e6ed86f2e5699 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 6 Nov 2018 09:45:40 +0100 Subject: [PATCH 116/558] Center icon an label vertically. Contributes to CURA-5786. --- resources/qml/IconLabel.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 2e765e2dbc..918485751e 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -24,6 +24,7 @@ Item id: icon anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter source: UM.Theme.getIcon("dot") width: UM.Theme.getSize("section_icon").width @@ -40,6 +41,7 @@ Item id: label anchors.left: icon.right anchors.leftMargin: UM.Theme.getSize("thin_margin").width + anchors.verticalCenter: parent.verticalCenter text: "Empty label" color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") From 317447aa5451ac0d4220dead40bba89b61587bbf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 6 Nov 2018 09:52:01 +0100 Subject: [PATCH 117/558] Fix multi-buildplate panel location CURA-5772 --- resources/qml/Account/AvatarImage.qml | 2 +- resources/qml/Cura.qml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/qml/Account/AvatarImage.qml b/resources/qml/Account/AvatarImage.qml index 3be81aa155..b76aff6990 100644 --- a/resources/qml/Account/AvatarImage.qml +++ b/resources/qml/Account/AvatarImage.qml @@ -24,7 +24,7 @@ Item source: UM.Theme.getImage("avatar_default") fillMode: Image.PreserveAspectCrop visible: false - mipmap: true + mipmap: true } Rectangle diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3e2515cb3e..534fffb418 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -212,8 +212,9 @@ UM.MainWindow visible: UM.Preferences.getValue("cura/use_multi_build_plate") anchors { - bottom: parent.bottom - left: parent.left + bottom: viewOrientationControls.top + left: toolbar.right + margins: UM.Theme.getSize("default_margin").width } } From 11a3da3068bf71ac3d514af893db4b4870c8b3f8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 6 Nov 2018 11:06:20 +0100 Subject: [PATCH 118/558] Removed color animation from stage buttons This caused laggy updates and it didn't add that much anyway CURA-5772 --- resources/qml/ActionButton.qml | 2 -- resources/themes/cura-light/styles.qml | 2 -- 2 files changed, 4 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index a1c03af143..621318c4bb 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -37,7 +37,6 @@ Button color: button.hovered ? button.textHoverColor : button.textColor visible: source != "" anchors.verticalCenter: parent.verticalCenter - Behavior on color { ColorAnimation { duration: 50 } } } Label @@ -59,7 +58,6 @@ Button radius: UM.Theme.getSize("action_button_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor - Behavior on color { ColorAnimation { duration: 50 } } } MouseArea diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 43e8d29b57..dacff1b42b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -129,8 +129,6 @@ QtObject return UM.Theme.getColor("main_window_header_button_background_inactive") } } - - Behavior on color { ColorAnimation { duration: 50 } } } } From f41ae128c2c14fb05dc84058b8f5833a396805bb Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 6 Nov 2018 11:24:41 +0100 Subject: [PATCH 119/558] Modify alignments to avoid binding loop logs. Contributes to CURA-5786. --- resources/qml/IconLabel.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 918485751e..7c90382892 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -24,7 +24,6 @@ Item id: icon anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter source: UM.Theme.getIcon("dot") width: UM.Theme.getSize("section_icon").width @@ -41,7 +40,7 @@ Item id: label anchors.left: icon.right anchors.leftMargin: UM.Theme.getSize("thin_margin").width - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: icon.verticalCenter text: "Empty label" color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") From b6b60702c054ff93c112089583c721a6ddedd44a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 6 Nov 2018 14:32:48 +0100 Subject: [PATCH 120/558] Make the action panel to have a fixed width. Remove the animations when switching states. Contributes to CURA-5786. --- resources/qml/ActionPanel/ActionPanelWidget.qml | 7 +++---- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 -- resources/themes/cura-light/theme.json | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/qml/ActionPanel/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml index 1fc288af6a..0db778de5a 100644 --- a/resources/qml/ActionPanel/ActionPanelWidget.qml +++ b/resources/qml/ActionPanel/ActionPanelWidget.qml @@ -16,7 +16,7 @@ Rectangle { id: actionPanelWidget - width: childrenRect.width + 2 * UM.Theme.getSize("thick_margin").width + width: UM.Theme.getSize("action_panel_widget").width height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height color: UM.Theme.getColor("main_background") @@ -36,13 +36,12 @@ Rectangle topMargin: UM.Theme.getSize("thick_margin").height left: parent.left leftMargin: UM.Theme.getSize("thick_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("thick_margin").width } sourceComponent: outputAvailable ? outputProcessWidget : sliceProcessWidget } - Behavior on height { NumberAnimation { duration: 100 } } - Behavior on width { NumberAnimation { duration: 100 } } - Component { id: sliceProcessWidget diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index e70ec45e43..1ba5776b6b 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -17,8 +17,6 @@ Column { id: widget - width: UM.Theme.getSize("action_panel_button").width - spacing: UM.Theme.getSize("thin_margin").height UM.I18nCatalog diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f354b521ee..27dfbaf807 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -379,6 +379,7 @@ "configuration_selector_widget": [35.0, 4.5], "configuration_selector_mode_tabs": [0.0, 3.0], + "action_panel_widget": [25.0, 0.0], "action_panel_information_widget": [20.0, 0.0], "action_panel_button": [15.0, 3.0], From 5dddcbd6664b38f091ce0565c01a5a6ece1cc35f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 6 Nov 2018 15:14:27 +0100 Subject: [PATCH 121/558] Add a new property to the ActionButton to indicate whether the button has a fixed width or the width will be dependant on the content. Contributes to CURA-5786. --- resources/qml/Account/GeneralOperations.qml | 2 ++ resources/qml/Account/UserOperations.qml | 2 ++ resources/qml/ActionButton.qml | 7 +++++++ resources/qml/ActionPanel/OutputDevicesActionButton.qml | 1 + resources/qml/ActionPanel/SliceProcessWidget.qml | 1 + 5 files changed, 13 insertions(+) diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 6bc94dd830..362e088033 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -21,6 +21,7 @@ Row textColor: UM.Theme.getColor("main_window_header_button_text_active") textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + fixedWidthMode: true } Cura.ActionButton @@ -29,5 +30,6 @@ Row height: UM.Theme.getSize("account_button").height text: catalog.i18nc("@button", "Login") onClicked: Cura.API.account.login() + fixedWidthMode: true } } \ No newline at end of file diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index a12bfbf6d7..c167813425 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -21,6 +21,7 @@ Row textColor: UM.Theme.getColor("main_window_header_button_text_active") textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + fixedWidthMode: true } Cura.ActionButton @@ -29,5 +30,6 @@ Row height: UM.Theme.getSize("account_button").height text: catalog.i18nc("@button", "Logout") onClicked: Cura.API.account.logout() + fixedWidthMode: true } } \ No newline at end of file diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 05e75ac8c5..b35ad4ba87 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -24,6 +24,10 @@ Button property var outlineColor: color property var outlineHoverColor: hoverColor property var outlineDisabledColor: outlineColor + // This property is used to indicate whether the button has a fixed width or the width would depend on the contents + // Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case, + // we elide the text to the right so the text will be cut off with the three dots at the end. + property var fixedWidthMode: false contentItem: Row { @@ -50,6 +54,9 @@ Button visible: text != "" renderType: Text.NativeRendering anchors.verticalCenter: parent.verticalCenter + width: fixedWidthMode ? button.width - button.leftPadding - button.rightPadding : undefined + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight } } diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 87faa0a2bf..be79a1893e 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -16,6 +16,7 @@ Item { id: saveToButton height: parent.height + fixedWidthMode: true anchors { diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 1ba5776b6b..2d4a7b6b89 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -86,6 +86,7 @@ Column id: prepareButton width: parent.width height: UM.Theme.getSize("action_panel_button").height + fixedWidthMode: true text: { if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) From f15d03d48c84855ca30ec60017e9f00837b686f3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 7 Nov 2018 16:30:52 +0100 Subject: [PATCH 122/558] Fix foldout of the layerview panel being too short or too long CURA-5829 --- .../SimulationViewMenuComponent.qml | 152 +++++++++--------- 1 file changed, 80 insertions(+), 72 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index cb70d1d78e..1cbaffa65e 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -19,7 +19,7 @@ Rectangle width: UM.Theme.getSize("layerview_menu_size").width - height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height + height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height + 2 * UM.Theme.getSize("default_margin").height Behavior on height { NumberAnimation { duration: 100 } } @@ -469,83 +469,91 @@ Rectangle } } - // Gradient colors for feedrate - Rectangle - { // In QML 5.9 can be changed by LinearGradient - // Invert values because then the bar is rotated 90 degrees - id: feedrateGradient - visible: viewSettings.show_feedrate_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} - gradient: Gradient - { - GradientStop + Item + { + // Another hack on top of the rotation of the gradient. + // Since we set the side of the panel to use childrenRect (and that uses the un-rotated height), add this + // wrapper item with the correct width & height so it doesn't get confused. + width: parent.width + height: feedrateGradient.visible || thicknessGradient.visible ? Math.round(UM.Theme.getSize("layerview_row").height * 1.5) : 0 + // Gradient colors for feedrate + Rectangle + { // In QML 5.9 can be changed by LinearGradient + // Invert values because then the bar is rotated 90 degrees + id: feedrateGradient + visible: viewSettings.show_feedrate_gradient + anchors.left: parent.right + height: parent.width + width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} + gradient: Gradient { - position: 0.000 - color: Qt.rgba(1, 0.5, 0, 1) - } - GradientStop - { - position: 0.625 - color: Qt.rgba(0.375, 0.5, 0, 1) - } - GradientStop - { - position: 0.75 - color: Qt.rgba(0.25, 1, 0, 1) - } - GradientStop - { - position: 1.0 - color: Qt.rgba(0, 0, 1, 1) + GradientStop + { + position: 0.000 + color: Qt.rgba(1, 0.5, 0, 1) + } + GradientStop + { + position: 0.625 + color: Qt.rgba(0.375, 0.5, 0, 1) + } + GradientStop + { + position: 0.75 + color: Qt.rgba(0.25, 1, 0, 1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0, 0, 1, 1) + } } } - } - // Gradient colors for layer thickness (similar to parula colormap) - Rectangle // In QML 5.9 can be changed by LinearGradient - { - // Invert values because then the bar is rotated 90 degrees - id: thicknessGradient - visible: viewSettings.show_thickness_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} - gradient: Gradient + // Gradient colors for layer thickness (similar to parula colormap) + Rectangle // In QML 5.9 can be changed by LinearGradient { - GradientStop + // Invert values because then the bar is rotated 90 degrees + id: thicknessGradient + visible: viewSettings.show_thickness_gradient + anchors.left: parent.right + height: parent.width + width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + + transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} + gradient: Gradient { - position: 0.000 - color: Qt.rgba(1, 1, 0, 1) - } - GradientStop - { - position: 0.25 - color: Qt.rgba(1, 0.75, 0.25, 1) - } - GradientStop - { - position: 0.5 - color: Qt.rgba(0, 0.75, 0.5, 1) - } - GradientStop - { - position: 0.75 - color: Qt.rgba(0, 0.375, 0.75, 1) - } - GradientStop - { - position: 1.0 - color: Qt.rgba(0, 0, 0.5, 1) + GradientStop + { + position: 0.000 + color: Qt.rgba(1, 1, 0, 1) + } + GradientStop + { + position: 0.25 + color: Qt.rgba(1, 0.75, 0.25, 1) + } + GradientStop + { + position: 0.5 + color: Qt.rgba(0, 0.75, 0.5, 1) + } + GradientStop + { + position: 0.75 + color: Qt.rgba(0, 0.375, 0.75, 1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0, 0, 0.5, 1) + } } } } From 9f663cfd18b13f8504bf3d753166fe1f9a9b653c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 7 Nov 2018 17:25:43 +0100 Subject: [PATCH 123/558] Change the gradient for the LinearGradient that works in the new versions of Qt. I also changed it because we had a TODO here and I thought it was the right moment to do it. Contributes to CURA-5829. --- .../SimulationViewMenuComponent.qml | 139 ++++++++++-------- 1 file changed, 80 insertions(+), 59 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 1cbaffa65e..d251244c9f 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -5,6 +5,7 @@ import QtQuick 2.4 import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.1 +import QtGraphicalEffects 1.0 import UM 1.0 as UM import Cura 1.0 as Cura @@ -469,75 +470,95 @@ Rectangle } } - Item + // Gradient colors for feedrate + Rectangle { - // Another hack on top of the rotation of the gradient. - // Since we set the side of the panel to use childrenRect (and that uses the un-rotated height), add this - // wrapper item with the correct width & height so it doesn't get confused. - width: parent.width - height: feedrateGradient.visible || thicknessGradient.visible ? Math.round(UM.Theme.getSize("layerview_row").height * 1.5) : 0 - // Gradient colors for feedrate - Rectangle - { // In QML 5.9 can be changed by LinearGradient - // Invert values because then the bar is rotated 90 degrees - id: feedrateGradient - visible: viewSettings.show_feedrate_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} - gradient: Gradient - { - GradientStop - { - position: 0.000 - color: Qt.rgba(1, 0.5, 0, 1) - } - GradientStop - { - position: 0.625 - color: Qt.rgba(0.375, 0.5, 0, 1) - } - GradientStop - { - position: 0.75 - color: Qt.rgba(0.25, 1, 0, 1) - } - GradientStop - { - position: 1.0 - color: Qt.rgba(0, 0, 1, 1) - } - } - } + id: feedrateGradient + visible: viewSettings.show_feedrate_gradient + anchors.left: parent.left + anchors.right: parent.right + height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") - // Gradient colors for layer thickness (similar to parula colormap) - Rectangle // In QML 5.9 can be changed by LinearGradient + LinearGradient { - // Invert values because then the bar is rotated 90 degrees - id: thicknessGradient - visible: viewSettings.show_thickness_gradient - anchors.left: parent.right - height: parent.width - width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - - transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_lining").width + right: parent.right + rightMargin: UM.Theme.getSize("default_lining").width + top: parent.top + topMargin: UM.Theme.getSize("default_lining").width + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_lining").width + } + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) gradient: Gradient { GradientStop { position: 0.000 - color: Qt.rgba(1, 1, 0, 1) + color: Qt.rgba(0, 0, 1, 1) } GradientStop { position: 0.25 - color: Qt.rgba(1, 0.75, 0.25, 1) + color: Qt.rgba(0.25, 1, 0, 1) + } + GradientStop + { + position: 0.375 + color: Qt.rgba(0.375, 0.5, 0, 1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(1, 0.5, 0, 1) + } + } + } + } + + // Gradient colors for layer thickness (similar to parula colormap) + Rectangle + { + id: thicknessGradient + visible: viewSettings.show_thickness_gradient + anchors.left: parent.left + anchors.right: parent.right + height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + + LinearGradient + { + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_lining").width + right: parent.right + rightMargin: UM.Theme.getSize("default_lining").width + top: parent.top + topMargin: UM.Theme.getSize("default_lining").width + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_lining").width + } + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) + gradient: Gradient + { + GradientStop + { + position: 0.000 + color: Qt.rgba(0, 0, 0.5, 1) + } + GradientStop + { + position: 0.25 + color: Qt.rgba(0, 0.375, 0.75, 1) } GradientStop { @@ -547,12 +568,12 @@ Rectangle GradientStop { position: 0.75 - color: Qt.rgba(0, 0.375, 0.75, 1) + color: Qt.rgba(1, 0.75, 0.25, 1) } GradientStop { position: 1.0 - color: Qt.rgba(0, 0, 0.5, 1) + color: Qt.rgba(1, 1, 0, 1) } } } From e66dd2be0b417646fa015dba7133a21b6d5a48e4 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 8 Nov 2018 15:03:24 +0100 Subject: [PATCH 124/558] Action-Panel (CURA-5786) can now know about Preview-Stage (CURA-5829). --- resources/qml/ActionPanel/OutputProcessWidget.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index db9a23cdf3..0ea956d1dc 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -110,7 +110,7 @@ Column hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - onClicked: UM.Controller.setActiveStage("MonitorStage") + onClicked: UM.Controller.setActiveStage("PreviewStage") } Cura.OutputDevicesActionButton From 88234f7e21620d2e045aefa6bbc9247da941e0c7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 9 Nov 2018 10:48:22 +0100 Subject: [PATCH 125/558] Change ExtruderIcon to match the new design CURA-5785 --- resources/qml/CustomConfigurationSelector.qml | 4 +- resources/qml/ExtruderIcon.qml | 46 ++++++------ .../cura-light/icons/extruder_button.svg | 73 +++---------------- 3 files changed, 33 insertions(+), 90 deletions(-) diff --git a/resources/qml/CustomConfigurationSelector.qml b/resources/qml/CustomConfigurationSelector.qml index 17b652e8d8..c78ca700da 100644 --- a/resources/qml/CustomConfigurationSelector.qml +++ b/resources/qml/CustomConfigurationSelector.qml @@ -195,8 +195,8 @@ Rectangle height: width checked: control.checked - material_color: model.color - text_color: extruderStaticText.color + materialColor: model.color + textColor: extruderStaticText.color } } } diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index e4161e0058..eb4bdef0f7 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -13,46 +13,44 @@ Item implicitHeight: implicitWidth property bool checked: true - property alias material_color: materialColorCircle.color - property alias text_color: extruderNumberText.color + property alias materialColor: mainIcon.color + property alias textColor: extruderNumberText.color UM.RecolorImage { - id: mainCircle + id: mainIcon anchors.fill: parent sourceSize.width: parent.width sourceSize.height: parent.width source: UM.Theme.getIcon("extruder_button") - color: extruderNumberText.color } - Label - { - id: extruderNumberText - anchors.centerIn: parent - text: index + 1; - font: UM.Theme.getFont("default_bold") - } - - // Material colour circle - // Only draw the filling colour of the material inside the SVG border. Rectangle { - id: materialColorCircle + id: extruderNumberCircle + + width: height + height: parent.height / 2 + radius: Math.round(width / 2) + color: "white" anchors { - right: parent.right + horizontalCenter: parent.horizontalCenter + top: parent.top + // The circle needs to be slightly off center (so it sits in the middle of the square bit of the icon) + topMargin: (parent.height - height) / 2 - 0.1 * parent.height } - width: Math.round(parent.width * 0.35) - height: Math.round(parent.height * 0.35) - radius: Math.round(width / 2) - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("extruder_button_material_border") - - opacity: !extruderIconItem.checked ? 0.6 : 1.0 + Label + { + id: extruderNumberText + anchors.centerIn: parent + text: index + 1 + font: UM.Theme.getFont("default") + width: contentWidth + height: contentHeight + } } } \ No newline at end of file diff --git a/resources/themes/cura-light/icons/extruder_button.svg b/resources/themes/cura-light/icons/extruder_button.svg index e3c01b6a0a..c79ba5c5df 100644 --- a/resources/themes/cura-light/icons/extruder_button.svg +++ b/resources/themes/cura-light/icons/extruder_button.svg @@ -1,64 +1,9 @@ - - - - - - image/svg+xml - - Artboard 3 Copy - - - - - - Artboard 3 Copy - Created with Sketch. - - - + + + + + + + + + \ No newline at end of file From 2adb79aa39a2944ddba9397512d0c51e9d048bb5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 9 Nov 2018 13:45:51 +0100 Subject: [PATCH 126/558] Added re-usable expandable component CURA-5785 --- resources/qml/ExpandableComponent.qml | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 resources/qml/ExpandableComponent.qml diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml new file mode 100644 index 0000000000..0b728ccaff --- /dev/null +++ b/resources/qml/ExpandableComponent.qml @@ -0,0 +1,77 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.3 + +// The expandable component has 3 major sub components: +// * The headerItem; Always visible and should hold some info about what happens if the component is expanded +// * The popupItem; The content that needs to be shown if the component is expanded. +// * The Button; The actual button that expands the popup. +Item +{ + // The headerItem holds the QML item that is always displayed. + property alias headerItem: headerItemLoader.sourceComponent + + // The popupItem holds the QML item that is shown when the "open" button is pressed + property var popupItem + + // The background color of the popup + property color popupBackgroundColor: "white" + + // How much spacing is needed around the popupItem + property alias padding: popup.padding + + onPopupItemChanged: + { + // Since we want the size of the popup to be set by the size of the content, + // we need to do it like this. + popup.width = popupItem.width + 2 * popup.padding + popup.height = popupItem.height + 2 * popup.padding + popup.contentItem = popupItem + } + + implicitHeight: 100 + implicitWidth: 400 + + Loader + { + id: headerItemLoader + anchors + { + left: parent.left + right: collapseButton.left + top: parent.top + bottom: parent.bottom + } + } + + Button + { + id: collapseButton + anchors + { + right: parent.right + top: parent.top + bottom: parent.bottom + } + text: popup.visible ? "close" : "open" + onClicked: popup.visible ? popup.close() : popup.open() + } + + Popup + { + id: popup + + // Ensure that the popup is located directly below the headerItem + y: headerItemLoader.height + + // Make the popup right aligned with the rest. + x: -width + collapseButton.width + headerItemLoader.width + + closePolicy: Popup.CloseOnPressOutsideParent + + background: Rectangle + { + id: background + color: popupBackgroundColor + } + } +} From 1d775c984e4ebf426bc563adcc639b3d643410bf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 9 Nov 2018 14:31:06 +0100 Subject: [PATCH 127/558] Added background padding to expandable component CURA-5785 --- resources/qml/ExpandableComponent.qml | 66 +++++++++++++++++---------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0b728ccaff..26bdf3b3ce 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -1,6 +1,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 +import UM 1.2 as UM + // The expandable component has 3 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded // * The popupItem; The content that needs to be shown if the component is expanded. @@ -16,8 +18,13 @@ Item // The background color of the popup property color popupBackgroundColor: "white" + property alias headerBackgroundColor: background.color + // How much spacing is needed around the popupItem - property alias padding: popup.padding + property alias popupPadding: popup.padding + + // How much padding is needed around the header & button + property alias headerPadding: background.padding onPopupItemChanged: { @@ -30,30 +37,39 @@ Item implicitHeight: 100 implicitWidth: 400 - - Loader + Rectangle { - id: headerItemLoader - anchors - { - left: parent.left - right: collapseButton.left - top: parent.top - bottom: parent.bottom - } - } + id: background + property real padding: UM.Theme.getSize("default_margin").width - Button - { - id: collapseButton - anchors + color: "white" + anchors.fill: parent + Loader { - right: parent.right - top: parent.top - bottom: parent.bottom + id: headerItemLoader + anchors + { + left: parent.left + right: collapseButton.left + top: parent.top + bottom: parent.bottom + margins: background.padding + } + } + + Button + { + id: collapseButton + anchors + { + right: parent.right + top: parent.top + bottom: parent.bottom + margins: background.padding + } + text: popup.visible ? "close" : "open" + onClicked: popup.visible ? popup.close() : popup.open() } - text: popup.visible ? "close" : "open" - onClicked: popup.visible ? popup.close() : popup.open() } Popup @@ -61,16 +77,16 @@ Item id: popup // Ensure that the popup is located directly below the headerItem - y: headerItemLoader.height + y: headerItemLoader.height + 2 * background.padding - // Make the popup right aligned with the rest. - x: -width + collapseButton.width + headerItemLoader.width + // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between + //the button & text. + x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding closePolicy: Popup.CloseOnPressOutsideParent background: Rectangle { - id: background color: popupBackgroundColor } } From 2c7bdba7d009d8dfbcebb99a7e9b0b85172432f6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 9 Nov 2018 15:20:26 +0100 Subject: [PATCH 128/558] Update ConfigurationSelector header to that it looks more like the new design CURA-5785 --- cura/Settings/ExtrudersModel.py | 11 ++- plugins/PrepareStage/PrepareMenu.qml | 10 ++- .../QuickConfigurationSelector.qml | 79 ++++++++++++++++++- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 52fc502bfc..9b85afa10e 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -47,6 +47,9 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): VariantRole = Qt.UserRole + 7 StackRole = Qt.UserRole + 8 + MaterialBrandRole = Qt.UserRole + 9 + ColorNameRole = Qt.UserRole + 10 + ## List of colours to display if there is no material or the material has no known # colour. defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"] @@ -67,7 +70,8 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): self.addRoleName(self.MaterialRole, "material") self.addRoleName(self.VariantRole, "variant") self.addRoleName(self.StackRole, "stack") - + self.addRoleName(self.MaterialBrandRole, "material_brand") + self.addRoleName(self.ColorNameRole, "color_name") self._update_extruder_timer = QTimer() self._update_extruder_timer.setInterval(100) self._update_extruder_timer.setSingleShot(True) @@ -183,7 +187,8 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): default_color = self.defaultColors[position] if 0 <= position < len(self.defaultColors) else self.defaultColors[0] color = extruder.material.getMetaDataEntry("color_code", default = default_color) if extruder.material else default_color - + material_brand = extruder.material.getMetaDataEntry("brand", default = "generic") + color_name = extruder.material.getMetaDataEntry("color_name") # construct an item with only the relevant information item = { "id": extruder.getId(), @@ -195,6 +200,8 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): "material": extruder.material.getName() if extruder.material else "", "variant": extruder.variant.getName() if extruder.variant else "", # e.g. print core "stack": extruder, + "material_brand": material_brand, + "color_name": color_name } items.append(item) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index e8514a9ef9..bcc8ec4c0a 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -50,16 +50,18 @@ Item Cura.QuickConfigurationSelector { - id: configSelection + height: prepareMenu.height + width: UM.Theme.getSize("configuration_selector_widget").width + /*id: configSelection width: visible ? UM.Theme.getSize("machine_selector_widget").width * 0.2 : 0 panelWidth: UM.Theme.getSize("machine_selector_widget").width - height: prepareMenu.height + height: prepareMenu.height*/ } - Cura.CustomConfigurationSelector + /*Cura.CustomConfigurationSelector { width: UM.Theme.getSize("configuration_selector_widget").width - } + }*/ Cura.PrintSetupSelector { diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 740c12d340..966133d906 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -8,7 +8,82 @@ import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.0 as Cura -Item + +Cura.ExpandableComponent +{ + id: base + headerItem: Item + { + Cura.ExtrudersModel + { + id: extrudersModel + } + + ListView + { + // Horizontal list that shows the extruders + id: extrudersList + + orientation: ListView.Horizontal + anchors.fill: parent + model: extrudersModel + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + } + + delegate: Item + { + height: parent.height + width: Math.round(ListView.view.width / extrudersModel.rowCount()) + + Cura.ExtruderIcon + { + id: extruderIcon + materialColor: model.color + height: parent.height + width: height + } + + Label + { + id: brandNameLabel + + text: model.material_brand + elide: Text.ElideRight + + anchors + { + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + } + Label + { + text: model.color_name + elide: Text.ElideRight + + anchors + { + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + top: brandNameLabel.bottom + } + } + } + } + } + + +} + +/*Item { id: configurationSelector property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null @@ -65,4 +140,4 @@ Item onClosed: visible = false onOpened: visible = true } -} \ No newline at end of file +}*/ \ No newline at end of file From 1602bf0999974c4815faa54575ad84aabb1e3867 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 9 Nov 2018 16:59:10 +0100 Subject: [PATCH 129/558] Re-Add the material & printcore selection to the configuration selector CURA-5785 --- .../QuickConfigurationSelector.qml | 170 ++++++++++++++++-- 1 file changed, 157 insertions(+), 13 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 966133d906..e093c96ae5 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -4,6 +4,9 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.11 + +import QtQuick.Controls 1.1 as OldControls import UM 1.2 as UM import Cura 1.0 as Cura @@ -12,33 +15,28 @@ import Cura 1.0 as Cura Cura.ExpandableComponent { id: base + Cura.ExtrudersModel + { + id: extrudersModel + } + headerItem: Item { - Cura.ExtrudersModel - { - id: extrudersModel - } - + // Horizontal list that shows the extruders ListView { - // Horizontal list that shows the extruders id: extrudersList orientation: ListView.Horizontal anchors.fill: parent model: extrudersModel - Connections - { - target: Cura.MachineManager - onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - } - delegate: Item { height: parent.height width: Math.round(ListView.view.width / extrudersModel.rowCount()) + // Extruder icon. Shows extruder index and has the same color as the active material. Cura.ExtruderIcon { id: extruderIcon @@ -47,6 +45,7 @@ Cura.ExpandableComponent width: height } + // Label for the human readable material color name Label { id: brandNameLabel @@ -62,6 +61,8 @@ Cura.ExpandableComponent rightMargin: UM.Theme.getSize("default_margin").width } } + + // Label that shows the brand of the material Label { text: model.color_name @@ -80,7 +81,150 @@ Cura.ExpandableComponent } } - + popupItem: Item + { + width: base.width + height: 200 + + TabBar + { + id: tabBar + onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + width: parent.width + height: 50 + Repeater + { + model: extrudersModel + + delegate: TabButton + { + width: Math.round(ListView.view.width / extrudersModel.rowCount()) + height: parent.height + contentItem: Item + { + Cura.ExtruderIcon + { + anchors.horizontalCenter: parent.horizontalCenter + materialColor: model.color + width: parent.height + height: parent.height + } + } + } + } + } + + Item + { + id: tabControl + width: parent.width + anchors.top: tabBar.bottom + anchors.bottom: parent.bottom + property var model: extrudersModel.items[tabBar.currentIndex] + property real textWidth: Math.round(width * 0.3) + property real controlWidth: Math.round(width * 0.7) + Column + { + spacing: UM.Theme.getSize("default_margin").height + Row + { + height: UM.Theme.getSize("print_setup_item").height + + Label + { + text: "Enabled" + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.CheckBox + { + checked: Cura.MachineManager.getExtruder(parent.model.index).isEnabled + onClicked: Cura.MachineManager.setExtruderEnabled(parent.model.index, checked) + height: UM.Theme.getSize("setting_control").height + style: UM.Theme.styles.checkbox + } + } + + Row + { + height: UM.Theme.getSize("print_setup_item").height + Label + { + text: "Material" + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.ToolButton + { + id: materialSelection + + property var activeExtruder: Cura.MachineManager.activeStack + property var hasActiveExtruder: activeExtruder != null + property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" + property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true + property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported + + text: currentRootMaterialName + tooltip: currentRootMaterialName + visible: Cura.MachineManager.hasMaterials + + enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 + + height: UM.Theme.getSize("setting_control").height + width: tabControl.controlWidth + + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true + menu: Cura.MaterialMenu + { + extruderIndex: Cura.ExtruderManager.activeExtruderIndex + } + + } + } + + Row + { + height: UM.Theme.getSize("print_setup_item").height + + Label + { + text: Cura.MachineManager.activeDefinitionVariantsName + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.ToolButton + { + id: variantSelection + text: Cura.MachineManager.activeVariantName + tooltip: Cura.MachineManager.activeVariantName; + visible: Cura.MachineManager.hasVariants + + height: UM.Theme.getSize("setting_control").height + width: tabControl.controlWidth + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + + menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } + } + } + } + + } + } + } /*Item From 69daa0d91a2d7a70fa9d4e3a5d90778799dbca31 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 12:44:56 +0100 Subject: [PATCH 130/558] Rename Toolbox menu to Marketplace. It was remove by mistake in a merge conflict. Contributes to CURA-5784. --- resources/qml/MainWindow/ApplicationMenu.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index d3bc115419..04c068cb54 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -86,7 +86,7 @@ Item Menu { id: plugin_menu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Toolbox") + title: catalog.i18nc("@title:menu menubar:toplevel", "&Marketplace") MenuItem { action: Cura.Actions.browsePackages } } From 3669a3791dc04f9fa35a9ef62cd3e57b8667ce94 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 12:56:30 +0100 Subject: [PATCH 131/558] Hide the Preview shortcut in the action panel when the active stage is the PreviewStage. Also adjust the size of the output button when the Preview button is not visible. Contributes to CURA-5786. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 0ea956d1dc..f4e014b1ec 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -102,6 +102,8 @@ Column Cura.ActionButton { + id: previewStageShortcut + leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_panel_button").height @@ -111,11 +113,12 @@ Column textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") onClicked: UM.Controller.setActiveStage("PreviewStage") + visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage" } Cura.OutputDevicesActionButton { - width: UM.Theme.getSize("action_panel_button").width + width: previewStageShortcut.visible ? UM.Theme.getSize("action_panel_button").width : parent.width height: UM.Theme.getSize("action_panel_button").height } } From f65b1f8fbc183fb1b696baacc263c54ef9246f03 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 13:16:38 +0100 Subject: [PATCH 132/558] Add soft animation to the entire popup and not only in the background. This prevents the content to show before the background. Contributes to CURA-5784. --- resources/qml/Account/AccountWidget.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index e37523296f..d3bd6fd130 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -51,6 +51,9 @@ Button closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + opacity: opened ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + contentItem: AccountDetails { id: panel @@ -61,8 +64,6 @@ Button background: UM.PointingRectangle { - opacity: visible ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } color: UM.Theme.getColor("tool_panel_background") borderColor: UM.Theme.getColor("lining") borderWidth: UM.Theme.getSize("default_lining").width From 8a63a79896b3c22f94562ddc0aec1b939103494b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 13:17:59 +0100 Subject: [PATCH 133/558] Add soft animation to the entire popup and not only in the background. This prevents the content to show before the background. Contributes to CURA-5786. --- .../ActionPanel/PrintInformationWidget.qml | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml index 620c3a408c..82707576e0 100644 --- a/resources/qml/ActionPanel/PrintInformationWidget.qml +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -7,29 +7,30 @@ import QtQuick.Controls 2.1 import UM 1.1 as UM import Cura 1.0 as Cura -Button +UM.RecolorImage { id: widget - implicitHeight: UM.Theme.getSize("section_icon").height - implicitWidth: UM.Theme.getSize("section_icon").width + //implicitHeight: UM.Theme.getSize("section_icon").height + //implicitWidth: UM.Theme.getSize("section_icon").width - background: UM.RecolorImage + source: UM.Theme.getIcon("info") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: popup.opened ? UM.Theme.getColor("primary") : UM.Theme.getColor("text_medium") + + MouseArea { - id: moreInformationIcon - - source: UM.Theme.getIcon("info") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - - sourceSize.width: width - sourceSize.height: height - - color: widget.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text_medium") + anchors.fill: parent + hoverEnabled: true + onEntered: popup.open() + onExited: popup.close() } - onClicked: popup.opened ? popup.close() : popup.open() - Popup { id: popup @@ -39,6 +40,9 @@ Button closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + opacity: opened ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + contentItem: PrintJobInformation { id: printJobInformation @@ -47,8 +51,6 @@ Button background: UM.PointingRectangle { - opacity: visible ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } color: UM.Theme.getColor("tool_panel_background") borderColor: UM.Theme.getColor("lining") borderWidth: UM.Theme.getSize("default_lining").width From 38a80ecae59eeac754f10cd2ef00054ed09c3ba2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 14:06:52 +0100 Subject: [PATCH 134/558] Make some tweaks in the UI for the preview stage. Clean up the default theme a bit by removing unused entries. Contributes to CURA-5829. --- plugins/SimulationView/LayerSlider.qml | 10 ++--- plugins/SimulationView/PathSlider.qml | 9 ++-- .../SimulationViewMainComponent.qml | 4 +- resources/themes/cura-dark/theme.json | 1 - resources/themes/cura-light/styles.qml | 41 ------------------- resources/themes/cura-light/theme.json | 33 ++++++--------- 6 files changed, 21 insertions(+), 77 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 7916cd62b3..42b8cf0ba0 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -21,15 +21,12 @@ Item property color lowerHandleColor: UM.Theme.getColor("slider_handle") property color rangeHandleColor: UM.Theme.getColor("slider_groove_fill") property color handleActiveColor: UM.Theme.getColor("slider_handle_active") - property real handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width property var activeHandle: upperHandle // Track properties property real trackThickness: UM.Theme.getSize("slider_groove").width // width of the slider track - property real trackRadius: trackThickness / 2 + property real trackRadius: UM.Theme.getSize("slider_groove_radius").width property color trackColor: UM.Theme.getColor("slider_groove") - property real trackBorderWidth: 1 - property color trackBorderColor: UM.Theme.getColor("slider_groove_border") // value properties property real maximumValue: 100 @@ -90,8 +87,6 @@ Item radius: sliderRoot.trackRadius anchors.centerIn: sliderRoot color: sliderRoot.trackColor - border.width: sliderRoot.trackBorderWidth - border.color: sliderRoot.trackBorderColor visible: sliderRoot.layersVisible } @@ -140,9 +135,10 @@ Item Rectangle { - width: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth + width: sliderRoot.trackThickness height: parent.height + sliderRoot.handleSize anchors.centerIn: parent + radius: sliderRoot.trackRadius color: sliderRoot.rangeHandleColor } diff --git a/plugins/SimulationView/PathSlider.qml b/plugins/SimulationView/PathSlider.qml index 701e54e398..c7a43c6407 100644 --- a/plugins/SimulationView/PathSlider.qml +++ b/plugins/SimulationView/PathSlider.qml @@ -23,10 +23,8 @@ Item // track properties property real trackThickness: UM.Theme.getSize("slider_groove").width - property real trackRadius: trackThickness / 2 + property real trackRadius: UM.Theme.getSize("slider_groove_radius").width property color trackColor: UM.Theme.getColor("slider_groove") - property real trackBorderWidth: 1 // width of the slider track border - property color trackBorderColor: UM.Theme.getColor("slider_groove_border") // value properties property real maximumValue: 100 @@ -68,8 +66,6 @@ Item radius: sliderRoot.trackRadius anchors.centerIn: sliderRoot color: sliderRoot.trackColor - border.width: sliderRoot.trackBorderWidth - border.color: sliderRoot.trackBorderColor visible: sliderRoot.pathsVisible } @@ -86,9 +82,10 @@ Item Rectangle { - height: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth + height: sliderRoot.trackThickness width: parent.width + sliderRoot.handleSize anchors.centerIn: parent + radius: sliderRoot.trackRadius color: sliderRoot.rangeColor } } diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 784938e5c2..4e038a1cf1 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -18,7 +18,7 @@ Item { id: pathSlider height: UM.Theme.getSize("slider_handle").width - width: UM.Theme.getSize("layerview_menu_size").width + width: UM.Theme.getSize("slider_layerview_size").height anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("default_margin").height @@ -166,7 +166,7 @@ Item id: layerSlider width: UM.Theme.getSize("slider_handle").width - height: UM.Theme.getSize("layerview_menu_size").height + height: UM.Theme.getSize("slider_layerview_size").height anchors { diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 344efb6fd1..62b1dbfa0f 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -135,7 +135,6 @@ "slider_handle": [255, 255, 255, 255], "slider_handle_hover": [77, 182, 226, 255], "slider_handle_active": [68, 192, 255, 255], - "slider_handle_border": [39, 44, 48, 255], "slider_text_background": [255, 255, 255, 255], "checkbox": [43, 48, 52, 255], diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index dacff1b42b..503a3eddca 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -915,47 +915,6 @@ QtObject } } - property Component slider: Component - { - SliderStyle - { - groove: Rectangle - { - implicitWidth: control.width - implicitHeight: Theme.getSize("slider_groove").height - - color: Theme.getColor("slider_groove") - border.width: Theme.getSize("default_lining").width - border.color: Theme.getColor("slider_groove_border") - - radius: Math.round(width / 2) - - Rectangle - { - anchors - { - left: parent.left - top: parent.top - bottom: parent.bottom - } - color: Theme.getColor("slider_groove_fill"); - width: Math.round((control.value / (control.maximumValue - control.minimumValue)) * parent.width); - radius: Math.round(width / 2); - } - } - handle: Rectangle - { - width: Theme.getSize("slider_handle").width; - height: Theme.getSize("slider_handle").height; - color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); - border.width: Theme.getSize("default_lining").width - border.color: control.hovered ? Theme.getColor("slider_handle_hover_border") : Theme.getColor("slider_handle_border") - radius: Math.round(Theme.getSize("slider_handle").width / 2); //Round. - Behavior on color { ColorAnimation { duration: 50; } } - } - } - } - property Component text_field: Component { TextFieldStyle diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f882277d65..48cf5d456d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -131,11 +131,11 @@ "button_disabled": [31, 36, 39, 255], "button_disabled_text": [255, 255, 255, 101], - "small_button": [31, 36, 39, 0], - "small_button_hover": [68, 72, 75, 255], - "small_button_active": [68, 72, 75, 255], - "small_button_active_hover": [68, 72, 75, 255], - "small_button_text": [31, 36, 39, 197], + "small_button": [0, 0, 0, 0], + "small_button_hover": [10, 8, 80, 255], + "small_button_active": [10, 8, 80, 255], + "small_button_active_hover": [10, 8, 80, 255], + "small_button_text": [171, 171, 191, 255], "small_button_text_hover": [255, 255, 255, 255], "small_button_text_active": [255, 255, 255, 255], "small_button_text_active_hover": [255, 255, 255, 255], @@ -215,13 +215,11 @@ "progressbar_background": [245, 245, 245, 255], "progressbar_control": [50, 130, 255, 255], - "slider_groove": [245, 245, 245, 255], - "slider_groove_border": [127, 127, 127, 255], - "slider_groove_fill": [127, 127, 127, 255], - "slider_handle": [0, 0, 0, 255], + "slider_groove": [223, 223, 223, 255], + "slider_groove_fill": [10, 8, 80, 255], + "slider_handle": [10, 8, 80, 255], "slider_handle_hover": [77, 182, 226, 255], - "slider_handle_active": [68, 192, 255, 255], - "slider_handle_border": [39, 44, 48, 255], + "slider_handle_active": [50, 130, 255, 255], "slider_text_background": [255, 255, 255, 255], "quality_slider_unavailable": [179, 179, 179, 255], @@ -449,17 +447,12 @@ "scrollbar": [0.75, 0.5], - "quality_slider_bar": [1, 0.2], - - "slider_groove": [0.3, 0.3], - "slider_handle": [1.0, 1.0], - "slider_layerview_size": [1.0, 22.0], - "slider_layerview_background": [4.0, 0.0], - "slider_layerview_margin": [1.0, 1.5], + "slider_groove": [0.5, 0.5], + "slider_groove_radius": [0.15, 0.15], + "slider_handle": [1.5, 1.5], + "slider_layerview_size": [1.0, 26.0], "layerview_menu_size": [15, 20], - "layerview_menu_size_material_color_mode": [15, 16], - "layerview_menu_size_collapsed": [15, 6], "layerview_legend_size": [1.0, 1.0], "layerview_row": [11.0, 1.5], "layerview_row_spacing": [0.0, 0.5], From 9bf18031ce33f41d649e5471048ac84a3dc06bd9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 11 Nov 2018 19:15:02 +0100 Subject: [PATCH 135/558] Apply restyle of the toolbar according to the new designs. --- .../qml/ActionPanel/ActionPanelWidget.qml | 1 - resources/qml/Cura.qml | 2 + resources/qml/ExtruderButton.qml | 35 +++-- resources/qml/Toolbar.qml | 130 +++++++++++------- resources/themes/cura-light/styles.qml | 75 ++++++++++ resources/themes/cura-light/theme.json | 9 +- 6 files changed, 185 insertions(+), 67 deletions(-) diff --git a/resources/qml/ActionPanel/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml index 0db778de5a..a1cd81e9e9 100644 --- a/resources/qml/ActionPanel/ActionPanelWidget.qml +++ b/resources/qml/ActionPanel/ActionPanelWidget.qml @@ -23,7 +23,6 @@ Rectangle border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width - visible: CuraApplication.platformActivity property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index dc64aeee38..819d986ece 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -186,6 +186,7 @@ UM.MainWindow verticalCenter: parent.verticalCenter left: parent.left } + visible: CuraApplication.platformActivity } ObjectsList @@ -235,6 +236,7 @@ UM.MainWindow anchors.bottom: parent.bottom anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.bottomMargin: UM.Theme.getSize("thick_margin").height + visible: CuraApplication.platformActivity } Loader diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 2c1b80047e..7923521658 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -15,37 +15,36 @@ Button text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name) - style: UM.Theme.styles.tool_button; + style: UM.Theme.styles.toolbar_button iconSource: UM.Theme.getIcon("extruder_button") checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1 enabled: UM.Selection.hasSelection && extruder.stack.isEnabled - property color customColor: base.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button"); - - Rectangle - { - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_lining").width; - - color: "transparent" - - border.width: base.checked ? UM.Theme.getSize("default_lining").width : 0; - border.color: UM.Theme.getColor("button_text") - } - Item { anchors.centerIn: parent width: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("default_margin").height + opacity: !base.enabled ? 0.2 : 1.0 Label { - anchors.centerIn: parent; - text: index + 1; - color: parent.enabled ? UM.Theme.getColor("button_text") : UM.Theme.getColor("button_disabled_text") - font: UM.Theme.getFont("default_bold"); + anchors.centerIn: parent + text: index + 1 + color: + { + if (base.checked) + { + return UM.Theme.getColor("toolbar_button_text_active") + } + else if(base.hovered) + { + return UM.Theme.getColor("toolbar_button_text_hover") + } + return UM.Theme.getColor("toolbar_button_text") + } + font: UM.Theme.getFont("default_bold") } } diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index a04b3650df..9955ceeba7 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -11,75 +11,113 @@ import Cura 1.0 as Cura Item { - id: base; + id: base - width: buttons.width; + width: buttons.width height: buttons.height property int activeY - Column + Item { - id: buttons; + id: buttons + width: parent.visible ? toolButtons.width : 0 + height: childrenRect.height - anchors.bottom: parent.bottom - anchors.left: parent.left - spacing: UM.Theme.getSize("button_lining").width + Behavior on width { NumberAnimation { duration: 100 } } - Repeater + // Used to create a rounded rectangle behind the toolButtons + Rectangle { - id: repeat + anchors.fill: toolButtons + anchors.leftMargin: -radius + radius: UM.Theme.getSize("default_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("toolbar_background") + } - model: UM.ToolModel { } - width: childrenRect.width - height: childrenRect.height - Button + Column + { + id: toolButtons + + anchors.top: parent.top + anchors.right: parent.right + spacing: UM.Theme.getSize("button_lining").width + + Repeater { - text: model.name + (model.shortcut ? (" (" + model.shortcut + ")") : "") - iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon - checkable: true - checked: model.active - enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled - style: UM.Theme.styles.tool_button + id: repeat - onCheckedChanged: + model: UM.ToolModel { } + width: childrenRect.width + height: childrenRect.height + Button { - if (checked) - { - base.activeY = y; - } - } + text: model.name + (model.shortcut ? (" (" + model.shortcut + ")") : "") + iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon + checkable: true + checked: model.active + enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled + style: UM.Theme.styles.toolbar_button - //Workaround since using ToolButton's onClicked would break the binding of the checked property, instead - //just catch the click so we do not trigger that behaviour. - MouseArea - { - anchors.fill: parent; - onClicked: + onCheckedChanged: { - forceActiveFocus() //First grab focus, so all the text fields are updated - if(parent.checked) + if (checked) { - UM.Controller.setActiveTool(null); + base.activeY = y; } - else + } + + //Workaround since using ToolButton's onClicked would break the binding of the checked property, instead + //just catch the click so we do not trigger that behaviour. + MouseArea + { + anchors.fill: parent; + onClicked: { - UM.Controller.setActiveTool(model.id); + forceActiveFocus() //First grab focus, so all the text fields are updated + if(parent.checked) + { + UM.Controller.setActiveTool(null); + } + else + { + UM.Controller.setActiveTool(model.id); + } } } } } } - Item { height: UM.Theme.getSize("default_margin").height; width: UM.Theme.getSize("default_lining").width; visible: extruders.count > 0 } - - Repeater + // Used to create a rounded rectangle behind the extruderButtons + Rectangle { - id: extruders - width: childrenRect.width - height: childrenRect.height - property var _model: Cura.ExtrudersModel { id: extrudersModel } - model: _model.items.length > 1 ? _model : 0 - ExtruderButton { extruder: model } + anchors.fill: extruderButtons + anchors.leftMargin: -radius + radius: UM.Theme.getSize("default_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("toolbar_background") + } + + Column + { + id: extruderButtons + + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.top: toolButtons.bottom + anchors.right: parent.right + + Repeater + { + id: extruders + width: childrenRect.width + height: childrenRect.height + property var _model: Cura.ExtrudersModel { id: extrudersModel } + model: _model.items.length > 1 ? _model : 0 + ExtruderButton { extruder: model } + } } } @@ -91,7 +129,7 @@ Item anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: base.top; anchors.topMargin: base.activeY - z: buttons.z -1 + z: buttons.z - 1 target: Qt.point(parent.right, base.activeY + Math.round(UM.Theme.getSize("button").height/2)) arrowSize: UM.Theme.getSize("default_arrow").width diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 503a3eddca..52ae3cd243 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -171,6 +171,81 @@ QtObject } } + property Component toolbar_button: Component + { + ButtonStyle + { + background: Item + { + implicitWidth: Theme.getSize("button").width; + implicitHeight: Theme.getSize("button").height; + + UM.PointingRectangle + { + id: button_tooltip + + anchors.left: parent.right + anchors.leftMargin: Theme.getSize("button_tooltip_arrow").width * 2 + anchors.verticalCenter: parent.verticalCenter + + target: Qt.point(parent.x, y + Math.round(height/2)) + arrowSize: Theme.getSize("button_tooltip_arrow").width + color: Theme.getColor("button_tooltip") + opacity: control.hovered ? 1.0 : 0.0; + visible: control.text != "" + + width: control.hovered ? button_tip.width + Theme.getSize("button_tooltip").width : 0 + height: Theme.getSize("button_tooltip").height + + Behavior on width { NumberAnimation { duration: 100; } } + Behavior on opacity { NumberAnimation { duration: 100; } } + + Label + { + id: button_tip + + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter; + + text: control.text; + font: Theme.getFont("button_tooltip"); + color: Theme.getColor("tooltip_text"); + } + } + } + + label: Item + { + UM.RecolorImage + { + anchors.centerIn: parent; + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource; + width: Theme.getSize("button_icon").width; + height: Theme.getSize("button_icon").height; + color: + { + if(control.checkable && control.checked && control.hovered) + { + return Theme.getColor("toolbar_button_text_active_hover"); + } + else if(control.pressed || (control.checkable && control.checked)) + { + return Theme.getColor("toolbar_button_text_active"); + } + else if(control.hovered) + { + return Theme.getColor("toolbar_button_text_hover"); + } + return Theme.getColor("toolbar_button_text"); + } + + sourceSize: Theme.getSize("button_icon") + } + } + } + } + property Component tool_button: Component { ButtonStyle diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 48cf5d456d..a33ff87042 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -105,6 +105,8 @@ "action_panel_secondary": [27, 95, 202, 255], + "toolbar_background": [255, 255, 255, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], @@ -120,6 +122,11 @@ "error": [255, 140, 0, 255], "warning": [255, 190, 35, 255], + "toolbar_button_text": [10, 8, 80, 255], + "toolbar_button_text_hover": [50, 130, 255, 255], + "toolbar_button_text_active": [50, 130, 255, 255], + "toolbar_button_text_active_hover": [50, 130, 255, 255], + "button": [31, 36, 39, 255], "button_hover": [68, 72, 75, 255], "button_active": [68, 72, 75, 255], @@ -128,8 +135,6 @@ "button_text_hover": [255, 255, 255, 255], "button_text_active": [255, 255, 255, 255], "button_text_active_hover": [255, 255, 255, 255], - "button_disabled": [31, 36, 39, 255], - "button_disabled_text": [255, 255, 255, 101], "small_button": [0, 0, 0, 0], "small_button_hover": [10, 8, 80, 255], From f534885e341bd3fd1098d59e55c7231ff29c5b76 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 12 Nov 2018 09:35:32 +0100 Subject: [PATCH 136/558] Modify the color behavior of the toolbar buttons. --- resources/themes/cura-light/styles.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 52ae3cd243..6f099bf1c5 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -225,11 +225,11 @@ QtObject height: Theme.getSize("button_icon").height; color: { - if(control.checkable && control.checked && control.hovered) + if (control.checked && control.hovered) { return Theme.getColor("toolbar_button_text_active_hover"); } - else if(control.pressed || (control.checkable && control.checked)) + else if (control.checked) { return Theme.getColor("toolbar_button_text_active"); } From e64158402137953789861adfbe77f2345b5bb983 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 09:45:55 +0100 Subject: [PATCH 137/558] Made strings in ConfigurationSelector translatable. CURA-5785 --- .../ConfigurationMenu/QuickConfigurationSelector.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index e093c96ae5..3c354384c7 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -15,11 +15,18 @@ import Cura 1.0 as Cura Cura.ExpandableComponent { id: base + Cura.ExtrudersModel { id: extrudersModel } + UM.I18nCatalog + { + id: catalog + name: "cura" + } + headerItem: Item { // Horizontal list that shows the extruders @@ -132,7 +139,7 @@ Cura.ExpandableComponent Label { - text: "Enabled" + text: catalog.i18nc("@label", "Enabled") verticalAlignment: Text.AlignVCenter font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") @@ -154,7 +161,7 @@ Cura.ExpandableComponent height: UM.Theme.getSize("print_setup_item").height Label { - text: "Material" + text: catalog.i18nc("@label", "Material") verticalAlignment: Text.AlignVCenter font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") From b60977e435676171c3bb678c98f74c449a474cd3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 11:14:39 +0100 Subject: [PATCH 138/558] Convert PrintSetupSelector to an ExpandableComponent CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 1 + resources/qml/PrintSetupSelector.qml | 281 ++++++++++++--------------- 2 files changed, 125 insertions(+), 157 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index bcc8ec4c0a..ff8cdc2a47 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -66,6 +66,7 @@ Item Cura.PrintSetupSelector { width: UM.Theme.getSize("print_setup_widget").width + height: prepareMenu.height onShowTooltip: prepareMenu.showTooltip(item, location, text) onHideTooltip: prepareMenu.hideTooltip() } diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 8232e76a17..7a415b1e2e 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -10,22 +10,14 @@ import Cura 1.0 as Cura import "Menus" import "Menus/ConfigurationMenu" -Rectangle +Cura.ExpandableComponent { id: base height: childrenRect.height - property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced - property variant printDuration: PrintInformation.currentPrintTime - property variant printMaterialLengths: PrintInformation.materialLengths - property variant printMaterialWeights: PrintInformation.materialWeights - property variant printMaterialCosts: PrintInformation.materialCosts - property variant printMaterialNames: PrintInformation.materialNames - - color: UM.Theme.getColor("main_background") UM.I18nCatalog { id: catalog; name: "cura"} // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. @@ -46,40 +38,12 @@ Rectangle } } - function strPadLeft(string, pad, length) - { - return (new Array(length + 1).join(pad) + string).slice(-length); - } - - function getPrettyTime(time) - { - var hours = Math.floor(time / 3600) - time -= hours * 3600 - var minutes = Math.floor(time / 60); - time -= minutes * 60 - var seconds = Math.floor(time); - - var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2); - return finalTime; - } - - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - - onWheel: - { - wheel.accepted = true; - } - } - onCurrentModeIndexChanged: { UM.Preferences.setValue("cura/active_mode", currentModeIndex); } - Label + headerItem: Label { id: settingsModeLabel text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified") @@ -98,146 +62,149 @@ Rectangle color: UM.Theme.getColor("text") } - - ListView + popupItem: Item { - // Settings mode selection toggle - id: settingsModeSelection - model: modesListModel - width: Math.round(parent.width * 0.55) - height: UM.Theme.getSize("print_setup_mode_toggle").height - visible: !hideSettings - - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - anchors.top: settingsModeLabel.top - - ButtonGroup + height: settingsModeSelection.height + sidebarContents.height + width: UM.Theme.getSize("print_setup_widget").width + ListView { - id: modeMenuGroup + // Settings mode selection toggle + id: settingsModeSelection + model: modesListModel + width: Math.round(parent.width * 0.55) + height: UM.Theme.getSize("print_setup_mode_toggle").height + visible: !hideSettings + + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + + ButtonGroup + { + id: modeMenuGroup + } + + delegate: Button + { + id: control + + height: settingsModeSelection.height + width: Math.round(parent.width / 2) + + anchors.left: parent.left + anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2) + anchors.verticalCenter: parent.verticalCenter + + ButtonGroup.group: modeMenuGroup + + checkable: true + checked: base.currentModeIndex == index + onClicked: base.currentModeIndex = index + + onHoveredChanged: + { + if (hovered) + { + tooltipDelayTimer.item = settingsModeSelection + tooltipDelayTimer.text = model.tooltipText + tooltipDelayTimer.start() + } + else + { + tooltipDelayTimer.stop() + base.hideTooltip() + } + } + + background: Rectangle + { + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + + // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + } + + contentItem: Label + { + text: model.text + font: UM.Theme.getFont("default") + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + renderType: Text.NativeRendering + elide: Text.ElideRight + color: + { + if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } + } + } } - delegate: Button + Item { - id: control - - height: settingsModeSelection.height - width: Math.round(parent.width / 2) - + id: sidebarContents + anchors.top: settingsModeSelection.bottom + anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: parent.left - anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2) - anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + height: UM.Theme.getSize("print_setup_widget").height - ButtonGroup.group: modeMenuGroup + visible: !hideSettings - checkable: true - checked: base.currentModeIndex == index - onClicked: base.currentModeIndex = index - - onHoveredChanged: + // We load both of them at once (instead of using a loader) because the advanced sidebar can take + // quite some time to load. So in this case we sacrifice memory for speed. + SidebarAdvanced { - if (hovered) - { - tooltipDelayTimer.item = settingsModeSelection - tooltipDelayTimer.text = model.tooltipText - tooltipDelayTimer.start() - } - else - { - tooltipDelayTimer.stop() - base.hideTooltip() - } + anchors.fill: parent + visible: currentModeIndex == 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() } - background: Rectangle + SidebarSimple { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - - // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - - contentItem: Label - { - text: model.text - font: UM.Theme.getFont("default") - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - elide: Text.ElideRight - color: - { - if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } + anchors.fill: parent + visible: currentModeIndex != 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() } } - } - Item - { - id: sidebarContents - anchors.top: settingsModeSelection.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("print_setup_widget").height - - visible: !hideSettings - - // We load both of them at once (instead of using a loader) because the advanced sidebar can take - // quite some time to load. So in this case we sacrifice memory for speed. - SidebarAdvanced + // Setting mode: Recommended or Custom + ListModel { - anchors.fill: parent - visible: currentModeIndex == 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() + id: modesListModel } - SidebarSimple + Component.onCompleted: { - anchors.fill: parent - visible: currentModeIndex != 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - } + modesListModel.append({ + text: catalog.i18nc("@title:tab", "Recommended"), + tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Recommended Print Setup")).arg(catalog.i18nc("@tooltip", "Print with the recommended settings for the selected printer, material and quality.")) + }) + modesListModel.append({ + text: catalog.i18nc("@title:tab", "Custom"), + tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Custom Print Setup")).arg(catalog.i18nc("@tooltip", "Print with finegrained control over every last bit of the slicing process.")) + }) - // Setting mode: Recommended or Custom - ListModel - { - id: modesListModel - } + var index = Math.round(UM.Preferences.getValue("cura/active_mode")) - Component.onCompleted: - { - modesListModel.append({ - text: catalog.i18nc("@title:tab", "Recommended"), - tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Recommended Print Setup")).arg(catalog.i18nc("@tooltip", "Print with the recommended settings for the selected printer, material and quality.")) - }) - modesListModel.append({ - text: catalog.i18nc("@title:tab", "Custom"), - tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Custom Print Setup")).arg(catalog.i18nc("@tooltip", "Print with finegrained control over every last bit of the slicing process.")) - }) - - var index = Math.round(UM.Preferences.getValue("cura/active_mode")) - - if(index != null && !isNaN(index)) - { - currentModeIndex = index; - } - else - { - currentModeIndex = 0; + if(index != null && !isNaN(index)) + { + currentModeIndex = index; + } + else + { + currentModeIndex = 0; + } } } } From 88b57518d9770ea1406cd0a97fc975132588483c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 11:24:11 +0100 Subject: [PATCH 139/558] Fix codestyle CURA-5785 --- resources/qml/SidebarSimple.qml | 187 ++++++++++++++++---------------- 1 file changed, 94 insertions(+), 93 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 59980d1f55..affd1eb3a2 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -13,16 +13,18 @@ Item { id: base - signal showTooltip(Item item, point location, string text); - signal hideTooltip(); + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + + property Action configureSettings - property Action configureSettings; - property variant minimumPrintTime: PrintInformation.minimumPrintTime; - property variant maximumPrintTime: PrintInformation.maximumPrintTime; property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - Component.onCompleted: PrintInformation.enabled = true - Component.onDestruction: PrintInformation.enabled = false - UM.I18nCatalog { id: catalog; name: "cura" } + + UM.I18nCatalog + { + id: catalog + name: "cura" + } ScrollView { @@ -313,7 +315,7 @@ Item } } - Rectangle + Item { id: rightArea width: @@ -324,7 +326,6 @@ Item return qualityModel.qualitySliderMarginRight - 10 } height: parent.height - color: "transparent" x: { if (qualityModel.availableTotalTicks == 0) @@ -450,10 +451,7 @@ Item var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) } - onExited: - { - base.hideTooltip(); - } + onExited: base.hideTooltip() } } @@ -575,7 +573,8 @@ Item } // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider - Binding { + Binding + { target: infillSlider property: "value" value: parseInt(infillDensity.properties.value) @@ -604,10 +603,12 @@ Item // set initial value from stack value: parseInt(infillDensity.properties.value) - onValueChanged: { + onValueChanged: + { // Don't round the value if it's already the same - if (parseInt(infillDensity.properties.value) == infillSlider.value) { + if (parseInt(infillDensity.properties.value) == infillSlider.value) + { return } @@ -631,7 +632,8 @@ Item style: SliderStyle { - groove: Rectangle { + groove: Rectangle + { id: groove implicitWidth: 200 * screenScaleFactor implicitHeight: 2 * screenScaleFactor @@ -639,8 +641,10 @@ Item radius: 1 } - handle: Item { - Rectangle { + handle: Item + { + Rectangle + { id: handleButton anchors.centerIn: parent color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") @@ -650,24 +654,27 @@ Item } } - tickmarks: Repeater { + tickmarks: Repeater + { id: repeater model: control.maximumValue / control.stepSize + 1 // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) - function shouldShowTick (index) { - if (index % 10 == 0) { + function shouldShowTick (index) + { + if (index % 10 == 0) + { return true } return false } - Rectangle { + Rectangle + { anchors.verticalCenter: parent.verticalCenter color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") width: 1 * screenScaleFactor height: 6 * screenScaleFactor - y: 0 x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) visible: shouldShowTick(index) } @@ -693,8 +700,10 @@ Item model: infillModel anchors.fill: parent - function activeIndex () { - for (var i = 0; i < infillModel.count; i++) { + function activeIndex () + { + for (var i = 0; i < infillModel.count; i++) + { var density = Math.round(infillDensity.properties.value) var steps = Math.round(infillSteps.properties.value) var infillModelItem = infillModel.get(i) @@ -703,8 +712,8 @@ Item && density >= infillModelItem.percentageMin && density <= infillModelItem.percentageMax && steps >= infillModelItem.stepsMin - && steps <= infillModelItem.stepsMax - ){ + && steps <= infillModelItem.stepsMax) + { return i } } @@ -719,7 +728,8 @@ Item border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("quality_slider_unavailable") - UM.RecolorImage { + UM.RecolorImage + { anchors.fill: parent anchors.margins: 2 * screenScaleFactor sourceSize.width: width @@ -732,7 +742,8 @@ Item } // Gradual Support Infill Checkbox - CheckBox { + CheckBox + { id: enableGradualInfillCheckBox property alias _hovered: enableGradualInfillMouseArea.containsMouse @@ -745,7 +756,8 @@ Item visible: infillSteps.properties.enabled == "True" checked: parseInt(infillSteps.properties.value) > 0 - MouseArea { + MouseArea + { id: enableGradualInfillMouseArea anchors.fill: parent @@ -754,35 +766,37 @@ Item property var previousInfillDensity: parseInt(infillDensity.properties.value) - onClicked: { + onClicked: + { // Set to 90% only when enabling gradual infill var newInfillDensity; - if (parseInt(infillSteps.properties.value) == 0) { + if (parseInt(infillSteps.properties.value) == 0) + { previousInfillDensity = parseInt(infillDensity.properties.value) - newInfillDensity = 90; + newInfillDensity = 90 } else { - newInfillDensity = previousInfillDensity; + newInfillDensity = previousInfillDensity } Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) - var infill_steps_value = 0; + var infill_steps_value = 0 if (parseInt(infillSteps.properties.value) == 0) - infill_steps_value = 5; + { + infill_steps_value = 5 + } Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) } - onEntered: { - base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), + onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) - } - onExited: { - base.hideTooltip() - } + onExited: base.hideTooltip() + } - Label { + Label + { id: gradualInfillLabel height: parent.height anchors.left: enableGradualInfillCheckBox.right @@ -855,9 +869,9 @@ Item anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.verticalCenter: enableSupportCheckBox.verticalCenter - text: catalog.i18nc("@label", "Generate Support"); - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); + text: catalog.i18nc("@label", "Generate Support") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") elide: Text.ElideRight } @@ -869,32 +883,24 @@ Item anchors.top: enableSupportLabel.top anchors.left: infillCellRight.left - style: UM.Theme.styles.checkbox; + style: UM.Theme.styles.checkbox enabled: base.settingsEnabled visible: supportEnabled.properties.enabled == "True" - checked: supportEnabled.properties.value == "True"; + checked: supportEnabled.properties.value == "True" MouseArea { id: enableSupportMouseArea anchors.fill: parent hoverEnabled: true - enabled: true - onClicked: - { - // The value is a string "True" or "False" - supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True"); - } - onEntered: - { - base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), - catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")); - } - onExited: - { - base.hideTooltip(); - } + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") + + onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), + catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) + + onExited: base.hideTooltip() + } } @@ -916,7 +922,7 @@ Item textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started anchors.top: enableSupportCheckBox.top - //anchors.topMargin: ((supportEnabled.properties.value === "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("thick_margin").height : 0 + anchors.left: enableSupportCheckBox.right anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) @@ -933,24 +939,21 @@ Item { if (supportExtruderNr.properties == null) { - return Cura.MachineManager.defaultExtruderPosition; + return Cura.MachineManager.defaultExtruderPosition } else { - var extruder = parseInt(supportExtruderNr.properties.value); + var extruder = parseInt(supportExtruderNr.properties.value) if ( extruder === -1) { - return Cura.MachineManager.defaultExtruderPosition; + return Cura.MachineManager.defaultExtruderPosition } return extruder; } } - onActivated: - { - // Send the extruder nr as a string. - supportExtruderNr.setPropertyValue("value", String(index)); - } + onActivated: supportExtruderNr.setPropertyValue("value", String(index)) + MouseArea { id: supportExtruderMouseArea @@ -963,17 +966,16 @@ Item base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); } - onExited: - { - base.hideTooltip(); - } + onExited: base.hideTooltip() + } function updateCurrentColor() { - var current_extruder = extruderModel.get(currentIndex); - if (current_extruder !== undefined) { - supportExtruderCombobox.color_override = current_extruder.color; + var current_extruder = extruderModel.get(currentIndex) + if (current_extruder !== undefined) + { + supportExtruderCombobox.color_override = current_extruder.color } } @@ -989,7 +991,8 @@ Item color: UM.Theme.getColor("text") elide: Text.ElideRight - anchors { + anchors + { left: parent.left leftMargin: UM.Theme.getSize("thick_margin").width right: infillCellLeft.right @@ -1008,7 +1011,7 @@ Item anchors.left: infillCellRight.left //: Setting enable printing build-plate adhesion helper checkbox - style: UM.Theme.styles.checkbox; + style: UM.Theme.styles.checkbox enabled: base.settingsEnabled visible: platformAdhesionType.properties.enabled == "True" @@ -1022,29 +1025,27 @@ Item enabled: base.settingsEnabled onClicked: { - var adhesionType = "skirt"; + var adhesionType = "skirt" if(!parent.checked) { // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft - platformAdhesionType.removeFromContainer(0); - adhesionType = platformAdhesionType.properties.value; + platformAdhesionType.removeFromContainer(0) + adhesionType = platformAdhesionType.properties.value if(adhesionType == "skirt" || adhesionType == "none") { // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim - adhesionType = "brim"; + adhesionType = "brim" } } - platformAdhesionType.setPropertyValue("value", adhesionType); + platformAdhesionType.setPropertyValue("value", adhesionType) } onEntered: { base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); } - onExited: - { - base.hideTooltip(); - } + onExited: base.hideTooltip() + } } @@ -1163,6 +1164,6 @@ Item color: extruders.getItem(extruderNumber).color }) } - supportExtruderCombobox.updateCurrentColor(); + supportExtruderCombobox.updateCurrentColor() } } From 987ff1737ff11223ec986cf74d79a0d529f2c5dd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 11:27:54 +0100 Subject: [PATCH 140/558] Remove unused background from PrintSetupSelector CURA-5785 --- resources/qml/SidebarSimple.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index affd1eb3a2..5e723a3d70 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -33,11 +33,10 @@ Item style: UM.Theme.styles.scrollview flickableItem.flickableDirection: Flickable.VerticalFlick - Rectangle + Item { width: childrenRect.width height: childrenRect.height - color: UM.Theme.getColor("main_background") // // Quality profile From ca637338270e12c7dd32e20e21dd005eae2066cb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 13:06:12 +0100 Subject: [PATCH 141/558] Updated header of the settingbar CURA-5785 --- resources/qml/IconWithText.qml | 60 ++++++++++++++++++ resources/qml/PrintSetupSelector.qml | 94 ++++++++++++++++++++++++---- 2 files changed, 141 insertions(+), 13 deletions(-) create mode 100644 resources/qml/IconWithText.qml diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml new file mode 100644 index 0000000000..0b0feea821 --- /dev/null +++ b/resources/qml/IconWithText.qml @@ -0,0 +1,60 @@ +// 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.0 +import QtQuick.Layouts 1.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +// Reusable component that holds an (re-colorable) icon on the left with some text on the right +Item +{ + property alias iconColor: icon.color + property alias source: icon.source + property alias text: label.text + + implicitWidth: icon.width + 100 + implicitHeight: icon.height + + Component.onCompleted: print(label.contentWidth) + + UM.RecolorImage + { + id: icon + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + color: "black" + + anchors + { + left: parent.left + verticalCenter: parent.verticalCenter + } + + } + + Label + { + id: label + height: contentHeight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + anchors + { + left: icon.right + right: parent.right + top: parent.top + bottom: parent.bottom + rightMargin: 0 + margins: UM.Theme.getSize("narrow_margin").width + } + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 7a415b1e2e..2daf8adb4b 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -18,12 +18,19 @@ Cura.ExpandableComponent property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced - UM.I18nCatalog { id: catalog; name: "cura"} + property string enabledText: catalog.i18nc("@label", "On") + property string disabledText: catalog.i18nc("@label", "Off") // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. signal showTooltip(Item item, point location, string text) signal hideTooltip() + UM.I18nCatalog + { + id: catalog + name: "cura" + } + Timer { id: tooltipDelayTimer @@ -32,18 +39,82 @@ Cura.ExpandableComponent property var item property string text - onTriggered: + onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) + } + + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + + headerItem: Row + { + anchors.fill: parent + + IconWithText { - base.showTooltip(base, {x: 0, y: item.y}, text); + source: UM.Theme.getIcon("category_layer_height") + text: Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: layerHeight + containerStackId: Cura.MachineManager.activeStackId + key: "layer_height" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_infill") + text: parseInt(infillDensity.properties.value) + "%" + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: infillDensity + containerStackId: Cura.MachineManager.activeStackId + key: "infill_sparse_density" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_support") + text: supportEnabled.properties.value == "True" ? enabledText : disabledText + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: supportEnabled + containerStack: Cura.MachineManager.activeMachine + key: "support_enable" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_adhesion") + text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + key: "adhesion_type" + watchedProperties: [ "value"] + } } } - onCurrentModeIndexChanged: - { - UM.Preferences.setValue("cura/active_mode", currentModeIndex); - } - headerItem: Label + /*Label { id: settingsModeLabel text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified") @@ -51,16 +122,13 @@ Cura.ExpandableComponent anchors { - left: parent.left - top: parent.top - margins: UM.Theme.getSize("thick_margin").width + fill: parent } - width: Math.round(parent.width * 0.45) height: contentHeight font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") - } + }*/ popupItem: Item { From 54685c983acf1e1d5d24425b67d7d5f5e7a2c3ff Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 13:29:21 +0100 Subject: [PATCH 142/558] Make PrintSetupSelector use layout instead of fixed width This makes the components autoscale a bit when needed. CURA-5785 --- resources/qml/IconWithText.qml | 22 ++++++++++++++++------ resources/qml/PrintSetupSelector.qml | 15 ++++----------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index 0b0feea821..d19c7e3899 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -8,18 +8,29 @@ import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura -// Reusable component that holds an (re-colorable) icon on the left with some text on the right +// Reusable component that holds an (re-colorable) icon on the left with some text on the right. +// This component is also designed to be used with layouts. It will use the width of the text + icon as preferred width +// It sets the icon size + half of the content as it's minium width (in which case it will elide the text) Item { property alias iconColor: icon.color property alias source: icon.source property alias text: label.text + property real margin: UM.Theme.getSize("narrow_margin").width + + // These properties can be used in combination with layouts. + readonly property real contentWidth: icon.width + margin + label.contentWidth + readonly property real minContentWidth: icon.width + margin + 0.5 * label.contentWidth + + Layout.minimumWidth: minContentWidth + Layout.preferredWidth: contentWidth + Layout.fillHeight: true + Layout.fillWidth: true + implicitWidth: icon.width + 100 implicitHeight: icon.height - Component.onCompleted: print(label.contentWidth) - UM.RecolorImage { id: icon @@ -35,18 +46,17 @@ Item left: parent.left verticalCenter: parent.verticalCenter } - } Label { id: label - height: contentHeight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") renderType: Text.NativeRendering elide: Text.ElideRight verticalAlignment: Text.AlignVCenter + anchors { left: icon.right @@ -54,7 +64,7 @@ Item top: parent.top bottom: parent.bottom rightMargin: 0 - margins: UM.Theme.getSize("narrow_margin").width + margins: margin } } } \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 2daf8adb4b..4a8ebda2b3 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -18,8 +18,8 @@ Cura.ExpandableComponent property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced - property string enabledText: catalog.i18nc("@label", "On") - property string disabledText: catalog.i18nc("@label", "Off") + property string enabledText: catalog.i18nc("@label:Should be short", "On") + property string disabledText: catalog.i18nc("@label:Should be short", "Off") // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. signal showTooltip(Item item, point location, string text) @@ -44,7 +44,7 @@ Cura.ExpandableComponent onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) - headerItem: Row + headerItem: RowLayout { anchors.fill: parent @@ -52,8 +52,6 @@ Cura.ExpandableComponent { source: UM.Theme.getIcon("category_layer_height") text: Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" - width: parent.width / 4 - height: parent.height UM.SettingPropertyProvider { @@ -68,8 +66,6 @@ Cura.ExpandableComponent { source: UM.Theme.getIcon("category_infill") text: parseInt(infillDensity.properties.value) + "%" - width: parent.width / 4 - height: parent.height UM.SettingPropertyProvider { @@ -84,8 +80,7 @@ Cura.ExpandableComponent { source: UM.Theme.getIcon("category_support") text: supportEnabled.properties.value == "True" ? enabledText : disabledText - width: parent.width / 4 - height: parent.height + UM.SettingPropertyProvider { @@ -100,8 +95,6 @@ Cura.ExpandableComponent { source: UM.Theme.getIcon("category_adhesion") text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText - width: parent.width / 4 - height: parent.height UM.SettingPropertyProvider { From 8d49d5a1b10fe1f6e6f1459fb0e602df1ab66bec Mon Sep 17 00:00:00 2001 From: THeijmans Date: Mon, 12 Nov 2018 13:29:51 +0100 Subject: [PATCH 143/558] CPE and CPE+ Comb retractions In this commit I changed all CPE and CPE+ profiles to have a 50mm combing max distance without retraction. This should decrease blobs caused by combing long distances. I also reverted the CPE infill back to triangles, as we now connect this infill type as well. --- .../ultimaker_s5/um_s5_aa0.25_CPE_Normal_Quality.inst.cfg | 1 + .../quality/ultimaker_s5/um_s5_aa0.4_CPEP_Draft_Print.inst.cfg | 2 +- .../quality/ultimaker_s5/um_s5_aa0.4_CPEP_Fast_Print.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.4_CPEP_High_Quality.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.4_CPEP_Normal_Quality.inst.cfg | 2 +- .../quality/ultimaker_s5/um_s5_aa0.4_CPE_Draft_Print.inst.cfg | 3 ++- .../quality/ultimaker_s5/um_s5_aa0.4_CPE_Fast_Print.inst.cfg | 3 ++- .../quality/ultimaker_s5/um_s5_aa0.4_CPE_High_Quality.inst.cfg | 3 ++- .../ultimaker_s5/um_s5_aa0.4_CPE_Normal_Quality.inst.cfg | 3 ++- .../um_s5_aa0.4_aluminum_CPEP_Draft_Print.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Fast_Print.inst.cfg | 2 +- .../um_s5_aa0.4_aluminum_CPEP_High_Quality.inst.cfg | 2 +- .../um_s5_aa0.4_aluminum_CPEP_Normal_Quality.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Draft_Print.inst.cfg | 3 ++- .../ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Fast_Print.inst.cfg | 3 ++- .../um_s5_aa0.4_aluminum_CPE_High_Quality.inst.cfg | 3 ++- .../um_s5_aa0.4_aluminum_CPE_Normal_Quality.inst.cfg | 3 ++- .../quality/ultimaker_s5/um_s5_aa0.8_CPEP_Fast_Print.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.8_CPEP_Superdraft_Print.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.8_CPEP_Verydraft_Print.inst.cfg | 2 +- .../quality/ultimaker_s5/um_s5_aa0.8_CPE_Draft_Print.inst.cfg | 1 + .../ultimaker_s5/um_s5_aa0.8_CPE_Superdraft_Print.inst.cfg | 1 + .../ultimaker_s5/um_s5_aa0.8_CPE_Verydraft_Print.inst.cfg | 1 + .../ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Fast_Print.inst.cfg | 2 +- .../um_s5_aa0.8_aluminum_CPEP_Superdraft_Print.inst.cfg | 2 +- .../um_s5_aa0.8_aluminum_CPEP_Verydraft_Print.inst.cfg | 2 +- .../ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Draft_Print.inst.cfg | 1 + .../um_s5_aa0.8_aluminum_CPE_Superdraft_Print.inst.cfg | 1 + .../um_s5_aa0.8_aluminum_CPE_Verydraft_Print.inst.cfg | 1 + 29 files changed, 37 insertions(+), 22 deletions(-) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.25_CPE_Normal_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.25_CPE_Normal_Quality.inst.cfg index 2068ed51c0..c15311d104 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.25_CPE_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.25_CPE_Normal_Quality.inst.cfg @@ -12,6 +12,7 @@ material = generic_cpe variant = AA 0.25 [values] +retraction_combing_max_distance = 50 retraction_extrusion_window = 0.5 speed_infill = =math.ceil(speed_print * 40 / 55) speed_topbottom = =math.ceil(speed_print * 30 / 55) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Draft_Print.inst.cfg index 421fcdf095..627302e0ab 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Draft_Print.inst.cfg @@ -29,7 +29,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Fast_Print.inst.cfg index 536c6c97b8..cda8d85211 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Fast_Print.inst.cfg @@ -29,7 +29,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_High_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_High_Quality.inst.cfg index 77182c21e1..3ce76bf6be 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_High_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_High_Quality.inst.cfg @@ -31,7 +31,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Normal_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Normal_Quality.inst.cfg index d779baf315..d402b663c6 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPEP_Normal_Quality.inst.cfg @@ -31,7 +31,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Draft_Print.inst.cfg index c51e5652e1..505cd952d2 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Draft_Print.inst.cfg @@ -15,6 +15,7 @@ variant = AA 0.4 material_print_temperature = =default_material_print_temperature + 10 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 skin_overlap = 20 speed_print = 60 speed_layer_0 = =math.ceil(speed_print * 20 / 60) @@ -24,5 +25,5 @@ speed_wall_0 = =math.ceil(speed_wall * 35 / 45) wall_thickness = 1 -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 50 / 60) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Fast_Print.inst.cfg index b80d3ccf22..cc5df0abb9 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Fast_Print.inst.cfg @@ -16,11 +16,12 @@ cool_min_speed = 7 material_print_temperature = =default_material_print_temperature + 5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 60 speed_layer_0 = =math.ceil(speed_print * 20 / 60) speed_topbottom = =math.ceil(speed_print * 30 / 60) speed_wall = =math.ceil(speed_print * 40 / 60) speed_wall_0 = =math.ceil(speed_wall * 30 / 40) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 50 / 60) \ No newline at end of file diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_High_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_High_Quality.inst.cfg index c90eedaec3..c81dc0f5a7 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_High_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_High_Quality.inst.cfg @@ -18,10 +18,11 @@ machine_nozzle_heat_up_speed = 1.5 material_print_temperature = =default_material_print_temperature - 5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 50 speed_layer_0 = =math.ceil(speed_print * 20 / 50) speed_topbottom = =math.ceil(speed_print * 30 / 50) speed_wall = =math.ceil(speed_print * 30 / 50) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 40 / 50) \ No newline at end of file diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Normal_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Normal_Quality.inst.cfg index e098b0ffb4..7d29f8fb7c 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_CPE_Normal_Quality.inst.cfg @@ -16,10 +16,11 @@ machine_nozzle_cool_down_speed = 0.85 machine_nozzle_heat_up_speed = 1.5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 55 speed_layer_0 = =math.ceil(speed_print * 20 / 55) speed_topbottom = =math.ceil(speed_print * 30 / 55) speed_wall = =math.ceil(speed_print * 30 / 55) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 45 / 55) \ No newline at end of file diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Draft_Print.inst.cfg index 46e3483a6a..4a55f5d24c 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Draft_Print.inst.cfg @@ -30,7 +30,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Fast_Print.inst.cfg index 5c235b656a..730e058212 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Fast_Print.inst.cfg @@ -30,7 +30,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_High_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_High_Quality.inst.cfg index 326a730fe4..e6921e63d8 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_High_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_High_Quality.inst.cfg @@ -32,7 +32,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Normal_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Normal_Quality.inst.cfg index d40b2db90e..a4eec45e38 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPEP_Normal_Quality.inst.cfg @@ -32,7 +32,7 @@ material_print_temperature_layer_0 = =material_print_temperature multiple_mesh_overlap = 0 prime_tower_enable = True prime_tower_wipe_enabled = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_extrusion_window = 1 retraction_hop = 0.2 retraction_hop_enabled = False diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Draft_Print.inst.cfg index c812066e0c..4f085f10a6 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Draft_Print.inst.cfg @@ -16,6 +16,7 @@ buildplate = Aluminum material_print_temperature = =default_material_print_temperature + 10 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 skin_overlap = 20 speed_print = 60 speed_layer_0 = 20 @@ -25,7 +26,7 @@ speed_wall_0 = =math.ceil(speed_wall * 35 / 45) wall_thickness = 1 -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 50 / 60) prime_tower_purge_volume = 1 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Fast_Print.inst.cfg index ef634316da..2580bf952d 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Fast_Print.inst.cfg @@ -17,13 +17,14 @@ cool_min_speed = 7 material_print_temperature = =default_material_print_temperature + 5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 60 speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 60) speed_wall = =math.ceil(speed_print * 40 / 60) speed_wall_0 = =math.ceil(speed_wall * 30 / 40) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 50 / 60) prime_tower_purge_volume = 1 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_High_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_High_Quality.inst.cfg index cda97e6ab3..d6f07c37a5 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_High_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_High_Quality.inst.cfg @@ -19,12 +19,13 @@ machine_nozzle_heat_up_speed = 1.5 material_print_temperature = =default_material_print_temperature - 5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 50 speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 50) speed_wall = =math.ceil(speed_print * 30 / 50) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 40 / 50) prime_tower_purge_volume = 1 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Normal_Quality.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Normal_Quality.inst.cfg index 5a75f3b6e3..6032ff3845 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.4_aluminum_CPE_Normal_Quality.inst.cfg @@ -17,12 +17,13 @@ machine_nozzle_cool_down_speed = 0.85 machine_nozzle_heat_up_speed = 1.5 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 +retraction_combing_max_distance = 50 speed_print = 55 speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 55) speed_wall = =math.ceil(speed_print * 30 / 55) -infill_pattern = zigzag +infill_pattern = triangles speed_infill = =math.ceil(speed_print * 45 / 55) prime_tower_purge_volume = 1 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Fast_Print.inst.cfg index e78006689b..b855eb2c8b 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Fast_Print.inst.cfg @@ -22,7 +22,7 @@ material_print_temperature = =default_material_print_temperature - 10 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Superdraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Superdraft_Print.inst.cfg index c6d0962157..d74711e8cf 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Superdraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Superdraft_Print.inst.cfg @@ -22,7 +22,7 @@ material_print_temperature = =default_material_print_temperature - 5 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Verydraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Verydraft_Print.inst.cfg index b80f773594..b65a7ff93c 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Verydraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPEP_Verydraft_Print.inst.cfg @@ -22,7 +22,7 @@ material_print_temperature = =default_material_print_temperature - 7 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Draft_Print.inst.cfg index 532aacabf7..7cb69ba3eb 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Draft_Print.inst.cfg @@ -17,6 +17,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 15 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 40 speed_topbottom = =math.ceil(speed_print * 25 / 40) speed_wall = =math.ceil(speed_print * 30 / 40) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Superdraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Superdraft_Print.inst.cfg index 55b9ae8315..6c323fe602 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Superdraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Superdraft_Print.inst.cfg @@ -17,6 +17,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 20 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 45 speed_topbottom = =math.ceil(speed_print * 30 / 45) speed_wall = =math.ceil(speed_print * 40 / 45) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Verydraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Verydraft_Print.inst.cfg index 01761062a4..a0380ecc0e 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Verydraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_CPE_Verydraft_Print.inst.cfg @@ -17,6 +17,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 17 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 40 speed_topbottom = =math.ceil(speed_print * 25 / 40) speed_wall = =math.ceil(speed_print * 30 / 40) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Fast_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Fast_Print.inst.cfg index 3e74390840..c01f9b1ff1 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Fast_Print.inst.cfg @@ -23,7 +23,7 @@ material_print_temperature = =default_material_print_temperature - 10 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Superdraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Superdraft_Print.inst.cfg index 4c1b807430..b9c9ef6611 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Superdraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Superdraft_Print.inst.cfg @@ -23,7 +23,7 @@ material_print_temperature = =default_material_print_temperature - 5 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Verydraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Verydraft_Print.inst.cfg index 11aefc90cd..be2cc62b08 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Verydraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPEP_Verydraft_Print.inst.cfg @@ -23,7 +23,7 @@ material_print_temperature = =default_material_print_temperature - 7 material_print_temperature_layer_0 = =material_print_temperature material_standby_temperature = 100 prime_tower_enable = True -retraction_combing = off +retraction_combing_max_distance = 50 retraction_hop = 0.1 retraction_hop_enabled = False skin_overlap = 0 diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Draft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Draft_Print.inst.cfg index 80c0585061..0d0ed8f8b2 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Draft_Print.inst.cfg @@ -18,6 +18,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 15 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 40 speed_topbottom = =math.ceil(speed_print * 25 / 40) speed_wall = =math.ceil(speed_print * 30 / 40) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Superdraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Superdraft_Print.inst.cfg index 5dcc454173..a163e0c735 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Superdraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Superdraft_Print.inst.cfg @@ -18,6 +18,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 20 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 45 speed_topbottom = =math.ceil(speed_print * 30 / 45) speed_wall = =math.ceil(speed_print * 40 / 45) diff --git a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Verydraft_Print.inst.cfg b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Verydraft_Print.inst.cfg index 8423e109e8..2137cf740b 100644 --- a/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Verydraft_Print.inst.cfg +++ b/resources/quality/ultimaker_s5/um_s5_aa0.8_aluminum_CPE_Verydraft_Print.inst.cfg @@ -18,6 +18,7 @@ line_width = =machine_nozzle_size * 0.875 material_print_temperature = =default_material_print_temperature + 17 material_standby_temperature = 100 prime_tower_enable = True +retraction_combing_max_distance = 50 speed_print = 40 speed_topbottom = =math.ceil(speed_print * 25 / 40) speed_wall = =math.ceil(speed_print * 30 / 40) From 4be33031d7553c06ed7bf5adab7d2f9c31008dae Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 14:07:45 +0100 Subject: [PATCH 144/558] Added icons to ExpandableComponent This also makes the entire header react to mouse events instead of just the icon/button CURA-5785 --- resources/qml/ExpandableComponent.qml | 31 ++++++++++++++++--- .../QuickConfigurationSelector.qml | 2 ++ resources/qml/PrintSetupSelector.qml | 8 +++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 26bdf3b3ce..af579340a5 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -6,7 +6,7 @@ import UM 1.2 as UM // The expandable component has 3 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded // * The popupItem; The content that needs to be shown if the component is expanded. -// * The Button; The actual button that expands the popup. +// * The Icon; An icon that is displayed on the right of the drawer. Item { // The headerItem holds the QML item that is always displayed. @@ -26,6 +26,18 @@ Item // How much padding is needed around the header & button property alias headerPadding: background.padding + // What icon should be displayed on the right. + property alias iconSource: collapseButton.source + + // What is the color of the icon? + property alias iconColor: collapseButton.color + + // The icon size (it's always drawn as a square) + property alias iconSize: collapseButton.width + + // Is the "drawer" open? + readonly property alias expanded: popup.visible + onPopupItemChanged: { // Since we want the size of the popup to be set by the size of the content, @@ -57,17 +69,26 @@ Item } } - Button + UM.RecolorImage { id: collapseButton anchors { right: parent.right - top: parent.top - bottom: parent.bottom + verticalCenter: parent.verticalCenter margins: background.padding } - text: popup.visible ? "close" : "open" + sourceSize.width: width + sourceSize.height: height + visible: source != "" + width: UM.Theme.getSize("section_icon").width + height: width + color: "black" + } + + MouseArea + { + anchors.fill: parent onClicked: popup.visible ? popup.close() : popup.open() } } diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 3c354384c7..75787ea033 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -27,6 +27,8 @@ Cura.ExpandableComponent name: "cura" } + iconSource: expanded ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") + headerItem: Item { // Horizontal list that shows the extruders diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 4a8ebda2b3..1281961ef4 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -14,7 +14,6 @@ Cura.ExpandableComponent { id: base - height: childrenRect.height property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced @@ -25,6 +24,11 @@ Cura.ExpandableComponent signal showTooltip(Item item, point location, string text) signal hideTooltip() + height: childrenRect.height + iconSource: UM.Theme.getIcon("pencil") + + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + UM.I18nCatalog { id: catalog @@ -42,8 +46,6 @@ Cura.ExpandableComponent onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) } - onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) - headerItem: RowLayout { anchors.fill: parent From 783fe9ab73db3c24abe5dbfcfd6e34ce4c09f911 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 15:23:58 +0100 Subject: [PATCH 145/558] Updated the look of the extruder buttons CURA-5785 --- resources/qml/ExtruderButton.qml | 60 ++++---------------------------- resources/qml/Toolbar.qml | 7 +++- 2 files changed, 13 insertions(+), 54 deletions(-) diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 7923521658..764e9c94cb 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.0 import UM 1.2 as UM import Cura 1.0 as Cura @@ -11,65 +11,19 @@ Button { id: base - property var extruder; + property var extruder text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name) - style: UM.Theme.styles.toolbar_button - iconSource: UM.Theme.getIcon("extruder_button") - checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1 enabled: UM.Selection.hasSelection && extruder.stack.isEnabled - Item + background: Item {} + contentItem: ExtruderIcon { - anchors.centerIn: parent - width: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("default_margin").height - opacity: !base.enabled ? 0.2 : 1.0 - - Label - { - anchors.centerIn: parent - text: index + 1 - color: - { - if (base.checked) - { - return UM.Theme.getColor("toolbar_button_text_active") - } - else if(base.hovered) - { - return UM.Theme.getColor("toolbar_button_text_hover") - } - return UM.Theme.getColor("toolbar_button_text") - } - font: UM.Theme.getFont("default_bold") - } - } - - // Material colour circle - // Only draw the filling colour of the material inside the SVG border. - Rectangle - { - anchors - { - right: parent.right - top: parent.top - rightMargin: UM.Theme.getSize("extruder_button_material_margin").width - topMargin: UM.Theme.getSize("extruder_button_material_margin").height - } - - color: model.color - - width: UM.Theme.getSize("extruder_button_material").width - height: UM.Theme.getSize("extruder_button_material").height - radius: Math.round(width / 2) - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("extruder_button_material_border") - - opacity: !base.enabled ? 0.2 : 1.0 + width: UM.Theme.getSize("button_icon").width + materialColor: model.color + property int index: extruder.index } onClicked: diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 9955ceeba7..2239125fbe 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -116,7 +116,12 @@ Item height: childrenRect.height property var _model: Cura.ExtrudersModel { id: extrudersModel } model: _model.items.length > 1 ? _model : 0 - ExtruderButton { extruder: model } + ExtruderButton + { + extruder: model + height: UM.Theme.getSize("button").width + width: UM.Theme.getSize("button").width + } } } } From 4c1a45f904faf1b7e37bef6e18c476b113a6df58 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 15:53:09 +0100 Subject: [PATCH 146/558] Added sizes to the stage menu This isn't themed, but right now it does adhere to the sizes I got from UX CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 73 +++++++++++++++------------- resources/qml/MachineSelector.qml | 2 +- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ff8cdc2a47..9fd8747e28 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -1,5 +1,5 @@ import QtQuick 2.7 - +import QtQuick.Layouts 1.1 import QtQuick.Controls 1.4 import UM 1.3 as UM @@ -19,9 +19,12 @@ Item name: "cura" } - Row + // Item to ensure that all of the buttons are nicely centered. + Item { anchors.horizontalCenter: parent.horizontalCenter + width: openFileButton.width + UM.Theme.getSize("default_margin").width + itemRow.width + height: parent.height Button { @@ -33,42 +36,46 @@ Item action: Cura.Actions.open } - Item + RowLayout { - id: spacing - width: UM.Theme.getSize("default_margin").width - height: prepareMenu.height - } + id: itemRow - Cura.MachineSelector - { - id: machineSelection - width: UM.Theme.getSize("machine_selector_widget").width - configSelection.width - height: prepareMenu.height - z: openFileButton.z - 1 - } + anchors.left: openFileButton.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width - Cura.QuickConfigurationSelector - { - height: prepareMenu.height - width: UM.Theme.getSize("configuration_selector_widget").width - /*id: configSelection - width: visible ? UM.Theme.getSize("machine_selector_widget").width * 0.2 : 0 - panelWidth: UM.Theme.getSize("machine_selector_widget").width - height: prepareMenu.height*/ - } + width: 0.9 * prepareMenu.width + height: parent.height - /*Cura.CustomConfigurationSelector - { - width: UM.Theme.getSize("configuration_selector_widget").width - }*/ + Cura.MachineSelector + { + id: machineSelection + z: openFileButton.z - 1 - Cura.PrintSetupSelector - { - width: UM.Theme.getSize("print_setup_widget").width - height: prepareMenu.height - onShowTooltip: prepareMenu.showTooltip(item, location, text) - onHideTooltip: prepareMenu.hideTooltip() + Layout.minimumWidth: 240 + Layout.maximumWidth: 240 + Layout.fillWidth: true + Layout.fillHeight: true + } + + Cura.QuickConfigurationSelector + { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width + } + + Cura.PrintSetupSelector + { + id: printSetupSelector + + onShowTooltip: prepareMenu.showTooltip(item, location, text) + onHideTooltip: prepareMenu.hideTooltip() + + Layout.minimumWidth: 460 + Layout.maximumWidth: 460 + Layout.fillWidth: true + Layout.fillHeight: true + } } } } \ No newline at end of file diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index d82211af3a..b4ca9a4899 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -19,7 +19,7 @@ ToolButton text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName tooltip: Cura.MachineManager.activeMachineName - + width: 240 style: ButtonStyle { background: Rectangle From fe4ed464962d76abd6a8058f1f69987f8bad205d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 16:55:42 +0100 Subject: [PATCH 147/558] Show material name instead of just color CURA-5785 --- .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 75787ea033..7c70229b5d 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -54,7 +54,7 @@ Cura.ExpandableComponent width: height } - // Label for the human readable material color name + // Label for the brand of the material Label { id: brandNameLabel @@ -71,10 +71,10 @@ Cura.ExpandableComponent } } - // Label that shows the brand of the material + // Label that shows the name of the material Label { - text: model.color_name + text: model.material elide: Text.ElideRight anchors From c18b8241f55f425d5c6a91c00bb8d130560bbdbb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 14:00:00 +0100 Subject: [PATCH 148/558] Change MachineSelection so that it also uses the ExpandableComponent CURA-5785 --- resources/qml/Cura.qml | 1 - resources/qml/MachineSelector.qml | 176 ++++++++++++++++++------------ 2 files changed, 108 insertions(+), 69 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 819d986ece..cdbf1f3511 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -249,7 +249,6 @@ UM.MainWindow source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : "" } - Loader { // The stage menu is, as the name implies, a menu that is defined by the active stage. diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index b4ca9a4899..206229e837 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.4 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 @@ -10,77 +10,117 @@ import UM 1.2 as UM import Cura 1.0 as Cura import "Menus" -ToolButton + +Cura.ExpandableComponent { - id: base + id: machineSelector + property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" - property bool printerConnected: Cura.MachineManager.printerConnected - property var printerStatus: Cura.MachineManager.printerConnected ? "connected" : "disconnected" - text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName - tooltip: Cura.MachineManager.activeMachineName - width: 240 - style: ButtonStyle + iconSource: expanded ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") + + UM.I18nCatalog { - background: Rectangle - { - color: - { - if (control.pressed) { - return UM.Theme.getColor("machine_selector_active"); - } - else if (control.hovered) { - return UM.Theme.getColor("machine_selector_hover"); - } - else { - return UM.Theme.getColor("machine_selector_bar"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - - UM.RecolorImage - { - id: downArrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_emphasis") - source: UM.Theme.getIcon("arrow_bottom") - } - - PrinterStatusIcon - { - id: printerStatusIcon - visible: printerConnected || isNetworkPrinter - status: printerStatus - anchors - { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width - } - } - - Label - { - id: sidebarComboBoxLabel - color: UM.Theme.getColor("machine_selector_text_active") - text: control.text; - elide: Text.ElideRight; - anchors.left: printerStatusIcon.visible ? printerStatusIcon.right : parent.left; - anchors.leftMargin: printerStatusIcon.visible ? UM.Theme.getSize("narrow_margin").width : UM.Theme.getSize("thick_margin").width - anchors.right: downArrow.left; - anchors.rightMargin: control.rightMargin; - anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("medium_bold") - } - } - label: Label {} + id: catalog + name: "cura" } - menu: PrinterMenu { } + headerItem: Item + { + Label + { + text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName + verticalAlignment: Text.AlignVCenter + height: parent.height + } + } + + popupItem: Item + { + id: popup + width: 240 + height: 200 + + ScrollView + { + anchors.fill: parent + contentHeight: column.implicitHeight + contentWidth: row.implicitWidth + clip: true + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + + Column + { + id: column + anchors.fill: parent + Label + { + text: catalog.i18nc("@label", "Networked Printers") + visible: networkedPrintersModel.items.length > 0 + height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + font: UM.Theme.getFont("medium_bold") + verticalAlignment: Text.AlignVCenter + } + + Repeater + { + id: networkedPrinters + + model: UM.ContainerStacksModel + { + id: networkedPrintersModel + filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} + } + + delegate: RoundButton + { + text: name + width: parent.width + + checkable: true + onClicked: Cura.MachineManager.setActiveMachine(model.id) + radius: UM.Theme.getSize("default_radius").width + + Connections + { + target: Cura.MachineManager + onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + } + } + + } + + Label + { + text: catalog.i18nc("@label", "Virtual Printers") + visible: virtualPrintersModel.items.length > 0 + height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + font: UM.Theme.getFont("medium_bold") + verticalAlignment: Text.AlignVCenter + } + + Repeater + { + id: virtualPrinters + + model: UM.ContainerStacksModel + { + id: virtualPrintersModel + filter: {"type": "machine", "um_network_key": null} + } + + delegate: RoundButton + { + text: name + width: parent.width + checked: Cura.MachineManager.activeMachineId == model.id + checkable: true + onClicked: Cura.MachineManager.setActiveMachine(model.id) + radius: UM.Theme.getSize("default_radius").width + } + + } + } + } + } } From deb5fd1926763af05bf107fe7599cff1f085ec23 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 15:35:05 +0100 Subject: [PATCH 149/558] Fix PrintSetupSelector for previewStage CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 3 ++- resources/qml/PrintSetupSelector.qml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 66f7d527d9..db96525365 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -25,7 +25,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter spacing: UM.Theme.getSize("default_margin").width - + height: parent.height ComboBox { // This item contains the views selector, a combobox that is dynamically created from @@ -87,6 +87,7 @@ Item Cura.PrintSetupSelector { width: UM.Theme.getSize("print_setup_widget").width + height: parent.height onShowTooltip: previewMenu.showTooltip(item, location, text) onHideTooltip: previewMenu.hideTooltip() } diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 1281961ef4..65bcee8507 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -24,6 +24,7 @@ Cura.ExpandableComponent signal showTooltip(Item item, point location, string text) signal hideTooltip() + implicitWidth: 200 height: childrenRect.height iconSource: UM.Theme.getIcon("pencil") From 785c2661a2ad382d77285cbb124bfee1e5f1985e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 15:57:00 +0100 Subject: [PATCH 150/558] Make SimulationViewMenuComponent also use the ExpandableComponent CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 2 +- .../SimulationViewMenuComponent.qml | 74 +++---------------- resources/qml/ExpandableComponent.qml | 8 ++ 3 files changed, 20 insertions(+), 64 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index db96525365..aeef2bf300 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -78,7 +78,7 @@ Item property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - height: childrenRect.height + height: parent.height width: childrenRect.width source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index d251244c9f..fe9f4471fd 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -10,19 +10,13 @@ import QtGraphicalEffects 1.0 import UM 1.0 as UM import Cura 1.0 as Cura -Rectangle + +Cura.ExpandableComponent { id: base - color: UM.Theme.getColor("tool_panel_background") - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - width: UM.Theme.getSize("layerview_menu_size").width - - height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height + 2 * UM.Theme.getSize("default_margin").height - - Behavior on height { NumberAnimation { duration: 100 } } + iconSource: UM.Theme.getIcon("pencil") property var buttonTarget: { @@ -51,59 +45,21 @@ Rectangle } } - Label + headerItem: Label { id: layerViewTypesLabel - text: catalog.i18nc("@label","Color scheme") - font: UM.Theme.getFont("default"); + text: catalog.i18nc("@label", "Color scheme") + font: UM.Theme.getFont("default") visible: !UM.SimulationView.compatibilityMode color: UM.Theme.getColor("setting_control_text") - height: contentHeight - anchors - { - top: parent.top - margins: UM.Theme.getSize("default_margin").height - right: collapseButton.left - left: parent.left - } + height: base.height + verticalAlignment: Text.AlignVCenter } - Button - { - id: collapseButton - - anchors - { - top: parent.top - margins: UM.Theme.getSize("default_margin").width - right: parent.right - } - - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - - onClicked: viewSettings.collapsed = !viewSettings.collapsed - - style: ButtonStyle - { - background: UM.RecolorImage - { - width: control.width - height: control.height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("setting_control_text") - source: viewSettings.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") - } - label: Label{ } - } - } - - Column + popupItem: Column { id: viewSettings - property bool collapsed: false property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|") property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves") property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers") @@ -118,19 +74,11 @@ Rectangle property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers") property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") - anchors - { - top: layerViewTypesLabel.bottom - left: parent.left - right: parent.right - margins: UM.Theme.getSize("default_margin").height - - } + width: UM.Theme.getSize("layerview_menu_size").width + height: childrenRect.height spacing: UM.Theme.getSize("layerview_row_spacing").height - visible: !collapsed - ListModel // matches SimulationView.py { id: layerViewTypes diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index af579340a5..06b4146a57 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -47,6 +47,14 @@ Item popup.contentItem = popupItem } + Connections + { + // Since it could be that the popup is dynamically populated, we should also take these changes into account. + target: popupItem + onWidthChanged: popup.width = popupItem.width + 2 * popup.padding + onHeightChanged: popup.height = popupItem.height + 2 * popup.padding + } + implicitHeight: 100 implicitWidth: 400 Rectangle From c9389dd9ab824b40a09b13fd9f3939ffc531f874 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 15:58:34 +0100 Subject: [PATCH 151/558] Codestyle fixes --- resources/qml/PrintSetupSelector.qml | 29 ++++++---------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 65bcee8507..7a7d438bc3 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -109,23 +109,6 @@ Cura.ExpandableComponent } } - - /*Label - { - id: settingsModeLabel - text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified") - renderType: Text.NativeRendering - - anchors - { - fill: parent - } - - height: contentHeight - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - }*/ - popupItem: Item { height: settingsModeSelection.height + sidebarContents.height @@ -184,7 +167,7 @@ Cura.ExpandableComponent border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is + // For some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } @@ -200,13 +183,13 @@ Cura.ExpandableComponent { if(control.pressed) { - return UM.Theme.getColor("action_button_active_text"); + return UM.Theme.getColor("action_button_active_text") } else if(control.hovered) { - return UM.Theme.getColor("action_button_hovered_text"); + return UM.Theme.getColor("action_button_hovered_text") } - return UM.Theme.getColor("action_button_text"); + return UM.Theme.getColor("action_button_text") } } } @@ -263,11 +246,11 @@ Cura.ExpandableComponent if(index != null && !isNaN(index)) { - currentModeIndex = index; + currentModeIndex = index } else { - currentModeIndex = 0; + currentModeIndex = 0 } } } From 20e2f317de0507ec889baa5dc30cf48277165bdb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:02:45 +0100 Subject: [PATCH 152/558] Add background to viewModeSelection CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 71 +++++++++++++++------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index aeef2bf300..f21c13a5bc 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -26,49 +26,56 @@ Item anchors.horizontalCenter: parent.horizontalCenter spacing: UM.Theme.getSize("default_margin").width height: parent.height - ComboBox + + Rectangle { - // This item contains the views selector, a combobox that is dynamically created from - // the list of available Views (packages that create different visualizations of the - // scene). - id: viewModeButton - - style: UM.Theme.styles.combobox - - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags() + color: UM.Theme.getColor("tool_panel_background") + width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width + height: parent.height + ComboBox { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) - { - model.getItem(i).active = (i == currentIndex) - } - } + // This item contains the views selector, a combobox that is dynamically created from + // the list of available Views (packages that create different visualizations of the + // scene). + id: viewModeButton - // get the index of the active model item on start - function getActiveIndex() - { - for (var i = 0; i < model.rowCount(); i++) + style: UM.Theme.styles.combobox + anchors.centerIn: parent + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags() { - if (model.getItem(i).active) + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) { - return i; + model.getItem(i).active = (i == currentIndex) } } - return 0 - } - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) + // get the index of the active model item on start + function getActiveIndex() { - UM.Controller.setActiveView(model.getItem(currentIndex).id) + for (var i = 0; i < model.rowCount(); i++) + { + if (model.getItem(i).active) + { + return i; + } + } + return 0 } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + UM.Controller.setActiveView(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() } - currentIndex: getActiveIndex() } Loader From 4b8d20cad770646c9f33c6ca5a508bedee968858 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 13 Nov 2018 16:27:19 +0100 Subject: [PATCH 153/558] Correct the link to create a new account Previously this button just took you to the log-in page. Fixes issue CURA-5921. --- resources/qml/Account/GeneralOperations.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 362e088033..4614c4ba88 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -20,7 +20,7 @@ Row hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("main_window_header_button_text_active") textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") - onClicked: Qt.openUrlExternally("https://account.ultimaker.com") + onClicked: Qt.openUrlExternally("https://account.ultimaker.com/app/create") fixedWidthMode: true } From b83175a380e170a71e8b6cdfae0235a4777e9c44 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:31:48 +0100 Subject: [PATCH 154/558] Add rounded corners to stage menus CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 72 +++++++++------ plugins/PreviewStage/PreviewMenu.qml | 130 +++++++++++++++------------ 2 files changed, 117 insertions(+), 85 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 9fd8747e28..7006545204 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -23,7 +23,7 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButton.width + UM.Theme.getSize("default_margin").width + itemRow.width + width: openFileButton.width + itemRowBackground.width height: parent.height Button @@ -36,45 +36,59 @@ Item action: Cura.Actions.open } - RowLayout + Rectangle { - id: itemRow + id: itemRowBackground + radius: UM.Theme.getSize("default_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("toolbar_background") + + width: itemRow.width + UM.Theme.getSize("default_margin").width + height: parent.height anchors.left: openFileButton.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: 0.9 * prepareMenu.width - height: parent.height - - Cura.MachineSelector + RowLayout { - id: machineSelection - z: openFileButton.z - 1 + id: itemRow - Layout.minimumWidth: 240 - Layout.maximumWidth: 240 - Layout.fillWidth: true - Layout.fillHeight: true - } + anchors.centerIn: parent - Cura.QuickConfigurationSelector - { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width - } + width: 0.9 * prepareMenu.width + height: parent.height - 2 * UM.Theme.getSize("default_lining").width - Cura.PrintSetupSelector - { - id: printSetupSelector + Cura.MachineSelector + { + id: machineSelection + z: openFileButton.z - 1 - onShowTooltip: prepareMenu.showTooltip(item, location, text) - onHideTooltip: prepareMenu.hideTooltip() + Layout.minimumWidth: 240 + Layout.maximumWidth: 240 + Layout.fillWidth: true + Layout.fillHeight: true + } - Layout.minimumWidth: 460 - Layout.maximumWidth: 460 - Layout.fillWidth: true - Layout.fillHeight: true + Cura.QuickConfigurationSelector + { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width + } + + Cura.PrintSetupSelector + { + id: printSetupSelector + + onShowTooltip: prepareMenu.showTooltip(item, location, text) + onHideTooltip: prepareMenu.hideTooltip() + + Layout.minimumWidth: 460 + Layout.maximumWidth: 460 + Layout.fillWidth: true + Layout.fillHeight: true + } } } } diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index f21c13a5bc..1741706679 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -15,88 +15,106 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() + property real itemHeight: height - 2 * UM.Theme.getSize("default_lining").width + UM.I18nCatalog { id: catalog name: "cura" } - Row + Rectangle { - anchors.horizontalCenter: parent.horizontalCenter - spacing: UM.Theme.getSize("default_margin").width + anchors.fill: stageMenu + anchors.leftMargin: -radius + radius: UM.Theme.getSize("default_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("toolbar_background") + } + + Item + { + id: stageMenu height: parent.height - - Rectangle + width: childrenRect.width + UM.Theme.getSize("default_margin").width + anchors.horizontalCenter: parent.horizontalCenter + Row { - color: UM.Theme.getColor("tool_panel_background") - width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width - height: parent.height - ComboBox + anchors.centerIn: parent + spacing: UM.Theme.getSize("default_margin").width + height: parent.height - 2 * UM.Theme.getSize("default_lining").width + + Item { - // This item contains the views selector, a combobox that is dynamically created from - // the list of available Views (packages that create different visualizations of the - // scene). - id: viewModeButton - - style: UM.Theme.styles.combobox - anchors.centerIn: parent - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags() + width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width + height: parent.height + ComboBox { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) - { - model.getItem(i).active = (i == currentIndex) - } - } + // This item contains the views selector, a combobox that is dynamically created from + // the list of available Views (packages that create different visualizations of the + // scene). + id: viewModeButton - // get the index of the active model item on start - function getActiveIndex() - { - for (var i = 0; i < model.rowCount(); i++) + style: UM.Theme.styles.combobox + anchors.centerIn: parent + model: UM.ViewModel { } + textRole: "name" + + // update the model's active index + function updateItemActiveFlags() { - if (model.getItem(i).active) + currentIndex = getActiveIndex() + for (var i = 0; i < model.rowCount(); i++) { - return i; + model.getItem(i).active = (i == currentIndex) } } - return 0 - } - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) + // get the index of the active model item on start + function getActiveIndex() { - UM.Controller.setActiveView(model.getItem(currentIndex).id) + for (var i = 0; i < model.rowCount(); i++) + { + if (model.getItem(i).active) + { + return i; + } + } + return 0 } + + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + { + UM.Controller.setActiveView(model.getItem(currentIndex).id) + } + } + currentIndex: getActiveIndex() } - currentIndex: getActiveIndex() } - } - Loader - { - // TODO: Make this panel collapsable and ensure it has a standardised background. - id: viewPanel + Loader + { + // TODO: Make this panel collapsable and ensure it has a standardised background. + id: viewPanel - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - height: parent.height - width: childrenRect.width + height: parent.height + width: childrenRect.width - source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" - } + source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" + } - Cura.PrintSetupSelector - { - width: UM.Theme.getSize("print_setup_widget").width - height: parent.height - onShowTooltip: previewMenu.showTooltip(item, location, text) - onHideTooltip: previewMenu.hideTooltip() + Cura.PrintSetupSelector + { + width: UM.Theme.getSize("print_setup_widget").width + height: parent.height + onShowTooltip: previewMenu.showTooltip(item, location, text) + onHideTooltip: previewMenu.hideTooltip() + } } } } \ No newline at end of file From 551bc2fbd41984a4ca11a4d42a49be04736f5e9b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:40:51 +0100 Subject: [PATCH 155/558] Removed line around the headerbar I was checking an old design, the new one doesn't have a line around it CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 5 ++--- plugins/PreviewStage/PreviewMenu.qml | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 7006545204..ac43fd5634 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -40,8 +40,7 @@ Item { id: itemRowBackground radius: UM.Theme.getSize("default_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("toolbar_background") width: itemRow.width + UM.Theme.getSize("default_margin").width @@ -57,7 +56,7 @@ Item anchors.centerIn: parent width: 0.9 * prepareMenu.width - height: parent.height - 2 * UM.Theme.getSize("default_lining").width + height: parent.height Cura.MachineSelector { diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 1741706679..b441a78dff 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -28,8 +28,6 @@ Item anchors.fill: stageMenu anchors.leftMargin: -radius radius: UM.Theme.getSize("default_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") color: UM.Theme.getColor("toolbar_background") } @@ -43,7 +41,7 @@ Item { anchors.centerIn: parent spacing: UM.Theme.getSize("default_margin").width - height: parent.height - 2 * UM.Theme.getSize("default_lining").width + height: parent.height Item { From a9fdd455ebf39dbc66f592324ebcca08620ed14e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:47:39 +0100 Subject: [PATCH 156/558] Add seperator lines for the stageMenu's CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 18 +++++++++++++++++- plugins/PreviewStage/PreviewMenu.qml | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ac43fd5634..c7164eb490 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -69,11 +69,27 @@ Item Layout.fillHeight: true } + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } + Cura.QuickConfigurationSelector { Layout.fillHeight: true Layout.fillWidth: true - Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width + Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width - 2 * UM.Theme.getSize("default_lining").width + } + + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") } Cura.PrintSetupSelector diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index b441a78dff..ccc0a98c6e 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -40,7 +40,7 @@ Item Row { anchors.centerIn: parent - spacing: UM.Theme.getSize("default_margin").width + //spacing: UM.Theme.getSize("default_margin").width height: parent.height Item @@ -93,6 +93,14 @@ Item } } + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } + Loader { // TODO: Make this panel collapsable and ensure it has a standardised background. @@ -106,6 +114,13 @@ Item source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" } + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } Cura.PrintSetupSelector { width: UM.Theme.getSize("print_setup_widget").width From 12c296241436acf72fd171f00e914be74ffd3ba7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Nov 2018 16:59:02 +0100 Subject: [PATCH 157/558] Update the look & feel of openButton to the new design CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 30 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index c7164eb490..3c7235a26f 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -23,19 +23,30 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButton.width + itemRowBackground.width + width: openFileButtonBackground.width + itemRowBackground.width height: parent.height - Button + Rectangle { - id: openFileButton - text: catalog.i18nc("@action:button", "Open File") - iconSource: UM.Theme.getIcon("load") - style: UM.Theme.styles.tool_button - tooltip: "" - action: Cura.Actions.open + id: openFileButtonBackground + height: UM.Theme.getSize("stage_menu").height + width: UM.Theme.getSize("stage_menu").height + + radius: UM.Theme.getSize("default_radius").width + color: UM.Theme.getColor("toolbar_background") + Button + { + id: openFileButton + text: catalog.i18nc("@action:button", "Open File") + iconSource: UM.Theme.getIcon("load") + style: UM.Theme.styles.toolbar_button + tooltip: "" + action: Cura.Actions.open + anchors.centerIn: parent + } } + Rectangle { id: itemRowBackground @@ -46,7 +57,7 @@ Item width: itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height - anchors.left: openFileButton.right + anchors.left: openFileButtonBackground.right anchors.leftMargin: UM.Theme.getSize("default_margin").width RowLayout @@ -57,6 +68,7 @@ Item width: 0.9 * prepareMenu.width height: parent.height + spacing: 0 Cura.MachineSelector { From fb72f9a0594c8ac1d3e721dbad60617c227699d0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 09:59:56 +0100 Subject: [PATCH 158/558] Fixed size of expandableItem not being the correct width CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 1 + plugins/SimulationView/SimulationViewMenuComponent.qml | 2 +- resources/qml/ExpandableComponent.qml | 2 +- .../qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index ccc0a98c6e..5b0ae4e9c5 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -121,6 +121,7 @@ Item width: UM.Theme.getSize("default_lining").width color: UM.Theme.getColor("lining") } + Cura.PrintSetupSelector { width: UM.Theme.getSize("print_setup_widget").width diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index fe9f4471fd..92a4e1e317 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -74,7 +74,7 @@ Cura.ExpandableComponent property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers") property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") - width: UM.Theme.getSize("layerview_menu_size").width + width: base.width - 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height spacing: UM.Theme.getSize("layerview_row_spacing").height diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 06b4146a57..c525d163fe 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -111,7 +111,7 @@ Item // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between //the button & text. x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding - + padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent background: Rectangle diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 7c70229b5d..721416352d 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -92,7 +92,7 @@ Cura.ExpandableComponent popupItem: Item { - width: base.width + width: base.width - 2 * UM.Theme.getSize("default_margin").width height: 200 TabBar From c35b4f1d31d295fc9d91b15167cea6ac79298bd7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 10:00:44 +0100 Subject: [PATCH 159/558] Removed old unusued code CURA-5785 --- .../QuickConfigurationSelector.qml | 62 +------------------ 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 721416352d..5565884bd8 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -233,64 +233,4 @@ Cura.ExpandableComponent } } - -} - -/*Item -{ - id: configurationSelector - property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - property var panelWidth: control.width - - // Make this component only visible when it's a network printer and it is connected - visible: Cura.MachineManager.activeMachineNetworkKey != "" && Cura.MachineManager.printerConnected - - function switchPopupState() - { - popup.visible ? popup.close() : popup.open() - } - - SyncButton - { - id: syncButton - onClicked: switchPopupState() - outputDevice: connectedDevice - } - - Popup - { - // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property - id: popup - clip: true - closePolicy: Popup.CloseOnPressOutsideParent - y: configurationSelector.height - UM.Theme.getSize("default_lining").height - x: configurationSelector.width - width - width: panelWidth - visible: false - padding: UM.Theme.getSize("default_lining").width - transformOrigin: Popup.Top - contentItem: ConfigurationListView - { - id: configList - width: panelWidth - 2 * popup.padding - outputDevice: connectedDevice - } - background: Rectangle - { - color: UM.Theme.getColor("setting_control") - border.color: UM.Theme.getColor("setting_control_border") - } - exit: Transition - { - // This applies a default NumberAnimation to any changes a state change makes to x or y properties - NumberAnimation { property: "visible"; duration: 75; } - } - enter: Transition - { - // This applies a default NumberAnimation to any changes a state change makes to x or y properties - NumberAnimation { property: "visible"; duration: 75; } - } - onClosed: visible = false - onOpened: visible = true - } -}*/ \ No newline at end of file +} \ No newline at end of file From 878b7432327e92f2081f153d28063c42e6905c0c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 10:39:03 +0100 Subject: [PATCH 160/558] Add elide to machine selector label. CURA-5785 --- resources/qml/MachineSelector.qml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 206229e837..87a3154338 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -25,14 +25,12 @@ Cura.ExpandableComponent name: "cura" } - headerItem: Item + headerItem: Label { - Label - { - text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName - verticalAlignment: Text.AlignVCenter - height: parent.height - } + text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName + verticalAlignment: Text.AlignVCenter + height: parent.height + elide: Text.ElideRight } popupItem: Item From fcfe95c7d0a7217bd5793ee5e5148b835bae29c4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 12:57:57 +0100 Subject: [PATCH 161/558] Move OpenFile button to be instantiated left so it's tooltip doesn't get messed up CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 43 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 3c7235a26f..78f9ced1e7 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -26,27 +26,6 @@ Item width: openFileButtonBackground.width + itemRowBackground.width height: parent.height - Rectangle - { - id: openFileButtonBackground - height: UM.Theme.getSize("stage_menu").height - width: UM.Theme.getSize("stage_menu").height - - radius: UM.Theme.getSize("default_radius").width - color: UM.Theme.getColor("toolbar_background") - Button - { - id: openFileButton - text: catalog.i18nc("@action:button", "Open File") - iconSource: UM.Theme.getIcon("load") - style: UM.Theme.styles.toolbar_button - tooltip: "" - action: Cura.Actions.open - anchors.centerIn: parent - } - } - - Rectangle { id: itemRowBackground @@ -73,7 +52,7 @@ Item Cura.MachineSelector { id: machineSelection - z: openFileButton.z - 1 + z: openFileButtonBackground.z - 1 Layout.minimumWidth: 240 Layout.maximumWidth: 240 @@ -118,5 +97,25 @@ Item } } } + + Rectangle + { + id: openFileButtonBackground + height: UM.Theme.getSize("stage_menu").height + width: UM.Theme.getSize("stage_menu").height + + radius: UM.Theme.getSize("default_radius").width + color: UM.Theme.getColor("toolbar_background") + Button + { + id: openFileButton + text: catalog.i18nc("@action:button", "Open File") + iconSource: UM.Theme.getIcon("load") + style: UM.Theme.styles.toolbar_button + tooltip: "" + action: Cura.Actions.open + anchors.centerIn: parent + } + } } } \ No newline at end of file From b589920f53a7192bd620e55e7d4ec87d22bbde7d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 13:55:39 +0100 Subject: [PATCH 162/558] Move a few hardcoded sizes to the theme CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 9 ++++----- resources/themes/cura-light/theme.json | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 78f9ced1e7..9507d786b2 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -53,9 +53,8 @@ Item { id: machineSelection z: openFileButtonBackground.z - 1 - - Layout.minimumWidth: 240 - Layout.maximumWidth: 240 + Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width + Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.fillWidth: true Layout.fillHeight: true } @@ -90,8 +89,8 @@ Item onShowTooltip: prepareMenu.showTooltip(item, location, text) onHideTooltip: prepareMenu.hideTooltip() - Layout.minimumWidth: 460 - Layout.maximumWidth: 460 + Layout.minimumWidth: UM.Theme.getSize("print_setup_widget").width + Layout.maximumWidth: UM.Theme.getSize("print_setup_widget").width Layout.fillWidth: true Layout.fillHeight: true } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a33ff87042..a36940641e 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -374,7 +374,7 @@ "account_button": [12, 3], - "print_setup_widget": [35.0, 42.0], + "print_setup_widget": [30.0, 42.0], "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], @@ -386,7 +386,7 @@ "action_panel_information_widget": [20.0, 0.0], "action_panel_button": [15.0, 3.0], - "machine_selector_widget": [28.0, 4.5], + "machine_selector_widget": [16.0, 4.5], "views_selector": [0.0, 4.0], From 7ca3490097027f9cb4342a52007ee558897d8c3d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 14:00:19 +0100 Subject: [PATCH 163/558] Make the collapse arrows consistent with the rest of the UI CURA-5785 --- resources/qml/ExpandableComponent.qml | 2 +- resources/qml/MachineSelector.qml | 2 +- .../qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index c525d163fe..bfafa9b29e 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -109,7 +109,7 @@ Item y: headerItemLoader.height + 2 * background.padding // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between - //the button & text. + // the button & text. x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 87a3154338..6a33cf3a0e 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -17,7 +17,7 @@ Cura.ExpandableComponent property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" - iconSource: expanded ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog { diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 5565884bd8..b2213918dd 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -27,7 +27,7 @@ Cura.ExpandableComponent name: "cura" } - iconSource: expanded ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") headerItem: Item { From 429a49aa2eddc2c42c0f592181f6f77e880954c7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 14:06:55 +0100 Subject: [PATCH 164/558] Make the default size of the expandableComponent icon depend on the height of the element This is a way more sensible default. CURA-5785 --- resources/qml/ExpandableComponent.qml | 7 ++++--- .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index bfafa9b29e..c098443cd7 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -9,6 +9,7 @@ import UM 1.2 as UM // * The Icon; An icon that is displayed on the right of the drawer. Item { + id: base // The headerItem holds the QML item that is always displayed. property alias headerItem: headerItemLoader.sourceComponent @@ -33,7 +34,7 @@ Item property alias iconColor: collapseButton.color // The icon size (it's always drawn as a square) - property alias iconSize: collapseButton.width + property alias iconSize: collapseButton.height // Is the "drawer" open? readonly property alias expanded: popup.visible @@ -89,8 +90,8 @@ Item sourceSize.width: width sourceSize.height: height visible: source != "" - width: UM.Theme.getSize("section_icon").width - height: width + width: height + height: 0.2 * base.height color: "black" } diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index b2213918dd..e77f949661 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -28,7 +28,6 @@ Cura.ExpandableComponent } iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") - headerItem: Item { // Horizontal list that shows the extruders From c27f51d944b3dc84946f5f17a884723afbfd1a8f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 16:44:36 +0100 Subject: [PATCH 165/558] Make the view selector also use the expandableComponent CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 91 +++++++++++++++------------- resources/qml/MachineSelector.qml | 1 + 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 5b0ae4e9c5..bb8b992471 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -3,7 +3,7 @@ import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 import UM 1.3 as UM import Cura 1.1 as Cura @@ -43,53 +43,62 @@ Item //spacing: UM.Theme.getSize("default_margin").width height: parent.height - Item + Cura.ExpandableComponent { - width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width + id: viewSelector + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") height: parent.height - ComboBox + + property var viewModel: UM.ViewModel { } + + property var activeView: { - // This item contains the views selector, a combobox that is dynamically created from - // the list of available Views (packages that create different visualizations of the - // scene). - id: viewModeButton - - style: UM.Theme.styles.combobox - anchors.centerIn: parent - model: UM.ViewModel { } - textRole: "name" - - // update the model's active index - function updateItemActiveFlags() + for (var i = 0; i < viewModel.rowCount(); i++) { - currentIndex = getActiveIndex() - for (var i = 0; i < model.rowCount(); i++) + if(viewModel.getItem(i).active) { - model.getItem(i).active = (i == currentIndex) + return viewModel.getItem(i) + } + } + // Nothing was active, so just return the first one (the list is sorted by priority, so the most + // important one sshould be returned) + return viewModel.getItem(0) + } + + // Ensure that the controller is synced with whatever happend here. + onActiveViewChanged: UM.Controller.setActiveView(activeView.id) + + headerItem: Label + { + text: viewSelector.activeView.name + verticalAlignment: Text.AlignVCenter + height: parent.height + elide: Text.ElideRight + font: UM.Theme.getFont("default") + } + + popupItem: Column + { + id: column + width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + + // For some reason the height of the column gets set to 0 if this is not set... + Component.onCompleted: height = implicitHeight + + Repeater + { + id: networkedPrinters + model: viewSelector.viewModel + RoundButton + { + text: name + radius: UM.Theme.getSize("default_radius").width + checkable: true + checked: active + onClicked: UM.Controller.setActiveView(id) } } - // get the index of the active model item on start - function getActiveIndex() - { - for (var i = 0; i < model.rowCount(); i++) - { - if (model.getItem(i).active) - { - return i; - } - } - return 0 - } - - onCurrentIndexChanged: - { - if (model.getItem(currentIndex).id != undefined) - { - UM.Controller.setActiveView(model.getItem(currentIndex).id) - } - } - currentIndex: getActiveIndex() } } @@ -106,7 +115,7 @@ Item // TODO: Make this panel collapsable and ensure it has a standardised background. id: viewPanel - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) + //property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) height: parent.height width: childrenRect.width diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 6a33cf3a0e..b2a34e186e 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -31,6 +31,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight + font: UM.Theme.getFont("default") } popupItem: Item From 9aa5b6fe3f467d50796a80a43f95770e6bb080cf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 16:47:53 +0100 Subject: [PATCH 166/558] Hide one spacer if there is no viewPanel CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index bb8b992471..e24d0b25b1 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -106,7 +106,10 @@ Item Rectangle { height: parent.height - width: UM.Theme.getSize("default_lining").width + // If there is no viewPanel, we only need a single spacer, so hide this one. + visible: viewPanel.source != "" + width: visible ? UM.Theme.getSize("default_lining").width : 0 + color: UM.Theme.getColor("lining") } From 20b7a925a0f9525ed6e0f1ff2cb7703b739def74 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 16:49:01 +0100 Subject: [PATCH 167/558] Remove unused code & outdated todo comment CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index e24d0b25b1..df04507ba4 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -115,14 +115,9 @@ Item Loader { - // TODO: Make this panel collapsable and ensure it has a standardised background. id: viewPanel - - //property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - height: parent.height width: childrenRect.width - source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" } From 21d7619a4541b122bc480630dad18e42cfa85e6d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Nov 2018 16:57:05 +0100 Subject: [PATCH 168/558] Added a hover effect to the expandableComponent CURA-5785 --- resources/qml/ExpandableComponent.qml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index c098443cd7..d885253173 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -19,7 +19,8 @@ Item // The background color of the popup property color popupBackgroundColor: "white" - property alias headerBackgroundColor: background.color + property color headerBackgroundColor: "white" + property color headerHoverColor: "white" // How much spacing is needed around the popupItem property alias popupPadding: popup.padding @@ -63,7 +64,7 @@ Item id: background property real padding: UM.Theme.getSize("default_margin").width - color: "white" + color: headerBackgroundColor anchors.fill: parent Loader { @@ -97,8 +98,12 @@ Item MouseArea { + id: mouseArea anchors.fill: parent onClicked: popup.visible ? popup.close() : popup.open() + hoverEnabled: true + onEntered: background.color = headerHoverColor + onExited: background.color = headerBackgroundColor } } From c08aa2205ca502580b4ba613cd9266601bfd5898 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 15 Nov 2018 09:37:54 +0100 Subject: [PATCH 169/558] Fix enabled checkbox for extruder selection CURA-5785 --- .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index e77f949661..6f4e58a326 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -150,8 +150,8 @@ Cura.ExpandableComponent OldControls.CheckBox { - checked: Cura.MachineManager.getExtruder(parent.model.index).isEnabled - onClicked: Cura.MachineManager.setExtruderEnabled(parent.model.index, checked) + checked: Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled + onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox } From f0b8c1e6117fc0ddb9815b09d88ea630ecc448ca Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 15 Nov 2018 09:45:46 +0100 Subject: [PATCH 170/558] Fix some minor display issues CURA-5785 --- resources/qml/PrintSetupSelector.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 7a7d438bc3..e576dddc07 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -111,19 +111,22 @@ Cura.ExpandableComponent popupItem: Item { - height: settingsModeSelection.height + sidebarContents.height + height: settingsModeSelection.height + sidebarContents.height + 2 * UM.Theme.getSize("default_margin").height width: UM.Theme.getSize("print_setup_widget").width ListView { // Settings mode selection toggle id: settingsModeSelection model: modesListModel - width: Math.round(parent.width * 0.55) height: UM.Theme.getSize("print_setup_mode_toggle").height visible: !hideSettings - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors + { + right: parent.right + left: parent.left + margins: UM.Theme.getSize("thick_margin").width + } ButtonGroup { From eca9820fc4a91abd8bcc87562df1ed5289edcf42 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 15 Nov 2018 13:55:33 +0100 Subject: [PATCH 171/558] Add toggle function to expandable popup Also ensures that the machineSelector closes the popup on making a choice CURA-5785 --- resources/qml/ExpandableComponent.qml | 15 ++++++++++++++- resources/qml/MachineSelector.qml | 13 +++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index d885253173..129c7dc923 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -40,6 +40,19 @@ Item // Is the "drawer" open? readonly property alias expanded: popup.visible + function togglePopup() + { + if(popup.visible) + { + popup.close() + } + else + { + popup.open() + } + } + + onPopupItemChanged: { // Since we want the size of the popup to be set by the size of the content, @@ -100,7 +113,7 @@ Item { id: mouseArea anchors.fill: parent - onClicked: popup.visible ? popup.close() : popup.open() + onClicked: togglePopup() hoverEnabled: true onEntered: background.color = headerHoverColor onExited: background.color = headerBackgroundColor diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index b2a34e186e..b18f427980 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -77,8 +77,12 @@ Cura.ExpandableComponent width: parent.width checkable: true - onClicked: Cura.MachineManager.setActiveMachine(model.id) radius: UM.Theme.getSize("default_radius").width + onClicked: + { + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) + } Connections { @@ -114,8 +118,13 @@ Cura.ExpandableComponent width: parent.width checked: Cura.MachineManager.activeMachineId == model.id checkable: true - onClicked: Cura.MachineManager.setActiveMachine(model.id) + radius: UM.Theme.getSize("default_radius").width + onClicked: + { + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) + } } } From 3629e3b6046a0646c951c5d914f7797f8e968165 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 15 Nov 2018 14:04:52 +0100 Subject: [PATCH 172/558] Added highlight to ExpandableComponent CURA-5785 --- resources/qml/ExpandableComponent.qml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 129c7dc923..e110ed94be 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -40,6 +40,8 @@ Item // Is the "drawer" open? readonly property alias expanded: popup.visible + property alias expandedHighlightColor: expandedHightlight.color + function togglePopup() { if(popup.visible) @@ -52,7 +54,6 @@ Item } } - onPopupItemChanged: { // Since we want the size of the popup to be set by the size of the content, @@ -79,6 +80,7 @@ Item color: headerBackgroundColor anchors.fill: parent + Loader { id: headerItemLoader @@ -92,6 +94,17 @@ Item } } + // A highlight that is shown when the popup is expanded + Rectangle + { + id: expandedHightlight + width: parent.width + height: UM.Theme.getSize("thick_lining").height + color: UM.Theme.getColor("primary") + visible: expanded + anchors.bottom: parent.bottom + } + UM.RecolorImage { id: collapseButton From 6dd6f5ecc7ec6be44cd293b27925ad66771d18fa Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 15 Nov 2018 14:11:46 +0100 Subject: [PATCH 173/558] Made the hardcoded values of ExpandableComponent themable CURA-5785 --- resources/qml/ExpandableComponent.qml | 6 +++--- resources/themes/cura-light/theme.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index e110ed94be..9464a8f0ac 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -17,10 +17,10 @@ Item property var popupItem // The background color of the popup - property color popupBackgroundColor: "white" + property color popupBackgroundColor: UM.Theme.getColor("action_button") - property color headerBackgroundColor: "white" - property color headerHoverColor: "white" + property color headerBackgroundColor: UM.Theme.getColor("action_button") + property color headerHoverColor: UM.Theme.getColor("action_button_hovered") // How much spacing is needed around the popupItem property alias popupPadding: popup.padding diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a36940641e..d28611529b 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -75,6 +75,7 @@ "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], + "primary": [50, 130, 255, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], @@ -157,7 +158,7 @@ "action_button": [255, 255, 255, 255], "action_button_text": [0, 0, 0, 255], "action_button_border": [127, 127, 127, 255], - "action_button_hovered": [255, 255, 255, 255], + "action_button_hovered": [232, 242, 252, 255], "action_button_hovered_text": [31, 36, 39, 255], "action_button_hovered_border": [50, 130, 255, 255], "action_button_active": [255, 255, 255, 255], From e3dd5f1c39cea14bbeefed4ae2191f19ffdf8d75 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 13:59:51 +0100 Subject: [PATCH 174/558] Add documentation about qml z fix Co-Authored-By: nallath --- plugins/PrepareStage/PrepareMenu.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 9507d786b2..c464727dde 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -52,7 +52,7 @@ Item Cura.MachineSelector { id: machineSelection - z: openFileButtonBackground.z - 1 + z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.fillWidth: true @@ -117,4 +117,4 @@ Item } } } -} \ No newline at end of file +} From de020b4c758ba05dcbf374616c955b316683e883 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 14:02:00 +0100 Subject: [PATCH 175/558] Remove commented out code Co-Authored-By: nallath --- plugins/PreviewStage/PreviewMenu.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index df04507ba4..d7b5574035 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -40,7 +40,6 @@ Item Row { anchors.centerIn: parent - //spacing: UM.Theme.getSize("default_margin").width height: parent.height Cura.ExpandableComponent @@ -138,4 +137,4 @@ Item } } } -} \ No newline at end of file +} From 81b6f3ab11b0b73d6c0db10ff441bac1de7072e4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 14:03:39 +0100 Subject: [PATCH 176/558] Update unclear qml ID's CURA-5785 Co-Authored-By: nallath --- plugins/PreviewStage/PreviewMenu.qml | 4 ++-- resources/qml/ExpandableComponent.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index d7b5574035..bf162be4e3 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -78,7 +78,7 @@ Item popupItem: Column { - id: column + id: viewSelectorPopup width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width // For some reason the height of the column gets set to 0 if this is not set... @@ -86,7 +86,7 @@ Item Repeater { - id: networkedPrinters + id: viewsList model: viewSelector.viewModel RoundButton { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 9464a8f0ac..4d54ad9611 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -97,7 +97,7 @@ Item // A highlight that is shown when the popup is expanded Rectangle { - id: expandedHightlight + id: expandedHighlight width: parent.width height: UM.Theme.getSize("thick_lining").height color: UM.Theme.getColor("primary") From 514fc130457cbb488c06168eb51dc8e0437e8c9e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 14:04:33 +0100 Subject: [PATCH 177/558] Remove redundant documentation CURA-5875 Co-Authored-By: nallath --- resources/qml/ExpandableComponent.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 4d54ad9611..bbba44f743 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -16,7 +16,6 @@ Item // The popupItem holds the QML item that is shown when the "open" button is pressed property var popupItem - // The background color of the popup property color popupBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") @@ -31,7 +30,6 @@ Item // What icon should be displayed on the right. property alias iconSource: collapseButton.source - // What is the color of the icon? property alias iconColor: collapseButton.color // The icon size (it's always drawn as a square) From e087db7c2e0ce3857e16b14c499d5d239abc8828 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 13:26:03 +0100 Subject: [PATCH 178/558] Code style and fixes to comments Contributes to issue CURA-5785. --- plugins/PreviewStage/PreviewMenu.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index bf162be4e3..a3235d7cb8 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -54,13 +54,13 @@ Item { for (var i = 0; i < viewModel.rowCount(); i++) { - if(viewModel.getItem(i).active) + if (viewModel.getItem(i).active) { return viewModel.getItem(i) } } // Nothing was active, so just return the first one (the list is sorted by priority, so the most - // important one sshould be returned) + // important one should be returned) return viewModel.getItem(0) } From 3ef6d0544a02705eba13e5e115c3e1f40694fb95 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 14:11:04 +0100 Subject: [PATCH 179/558] Fix spelling and indents Ant-fuckery, as they say in the low lands. Contributes to issue CURA-5785. --- resources/qml/IconWithText.qml | 2 +- resources/qml/MachineSelector.qml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index d19c7e3899..9ce2f412cc 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura // Reusable component that holds an (re-colorable) icon on the left with some text on the right. // This component is also designed to be used with layouts. It will use the width of the text + icon as preferred width -// It sets the icon size + half of the content as it's minium width (in which case it will elide the text) +// It sets the icon size + half of the content as its minium width (in which case it will elide the text) Item { property alias iconColor: icon.color diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index b18f427980..fa680fa9a6 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -80,8 +80,8 @@ Cura.ExpandableComponent radius: UM.Theme.getSize("default_radius").width onClicked: { - togglePopup() - Cura.MachineManager.setActiveMachine(model.id) + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) } Connections From 3fd1cc0e8cec4c77d080860bccd9deb99bb2d62c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 14:58:11 +0100 Subject: [PATCH 180/558] Ensure that the added labels are also themable CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 2 ++ resources/qml/ExpandableComponent.qml | 2 +- resources/qml/MachineSelector.qml | 3 +++ .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index bf162be4e3..90c1cb7c99 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -74,6 +74,8 @@ Item height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } popupItem: Column diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index bbba44f743..c177dc758d 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -38,7 +38,7 @@ Item // Is the "drawer" open? readonly property alias expanded: popup.visible - property alias expandedHighlightColor: expandedHightlight.color + property alias expandedHighlightColor: expandedHighlight.color function togglePopup() { diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index b18f427980..1f18e1ab2a 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -32,6 +32,7 @@ Cura.ExpandableComponent height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") } popupItem: Item @@ -58,6 +59,7 @@ Cura.ExpandableComponent visible: networkedPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter } @@ -99,6 +101,7 @@ Cura.ExpandableComponent visible: virtualPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter } diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 6f4e58a326..d6b9b1c06a 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -60,6 +60,8 @@ Cura.ExpandableComponent text: model.material_brand elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") anchors { @@ -75,6 +77,8 @@ Cura.ExpandableComponent { text: model.material elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") anchors { From 5972bfaf0342d41f987ec38d1cb7c00c56dab4cb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 15:06:21 +0100 Subject: [PATCH 181/558] Add round to minContentWidth This prevents text from getting a weird width CURA-5785 --- resources/qml/IconWithText.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index 9ce2f412cc..dcb3ef7851 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -21,7 +21,7 @@ Item // These properties can be used in combination with layouts. readonly property real contentWidth: icon.width + margin + label.contentWidth - readonly property real minContentWidth: icon.width + margin + 0.5 * label.contentWidth + readonly property real minContentWidth: Math.round(icon.width + margin + 0.5 * label.contentWidth) Layout.minimumWidth: minContentWidth Layout.preferredWidth: contentWidth From fe15a0a5132716844afe25e2cd7dd7424667efe8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 15:09:47 +0100 Subject: [PATCH 182/558] Made width of machineSelector popup depend on size of the element CURA-5785 --- resources/qml/MachineSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 256e6ec218..793f45ddcf 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -38,7 +38,7 @@ Cura.ExpandableComponent popupItem: Item { id: popup - width: 240 + width: machineSelector.width - 2 * UM.Theme.getSize("default_margin").width height: 200 ScrollView From 816d844258c2126c86f9be7b2be50580932cef4d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Nov 2018 15:14:08 +0100 Subject: [PATCH 183/558] Use textwidth instead of round CURA-5785 Co-Authored-By: nallath --- .../Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index d6b9b1c06a..b1058ce627 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -134,7 +134,7 @@ Cura.ExpandableComponent anchors.bottom: parent.bottom property var model: extrudersModel.items[tabBar.currentIndex] property real textWidth: Math.round(width * 0.3) - property real controlWidth: Math.round(width * 0.7) + property real controlWidth: width - textWidth Column { spacing: UM.Theme.getSize("default_margin").height @@ -236,4 +236,4 @@ Cura.ExpandableComponent } } -} \ No newline at end of file +} From b72f1bb31403baa2c1ee48aa473ee3bbd715c780 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 15:15:44 +0100 Subject: [PATCH 184/558] Add missing screenScaleFactor for implicit sizes CURA-5785 --- resources/qml/ExpandableComponent.qml | 6 +++--- resources/qml/PrintSetupSelector.qml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index c177dc758d..d4eb18f4fa 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -6,7 +6,7 @@ import UM 1.2 as UM // The expandable component has 3 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded // * The popupItem; The content that needs to be shown if the component is expanded. -// * The Icon; An icon that is displayed on the right of the drawer. +// * The icon; An icon that is displayed on the right of the drawer. Item { id: base @@ -69,8 +69,8 @@ Item onHeightChanged: popup.height = popupItem.height + 2 * popup.padding } - implicitHeight: 100 - implicitWidth: 400 + implicitHeight: 100 * screenScaleFactor + implicitWidth: 400 * screenScaleFactor Rectangle { id: background diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index e576dddc07..b843244147 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -24,7 +24,7 @@ Cura.ExpandableComponent signal showTooltip(Item item, point location, string text) signal hideTooltip() - implicitWidth: 200 + implicitWidth: 200 * screenScaleFactor height: childrenRect.height iconSource: UM.Theme.getIcon("pencil") From 42399ecb24492d2f38cc85447a6ab33a1ad28d55 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 15:17:34 +0100 Subject: [PATCH 185/558] Let headerItem fill entire component if no icon is set CURA-5785 --- resources/qml/ExpandableComponent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index d4eb18f4fa..8ed6dc5674 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -85,7 +85,7 @@ Item anchors { left: parent.left - right: collapseButton.left + right: collapseButton.visible ? collapseButton.left : parent.right top: parent.top bottom: parent.bottom margins: background.padding From 7f99ed1af36f5d0ef75f7087b1c1d84676e982b2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 16:04:11 +0100 Subject: [PATCH 186/558] ExtruderIcon will now display that it's disabled correctly CURA-5785 --- cura/Settings/ExtrudersModel.py | 5 +++-- resources/qml/ExtruderButton.qml | 1 + resources/qml/ExtruderIcon.qml | 22 +++++++++++++++---- .../QuickConfigurationSelector.qml | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 9b85afa10e..14a8dadc69 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -24,8 +24,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): ## Human-readable name of the extruder. NameRole = Qt.UserRole + 2 - ## Is the extruder enabled? - EnabledRole = Qt.UserRole + 9 ## Colour of the material loaded in the extruder. ColorRole = Qt.UserRole + 3 @@ -50,6 +48,9 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): MaterialBrandRole = Qt.UserRole + 9 ColorNameRole = Qt.UserRole + 10 + ## Is the extruder enabled? + EnabledRole = Qt.UserRole + 11 + ## List of colours to display if there is no material or the material has no known # colour. defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"] diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 764e9c94cb..8a1f0af44a 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -23,6 +23,7 @@ Button { width: UM.Theme.getSize("button_icon").width materialColor: model.color + extruderEnabled: extruder.stack.isEnabled property int index: extruder.index } diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index eb4bdef0f7..87e210e75a 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -13,9 +13,9 @@ Item implicitHeight: implicitWidth property bool checked: true - property alias materialColor: mainIcon.color + property color materialColor property alias textColor: extruderNumberText.color - + property bool extruderEnabled: true UM.RecolorImage { id: mainIcon @@ -24,6 +24,7 @@ Item sourceSize.width: parent.width sourceSize.height: parent.width source: UM.Theme.getIcon("extruder_button") + color: extruderEnabled ? materialColor: "gray" } Rectangle @@ -31,9 +32,9 @@ Item id: extruderNumberCircle width: height - height: parent.height / 2 + height: Math.round(parent.height / 2) radius: Math.round(width / 2) - color: "white" + color: UM.Theme.getColor("toolbar_background") anchors { @@ -51,6 +52,19 @@ Item font: UM.Theme.getFont("default") width: contentWidth height: contentHeight + visible: extruderEnabled + } + + UM.RecolorImage + { + id: disabledIcon + anchors.fill: parent + anchors.margins: UM.Theme.getSize("thick_lining").width + sourceSize.width: width + sourceSize.height: width + source: UM.Theme.getIcon("cross1") + visible: !extruderEnabled + color: "black" } } } \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index b1058ce627..c157b0b24f 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -49,6 +49,7 @@ Cura.ExpandableComponent { id: extruderIcon materialColor: model.color + extruderEnabled: model.enabled height: parent.height width: height } @@ -118,6 +119,7 @@ Cura.ExpandableComponent { anchors.horizontalCenter: parent.horizontalCenter materialColor: model.color + extruderEnabled: model.enabled width: parent.height height: parent.height } From 52b2f4579ad1620b03b0ce3f34a44af306926008 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 16:10:26 +0100 Subject: [PATCH 187/558] Fix a number of QML warnings CURA-5785 --- resources/qml/Cura.qml | 16 ---------------- resources/qml/MachineSelector.qml | 2 +- .../QuickConfigurationSelector.qml | 6 +++--- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index cdbf1f3511..0312a636a6 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -214,22 +214,6 @@ UM.MainWindow } } - Loader - { - id: viewPanel - - anchors.bottom: viewModeButton.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: viewModeButton.right - - property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2)) - - height: childrenRect.height - width: childrenRect.width - - source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "" - } - Cura.ActionPanelWidget { anchors.right: parent.right diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 793f45ddcf..a464949192 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -45,7 +45,7 @@ Cura.ExpandableComponent { anchors.fill: parent contentHeight: column.implicitHeight - contentWidth: row.implicitWidth + contentWidth: column.implicitWidth clip: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index c157b0b24f..33610135fe 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -111,7 +111,7 @@ Cura.ExpandableComponent delegate: TabButton { - width: Math.round(ListView.view.width / extrudersModel.rowCount()) + width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 height: parent.height contentItem: Item { @@ -156,7 +156,7 @@ Cura.ExpandableComponent OldControls.CheckBox { - checked: Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled + checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox @@ -190,7 +190,7 @@ Cura.ExpandableComponent tooltip: currentRootMaterialName visible: Cura.MachineManager.hasMaterials - enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 + enabled: Cura.ExtruderManager.activeExtruderIndex > -1 height: UM.Theme.getSize("setting_control").height width: tabControl.controlWidth From bc5a2ce5b0c52d36a837d52ee085a8e1cb897494 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 16:16:15 +0100 Subject: [PATCH 188/558] Make ViewSelector panel close upon selecting different view CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 31223cfa4a..0052d341fb 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -75,7 +75,6 @@ Item elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") - } popupItem: Column @@ -96,7 +95,11 @@ Item radius: UM.Theme.getSize("default_radius").width checkable: true checked: active - onClicked: UM.Controller.setActiveView(id) + onClicked: + { + viewSelector.togglePopup() + UM.Controller.setActiveView(id) + } } } From 6b55490af88e30caa1afa7419141057ebe855304 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 16:30:47 +0100 Subject: [PATCH 189/558] Fix final QML warnings CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 3 ++- plugins/SimulationView/SimulationViewMenuComponent.qml | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 0052d341fb..a3cd7cb76b 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -35,10 +35,11 @@ Item { id: stageMenu height: parent.height - width: childrenRect.width + UM.Theme.getSize("default_margin").width + width: stageMenuRow.width + UM.Theme.getSize("default_margin").width anchors.horizontalCenter: parent.horizontalCenter Row { + id: stageMenuRow anchors.centerIn: parent height: parent.height diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 92a4e1e317..c20e141734 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -18,16 +18,6 @@ Cura.ExpandableComponent width: UM.Theme.getSize("layerview_menu_size").width iconSource: UM.Theme.getIcon("pencil") - property var buttonTarget: - { - if(parent != null) - { - var force_binding = parent.y; // ensure this gets reevaluated when the panel moves - return base.mapFromItem(parent.parent, parent.buttonTarget.x, parent.buttonTarget.y) - } - return Qt.point(0,0) - } - Connections { target: UM.Preferences From e3ebf89092333942ce6ae542c46b570d1ea22593 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 16 Nov 2018 17:26:10 +0100 Subject: [PATCH 190/558] Ensure that width of popup does not get set to 0 CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index a3cd7cb76b..b73c1088ae 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -83,8 +83,12 @@ Item id: viewSelectorPopup width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width - // For some reason the height of the column gets set to 0 if this is not set... - Component.onCompleted: height = implicitHeight + // For some reason the height/width of the column gets set to 0 if this is not set... + Component.onCompleted: + { + height = implicitHeight + width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + } Repeater { From 6fe89e3d54980d403b2b42f9ace88ed813345028 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Nov 2018 10:33:19 +0100 Subject: [PATCH 191/558] Fix width of simulationView component not being set correctly CURA-5785 --- plugins/SimulationView/SimulationViewMenuComponent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index c20e141734..89615f43a4 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -64,7 +64,7 @@ Cura.ExpandableComponent property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers") property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") - width: base.width - 2 * UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("layerview_menu_size").width - 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height spacing: UM.Theme.getSize("layerview_row_spacing").height From a490e420f09327be74f0145fb055ab5021d315c7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Nov 2018 11:42:04 +0100 Subject: [PATCH 192/558] Prevent the setting items from being recreated every stage switch CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 20 +++++++++----------- plugins/PreviewStage/PreviewMenu.qml | 12 +++++++----- resources/qml/Cura.qml | 11 +++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index c464727dde..ef01625a22 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -13,6 +13,7 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() + UM.I18nCatalog { id: catalog @@ -71,7 +72,7 @@ Item { Layout.fillHeight: true Layout.fillWidth: true - Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width - 2 * UM.Theme.getSize("default_lining").width + Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width } // Separator line @@ -82,17 +83,14 @@ Item color: UM.Theme.getColor("lining") } - Cura.PrintSetupSelector + Item { - id: printSetupSelector - - onShowTooltip: prepareMenu.showTooltip(item, location, text) - onHideTooltip: prepareMenu.hideTooltip() - - Layout.minimumWidth: UM.Theme.getSize("print_setup_widget").width - Layout.maximumWidth: UM.Theme.getSize("print_setup_widget").width - Layout.fillWidth: true - Layout.fillHeight: true + id: printSetupSelectorItem + // This is a work around to prevent the printSetupSelector from having to be re-loaded every time + // a stage switch is done. + children: [printSetupSelector] + height: childrenRect.height + width: childrenRect.width } } } diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index b73c1088ae..b331ff69c5 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -138,12 +138,14 @@ Item color: UM.Theme.getColor("lining") } - Cura.PrintSetupSelector + Item { - width: UM.Theme.getSize("print_setup_widget").width - height: parent.height - onShowTooltip: previewMenu.showTooltip(item, location, text) - onHideTooltip: previewMenu.hideTooltip() + id: printSetupSelectorItem + // This is a work around to prevent the printSetupSelector from having to be re-loaded every time + // a stage switch is done. + children: [printSetupSelector] + height: childrenRect.height + width: childrenRect.width } } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 0312a636a6..c239dc8d6f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -40,6 +40,7 @@ UM.MainWindow tooltip.hide(); } + Component.onCompleted: { CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) @@ -249,6 +250,16 @@ UM.MainWindow height: UM.Theme.getSize("stage_menu").height source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" + + // The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated + // Every time the stage is changed. + property var printSetupSelector: Cura.PrintSetupSelector + { + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + width: UM.Theme.getSize("print_setup_widget").width + height: UM.Theme.getSize("stage_menu").height + } } UM.MessageStack From b0f3fedc94354d30a8677bc93f02e67a9ec3d0f0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 19 Nov 2018 13:42:19 +0100 Subject: [PATCH 193/558] Fix import QtQuick versions to suit Qt 5.10 CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 3 +-- resources/qml/MachineSelector.qml | 2 +- .../qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index b331ff69c5..1a744aeb65 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 - -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index a464949192..c9756d93ba 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 33610135fe..d428a05463 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.11 +import QtQuick.Layouts 1.3 import QtQuick.Controls 1.1 as OldControls From 30b20b4aa56e6bda5cc0f7f6ae0ab7a4f2a2e905 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 19 Nov 2018 13:50:32 +0100 Subject: [PATCH 194/558] Add borders to expandable components This adds a lining to all of the drop-downs from the stage menus. Contributes to issue CURA-5876. --- resources/qml/ExpandableComponent.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 8ed6dc5674..0a80e020c9 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -17,6 +17,8 @@ Item property var popupItem property color popupBackgroundColor: UM.Theme.getColor("action_button") + property int popupBorderWidth: UM.Theme.getSize("default_lining").width + property color popupBorderColor: UM.Theme.getColor("lining") property color headerBackgroundColor: UM.Theme.getColor("action_button") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") @@ -147,6 +149,8 @@ Item background: Rectangle { color: popupBackgroundColor + border.width: popupBorderWidth + border.color: popupBorderColor } } } From 7a210087ff0aa8c34ebe7438bc744136b3afab64 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 19 Nov 2018 14:35:34 +0100 Subject: [PATCH 195/558] Add header for configuration selector It currently always says 'Custom', but we will want to make that dynamic at some point. Contributes to issue CURA-5876. --- .../QuickConfigurationSelector.qml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 33610135fe..d84298ee2e 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -12,6 +12,10 @@ import UM 1.2 as UM import Cura 1.0 as Cura +/** + * Menu that allows you to select the configuration of the current printer, such + * as the nozzle sizes and materials in each extruder. + */ Cura.ExpandableComponent { id: base @@ -99,10 +103,27 @@ Cura.ExpandableComponent width: base.width - 2 * UM.Theme.getSize("default_margin").width height: 200 + Label + { + id: customHeader + text: catalog.i18nc("@header", "Custom") + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + } + TabBar { id: tabBar onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + anchors.top: customHeader.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width height: 50 Repeater From 00a49fff26fac675207d30b6131f2d4869474197 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 19 Nov 2018 14:39:19 +0100 Subject: [PATCH 196/558] Rename QuickConfigurationSelector to ConfigurationMenu This is going to function as our main item for the configuration menu. It contains the part in the top bar and the glue item for the part in the popup. Contributes to issue CURA-5876. --- plugins/PrepareStage/PrepareMenu.qml | 2 +- .../{QuickConfigurationSelector.qml => ConfigurationMenu.qml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename resources/qml/Menus/ConfigurationMenu/{QuickConfigurationSelector.qml => ConfigurationMenu.qml} (100%) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ef01625a22..6b241e1da2 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -68,7 +68,7 @@ Item color: UM.Theme.getColor("lining") } - Cura.QuickConfigurationSelector + Cura.ConfigurationMenu { Layout.fillHeight: true Layout.fillWidth: true diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml similarity index 100% rename from resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml rename to resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml From 8683a1e07e5adc60e0be272eb4b6871d92f8c1ef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Nov 2018 16:16:41 +0100 Subject: [PATCH 197/558] Add previewStage to bundled cura package list CURA-5785 --- resources/bundled_packages/cura.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources/bundled_packages/cura.json b/resources/bundled_packages/cura.json index ee82b17a75..678ea0a697 100644 --- a/resources/bundled_packages/cura.json +++ b/resources/bundled_packages/cura.json @@ -356,6 +356,23 @@ } } }, + "PreviewStage": { + "package_info": { + "package_id": "PreviewStage", + "package_type": "plugin", + "display_name": "Preview Stage", + "description": "Provides a preview stage in Cura.", + "package_version": "1.0.0", + "sdk_version": 5, + "website": "https://ultimaker.com", + "author": { + "author_id": "UltimakerPackages", + "display_name": "Ultimaker B.V.", + "email": "plugins@ultimaker.com", + "website": "https://ultimaker.com" + } + } + }, "RemovableDriveOutputDevice": { "package_info": { "package_id": "RemovableDriveOutputDevice", From 16deeb09510b4bbaa6bc2c7b4ca7b939aa904caf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 19 Nov 2018 17:10:29 +0100 Subject: [PATCH 198/558] Remove old QuickConfigurationSelector It doesn't exist any more. Contributes to issue CURA-5876. --- resources/qml/qmldir | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/qmldir b/resources/qml/qmldir index d5e4106d33..878945b922 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -1,7 +1,6 @@ module Cura MachineSelector 1.0 MachineSelector.qml -QuickConfigurationSelector 1.0 QuickConfigurationSelector.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml ActionButton 1.0 ActionButton.qml From a04db164e6a0679ca684dd65ff33c50b9355a242 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 19 Nov 2018 17:11:51 +0100 Subject: [PATCH 199/558] Make it possible to swap between auto and custom configuration We're going to need to make this disappear when the printer is not connected. But that is for later. Contributes to issue CURA-5876. --- .../ConfigurationMenu/AutoConfiguration.qml | 25 +++ .../ConfigurationMenu/ConfigurationMenu.qml | 207 ++++++------------ .../ConfigurationMenu/CustomConfiguration.qml | 168 ++++++++++++++ 3 files changed, 263 insertions(+), 137 deletions(-) create mode 100644 resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml create mode 100644 resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml new file mode 100644 index 0000000000..e1f0ed480e --- /dev/null +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -0,0 +1,25 @@ +// 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.0 + +import UM 1.3 as UM + +Item +{ + Label + { + id: header + text: catalog.i18nc("@header", "Configurations") + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + } +} \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index d84298ee2e..10c52a7b0f 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -6,8 +6,6 @@ import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.11 -import QtQuick.Controls 1.1 as OldControls - import UM 1.2 as UM import Cura 1.0 as Cura @@ -100,163 +98,98 @@ Cura.ExpandableComponent popupItem: Item { + id: popup width: base.width - 2 * UM.Theme.getSize("default_margin").width height: 200 - Label - { - id: customHeader - text: catalog.i18nc("@header", "Custom") - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") + property var configuration_method: "auto" + AutoConfiguration + { + id: autoConfiguration + visible: popup.configuration_method === "auto" + anchors.top: header.bottom + height: visible ? childrenRect.height : 0 + } + + CustomConfiguration + { + id: customConfiguration + visible: popup.configuration_method === "custom" + anchors.top: header.bottom + height: visible ? childrenRect.height : 0 + } + + Rectangle + { + id: separator anchors { - top: parent.top left: parent.left right: parent.right + bottom: buttonBar.top + bottomMargin: UM.Theme.getSize("default_margin").height } + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") } - TabBar + Rectangle { - id: tabBar - onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) - anchors.top: customHeader.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width - height: 50 - Repeater + id: buttonBar + anchors { - model: extrudersModel - - delegate: TabButton - { - width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 - height: parent.height - contentItem: Item - { - Cura.ExtruderIcon - { - anchors.horizontalCenter: parent.horizontalCenter - materialColor: model.color - extruderEnabled: model.enabled - width: parent.height - height: parent.height - } - } - } + left: parent.left + right: parent.right + bottom: parent.bottom } - } + height: childrenRect.height - Item - { - id: tabControl - width: parent.width - anchors.top: tabBar.bottom - anchors.bottom: parent.bottom - property var model: extrudersModel.items[tabBar.currentIndex] - property real textWidth: Math.round(width * 0.3) - property real controlWidth: width - textWidth - Column + Cura.ActionButton { - spacing: UM.Theme.getSize("default_margin").height - Row + id: goToCustom + visible: popup.configuration_method === "auto" + text: catalog.i18nc("@label", "Custom") + + anchors { - height: UM.Theme.getSize("print_setup_item").height - - Label - { - text: catalog.i18nc("@label", "Enabled") - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - height: parent.height - width: tabControl.textWidth - } - - OldControls.CheckBox - { - checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false - onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) - height: UM.Theme.getSize("setting_control").height - style: UM.Theme.styles.checkbox - } + right: parent.right + bottom: parent.bottom } - Row - { - height: UM.Theme.getSize("print_setup_item").height - Label - { - text: catalog.i18nc("@label", "Material") - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - height: parent.height - width: tabControl.textWidth - } + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + height: UM.Theme.getSize("action_panel_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width - OldControls.ToolButton - { - id: materialSelection - - property var activeExtruder: Cura.MachineManager.activeStack - property var hasActiveExtruder: activeExtruder != null - property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" - property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true - property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported - - text: currentRootMaterialName - tooltip: currentRootMaterialName - visible: Cura.MachineManager.hasMaterials - - enabled: Cura.ExtruderManager.activeExtruderIndex > -1 - - height: UM.Theme.getSize("setting_control").height - width: tabControl.controlWidth - - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true - menu: Cura.MaterialMenu - { - extruderIndex: Cura.ExtruderManager.activeExtruderIndex - } - - } - } - - Row - { - height: UM.Theme.getSize("print_setup_item").height - - Label - { - text: Cura.MachineManager.activeDefinitionVariantsName - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - height: parent.height - width: tabControl.textWidth - } - - OldControls.ToolButton - { - id: variantSelection - text: Cura.MachineManager.activeVariantName - tooltip: Cura.MachineManager.activeVariantName; - visible: Cura.MachineManager.hasVariants - - height: UM.Theme.getSize("setting_control").height - width: tabControl.controlWidth - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - - menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } - } - } + onClicked: popup.configuration_method = "custom" } + Cura.ActionButton + { + id: goToAuto + visible: popup.configuration_method === "custom" + text: catalog.i18nc("@label", "Configurations") + + anchors + { + left: parent.left + bottom: parent.bottom + } + + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + height: UM.Theme.getSize("action_panel_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + + onClicked: popup.configuration_method = "auto" + } } } } diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml new file mode 100644 index 0000000000..953b6a48f0 --- /dev/null +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -0,0 +1,168 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtQuick.Controls 1.1 as OldControls + +import Cura 1.0 as Cura +import UM 1.3 as UM + +Item +{ + Label + { + id: header + text: catalog.i18nc("@header", "Custom") + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + } + + TabBar + { + id: tabBar + onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + anchors.top: header.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width + height: 50 + Repeater + { + model: extrudersModel + + delegate: TabButton + { + width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 + height: parent.height + contentItem: Item + { + Cura.ExtruderIcon + { + anchors.horizontalCenter: parent.horizontalCenter + materialColor: model.color + extruderEnabled: model.enabled + width: parent.height + height: parent.height + } + } + } + } + } + + Item + { + id: tabControl + width: parent.width + anchors.top: tabBar.bottom + anchors.bottom: parent.bottom + property var model: extrudersModel.items[tabBar.currentIndex] + property real textWidth: Math.round(width * 0.3) + property real controlWidth: width - textWidth + Column + { + spacing: UM.Theme.getSize("default_margin").height + Row + { + height: UM.Theme.getSize("print_setup_item").height + + Label + { + text: catalog.i18nc("@label", "Enabled") + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.CheckBox + { + checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false + onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) + height: UM.Theme.getSize("setting_control").height + style: UM.Theme.styles.checkbox + } + } + + Row + { + height: UM.Theme.getSize("print_setup_item").height + Label + { + text: catalog.i18nc("@label", "Material") + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.ToolButton + { + id: materialSelection + + property var activeExtruder: Cura.MachineManager.activeStack + property var hasActiveExtruder: activeExtruder != null + property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" + property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true + property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported + + text: currentRootMaterialName + tooltip: currentRootMaterialName + visible: Cura.MachineManager.hasMaterials + + enabled: Cura.ExtruderManager.activeExtruderIndex > -1 + + height: UM.Theme.getSize("setting_control").height + width: tabControl.controlWidth + + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true + menu: Cura.MaterialMenu + { + extruderIndex: Cura.ExtruderManager.activeExtruderIndex + } + + } + } + + Row + { + height: UM.Theme.getSize("print_setup_item").height + + Label + { + text: Cura.MachineManager.activeDefinitionVariantsName + verticalAlignment: Text.AlignVCenter + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: parent.height + width: tabControl.textWidth + } + + OldControls.ToolButton + { + id: variantSelection + text: Cura.MachineManager.activeVariantName + tooltip: Cura.MachineManager.activeVariantName; + visible: Cura.MachineManager.hasVariants + + height: UM.Theme.getSize("setting_control").height + width: tabControl.controlWidth + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true; + + menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } + } + } + } + + } +} \ No newline at end of file From fab0d5a4b7f1e3b5dd9bfc6ccecba5cc73c0a799 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 20 Nov 2018 13:25:15 +0100 Subject: [PATCH 200/558] Rename the color of the sidebar to main_background, since it was deleted but not updated in the usages. Contributes to CURA-5785. --- plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml | 2 +- plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml index a48cb2ee3f..62e1e3ab86 100644 --- a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -83,7 +83,7 @@ Item model: packageData.supported_configs headerDelegate: Rectangle { - color: UM.Theme.getColor("sidebar") + color: UM.Theme.getColor("main_background") height: UM.Theme.getSize("toolbox_chart_row").height Label { diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml index 068c369a3f..94e75a6de0 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml @@ -13,7 +13,7 @@ Component { property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width; property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width; anchors.fill: parent; - color: UM.Theme.getColor("sidebar"); + color: UM.Theme.getColor("main_background"); visible: OutputDevice != null; UM.I18nCatalog { From cbd5238738b1656c986caf87b58957ff605d4fb3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 13:55:28 +0100 Subject: [PATCH 201/558] Don't show custom/auto toggle buttons when not connected In order to prevent suddenly switching to the other side when the connection is lost or restored, we only evaluate this upon opening the popup. This way you might be surprised that closing and then opening it can show something else, but it will never surprise you while working on the popup itself as a user. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationMenu.qml | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 10c52a7b0f..fe292799a5 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -98,31 +98,37 @@ Cura.ExpandableComponent popupItem: Item { - id: popup + id: popupItem width: base.width - 2 * UM.Theme.getSize("default_margin").width height: 200 - property var configuration_method: "auto" + property var is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible. + onVisibleChanged: + { + is_connected = Cura.MachineManager.activeMachineNetworkKey != "" && Cura.MachineManager.printerConnected //Re-evaluate. + } + + property var configuration_method: buttonBar.visible ? "auto" : "custom" //Auto if connected to a printer at start-up, or Custom if not. AutoConfiguration { id: autoConfiguration - visible: popup.configuration_method === "auto" - anchors.top: header.bottom - height: visible ? childrenRect.height : 0 + visible: popupItem.configuration_method === "auto" + anchors.top: parent.top } CustomConfiguration { id: customConfiguration - visible: popup.configuration_method === "custom" - anchors.top: header.bottom - height: visible ? childrenRect.height : 0 + visible: popupItem.configuration_method === "custom" + anchors.top: parent.top } Rectangle { id: separator + visible: buttonBar.visible + anchors { left: parent.left @@ -131,12 +137,16 @@ Cura.ExpandableComponent bottomMargin: UM.Theme.getSize("default_margin").height } height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") } + //Allow switching between custom and auto. Rectangle { id: buttonBar + visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible. + anchors { left: parent.left @@ -148,7 +158,7 @@ Cura.ExpandableComponent Cura.ActionButton { id: goToCustom - visible: popup.configuration_method === "auto" + visible: popupItem.configuration_method === "auto" text: catalog.i18nc("@label", "Custom") anchors @@ -165,13 +175,13 @@ Cura.ExpandableComponent leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width - onClicked: popup.configuration_method = "custom" + onClicked: popupItem.configuration_method = "custom" } Cura.ActionButton { id: goToAuto - visible: popup.configuration_method === "custom" + visible: popupItem.configuration_method === "custom" text: catalog.i18nc("@label", "Configurations") anchors @@ -188,7 +198,7 @@ Cura.ExpandableComponent leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width - onClicked: popup.configuration_method = "auto" + onClicked: popupItem.configuration_method = "auto" } } } From 42d73836f400357e73d288d0a3be56848f7743f6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 14:19:55 +0100 Subject: [PATCH 202/558] Move default margin by default to Cura's action buttons So we don't have to repeat that every time you create a new button. Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 3 +++ resources/qml/ActionPanel/OutputDevicesActionButton.qml | 2 ++ resources/qml/ActionPanel/OutputProcessWidget.qml | 2 -- resources/qml/MainWindow/MainWindowHeader.qml | 2 -- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 4 ---- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 2a8b894867..08c44fb473 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -29,6 +29,9 @@ Button // we elide the text to the right so the text will be cut off with the three dots at the end. property var fixedWidthMode: false + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + contentItem: Row { UM.RecolorImage diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index be79a1893e..a2a69ed526 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -48,6 +48,8 @@ Item right: parent.right } + leftPadding: UM.Theme.getSize("narrow_margin").width //Need more space than usual here for wide text. + rightPadding: UM.Theme.getSize("narrow_margin").width tooltip: catalog.i18nc("@info:tooltip", "Select the active output device") iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom") color: UM.Theme.getColor("action_panel_secondary") diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index f4e014b1ec..772c05741f 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -104,8 +104,6 @@ Column { id: previewStageShortcut - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_panel_button").height text: catalog.i18nc("@button", "Preview") color: UM.Theme.getColor("secondary") diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 59ec542e6b..6f3358648b 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -81,8 +81,6 @@ Rectangle rightMargin: UM.Theme.getSize("default_margin").width verticalCenter: parent.verticalCenter } - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@action:button", "Marketplace") height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) color: UM.Theme.getColor("main_window_header_secondary_button_background_active") diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index fe292799a5..cb90735250 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -172,8 +172,6 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") height: UM.Theme.getSize("action_panel_button").height - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width onClicked: popupItem.configuration_method = "custom" } @@ -195,8 +193,6 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") height: UM.Theme.getSize("action_panel_button").height - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width onClicked: popupItem.configuration_method = "auto" } From a1068a3ef27d7fa3499ae8c149a3d0da2945e2cb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 14:24:09 +0100 Subject: [PATCH 203/558] Rename action_panel_button theme entry to action_button Because it's not just used in the save panel. Contributes to issue CURA-5876. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 6 +++--- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 +- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 4 ++-- resources/themes/cura-light/theme.json | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 772c05741f..61efda2f2d 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -104,7 +104,7 @@ Column { id: previewStageShortcut - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height text: catalog.i18nc("@button", "Preview") color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") @@ -116,8 +116,8 @@ Column Cura.OutputDevicesActionButton { - width: previewStageShortcut.visible ? UM.Theme.getSize("action_panel_button").width : parent.width - height: UM.Theme.getSize("action_panel_button").height + width: previewStageShortcut.visible ? UM.Theme.getSize("action_button").width : parent.width + height: UM.Theme.getSize("action_button").height } } } \ No newline at end of file diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 2d4a7b6b89..7de1a22edb 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -85,7 +85,7 @@ Column { id: prepareButton width: parent.width - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height fixedWidthMode: true text: { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index cb90735250..1015f67a2e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -171,7 +171,7 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height onClicked: popupItem.configuration_method = "custom" } @@ -192,7 +192,7 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height onClicked: popupItem.configuration_method = "auto" } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d28611529b..8b3e606094 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -385,7 +385,6 @@ "action_panel_widget": [25.0, 0.0], "action_panel_information_widget": [20.0, 0.0], - "action_panel_button": [15.0, 3.0], "machine_selector_widget": [16.0, 4.5], @@ -432,6 +431,9 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], + "action_button": [15.0, 3.0], + "action_button_radius": [0.15, 0.15], + "small_button": [2, 2], "small_button_icon": [1.5, 1.5], @@ -520,8 +522,6 @@ "avatar_image": [6.8, 6.8], - "action_button_radius": [0.15, 0.15], - "monitor_config_override_box": [1.0, 14.0], "monitor_extruder_circle": [2.75, 2.75], "monitor_text_line": [1.16, 1.16], From 895590c3d0a445d4e114766348cdc5de676442e5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 20 Nov 2018 14:28:54 +0100 Subject: [PATCH 204/558] Change the size of the progress bar control. Also add the rounded rectangle. Contributes to the new Cura UI-Flow. --- resources/themes/cura-light/styles.qml | 1 + resources/themes/cura-light/theme.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 6f099bf1c5..58035ae3bd 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -515,6 +515,7 @@ QtObject implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) implicitHeight: Theme.getSize("progressbar").height color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background") + radius: Theme.getSize("progressbar_radius").width } progress: Rectangle { diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a33ff87042..f4d50e4c79 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -448,7 +448,7 @@ "progressbar": [26.0, 0.75], "progressbar_radius": [0.15, 0.15], - "progressbar_control": [8.0, 0.4], + "progressbar_control": [8.0, 0.75], "scrollbar": [0.75, 0.5], From dca286cea51e1f336df2a5fa2aa0f7f80dc9917e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 14:34:06 +0100 Subject: [PATCH 205/558] Give action button a sane default height We don't want to give it a default width since that should just adjust to its contents by default, which is fine. Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 1 + resources/qml/ActionPanel/OutputProcessWidget.qml | 1 - resources/qml/ActionPanel/SliceProcessWidget.qml | 1 - resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 2 -- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 08c44fb473..0ed639db75 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -31,6 +31,7 @@ Button leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("action_button").height contentItem: Row { diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 61efda2f2d..98dbe5bd2c 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -104,7 +104,6 @@ Column { id: previewStageShortcut - height: UM.Theme.getSize("action_button").height text: catalog.i18nc("@button", "Preview") color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 7de1a22edb..09e0b2584a 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -85,7 +85,6 @@ Column { id: prepareButton width: parent.width - height: UM.Theme.getSize("action_button").height fixedWidthMode: true text: { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 1015f67a2e..aa30a1236b 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -171,7 +171,6 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - height: UM.Theme.getSize("action_button").height onClicked: popupItem.configuration_method = "custom" } @@ -192,7 +191,6 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - height: UM.Theme.getSize("action_button").height onClicked: popupItem.configuration_method = "auto" } From 3b4d728d6a134237c708b0093bc6925122859056 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 20 Nov 2018 14:35:13 +0100 Subject: [PATCH 206/558] Fix Simulation view popup not sizing down I have no idea why implictHeight does work and childrenRect.height doesn't (eg; childrenRect.height only scales up for some reason, never down) CURA-5785 --- plugins/SimulationView/SimulationViewMenuComponent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 89615f43a4..caf47508e3 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -65,7 +65,7 @@ Cura.ExpandableComponent property int top_layer_count: UM.Preferences.getValue("view/top_layer_count") width: UM.Theme.getSize("layerview_menu_size").width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + height: implicitHeight spacing: UM.Theme.getSize("layerview_row_spacing").height From d42ddad606111ffcf3a1e764e3bc0af6c7064d79 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 14:47:41 +0100 Subject: [PATCH 207/558] Add icons on left and right side of text For this I had to implement functionality in ActionButton to be able to display the icon on either side. Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 24 +++++++++++++++---- .../ConfigurationMenu/ConfigurationMenu.qml | 5 ++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 0ed639db75..28bda7fd35 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -11,7 +11,8 @@ Button { id: button property alias cursorShape: mouseArea.cursorShape - property alias iconSource: buttonIcon.source + property alias iconSource: buttonIconLeft.source + property var iconOnRightSide: false property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text @@ -35,16 +36,17 @@ Button contentItem: Row { + //Icon if displayed on the left side. UM.RecolorImage { - id: buttonIcon + id: buttonIconLeft source: "" height: Math.round(0.6 * parent.height) - width: height + width: visible ? height : 0 sourceSize.width: width sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" + visible: source != "" && !button.iconOnRightSide anchors.verticalCenter: parent.verticalCenter } @@ -61,6 +63,20 @@ Button horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight } + + //Icon if displayed on the right side. + UM.RecolorImage + { + id: buttonIconRight + source: buttonIconLeft.source + height: Math.round(0.6 * parent.height) + width: visible ? height : 0 + sourceSize.width: width + sourceSize.height: height + color: button.hovered ? button.textHoverColor : button.textColor + visible: source != "" && button.iconOnRightSide + anchors.verticalCenter: parent.verticalCenter + } } background: Rectangle diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index aa30a1236b..b38384ef8a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -172,6 +172,9 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.icons.arrow_right + iconOnRightSide: true + onClicked: popupItem.configuration_method = "custom" } @@ -192,6 +195,8 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.icons.arrow_left + onClicked: popupItem.configuration_method = "auto" } } From 6de24250edbb5d5a86dbdea6eff79e15f7196326 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 20 Nov 2018 14:50:12 +0100 Subject: [PATCH 208/558] Make icon height equal to text height This seems to be about the same actually as what it was. But now the relation is in there. I also made the right icon inherit as much as possible from the left icon so that if we change something, we only have to change it in the left icon. Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 28bda7fd35..7ecaeda4b0 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -41,7 +41,7 @@ Button { id: buttonIconLeft source: "" - height: Math.round(0.6 * parent.height) + height: buttonText.height width: visible ? height : 0 sourceSize.width: width sourceSize.height: height @@ -69,13 +69,13 @@ Button { id: buttonIconRight source: buttonIconLeft.source - height: Math.round(0.6 * parent.height) + height: buttonText.height width: visible ? height : 0 sourceSize.width: width sourceSize.height: height - color: button.hovered ? button.textHoverColor : button.textColor + color: buttonIconLeft.color visible: source != "" && button.iconOnRightSide - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: buttonIconLeft.verticalCenter } } From 669648d3e11a969ec75b83c5d5b763cef9705f71 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 20 Nov 2018 16:28:21 +0100 Subject: [PATCH 209/558] Improve the toolbar style by modifying the rectangles and the behavior to get a rounded rectangle on the right-top and right-bottom. Contributes to CURA-5962. --- resources/qml/ExtruderButton.qml | 16 ++---- resources/qml/Toolbar.qml | 36 ++++++++---- resources/themes/cura-light/styles.qml | 80 ++++++++++++++++++++------ resources/themes/cura-light/theme.json | 6 +- 4 files changed, 92 insertions(+), 46 deletions(-) diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 7923521658..cdd0386d30 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -21,6 +21,9 @@ Button checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1 enabled: UM.Selection.hasSelection && extruder.stack.isEnabled + property bool isFirstElement: extrudersModel.getItem(0).name == model.name + property bool isLastElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).name == model.name + Item { anchors.centerIn: parent @@ -32,18 +35,7 @@ Button { anchors.centerIn: parent text: index + 1 - color: - { - if (base.checked) - { - return UM.Theme.getColor("toolbar_button_text_active") - } - else if(base.hovered) - { - return UM.Theme.getColor("toolbar_button_text_hover") - } - return UM.Theme.getColor("toolbar_button_text") - } + color: UM.Theme.getColor("toolbar_button_text") font: UM.Theme.getFont("default_bold") } } diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 9955ceeba7..81896f1a75 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -28,12 +28,16 @@ Item // Used to create a rounded rectangle behind the toolButtons Rectangle { - anchors.fill: toolButtons - anchors.leftMargin: -radius + anchors + { + fill: toolButtons + leftMargin: -radius - border.width + rightMargin: -border.width + topMargin: -border.width + bottomMargin: -border.width + } radius: UM.Theme.getSize("default_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - color: UM.Theme.getColor("toolbar_background") + color: UM.Theme.getColor("lining") } Column @@ -42,13 +46,13 @@ Item anchors.top: parent.top anchors.right: parent.right - spacing: UM.Theme.getSize("button_lining").width + spacing: UM.Theme.getSize("default_lining").height Repeater { id: repeat - model: UM.ToolModel { } + model: UM.ToolModel { id: toolsModel } width: childrenRect.width height: childrenRect.height Button @@ -60,6 +64,9 @@ Item enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled style: UM.Theme.styles.toolbar_button + property bool isFirstElement: toolsModel.getItem(0).id == model.id + property bool isLastElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id + onCheckedChanged: { if (checked) @@ -93,12 +100,16 @@ Item // Used to create a rounded rectangle behind the extruderButtons Rectangle { - anchors.fill: extruderButtons - anchors.leftMargin: -radius + anchors + { + fill: extruderButtons + leftMargin: -radius - border.width + rightMargin: -border.width + topMargin: -border.width + bottomMargin: -border.width + } radius: UM.Theme.getSize("default_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - color: UM.Theme.getColor("toolbar_background") + color: UM.Theme.getColor("lining") } Column @@ -108,6 +119,7 @@ Item anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.top: toolButtons.bottom anchors.right: parent.right + spacing: UM.Theme.getSize("default_lining").height Repeater { diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 58035ae3bd..723b393efa 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -175,11 +175,68 @@ QtObject { ButtonStyle { - background: Item + background: Rectangle { - implicitWidth: Theme.getSize("button").width; - implicitHeight: Theme.getSize("button").height; + implicitWidth: Theme.getSize("button").width + implicitHeight: Theme.getSize("button").height + color: + { + if (control.checked && control.hovered) + { + return Theme.getColor("toolbar_button_active_hover") + } + else if (control.checked) + { + return Theme.getColor("toolbar_button_active") + } + else if(control.hovered) + { + return Theme.getColor("toolbar_button_hover") + } + return Theme.getColor("toolbar_background") + } + radius: UM.Theme.getSize("default_radius").width + Rectangle + { + id: topSquare + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + height: parent.radius + color: control.isFirstElement ? "transparent" : parent.color + } + + Rectangle + { + id: bottomSquare + anchors + { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: parent.radius + color: control.isLastElement ? "transparent" : parent.color + } + + Rectangle + { + id: leftSquare + anchors + { + left: parent.left + top: parent.top + bottom: parent.bottom + } + width: parent.radius + color: parent.color + } + + // This is the tooltip UM.PointingRectangle { id: button_tooltip @@ -223,22 +280,7 @@ QtObject source: control.iconSource; width: Theme.getSize("button_icon").width; height: Theme.getSize("button_icon").height; - color: - { - if (control.checked && control.hovered) - { - return Theme.getColor("toolbar_button_text_active_hover"); - } - else if (control.checked) - { - return Theme.getColor("toolbar_button_text_active"); - } - else if(control.hovered) - { - return Theme.getColor("toolbar_button_text_hover"); - } - return Theme.getColor("toolbar_button_text"); - } + color: Theme.getColor("toolbar_button_text"); sourceSize: Theme.getSize("button_icon") } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f4d50e4c79..d00e998cc8 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -123,9 +123,9 @@ "warning": [255, 190, 35, 255], "toolbar_button_text": [10, 8, 80, 255], - "toolbar_button_text_hover": [50, 130, 255, 255], - "toolbar_button_text_active": [50, 130, 255, 255], - "toolbar_button_text_active_hover": [50, 130, 255, 255], + "toolbar_button_hover": [232, 242, 252, 255], + "toolbar_button_active": [232, 242, 252, 255], + "toolbar_button_active_hover": [232, 242, 252, 255], "button": [31, 36, 39, 255], "button_hover": [68, 72, 75, 255], From 4bccd2b7b5b0faac7ddd6140c5bebe81c43659cf Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 20 Nov 2018 23:46:03 +0100 Subject: [PATCH 210/558] Restyle printer settings dropdown CURA-5941 --- plugins/PreviewStage/PreviewMenu.qml | 2 +- resources/qml/ActionButton.qml | 18 +- resources/qml/MachineSelector.qml | 2 +- .../QuickConfigurationSelector.qml | 2 +- resources/qml/PrintSetupSelector.qml | 343 ++++++++++++------ resources/themes/cura-light/theme.json | 7 +- 6 files changed, 251 insertions(+), 123 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index b331ff69c5..7b3a3af4e3 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -3,7 +3,7 @@ import QtQuick 2.7 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 2a8b894867..08f4d9d679 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -12,6 +12,7 @@ Button id: button property alias cursorShape: mouseArea.cursorShape property alias iconSource: buttonIcon.source + property alias iconSourceRight: buttonIconRight.source property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text @@ -29,7 +30,8 @@ Button // we elide the text to the right so the text will be cut off with the three dots at the end. property var fixedWidthMode: false - contentItem: Row + width: buttonIcon.width + buttonText.width + buttonIconRight.width + contentItem: Item { UM.RecolorImage { @@ -57,6 +59,20 @@ Button horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight } + + UM.RecolorImage + { + id: buttonIconRight + source: "" + height: Math.round(0.6 * parent.height) + width: height + sourceSize.width: width + sourceSize.height: height + color: button.hovered ? button.textHoverColor : button.textColor + visible: source != "" + anchors.verticalCenter: parent.verticalCenter + anchors.right: source != "" ? parent.right : undefined + } } background: Rectangle diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index a464949192..c9756d93ba 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index 33610135fe..d428a05463 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.11 +import QtQuick.Layouts 1.3 import QtQuick.Controls 1.1 as OldControls diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index b843244147..ed09238b51 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -28,8 +28,15 @@ Cura.ExpandableComponent height: childrenRect.height iconSource: UM.Theme.getIcon("pencil") + popupPadding : 0 + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + Component.onCompleted: + { + popupItemWrapper.width = base.width + } + UM.I18nCatalog { id: catalog @@ -109,142 +116,242 @@ Cura.ExpandableComponent } } - popupItem: Item + + Cura.ExtrudersModel { - height: settingsModeSelection.height + sidebarContents.height + 2 * UM.Theme.getSize("default_margin").height - width: UM.Theme.getSize("print_setup_widget").width - ListView - { - // Settings mode selection toggle - id: settingsModeSelection - model: modesListModel - height: UM.Theme.getSize("print_setup_mode_toggle").height - visible: !hideSettings + id: extrudersModel + } - anchors - { - right: parent.right - left: parent.left - margins: UM.Theme.getSize("thick_margin").width - } + popupItem: Rectangle + { + property var total_height: popupItemHeader.height + popupItemContent.height + 10 + separator_footer.height + id: popupItemWrapper + height: total_height - ButtonGroup - { - id: modeMenuGroup - } - - delegate: Button - { - id: control - - height: settingsModeSelection.height - width: Math.round(parent.width / 2) - - anchors.left: parent.left - anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2) - anchors.verticalCenter: parent.verticalCenter - - ButtonGroup.group: modeMenuGroup - - checkable: true - checked: base.currentModeIndex == index - onClicked: base.currentModeIndex = index - - onHoveredChanged: - { - if (hovered) - { - tooltipDelayTimer.item = settingsModeSelection - tooltipDelayTimer.text = model.tooltipText - tooltipDelayTimer.start() - } - else - { - tooltipDelayTimer.stop() - base.hideTooltip() - } - } - - background: Rectangle - { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - - // For some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - - contentItem: Label - { - text: model.text - font: UM.Theme.getFont("default") - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - elide: Text.ElideRight - color: - { - if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text") - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text") - } - return UM.Theme.getColor("action_button_text") - } - } - } - } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") Item { - id: sidebarContents - anchors.top: settingsModeSelection.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("print_setup_widget").height + id: popupItemHeader + height: 36 - visible: !hideSettings - - // We load both of them at once (instead of using a loader) because the advanced sidebar can take - // quite some time to load. So in this case we sacrifice memory for speed. - SidebarAdvanced + anchors { - anchors.fill: parent - visible: currentModeIndex == 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() + top: parent.top + right: parent.right + left: parent.left } - SidebarSimple + Label { - anchors.fill: parent - visible: currentModeIndex != 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() + id: popupItemHeaderText + text: catalog.i18nc("@label", "Print settings"); + font: UM.Theme.getFont("default") + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + height: parent.height + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + } + + Rectangle + { + width: parent.width + height: UM.Theme.getSize("default_lining").height + anchors.top: popupItemHeaderText.bottom + color: UM.Theme.getColor("action_button_border") + + } } - // Setting mode: Recommended or Custom - ListModel + Rectangle { - id: modesListModel + id: popupItemContent + width: parent.width + height: tabBar.height + sidebarContents.height + anchors + { + top: popupItemHeader.bottom + topMargin: 10 + right: parent.right + left: parent.left + leftMargin: 5 + rightMargin: 5 + } + + + TabBar + { + id: tabBar + onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + width: parent.width + height: UM.Theme.getSize("print_setup_tap_bar").width + z: 1 + Repeater + { + id: extruder_model_repeater + model: extrudersModel + + delegate: TabButton + { + z: 2 + width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 + implicitHeight: parent.height + + contentItem: Rectangle + { + z: 2 + Cura.ExtruderIcon + { + anchors.horizontalCenter: parent.horizontalCenter + materialColor: model.color + extruderEnabled: model.enabled + width: parent.height + height: parent.height + } + + } + + background: Rectangle + { + + width: parent.width + z: 1 + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: UM.Theme.getColor("action_button_border") + + visible: + { + return index == tabBar.currentIndex + } + + // overlap bottom border + Rectangle + { + width: parent.width - 4 + height: 4 + anchors.bottom: parent.bottom + anchors.bottomMargin: -2 + anchors.leftMargin: 2 + anchors.left: parent.left + + } + } + } + } + } + + Rectangle + { + id: sidebarContents + anchors.top: tabBar.bottom + anchors.left: parent.left + anchors.right: parent.right + height: UM.Theme.getSize("print_setup_widget").height + + + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: UM.Theme.getColor("action_button_border") + + SidebarSimple + { + anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height + id: sidebar_simple_id + anchors.fill: parent + visible: currentModeIndex != 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + + SidebarAdvanced + { + anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height + anchors.bottomMargin: 2 //does not overlap bottom border + anchors.fill: parent + visible: currentModeIndex == 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + + } } + + Item + { + id: separator_footer + anchors.top: popupItemContent.bottom + anchors.topMargin: 10 + width: parent.width + height: settingControlButton.height + 4 + + Rectangle + { + width: parent.width + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("action_button_border") + } + + Cura.ActionButton + { + id: settingControlButton + + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Custom") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + iconSourceRight: UM.Theme.getIcon("arrow_right") + width: UM.Theme.getSize("print_setup_action_button").width + fixedWidthMode: true + visible: currentModeIndex == 0 + anchors + { + top: parent.top + topMargin: 10 + bottomMargin: 10 + right: parent.right + rightMargin: 5 + } + + onClicked: currentModeIndex = 1 + } + + Cura.ActionButton + { + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Recommended") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.getIcon("arrow_left") + width: UM.Theme.getSize("print_setup_action_button").width + + + fixedWidthMode: true + visible: currentModeIndex == 1 + anchors + { + top: parent.top + topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + left: parent.left + leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + } + + onClicked: currentModeIndex = 0 + } + } Component.onCompleted: { - modesListModel.append({ - text: catalog.i18nc("@title:tab", "Recommended"), - tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Recommended Print Setup")).arg(catalog.i18nc("@tooltip", "Print with the recommended settings for the selected printer, material and quality.")) - }) - modesListModel.append({ - text: catalog.i18nc("@title:tab", "Custom"), - tooltipText: "%1

%2".arg(catalog.i18nc("@tooltip:title", "Custom Print Setup")).arg(catalog.i18nc("@tooltip", "Print with finegrained control over every last bit of the slicing process.")) - }) - var index = Math.round(UM.Preferences.getValue("cura/active_mode")) if(index != null && !isNaN(index)) @@ -257,4 +364,4 @@ Cura.ExpandableComponent } } } -} +} \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d28611529b..fc62edc480 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -528,6 +528,11 @@ "monitor_thick_lining": [0.16, 0.16], "monitor_corner_radius": [0.3, 0.3], "monitor_shadow_radius": [0.4, 0.4], - "monitor_shadow_offset": [0.15, 0.15] + "monitor_shadow_offset": [0.15, 0.15], + + "print_setup_selector_margin": [0.5, 0.5], + "print_setup_action_button": [13, 5], + "print_setup_tap_bar": [4, 4], + "print_setup_content_top_margin": [3, 3] } } From 8b085aa877194c45a3122ccbafa5460d57f9e28d Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 20 Nov 2018 23:47:25 +0100 Subject: [PATCH 211/558] Revert "Switch Ultimaker Account OAuth2 client" This reverts commit 4e8979334e0d794b2cd8cae72ce9c351890577c8. --- cura/API/Account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cura/API/Account.py b/cura/API/Account.py index 64d63c7025..397e220478 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -38,12 +38,13 @@ class Account(QObject): self._callback_port = 32118 self._oauth_root = "https://account.ultimaker.com" + self._cloud_api_root = "https://api.ultimaker.com" self._oauth_settings = OAuth2Settings( OAUTH_SERVER_URL= self._oauth_root, CALLBACK_PORT=self._callback_port, CALLBACK_URL="http://localhost:{}/callback".format(self._callback_port), - CLIENT_ID="um----------------------------ultimaker_cura", + CLIENT_ID="um---------------ultimaker_cura_drive_plugin", CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download packages.rating.read packages.rating.write", AUTH_DATA_PREFERENCE_KEY="general/ultimaker_auth_data", AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root), From 791929d6897942e971a112a26839c0fa6f94f847 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 20 Nov 2018 23:47:46 +0100 Subject: [PATCH 212/558] Revert "Merge branch 'fix-oauth2-client' into CURA-5785-Restyle_stage_menu" This reverts commit 4caf770a62f07b71a646b7f09a08623485b89582, reversing changes made to 0cdcd61ff2dfe2677e636cc2f1ee993cbd9d641d. --- resources/qml/Dialogs/AddMachineDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index aa160acd4d..0df8b891d9 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -73,7 +73,7 @@ UM.Dialog { top: parent.top left: parent.left - topMargin: UM.Theme.getSize("default_margin").height + topMargin: UM.Theme.getSize("default_margin") } text: catalog.i18nc("@title:tab", "Add a printer to Cura") From 60ed0ddc2493f357417922529f25ce242d8daba7 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 20 Nov 2018 23:49:33 +0100 Subject: [PATCH 213/558] Revert "Revert "Merge branch 'fix-oauth2-client' into CURA-5785-Restyle_stage_menu"" This reverts commit 791929d6897942e971a112a26839c0fa6f94f847. --- resources/qml/Dialogs/AddMachineDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index 0df8b891d9..aa160acd4d 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -73,7 +73,7 @@ UM.Dialog { top: parent.top left: parent.left - topMargin: UM.Theme.getSize("default_margin") + topMargin: UM.Theme.getSize("default_margin").height } text: catalog.i18nc("@title:tab", "Add a printer to Cura") From 23744e42d1f4480fdc7f3c56f3591074b3ae8723 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 09:15:18 +0100 Subject: [PATCH 214/558] Remove SaveButton file, since it's not used anymore. Contributes to CURA-5942 --- resources/qml/SaveButton.qml | 478 ----------------------------------- 1 file changed, 478 deletions(-) delete mode 100644 resources/qml/SaveButton.qml diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml deleted file mode 100644 index c2d310e30c..0000000000 --- a/resources/qml/SaveButton.qml +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 - -import UM 1.1 as UM -import Cura 1.0 as Cura - -// This widget does so much more than "just" being a save button, so it should be refactored at some point in time. -Item -{ - id: base; - UM.I18nCatalog { id: catalog; name: "cura"} - - property real progress: UM.Backend.progress - property int backendState: UM.Backend.state - property bool activity: CuraApplication.platformActivity - - property alias buttonRowWidth: saveRow.width - - property string fileBaseName - property string statusText: - { - if(!activity) - { - return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model"); - } - - switch(base.backendState) - { - case 1: - return catalog.i18nc("@label:PrintjobStatus", "Ready to slice"); - case 2: - return catalog.i18nc("@label:PrintjobStatus", "Slicing..."); - case 3: - return catalog.i18nc("@label:PrintjobStatus %1 is target operation", "Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription); - case 4: - return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice"); - case 5: - return catalog.i18nc("@label:PrintjobStatus", "Slicing unavailable"); - default: - return ""; - } - } - - function sliceOrStopSlicing() - { - try - { - if ([1, 5].indexOf(base.backendState) != -1) - { - CuraApplication.backend.forceSlice(); - } - else - { - CuraApplication.backend.stopSlicing(); - } - } - catch (e) - { - console.log("Could not start or stop slicing.", e) - } - } - - Label - { - id: statusLabel - width: parent.width - 2 * UM.Theme.getSize("thick_margin").width - anchors.top: parent.top - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default_bold") - text: statusText; - } - - Rectangle - { - id: progressBar - width: parent.width - 2 * UM.Theme.getSize("thick_margin").width - height: UM.Theme.getSize("progressbar").height - anchors.top: statusLabel.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4) - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - - Rectangle - { - width: Math.max(parent.width * base.progress) - height: parent.height - color: UM.Theme.getColor("progressbar_control") - radius: UM.Theme.getSize("progressbar_radius").width - visible: base.backendState == 2 - } - } - - // Shortcut for "save as/print/..." - Action - { - shortcut: "Ctrl+P" - onTriggered: - { - // only work when the button is enabled - if (saveToButton.enabled) - { - saveToButton.clicked(); - } - // prepare button - if (prepareButton.enabled) - { - sliceOrStopSlicing(); - } - } - } - - Item - { - id: saveRow - width: { - // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect - var children_width = UM.Theme.getSize("default_margin").width; - for (var index in children) - { - var child = children[index]; - if(child.visible) - { - children_width += child.width + child.anchors.rightMargin; - } - } - return Math.min(children_width, base.width - UM.Theme.getSize("thick_margin").width); - } - height: saveToButton.height - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("thick_margin").height - anchors.right: parent.right - clip: true - - Row - { - id: additionalComponentsRow - anchors.top: parent.top - anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right) - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - spacing: UM.Theme.getSize("default_margin").width - } - - Component.onCompleted: - { - saveRow.addAdditionalComponents("saveButton") - } - - Connections - { - target: CuraApplication - onAdditionalComponentsChanged: saveRow.addAdditionalComponents("saveButton") - } - - function addAdditionalComponents (areaId) - { - if(areaId == "saveButton") - { - for (var component in CuraApplication.additionalComponents["saveButton"]) - { - CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow - } - } - } - - Connections - { - target: UM.Preferences - onPreferenceChanged: - { - var autoSlice = UM.Preferences.getValue("general/auto_slice"); - prepareButton.autoSlice = autoSlice; - saveToButton.autoSlice = autoSlice; - } - } - - // Prepare button, only shows if auto_slice is off - Button - { - id: prepareButton - - tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process") - // 1 = not started, 2 = Processing - enabled: ([1, 2].indexOf(base.backendState) != -1) && base.activity - visible: !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity - property bool autoSlice - height: UM.Theme.getSize("save_button_save_to_button").height - - anchors.top: parent.top - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - // 1 = not started, 4 = error, 5 = disabled - text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel") - onClicked: - { - sliceOrStopSlicing(); - } - - style: ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - - Behavior on color { ColorAnimation { duration: 50; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("action_button") - text: control.text; - } - } - label: Item {} - } - } - - Button - { - id: saveToButton - - tooltip: UM.OutputDeviceManager.activeDeviceDescription; - // 3 = done, 5 = disabled - enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true - visible: base.backendState != "undefined" && autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true) - property bool autoSlice - height: UM.Theme.getSize("save_button_save_to_button").height - - anchors.top: parent.top - anchors.right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right - anchors.rightMargin: deviceSelectionMenu.visible ? -3 * UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thick_margin").width - - text: UM.OutputDeviceManager.activeDeviceShortDescription - onClicked: - { - forceActiveFocus(); - UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, - { "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats }); - } - - style: ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered_border"); - } - else - { - return UM.Theme.getColor("print_button_ready_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed"); - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered"); - } - else - { - return UM.Theme.getColor("print_button_ready"); - } - } - - Behavior on color { ColorAnimation { duration: 50; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") - font: UM.Theme.getFont("action_button") - text: control.text - } - } - label: Item { } - } - } - - Button - { - id: deviceSelectionMenu - tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); - anchors.top: parent.top - anchors.right: parent.right - - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - width: UM.Theme.getSize("save_button_save_to_button").height - height: UM.Theme.getSize("save_button_save_to_button").height - - // 3 = Done, 5 = Disabled - enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true - visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true - - - style: ButtonStyle - { - background: Rectangle - { - id: deviceSelectionIcon - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border") - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed_border") - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered_border") - } - else - { - return UM.Theme.getColor("print_button_ready_border") - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled") - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed") - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered") - } - else - { - return UM.Theme.getColor("print_button_ready") - } - } - Behavior on color { ColorAnimation { duration: 50; } } - anchors.left: parent.left - anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2); - width: parent.height - height: parent.height - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: height - color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") - source: UM.Theme.getIcon("arrow_bottom") - } - } - } - - menu: Menu - { - id: devicesMenu; - Instantiator - { - model: devicesModel; - MenuItem - { - text: model.description - checkable: true; - checked: model.id == UM.OutputDeviceManager.activeDevice - exclusiveGroup: devicesMenuGroup - onTriggered: - { - UM.OutputDeviceManager.setActiveDevice(model.id); - } - } - onObjectAdded: devicesMenu.insertItem(index, object) - onObjectRemoved: devicesMenu.removeItem(object) - } - ExclusiveGroup { id: devicesMenuGroup } - } - } - UM.OutputDevicesModel { id: devicesModel } - } -} From d74393498b18805de9453e05bded2e9c09a3d928 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 09:35:35 +0100 Subject: [PATCH 215/558] Fixed view selector header not updating correctly CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 1a744aeb65..fa1b6aae0f 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -54,22 +54,27 @@ Item { for (var i = 0; i < viewModel.rowCount(); i++) { - if (viewModel.getItem(i).active) + if (viewModel.items[i].active) { - return viewModel.getItem(i) + return viewModel.items[i] } } - // Nothing was active, so just return the first one (the list is sorted by priority, so the most - // important one should be returned) - return viewModel.getItem(0) + return null } - // Ensure that the controller is synced with whatever happend here. - onActiveViewChanged: UM.Controller.setActiveView(activeView.id) + Component.onCompleted: + { + // Nothing was active, so just return the first one (the list is sorted by priority, so the most + // important one should be returned) + if(activeView == null) + { + UM.Controller.setActiveView(viewModel.getItem(0).id) + } + } headerItem: Label { - text: viewSelector.activeView.name + text: viewSelector.activeView ? viewSelector.activeView.name : "" verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight @@ -98,7 +103,7 @@ Item text: name radius: UM.Theme.getSize("default_radius").width checkable: true - checked: active + checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false onClicked: { viewSelector.togglePopup() From 8e47d0475632296030f9e2d1f49c6d8797b93982 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 11:12:59 +0100 Subject: [PATCH 216/558] Adjust sizes and alignments to the print selector panel. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 2 +- resources/qml/ExpandableComponent.qml | 19 +++++++++++++++--- resources/qml/MachineSelector.qml | 27 +++++++++++++------------- resources/themes/cura-light/theme.json | 9 +++++---- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ef01625a22..121928e19f 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -46,7 +46,7 @@ Item anchors.centerIn: parent - width: 0.9 * prepareMenu.width + width: Math.round(0.9 * prepareMenu.width) height: parent.height spacing: 0 diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 8ed6dc5674..c1e3bc7985 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -10,6 +10,13 @@ import UM 1.2 as UM Item { id: base + + // Enumeration with the different possible alignments of the popup with respect of the headerItem + enum PopupAlignment { + AlignLeft, + AlignRight + } + // The headerItem holds the QML item that is always displayed. property alias headerItem: headerItemLoader.sourceComponent @@ -21,6 +28,9 @@ Item property color headerBackgroundColor: UM.Theme.getColor("action_button") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + // Defines the alignment of the popup with respect of the headerItem, by default to the right + property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight + // How much spacing is needed around the popupItem property alias popupPadding: popup.padding @@ -42,6 +52,7 @@ Item function togglePopup() { +// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight) if(popup.visible) { popup.close() @@ -116,8 +127,8 @@ Item sourceSize.height: height visible: source != "" width: height - height: 0.2 * base.height - color: "black" + height: Math.round(0.2 * base.height) + color: UM.Theme.getColor("text") } MouseArea @@ -140,13 +151,15 @@ Item // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between // the button & text. - x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding + x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent background: Rectangle { color: popupBackgroundColor + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") } } } diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index c9756d93ba..f029914884 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -17,6 +17,8 @@ Cura.ExpandableComponent property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + popupPadding: 0 + popupAlignment: ExpandableComponent.PopupAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog @@ -31,6 +33,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight + renderType: Text.NativeRendering font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } @@ -38,26 +41,25 @@ Cura.ExpandableComponent popupItem: Item { id: popup - width: machineSelector.width - 2 * UM.Theme.getSize("default_margin").width - height: 200 + width: UM.Theme.getSize("machine_selector_widget_content").width + height: UM.Theme.getSize("machine_selector_widget_content").height ScrollView { anchors.fill: parent - contentHeight: column.implicitHeight - contentWidth: column.implicitWidth clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff Column { id: column anchors.fill: parent + Label { - text: catalog.i18nc("@label", "Networked Printers") + text: catalog.i18nc("@label", "Network connected printers") visible: networkedPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter @@ -73,13 +75,12 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} } - delegate: RoundButton + delegate: Button { text: name width: parent.width - checkable: true - radius: UM.Theme.getSize("default_radius").width + onClicked: { togglePopup() @@ -92,14 +93,14 @@ Cura.ExpandableComponent onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] } } - } Label { - text: catalog.i18nc("@label", "Virtual Printers") + text: catalog.i18nc("@label", "Preset printers") visible: virtualPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter @@ -115,21 +116,19 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": null} } - delegate: RoundButton + delegate: Button { text: name width: parent.width checked: Cura.MachineManager.activeMachineId == model.id checkable: true - radius: UM.Theme.getSize("default_radius").width onClicked: { togglePopup() Cura.MachineManager.setActiveMachine(model.id) } } - } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d28611529b..5f52adff14 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -367,11 +367,11 @@ "sizes": { "window_minimum_size": [106, 66], - "main_window_header": [0.0, 4.5], + "main_window_header": [0.0, 4.0], "main_window_header_button": [8, 2.35], "main_window_header_button_icon": [1.2, 1.2], - "stage_menu": [0.0, 4.5], + "stage_menu": [0.0, 4.0], "account_button": [12, 3], @@ -380,14 +380,15 @@ "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], - "configuration_selector_widget": [35.0, 4.5], + "configuration_selector_widget": [35.0, 4.0], "configuration_selector_mode_tabs": [0.0, 3.0], "action_panel_widget": [25.0, 0.0], "action_panel_information_widget": [20.0, 0.0], "action_panel_button": [15.0, 3.0], - "machine_selector_widget": [16.0, 4.5], + "machine_selector_widget": [20.0, 4.0], + "machine_selector_widget_content": [25.0, 32.0], "views_selector": [0.0, 4.0], From b826a420265051cefd6483eb228e3716182b1380 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 11:37:58 +0100 Subject: [PATCH 217/558] Add the RoundedRectangle as background to the ExpandableComponent This way the expandable components can have rounded corners only on one side, thus preventing the need to do add backgrounds to the rows that they are in. CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 99 ++++++------- plugins/PreviewStage/PreviewMenu.qml | 191 ++++++++++++-------------- resources/qml/Cura.qml | 1 + resources/qml/ExpandableComponent.qml | 9 +- resources/qml/RoundedRectangle.qml | 39 ++++++ 5 files changed, 181 insertions(+), 158 deletions(-) create mode 100644 resources/qml/RoundedRectangle.qml diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ef01625a22..22f93aa5f2 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -24,77 +24,66 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButtonBackground.width + itemRowBackground.width + width: openFileButtonBackground.width + itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height - Rectangle + RowLayout { - id: itemRowBackground - radius: UM.Theme.getSize("default_radius").width - - color: UM.Theme.getColor("toolbar_background") - - width: itemRow.width + UM.Theme.getSize("default_margin").width - height: parent.height + id: itemRow anchors.left: openFileButtonBackground.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - RowLayout + width: 0.9 * prepareMenu.width + height: parent.height + spacing: 0 + + Cura.MachineSelector { - id: itemRow + id: machineSelection + z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. + headerCornerSide: 2 // Show corners on the left. + Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width + Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width + Layout.fillWidth: true + Layout.fillHeight: true + } - anchors.centerIn: parent - - width: 0.9 * prepareMenu.width + // Separator line + Rectangle + { height: parent.height - spacing: 0 + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } - Cura.MachineSelector - { - id: machineSelection - z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. - Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width - Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width - Layout.fillWidth: true - Layout.fillHeight: true - } + Cura.QuickConfigurationSelector + { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width + } - // Separator line - Rectangle - { - height: parent.height - width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") - } + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } - Cura.QuickConfigurationSelector - { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width - } - - // Separator line - Rectangle - { - height: parent.height - width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") - } - - Item - { - id: printSetupSelectorItem - // This is a work around to prevent the printSetupSelector from having to be re-loaded every time - // a stage switch is done. - children: [printSetupSelector] - height: childrenRect.height - width: childrenRect.width - } + Item + { + id: printSetupSelectorItem + // This is a work around to prevent the printSetupSelector from having to be re-loaded every time + // a stage switch is done. + children: [printSetupSelector] + height: childrenRect.height + width: childrenRect.width } } + Rectangle { id: openFileButtonBackground diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index fa1b6aae0f..d6033d6272 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -22,135 +22,122 @@ Item name: "cura" } - Rectangle - { - anchors.fill: stageMenu - anchors.leftMargin: -radius - radius: UM.Theme.getSize("default_radius").width - color: UM.Theme.getColor("toolbar_background") - } - Item + Row { - id: stageMenu + id: stageMenuRow + anchors.centerIn: parent height: parent.height - width: stageMenuRow.width + UM.Theme.getSize("default_margin").width - anchors.horizontalCenter: parent.horizontalCenter - Row + + Cura.ExpandableComponent { - id: stageMenuRow - anchors.centerIn: parent + id: viewSelector + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") height: parent.height + headerCornerSide: 2 // Show corners on the left side - Cura.ExpandableComponent + property var viewModel: UM.ViewModel { } + + property var activeView: { - id: viewSelector - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") - height: parent.height - - property var viewModel: UM.ViewModel { } - - property var activeView: + for (var i = 0; i < viewModel.rowCount(); i++) { - for (var i = 0; i < viewModel.rowCount(); i++) + if (viewModel.items[i].active) { - if (viewModel.items[i].active) - { - return viewModel.items[i] - } + return viewModel.items[i] } - return null } + return null + } + Component.onCompleted: + { + // Nothing was active, so just return the first one (the list is sorted by priority, so the most + // important one should be returned) + if(activeView == null) + { + UM.Controller.setActiveView(viewModel.getItem(0).id) + } + } + + headerItem: Label + { + text: viewSelector.activeView ? viewSelector.activeView.name : "" + verticalAlignment: Text.AlignVCenter + height: parent.height + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + + popupItem: Column + { + id: viewSelectorPopup + width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + + // For some reason the height/width of the column gets set to 0 if this is not set... Component.onCompleted: { - // Nothing was active, so just return the first one (the list is sorted by priority, so the most - // important one should be returned) - if(activeView == null) - { - UM.Controller.setActiveView(viewModel.getItem(0).id) - } + height = implicitHeight + width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width } - headerItem: Label + Repeater { - text: viewSelector.activeView ? viewSelector.activeView.name : "" - verticalAlignment: Text.AlignVCenter - height: parent.height - elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - - popupItem: Column - { - id: viewSelectorPopup - width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width - - // For some reason the height/width of the column gets set to 0 if this is not set... - Component.onCompleted: + id: viewsList + model: viewSelector.viewModel + RoundButton { - height = implicitHeight - width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width - } - - Repeater - { - id: viewsList - model: viewSelector.viewModel - RoundButton + text: name + radius: UM.Theme.getSize("default_radius").width + checkable: true + checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false + onClicked: { - text: name - radius: UM.Theme.getSize("default_radius").width - checkable: true - checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false - onClicked: - { - viewSelector.togglePopup() - UM.Controller.setActiveView(id) - } + viewSelector.togglePopup() + UM.Controller.setActiveView(id) } } - } - } - // Separator line - Rectangle - { - height: parent.height - // If there is no viewPanel, we only need a single spacer, so hide this one. - visible: viewPanel.source != "" - width: visible ? UM.Theme.getSize("default_lining").width : 0 - - color: UM.Theme.getColor("lining") } + } - Loader - { - id: viewPanel - height: parent.height - width: childrenRect.width - source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" - } + // Separator line + Rectangle + { + height: parent.height + // If there is no viewPanel, we only need a single spacer, so hide this one. + visible: viewPanel.source != "" + width: visible ? UM.Theme.getSize("default_lining").width : 0 - // Separator line - Rectangle - { - height: parent.height - width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") - } + color: UM.Theme.getColor("lining") + } - Item - { - id: printSetupSelectorItem - // This is a work around to prevent the printSetupSelector from having to be re-loaded every time - // a stage switch is done. - children: [printSetupSelector] - height: childrenRect.height - width: childrenRect.width - } + Loader + { + id: viewPanel + height: parent.height + width: childrenRect.width + source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" + } + + // Separator line + Rectangle + { + height: parent.height + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } + + Item + { + id: printSetupSelectorItem + // This is a work around to prevent the printSetupSelector from having to be re-loaded every time + // a stage switch is done. + children: [printSetupSelector] + height: childrenRect.height + width: childrenRect.width } } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c239dc8d6f..711c05c64c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -259,6 +259,7 @@ UM.MainWindow onHideTooltip: base.hideTooltip() width: UM.Theme.getSize("print_setup_widget").width height: UM.Theme.getSize("stage_menu").height + headerCornerSide: 4 // Show corners on the right side } } diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 8ed6dc5674..262c6bfd3f 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -40,6 +40,12 @@ Item property alias expandedHighlightColor: expandedHighlight.color + // What should the radius of the header be. This is also influenced by the headerCornerSide + property alias headerRadius: background.radius + + // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. + property alias headerCornerSide: background.cornerSide + function togglePopup() { if(popup.visible) @@ -71,7 +77,8 @@ Item implicitHeight: 100 * screenScaleFactor implicitWidth: 400 * screenScaleFactor - Rectangle + + RoundedRectangle { id: background property real padding: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/RoundedRectangle.qml b/resources/qml/RoundedRectangle.qml new file mode 100644 index 0000000000..d7ba7d6d13 --- /dev/null +++ b/resources/qml/RoundedRectangle.qml @@ -0,0 +1,39 @@ +import QtQuick 2.0 + +import UM 1.2 as UM + +// The rounded rectangle works mostly like a regular rectangle, but provides the option to have rounded corners on only one side of the rectangle. +Item +{ + // As per the regular rectangle + property color color: "transparent" + + // As per regular rectangle + property int radius: UM.Theme.getSize("default_radius").width + + // On what side should the corners be shown 0 can be used if no radius is needed. + // 1 is down, 2 is left, 3 is up and 4 is right. + property int cornerSide: 0 + + Rectangle + { + id: background + anchors.fill: parent + radius: cornerSide != 0 ? parent.radius : 0 + color: parent.color + } + + // The item that covers 2 of the corners to make them not rounded. + Rectangle + { + visible: cornerSide != 0 + height: cornerSide % 2 ? parent.radius: parent.height + width: cornerSide % 2 ? parent.width : parent.radius + color: parent.color + anchors + { + right: cornerSide == 2 ? parent.right: undefined + bottom: cornerSide == 3 ? parent.bottom: undefined + } + } +} From de650300e20abf2a54baa953076bb71cf2943e1b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 11:43:20 +0100 Subject: [PATCH 218/558] Add the buttons to add printer and manage printers in the bottom of the print selector panel. Contributes to CURA-5942. --- resources/qml/ExpandableComponent.qml | 6 ++-- resources/qml/MachineSelector.qml | 52 +++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index c1e3bc7985..aa9e1467fa 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -52,7 +52,6 @@ Item function togglePopup() { -// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight) if(popup.visible) { popup.close() @@ -149,8 +148,8 @@ Item // Ensure that the popup is located directly below the headerItem y: headerItemLoader.height + 2 * background.padding - // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between - // the button & text. + // Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left. + // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent @@ -160,6 +159,7 @@ Item color: popupBackgroundColor border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") + radius: UM.Theme.getSize("default_radius").width } } } diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index f029914884..3e70fda299 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.7 import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 @@ -46,7 +46,9 @@ Cura.ExpandableComponent ScrollView { - anchors.fill: parent + width: parent.width + anchors.top: parent.top + anchors.bottom: separator.top clip: true Column @@ -80,7 +82,7 @@ Cura.ExpandableComponent text: name width: parent.width checkable: true - + onClicked: { togglePopup() @@ -132,5 +134,49 @@ Cura.ExpandableComponent } } } + + Rectangle + { + id: separator + + anchors.bottom: buttonRow.top + width: parent.width + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") + } + + Row + { + id: buttonRow + + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + padding: UM.Theme.getSize("default_margin").width + spacing: UM.Theme.getSize("default_margin").width + + Cura.ActionButton + { + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@button", "Add printer") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + onClicked: Cura.Actions.addMachine.trigger() + } + + Cura.ActionButton + { + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@button", "Manage printers") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + onClicked: Cura.Actions.configureMachines.trigger() + } + } } } From 64bbab9d4024df8d1be956040d81a69551922308 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 11:50:00 +0100 Subject: [PATCH 219/558] Use the group name to show in the printer list if it's a network connected printer. Contributes to CURA-5942. --- resources/qml/MachineSelector.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 3e70fda299..417c5722b4 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -79,8 +79,9 @@ Cura.ExpandableComponent delegate: Button { - text: name + text: model.metadata["connect_group_name"] width: parent.width + checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] checkable: true onClicked: @@ -120,7 +121,7 @@ Cura.ExpandableComponent delegate: Button { - text: name + text: model.name width: parent.width checked: Cura.MachineManager.activeMachineId == model.id checkable: true From eef6ad662d816ac8266faaa391342accab36f07d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 11:50:39 +0100 Subject: [PATCH 220/558] Added enum for the roundedCorner property This makes it a whole lot easier to read what is being set. CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 2 +- plugins/PreviewStage/PreviewMenu.qml | 2 +- resources/qml/Cura.qml | 2 +- resources/qml/RoundedRectangle.qml | 24 +++++++++++++++++------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 22f93aa5f2..bf2a0e1283 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -42,7 +42,7 @@ Item { id: machineSelection z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. - headerCornerSide: 2 // Show corners on the left. + headerCornerSide: Cura.RoundedRectangle.Direction.Left Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.fillWidth: true diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index d6033d6272..29632e5f00 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -34,7 +34,7 @@ Item id: viewSelector iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") height: parent.height - headerCornerSide: 2 // Show corners on the left side + headerCornerSide: Cura.RoundedRectangle.Direction.Left property var viewModel: UM.ViewModel { } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 711c05c64c..2814bb9eb2 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -259,7 +259,7 @@ UM.MainWindow onHideTooltip: base.hideTooltip() width: UM.Theme.getSize("print_setup_widget").width height: UM.Theme.getSize("stage_menu").height - headerCornerSide: 4 // Show corners on the right side + headerCornerSide: RoundedRectangle.Direction.Right } } diff --git a/resources/qml/RoundedRectangle.qml b/resources/qml/RoundedRectangle.qml index d7ba7d6d13..9ad2230be5 100644 --- a/resources/qml/RoundedRectangle.qml +++ b/resources/qml/RoundedRectangle.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.7 import UM 1.2 as UM @@ -11,29 +11,39 @@ Item // As per regular rectangle property int radius: UM.Theme.getSize("default_radius").width - // On what side should the corners be shown 0 can be used if no radius is needed. + // On what side should the corners be shown 5 can be used if no radius is needed. // 1 is down, 2 is left, 3 is up and 4 is right. - property int cornerSide: 0 + property int cornerSide: RoundedRectangle.Direction.None + + enum Direction + { + None = 0, + Down = 1, + Left = 2, + Up = 3, + Right = 4, + All = 5 + } Rectangle { id: background anchors.fill: parent - radius: cornerSide != 0 ? parent.radius : 0 + radius: cornerSide != RoundedRectangle.Direction.None ? parent.radius : 0 color: parent.color } // The item that covers 2 of the corners to make them not rounded. Rectangle { - visible: cornerSide != 0 + visible: cornerSide != RoundedRectangle.Direction.None && cornerSide != RoundedRectangle.Direction.All height: cornerSide % 2 ? parent.radius: parent.height width: cornerSide % 2 ? parent.width : parent.radius color: parent.color anchors { - right: cornerSide == 2 ? parent.right: undefined - bottom: cornerSide == 3 ? parent.bottom: undefined + right: cornerSide == RoundedRectangle.Direction.Left ? parent.right: undefined + bottom: cornerSide == RoundedRectangle.Direction.Up ? parent.bottom: undefined } } } From bfd8e666570d636293bae9dbda0c2134de992065 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 21 Nov 2018 12:50:18 +0100 Subject: [PATCH 221/558] Removed margins and unused arches CURA-5941 --- resources/qml/PrintSetupSelector.qml | 46 +++++++++++++--------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index ed09238b51..61cc06b426 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -116,7 +116,6 @@ Cura.ExpandableComponent } } - Cura.ExtrudersModel { id: extrudersModel @@ -124,7 +123,7 @@ Cura.ExpandableComponent popupItem: Rectangle { - property var total_height: popupItemHeader.height + popupItemContent.height + 10 + separator_footer.height + property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("print_setup_selector_margin").height * 2 id: popupItemWrapper height: total_height @@ -176,7 +175,7 @@ Cura.ExpandableComponent anchors { top: popupItemHeader.bottom - topMargin: 10 + topMargin: UM.Theme.getSize("print_setup_selector_margin").height right: parent.right left: parent.left leftMargin: 5 @@ -213,7 +212,6 @@ Cura.ExpandableComponent width: parent.height height: parent.height } - } background: Rectangle @@ -232,11 +230,11 @@ Cura.ExpandableComponent // overlap bottom border Rectangle { - width: parent.width - 4 - height: 4 + width: parent.width - UM.Theme.getSize("default_lining").width * 4 + height: UM.Theme.getSize("default_lining").width * 4 anchors.bottom: parent.bottom - anchors.bottomMargin: -2 - anchors.leftMargin: 2 + anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2) + anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 anchors.left: parent.left } @@ -249,18 +247,17 @@ Cura.ExpandableComponent { id: sidebarContents anchors.top: tabBar.bottom + anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right height: UM.Theme.getSize("print_setup_widget").height - border.width: UM.Theme.getSize("default_lining").width * 2 border.color: UM.Theme.getColor("action_button_border") SidebarSimple { anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - id: sidebar_simple_id anchors.fill: parent visible: currentModeIndex != 1 onShowTooltip: base.showTooltip(item, location, text) @@ -270,25 +267,22 @@ Cura.ExpandableComponent SidebarAdvanced { anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.bottomMargin: 2 //does not overlap bottom border + anchors.bottomMargin: 2 //don't overlap bottom border anchors.fill: parent visible: currentModeIndex == 1 onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() } - } } - Item { - id: separator_footer + id: footerControll anchors.top: popupItemContent.bottom - anchors.topMargin: 10 + anchors.topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 width: parent.width - height: settingControlButton.height + 4 - + height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 Rectangle { width: parent.width @@ -299,7 +293,6 @@ Cura.ExpandableComponent Cura.ActionButton { id: settingControlButton - leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_panel_button").height @@ -315,10 +308,10 @@ Cura.ExpandableComponent anchors { top: parent.top - topMargin: 10 - bottomMargin: 10 + topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 right: parent.right - rightMargin: 5 + rightMargin: UM.Theme.getSize("print_setup_selector_margin").height } onClicked: currentModeIndex = 1 @@ -334,8 +327,6 @@ Cura.ExpandableComponent textHoverColor: UM.Theme.getColor("text") iconSource: UM.Theme.getIcon("arrow_left") width: UM.Theme.getSize("print_setup_action_button").width - - fixedWidthMode: true visible: currentModeIndex == 1 anchors @@ -347,7 +338,14 @@ Cura.ExpandableComponent leftMargin: UM.Theme.getSize("print_setup_selector_margin").height } - onClicked: currentModeIndex = 0 +// onClicked: currentModeIndex = 0 + MouseArea { + anchors.fill: parent + onClicked: { + currentModeIndex = 0 + + } + } } } Component.onCompleted: From bd636e61a0577b8f5f7eac160fa0af05757240c6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 13:17:36 +0100 Subject: [PATCH 222/558] Minor changes suggested in review CURA-5785 --- plugins/PrepareStage/PrepareMenu.qml | 2 +- plugins/PreviewStage/PreviewMenu.qml | 3 ++- plugins/SimulationView/SimulationViewMenuComponent.qml | 7 +++++-- resources/qml/ExtruderIcon.qml | 1 + resources/qml/MachineSelector.qml | 3 +++ resources/qml/PrintSetupSelector.qml | 1 + 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index bf2a0e1283..963908cea6 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -34,7 +34,7 @@ Item anchors.left: openFileButtonBackground.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: 0.9 * prepareMenu.width + width: Math.round(0.9 * prepareMenu.width) height: parent.height spacing: 0 diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 29632e5f00..656cf185d5 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -54,7 +54,7 @@ Item { // Nothing was active, so just return the first one (the list is sorted by priority, so the most // important one should be returned) - if(activeView == null) + if (activeView == null) { UM.Controller.setActiveView(viewModel.getItem(0).id) } @@ -68,6 +68,7 @@ Item elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering } popupItem: Column diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index caf47508e3..110cd1c109 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -132,6 +132,7 @@ Cura.ExpandableComponent visible: UM.SimulationView.compatibilityMode height: UM.Theme.getSize("layerview_row").height width: parent.width + renderType: Text.NativeRendering } Item // Spacer @@ -188,7 +189,7 @@ Cura.ExpandableComponent leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) rightMargin: UM.Theme.getSize("default_margin").width * 2 } - + renderType: Text.NativeRendering } } } @@ -254,6 +255,7 @@ Cura.ExpandableComponent text: label font: UM.Theme.getFont("default") elide: Text.ElideRight + renderType: Text.NativeRendering color: UM.Theme.getColor("setting_control_text") anchors.verticalCenter: parent.verticalCenter anchors.left: legendModelCheckBox.left @@ -310,7 +312,7 @@ Cura.ExpandableComponent width: parent.width color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") - + renderType: Text.NativeRendering Rectangle { anchors.verticalCenter: parent.verticalCenter @@ -357,6 +359,7 @@ Cura.ExpandableComponent anchors.left: parent.left color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } Label diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 87e210e75a..79106bdd3a 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -53,6 +53,7 @@ Item width: contentWidth height: contentHeight visible: extruderEnabled + renderType: Text.NativeRendering } UM.RecolorImage diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index c9756d93ba..750ac7f620 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -33,6 +33,7 @@ Cura.ExpandableComponent elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering } popupItem: Item @@ -60,6 +61,7 @@ Cura.ExpandableComponent height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter } @@ -103,6 +105,7 @@ Cura.ExpandableComponent font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter + renderType: Text.NativeRendering } Repeater diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index b843244147..2ecdc9e546 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -182,6 +182,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter renderType: Text.NativeRendering elide: Text.ElideRight + color: { if(control.pressed) From c7dbaa3a001fbca621e94134e15ce0d0c5ae4fae Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 13:22:03 +0100 Subject: [PATCH 223/558] Add rendertype for labels in quickConfigurationSelector CURA-5785 --- .../qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index d428a05463..ef7a425a87 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -152,6 +152,7 @@ Cura.ExpandableComponent color: UM.Theme.getColor("text") height: parent.height width: tabControl.textWidth + renderType: Text.NativeRendering } OldControls.CheckBox @@ -174,6 +175,7 @@ Cura.ExpandableComponent color: UM.Theme.getColor("text") height: parent.height width: tabControl.textWidth + renderType: Text.NativeRendering } OldControls.ToolButton @@ -217,6 +219,7 @@ Cura.ExpandableComponent color: UM.Theme.getColor("text") height: parent.height width: tabControl.textWidth + renderType: Text.NativeRendering } OldControls.ToolButton From 406fac9e605578422417cdbb7a666343a4260129 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 13:38:08 +0100 Subject: [PATCH 224/558] Remove duplicate entries of renderType. Contributes to CURA-5942. --- resources/qml/MachineSelector.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 1796df5678..417c5722b4 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -36,7 +36,6 @@ Cura.ExpandableComponent renderType: Text.NativeRendering font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } popupItem: Item @@ -65,7 +64,6 @@ Cura.ExpandableComponent renderType: Text.NativeRendering font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") - renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter } @@ -109,7 +107,6 @@ Cura.ExpandableComponent font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } Repeater From a9672458fd31ffb7c64273b88a779a9f262b19d6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 21 Nov 2018 13:46:50 +0100 Subject: [PATCH 225/558] Update extruderIcon to be more in line with the design CURA-5785 --- resources/qml/ExtruderIcon.qml | 10 ++++++---- .../ConfigurationMenu/QuickConfigurationSelector.qml | 3 +-- resources/themes/cura-light/theme.json | 9 +++++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 79106bdd3a..1e51835d60 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -9,8 +9,8 @@ Item { id: extruderIconItem - implicitWidth: UM.Theme.getSize("button").width - implicitHeight: implicitWidth + implicitWidth: UM.Theme.getSize("extruder_icon").width + implicitHeight: UM.Theme.getSize("extruder_icon").height property bool checked: true property color materialColor @@ -22,7 +22,7 @@ Item anchors.fill: parent sourceSize.width: parent.width - sourceSize.height: parent.width + sourceSize.height: parent.height source: UM.Theme.getIcon("extruder_button") color: extruderEnabled ? materialColor: "gray" } @@ -49,11 +49,13 @@ Item id: extruderNumberText anchors.centerIn: parent text: index + 1 - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("extruder_icon") width: contentWidth height: contentHeight visible: extruderEnabled renderType: Text.NativeRendering + horizontalAlignment: Text.alignHCenter + verticalAlignment: Text.alignVCenter } UM.RecolorImage diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index ef7a425a87..eb6800cb36 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -50,8 +50,7 @@ Cura.ExpandableComponent id: extruderIcon materialColor: model.color extruderEnabled: model.enabled - height: parent.height - width: height + anchors.verticalCenter: parent.verticalCenter } // Label for the brand of the material diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d28611529b..b09370ccdb 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -64,6 +64,12 @@ "size": 1.15, "weight": 50, "family": "Noto Sans" + }, + "extruder_icon": + { + "size": 0.7, + "weight": 50, + "family": "Noto Sans" } }, @@ -406,8 +412,7 @@ "thin_margin": [0.71, 0.71], "narrow_margin": [0.5, 0.5], - "extruder_button_material_margin": [0.70, 0.9], - "extruder_button_material": [0.75, 0.75], + "extruder_icon": [1.8, 1.8], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From a1f3ebc25b97f555362a1dead86d7cc6081f718a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 13:58:21 +0100 Subject: [PATCH 226/558] Fix typo. Contributes to CURA-5785. --- resources/qml/ExtruderIcon.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 1e51835d60..c103ee245c 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -54,8 +54,8 @@ Item height: contentHeight visible: extruderEnabled renderType: Text.NativeRendering - horizontalAlignment: Text.alignHCenter - verticalAlignment: Text.alignVCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } UM.RecolorImage From eb056ee17bbc7d843a83ce108e95d51bc6f499ba Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 21 Nov 2018 16:06:26 +0100 Subject: [PATCH 227/558] Fix display of custom configuration Since it had no width, everything was resized to 0. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 953b6a48f0..aa4cf3624b 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -10,6 +10,8 @@ import UM 1.3 as UM Item { + width: parent.width + Label { id: header From a052b8ec69e014c0ebce92ffb4fcb0067d85831c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 21 Nov 2018 16:08:29 +0100 Subject: [PATCH 228/558] Use Theme.getIcon instead of Theme.icons This is better for performance, according to the deprecation warning I got. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index b38384ef8a..111f42483e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -172,7 +172,7 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.icons.arrow_right + iconSource: UM.Theme.getIcon("arrow_right") iconOnRightSide: true onClicked: popupItem.configuration_method = "custom" @@ -195,7 +195,7 @@ Cura.ExpandableComponent textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.icons.arrow_left + iconSource: UM.Theme.getIcon("arrow_left") onClicked: popupItem.configuration_method = "auto" } From a826dfb156c46acfbe26533eab594aa27305040d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 21 Nov 2018 16:12:00 +0100 Subject: [PATCH 229/558] Fix binding loop in height of view selection bar Since these were part of the childrenRect of the bar, and attached to the bottom of the bar, the childrenRect depended on the position of the children and that depends on the childrenRect again. So just attach it to the top, it's logical. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 111f42483e..8f31d80810 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -164,7 +164,7 @@ Cura.ExpandableComponent anchors { right: parent.right - bottom: parent.bottom + top: parent.top } color: UM.Theme.getColor("secondary") @@ -187,7 +187,7 @@ Cura.ExpandableComponent anchors { left: parent.left - bottom: parent.bottom + top: parent.top } color: UM.Theme.getColor("secondary") From fe7d1825d4f124788e9fc0ec19db6528fae388c3 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 16:54:57 +0100 Subject: [PATCH 230/558] Add styling to the buttons in the printer list. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 2 +- resources/qml/MachineSelector.qml | 34 +++++++++++++++---- .../cura-light/images/header_pattern.svg | 1 + resources/themes/cura-light/theme.json | 1 + 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 resources/themes/cura-light/images/header_pattern.svg diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index fd296144c7..eed1da0ad8 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -91,7 +91,7 @@ Item radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("toolbar_background") - + Button { id: openFileButton diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index 417c5722b4..a6339e2621 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -46,6 +46,7 @@ Cura.ExpandableComponent ScrollView { + id: scroll width: parent.width anchors.top: parent.top anchors.bottom: separator.top @@ -54,16 +55,20 @@ Cura.ExpandableComponent Column { id: column - anchors.fill: parent + + // Can't use parent.width since the parent is the flickable component and not the ScrollView + width: scroll.width - 2 * UM.Theme.getSize("default_lining").width + x: UM.Theme.getSize("default_lining").width Label { text: catalog.i18nc("@label", "Network connected printers") visible: networkedPrintersModel.items.length > 0 + leftPadding: UM.Theme.getSize("default_margin").width height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 renderType: Text.NativeRendering - font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text_medium") verticalAlignment: Text.AlignVCenter } @@ -77,13 +82,20 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} } - delegate: Button + delegate: Cura.ActionButton { text: model.metadata["connect_group_name"] width: parent.width + height: UM.Theme.getSize("action_button").height checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] checkable: true + color: "transparent" + hoverColor: UM.Theme.getColor("action_button_hovered") + textColor: UM.Theme.getColor("text") + textHoverColor: UM.Theme.getColor("text") + outlineColor: checked ? UM.Theme.getColor("primary") : "transparent" + onClicked: { togglePopup() @@ -102,10 +114,11 @@ Cura.ExpandableComponent { text: catalog.i18nc("@label", "Preset printers") visible: virtualPrintersModel.items.length > 0 + leftPadding: UM.Theme.getSize("default_margin").width height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 renderType: Text.NativeRendering - font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text_medium") verticalAlignment: Text.AlignVCenter } @@ -119,13 +132,20 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": null} } - delegate: Button + delegate: Cura.ActionButton { text: model.name width: parent.width + height: UM.Theme.getSize("action_button").height checked: Cura.MachineManager.activeMachineId == model.id checkable: true + color: "transparent" + hoverColor: UM.Theme.getColor("action_button_hovered") + textColor: UM.Theme.getColor("text") + textHoverColor: UM.Theme.getColor("text") + outlineColor: checked ? UM.Theme.getColor("primary") : "transparent" + onClicked: { togglePopup() diff --git a/resources/themes/cura-light/images/header_pattern.svg b/resources/themes/cura-light/images/header_pattern.svg new file mode 100644 index 0000000000..2a9de2f3e9 --- /dev/null +++ b/resources/themes/cura-light/images/header_pattern.svg @@ -0,0 +1 @@ +Pattern \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 5f52adff14..4e6fe0776a 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -521,6 +521,7 @@ "avatar_image": [6.8, 6.8], + "action_button": [15.0, 3.0], "action_button_radius": [0.15, 0.15], "monitor_config_override_box": [1.0, 14.0], From f866390c7bb0cc9ac4af65d78a30c6b7995f6201 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 21 Nov 2018 16:56:25 +0100 Subject: [PATCH 231/558] Fix an issue in the action panel. When the panel is created while the user is in the preview stage, the row has no width. Contributes to CURA-5786. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index f4e014b1ec..3c4386f079 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -99,6 +99,7 @@ Column { id: buttonRow spacing: UM.Theme.getSize("default_margin").width + width: parent.width Cura.ActionButton { From a9f0402f636b652585c23c5ea7299f0256ba195d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 22 Nov 2018 09:37:36 +0100 Subject: [PATCH 232/558] Made size of viewselector themable CURA-5785 --- plugins/PreviewStage/PreviewMenu.qml | 1 + resources/themes/cura-light/theme.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index 656cf185d5..d660db549b 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -34,6 +34,7 @@ Item id: viewSelector iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") height: parent.height + width: UM.Theme.getSize("views_selector").width headerCornerSide: Cura.RoundedRectangle.Direction.Left property var viewModel: UM.ViewModel { } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index b09370ccdb..0df1c8eb31 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -395,7 +395,7 @@ "machine_selector_widget": [16.0, 4.5], - "views_selector": [0.0, 4.0], + "views_selector": [16.0, 4.5], "default_radius": [0.25, 0.25], From b890e40e81f62da2eade839ad48d7168cdcde7ff Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 10:54:25 +0100 Subject: [PATCH 233/558] Close the popup panel when the user clicks in some of the buttons in the printer selector. Contributes to CURA-5942. --- resources/qml/ExtruderIcon.qml | 1 + resources/qml/MachineSelector.qml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index c103ee245c..8f312adb85 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -16,6 +16,7 @@ Item property color materialColor property alias textColor: extruderNumberText.color property bool extruderEnabled: true + UM.RecolorImage { id: mainIcon diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index a6339e2621..14e1ebb48e 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -184,7 +184,11 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - onClicked: Cura.Actions.addMachine.trigger() + onClicked: + { + togglePopup() + Cura.Actions.addMachine.trigger() + } } Cura.ActionButton @@ -196,7 +200,11 @@ Cura.ExpandableComponent hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - onClicked: Cura.Actions.configureMachines.trigger() + onClicked: + { + togglePopup() + Cura.Actions.configureMachines.trigger() + } } } } From bf8a04fa4049b4a7bf99c4903b437109ec415b73 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 22 Nov 2018 11:08:46 +0100 Subject: [PATCH 234/558] Fix some minor display issues for simulation view CURA-5785 --- plugins/SimulationView/SimulationViewMenuComponent.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 110cd1c109..53b64afb47 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -40,7 +40,6 @@ Cura.ExpandableComponent id: layerViewTypesLabel text: catalog.i18nc("@label", "Color scheme") font: UM.Theme.getFont("default") - visible: !UM.SimulationView.compatibilityMode color: UM.Theme.getColor("setting_control_text") height: base.height verticalAlignment: Text.AlignVCenter @@ -273,6 +272,7 @@ Cura.ExpandableComponent text: catalog.i18nc("@label", "Only Show Top Layers") visible: UM.SimulationView.compatibilityMode style: UM.Theme.styles.checkbox + width: parent.width } CheckBox @@ -280,6 +280,7 @@ Cura.ExpandableComponent checked: viewSettings.top_layer_count == 5 onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") + width: parent.width visible: UM.SimulationView.compatibilityMode style: UM.Theme.styles.checkbox } From a1613c7f816c0d9c10659972f32bbed3a1995ea1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 22 Nov 2018 13:53:27 +0100 Subject: [PATCH 235/558] Set the variable types of the Action button to the right kind. Because of boyscouting; these must be colors (and not generic vars) --- resources/qml/ActionButton.qml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 2a8b894867..69d65e1c3f 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -15,15 +15,17 @@ Button property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text - property var color: UM.Theme.getColor("primary") - property var hoverColor: UM.Theme.getColor("primary_hover") - property var disabledColor: color - property var textColor: UM.Theme.getColor("button_text") - property var textHoverColor: UM.Theme.getColor("button_text_hover") - property var textDisabledColor: textColor - property var outlineColor: color - property var outlineHoverColor: hoverColor - property var outlineDisabledColor: outlineColor + + property color color: UM.Theme.getColor("primary") + property color hoverColor: UM.Theme.getColor("primary_hover") + property color disabledColor: color + property color textColor: UM.Theme.getColor("button_text") + property color textHoverColor: UM.Theme.getColor("button_text_hover") + property color textDisabledColor: textColor + property color outlineColor: color + property color outlineHoverColor: hoverColor + property color outlineDisabledColor: outlineColor + // This property is used to indicate whether the button has a fixed width or the width would depend on the contents // Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case, // we elide the text to the right so the text will be cut off with the three dots at the end. @@ -80,6 +82,7 @@ Button { id: mouseArea anchors.fill: parent + // Ensure that the button will still accept the clicks on it's own. onPressed: mouse.accepted = false hoverEnabled: true } From 9720512f50d87de2b6149f1d2475704309f3c07d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 13:54:10 +0100 Subject: [PATCH 236/558] Add a new printer selector button that is connected to the output devices and shows labels containing the type of printers that are in the same group. Contributes to CURA-5942. --- cura/PrinterOutputDevice.py | 5 + .../ConfigurationListView.qml | 2 +- .../{ => PrinterSelector}/MachineSelector.qml | 38 +----- .../PrinterSelector/MachineSelectorButton.qml | 110 ++++++++++++++++++ resources/qml/qmldir | 3 +- 5 files changed, 121 insertions(+), 37 deletions(-) rename resources/qml/{ => PrinterSelector}/MachineSelector.qml (79%) create mode 100644 resources/qml/PrinterSelector/MachineSelectorButton.qml diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 969aa3c460..f8a663f0e4 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -211,6 +211,11 @@ class PrinterOutputDevice(QObject, OutputDevice): self._unique_configurations.sort(key = lambda k: k.printerType) self.uniqueConfigurationsChanged.emit() + # Returns the unique configurations of the printers within this output device + @pyqtProperty("QVariantList", notify = uniqueConfigurationsChanged) + def uniquePrinterTypes(self) -> List[str]: + return list(set([configuration.printerType for configuration in self._unique_configurations])) + def _onPrintersChanged(self) -> None: for printer in self._printers: printer.configurationChanged.connect(self._updateUniqueConfigurations) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 7aaf87b4df..210ff6057f 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -21,7 +21,7 @@ Column { // FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI configurationList.model = [] - if(outputDevice) + if (outputDevice) { configurationList.model = outputDevice.uniqueConfigurations } diff --git a/resources/qml/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml similarity index 79% rename from resources/qml/MachineSelector.qml rename to resources/qml/PrinterSelector/MachineSelector.qml index 14e1ebb48e..9280c45cf4 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -8,8 +8,6 @@ import QtQuick.Layouts 1.1 import UM 1.2 as UM import Cura 1.0 as Cura -import "Menus" - Cura.ExpandableComponent { @@ -18,7 +16,7 @@ Cura.ExpandableComponent property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" popupPadding: 0 - popupAlignment: ExpandableComponent.PopupAlignment.AlignLeft + popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog @@ -82,25 +80,10 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} } - delegate: Cura.ActionButton + delegate: MachineSelectorButton { text: model.metadata["connect_group_name"] - width: parent.width - height: UM.Theme.getSize("action_button").height checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] - checkable: true - - color: "transparent" - hoverColor: UM.Theme.getColor("action_button_hovered") - textColor: UM.Theme.getColor("text") - textHoverColor: UM.Theme.getColor("text") - outlineColor: checked ? UM.Theme.getColor("primary") : "transparent" - - onClicked: - { - togglePopup() - Cura.MachineManager.setActiveMachine(model.id) - } Connections { @@ -132,25 +115,10 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": null} } - delegate: Cura.ActionButton + delegate: MachineSelectorButton { text: model.name - width: parent.width - height: UM.Theme.getSize("action_button").height checked: Cura.MachineManager.activeMachineId == model.id - checkable: true - - color: "transparent" - hoverColor: UM.Theme.getColor("action_button_hovered") - textColor: UM.Theme.getColor("text") - textHoverColor: UM.Theme.getColor("text") - outlineColor: checked ? UM.Theme.getColor("primary") : "transparent" - - onClicked: - { - togglePopup() - Cura.MachineManager.setActiveMachine(model.id) - } } } } diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml new file mode 100644 index 0000000000..5ba229c31c --- /dev/null +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -0,0 +1,110 @@ +// 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.Layouts 1.3 + +import UM 1.1 as UM +import Cura 1.0 as Cura + +Button +{ + id: machineSelectorButton + + width: parent.width + height: UM.Theme.getSize("action_button").height + leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) + checkable: true + + property var outputDevice: Cura.MachineManager.printerOutputDevices[0] + property var printerTypesList: [] + + function setPrinterTypesList() + { + printerTypesList = (checked && (outputDevice != null)) ? outputDevice.uniquePrinterTypes : [] + } + + contentItem: Item + { + width: machineSelectorButton.width - machineSelectorButton.leftPadding + height: UM.Theme.getSize("action_button").height + + Label + { + id: buttonText + anchors + { + left: parent.left + right: printerTypes.left + verticalCenter: parent.verticalCenter + } + text: machineSelectorButton.text + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("action_button") + visible: text != "" + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + Row + { + id: printerTypes + width: childrenRect.width + + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + } + spacing: UM.Theme.getSize("narrow_margin").width + + Repeater + { + model: printerTypesList + delegate: Label + { + text: modelData + } + } + } + } + + background: Rectangle + { + id: backgroundRect + 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" + } + + onClicked: + { + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) + } + + MouseArea + { + id: mouseArea + anchors.fill: parent + onPressed: mouse.accepted = false + hoverEnabled: true + } + + Connections + { + target: outputDevice + onUniqueConfigurationsChanged: setPrinterTypesList() + } + + Connections + { + target: Cura.MachineManager + onOutputDevicesChanged: setPrinterTypesList() + } + + Component.onCompleted: setPrinterTypesList() +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index d5e4106d33..458338c78a 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -9,4 +9,5 @@ MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml ActionPanelWidget 1.0 ActionPanelWidget.qml IconLabel 1.0 IconLabel.qml -OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml \ No newline at end of file +OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml +ExpandableComponent 1.0 ExpandableComponent.qml \ No newline at end of file From 698409803d6c3717dea8312741e0f188aee9a7b5 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 09:07:22 +0100 Subject: [PATCH 237/558] Fix null warning in QML CURA-5943 --- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 97b5bee745..73fc342d66 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -70,7 +70,7 @@ Column Label { id: materialLabel - text: printCoreConfiguration.material.name + text: printCoreConfiguration.material == null ? "" : printCoreConfiguration.material.name renderType: Text.NativeRendering elide: Text.ElideRight width: parent.width From 45d4f2ad3d4ba05d42757a4b0aef7433b22589b7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 13:48:50 +0100 Subject: [PATCH 238/558] Update MonitorSection CURA-5943 --- resources/qml/PrinterOutput/MonitorSection.qml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/resources/qml/PrinterOutput/MonitorSection.qml b/resources/qml/PrinterOutput/MonitorSection.qml index 6ed762362d..7ef89dabf7 100644 --- a/resources/qml/PrinterOutput/MonitorSection.qml +++ b/resources/qml/PrinterOutput/MonitorSection.qml @@ -1,10 +1,10 @@ // 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.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick 2.10 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura @@ -13,7 +13,8 @@ Item { id: base property string label - height: childrenRect.height; + height: childrenRect.height + Rectangle { color: UM.Theme.getColor("setting_category") @@ -30,4 +31,4 @@ Item color: UM.Theme.getColor("setting_category_text") } } -} \ No newline at end of file +} From cf0994037c962a35adbf26ace560fc0e749e239d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 13:56:03 +0100 Subject: [PATCH 239/558] Move MonitorButtonSytle to a separate QML file CURA-5943 --- .../PrinterOutput/ManualPrinterControl.qml | 84 ++---------------- .../qml/PrinterOutput/MonitorButtonStyle.qml | 88 +++++++++++++++++++ 2 files changed, 93 insertions(+), 79 deletions(-) create mode 100644 resources/qml/PrinterOutput/MonitorButtonStyle.qml diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 70961a2eb2..3219dc5792 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -9,6 +9,9 @@ import QtQuick.Layouts 1.1 import UM 1.2 as UM import Cura 1.0 as Cura +import "." + + Item { property var printerModel @@ -16,86 +19,9 @@ Item implicitWidth: parent.width implicitHeight: childrenRect.height - Component + MonitorButtonStyle { id: monitorButtonStyle - - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.floor(control.width / 2) - height: Math.floor(control.height / 2) - sourceSize.width: width - sourceSize.height: width - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - source: control.iconSource - } - } - } } Column @@ -551,4 +477,4 @@ Item } ExclusiveGroup { id: distanceGroup } } -} \ No newline at end of file +} diff --git a/resources/qml/PrinterOutput/MonitorButtonStyle.qml b/resources/qml/PrinterOutput/MonitorButtonStyle.qml new file mode 100644 index 0000000000..7bb1b91e55 --- /dev/null +++ b/resources/qml/PrinterOutput/MonitorButtonStyle.qml @@ -0,0 +1,88 @@ +import QtQuick 2.10 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + + +Component +{ + ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + return UM.Theme.getColor("action_button_border"); + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + return UM.Theme.getColor("action_button"); + } + Behavior on color + { + ColorAnimation + { + duration: 50 + } + } + } + + label: Item + { + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: Math.floor(control.width / 2) + height: Math.floor(control.height / 2) + sourceSize.width: width + sourceSize.height: width + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } + source: control.iconSource + } + } + } +} From 5a1691839169ba0ee3f4ca6be15514d5714f062a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 13:58:18 +0100 Subject: [PATCH 240/558] Update ManualPrinterControl CURA-5943 --- .../qml/PrinterOutput/ManualPrinterControl.qml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 3219dc5792..1a719c379e 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -1,12 +1,12 @@ // 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.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick 2.10 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 -import UM 1.2 as UM +import UM 1.3 as UM import Cura 1.0 as Cura import "." @@ -14,8 +14,10 @@ import "." Item { - property var printerModel + property var printerModel: null property var activePrintJob: printerModel != null ? printerModel.activePrintJob : null + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + implicitWidth: parent.width implicitHeight: childrenRect.height @@ -388,7 +390,7 @@ Item if (printerModel == null) { return false // Can't send custom commands if not connected. } - if (!connectedPrinter.acceptsCommands) { + if (connectedPrinter == null || !connectedPrinter.acceptsCommands) { return false // Not allowed to do anything } if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") { From e65f2d66a631d43dfa0c3da716ac332db7767a9f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 14:02:17 +0100 Subject: [PATCH 241/558] Add connectedPrinter to MonitorItem CURA-5943 --- resources/qml/PrinterOutput/MonitorItem.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/PrinterOutput/MonitorItem.qml b/resources/qml/PrinterOutput/MonitorItem.qml index cad8d2f7f3..a26ec20f64 100644 --- a/resources/qml/PrinterOutput/MonitorItem.qml +++ b/resources/qml/PrinterOutput/MonitorItem.qml @@ -15,6 +15,8 @@ Item property string value: "" height: childrenRect.height; + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + Row { height: UM.Theme.getSize("setting_control").height From 75661d9bba0079df9dfe3288c38282ca8e857c35 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 14:04:08 +0100 Subject: [PATCH 242/558] Fix MonitorSidebar due to widget renaming CURA-5943 --- resources/qml/MonitorSidebar.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index 2282034739..50416e34ab 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -1,15 +1,17 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura + import "Menus" import "Menus/ConfigurationMenu" + Rectangle { id: base @@ -85,7 +87,7 @@ Rectangle } } - MachineSelection + MachineSelector { id: machineSelection width: base.width - configSelection.width - separator.width @@ -104,7 +106,7 @@ Rectangle anchors.left: machineSelection.right } - ConfigurationSelection + CustomConfigurationSelector { id: configSelection visible: isNetworkPrinter && printerConnected @@ -112,7 +114,6 @@ Rectangle height: UM.Theme.getSize("stage_menu").height anchors.top: base.top anchors.right: parent.right - panelWidth: base.width } Loader From 8eb0f66df384a50f5f9afb12d8747737c20c4deb Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 14:05:23 +0100 Subject: [PATCH 243/558] Add connectedPrinter to ExtruderBox CURA-5943 --- resources/qml/PrinterOutput/ExtruderBox.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 510a44f9da..f5a1bd75c4 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -12,6 +12,8 @@ Item property alias color: background.color property var extruderModel property var position: index + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + implicitWidth: parent.width implicitHeight: UM.Theme.getSize("print_setup_extruder_box").height From d8c3078d78fc176fc764ee54bd12264850076b3e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 14:10:04 +0100 Subject: [PATCH 244/558] Add connectedPrinter to HeatedBedBox CURA-5943 --- resources/qml/PrinterOutput/HeatedBedBox.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 962ffa9b01..8c99814e02 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -1,10 +1,10 @@ // 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.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick 2.10 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura @@ -14,6 +14,7 @@ Item implicitWidth: parent.width height: visible ? UM.Theme.getSize("print_setup_extruder_box").height : 0 property var printerModel + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null Rectangle { @@ -114,7 +115,7 @@ Item { return false; //Can't preheat if not connected. } - if (!connectedPrinter.acceptsCommands) + if (connectedPrinter == null || !connectedPrinter.acceptsCommands) { return false; //Not allowed to do anything. } From 0211122b1209d55db109cb00d8a442d30b4c970b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 14:46:13 +0100 Subject: [PATCH 245/558] Add a proper component with a label and a rectangle in the background that shows the type of printer. Contributes to CURA-5942. --- .../qml/PrinterSelector/MachineSelector.qml | 1 + .../PrinterSelector/MachineSelectorButton.qml | 24 ++++++++++++++++--- resources/qml/ViewOrientationControls.qml | 2 +- resources/themes/cura-light/theme.json | 5 +++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 9280c45cf4..66ed4d4a2c 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -84,6 +84,7 @@ Cura.ExpandableComponent { text: model.metadata["connect_group_name"] checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null Connections { diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 5ba229c31c..44b162d00d 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -17,7 +17,7 @@ Button leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) checkable: true - property var outputDevice: Cura.MachineManager.printerOutputDevices[0] + property var outputDevice: null property var printerTypesList: [] function setPrinterTypesList() @@ -63,9 +63,27 @@ Button Repeater { model: printerTypesList - delegate: Label + delegate: Item { - text: modelData + width: UM.Theme.getSize("printer_type_label").width + height: UM.Theme.getSize("printer_type_label").height + + Rectangle + { + anchors.fill: parent + color: UM.Theme.getColor("printer_type_label_background") + } + + Label + { + id: printerTypeLabel + text: modelData + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + renderType: Text.NativeRendering + font: UM.Theme.getFont("very_small") + color: UM.Theme.getColor("text") + } } } } diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index acf75b1b48..fa5a51181d 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -21,7 +21,7 @@ Row { iconSource: UM.Theme.getIcon("view_3d") style: UM.Theme.styles.small_tool_button - onClicked:UM.Controller.rotateView("3d", 0) + onClicked: UM.Controller.rotateView("3d", 0) } // #2 Front view diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2f86829f11..94a89342e7 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -81,7 +81,6 @@ "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], - "primary": [50, 130, 255, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], @@ -114,6 +113,8 @@ "toolbar_background": [255, 255, 255, 255], + "printer_type_label_background": [171, 171, 191, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], @@ -398,6 +399,8 @@ "views_selector": [0.0, 4.0], + "printer_type_label": [3.5, 1.5], + "default_radius": [0.25, 0.25], "wide_lining": [0.5, 0.5], From 7f11142d5086b40164b490d90617a31bf41f63d8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Nov 2018 14:57:55 +0100 Subject: [PATCH 246/558] Fix height and vertical layout of popup Many things were made simpler. This took some time to fix... Contributes to issue CURA-5876. --- .../ConfigurationMenu/AutoConfiguration.qml | 4 ++ .../ConfigurationMenu/ConfigurationMenu.qml | 49 ++++++++----------- .../ConfigurationMenu/CustomConfiguration.qml | 6 ++- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index e1f0ed480e..cde18ab488 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -8,12 +8,16 @@ import UM 1.3 as UM Item { + width: parent.width + height: visible ? childrenRect.height : 0 + Label { id: header text: catalog.i18nc("@header", "Configurations") font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") + height: contentHeight anchors { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 8f31d80810..4aa8d66caa 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -96,32 +96,36 @@ Cura.ExpandableComponent } } - popupItem: Item + popupItem: Column { id: popupItem width: base.width - 2 * UM.Theme.getSize("default_margin").width - height: 200 + height: implicitHeight //Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up. + spacing: UM.Theme.getSize("default_margin").height property var is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible. onVisibleChanged: { - is_connected = Cura.MachineManager.activeMachineNetworkKey != "" && Cura.MachineManager.printerConnected //Re-evaluate. + is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate. } - property var configuration_method: buttonBar.visible ? "auto" : "custom" //Auto if connected to a printer at start-up, or Custom if not. + property var configuration_method: is_connected ? "auto" : "custom" //Auto if connected to a printer at start-up, or Custom if not. - AutoConfiguration + Item { - id: autoConfiguration - visible: popupItem.configuration_method === "auto" - anchors.top: parent.top - } + width: parent.width + height: childrenRect.height + AutoConfiguration + { + id: autoConfiguration + visible: popupItem.configuration_method === "auto" + } - CustomConfiguration - { - id: customConfiguration - visible: popupItem.configuration_method === "custom" - anchors.top: parent.top + CustomConfiguration + { + id: customConfiguration + visible: popupItem.configuration_method === "custom" + } } Rectangle @@ -129,30 +133,19 @@ Cura.ExpandableComponent id: separator visible: buttonBar.visible - anchors - { - left: parent.left - right: parent.right - bottom: buttonBar.top - bottomMargin: UM.Theme.getSize("default_margin").height - } + width: parent.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") } //Allow switching between custom and auto. - Rectangle + Item { id: buttonBar visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible. - anchors - { - left: parent.left - right: parent.right - bottom: parent.bottom - } + width: parent.width height: childrenRect.height Cura.ActionButton diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index aa4cf3624b..d424f35ebe 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -11,6 +11,7 @@ import UM 1.3 as UM Item { width: parent.width + height: visible ? childrenRect.height : 0 Label { @@ -18,6 +19,7 @@ Item text: catalog.i18nc("@header", "Custom") font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") + height: contentHeight anchors { @@ -62,14 +64,15 @@ Item { id: tabControl width: parent.width + height: childrenRect.height anchors.top: tabBar.bottom - anchors.bottom: parent.bottom property var model: extrudersModel.items[tabBar.currentIndex] property real textWidth: Math.round(width * 0.3) property real controlWidth: width - textWidth Column { spacing: UM.Theme.getSize("default_margin").height + Row { height: UM.Theme.getSize("print_setup_item").height @@ -165,6 +168,5 @@ Item } } } - } } \ No newline at end of file From 5c30df2a688d858fb5b23e6ccc4250acae1dc9b6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 15:00:35 +0100 Subject: [PATCH 247/558] Create a reusable component for the printer type label. Other parts of the UI can just reuse it. Contributes to CURA-5942. --- resources/qml/ActionButton.qml | 1 - .../PrinterSelector/MachineSelectorButton.qml | 24 ++----------- .../qml/PrinterSelector/PrinterTypeLabel.qml | 34 +++++++++++++++++++ resources/qml/qmldir | 3 +- 4 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 resources/qml/PrinterSelector/PrinterTypeLabel.qml diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 2a8b894867..ff8ee4b149 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.3 import UM 1.1 as UM diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 44b162d00d..e98036dbc8 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.3 import UM 1.1 as UM import Cura 1.0 as Cura @@ -15,6 +14,7 @@ Button width: parent.width height: UM.Theme.getSize("action_button").height leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) + rightPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) checkable: true property var outputDevice: null @@ -63,27 +63,9 @@ Button Repeater { model: printerTypesList - delegate: Item + delegate: Cura.PrinterTypeLabel { - width: UM.Theme.getSize("printer_type_label").width - height: UM.Theme.getSize("printer_type_label").height - - Rectangle - { - anchors.fill: parent - color: UM.Theme.getColor("printer_type_label_background") - } - - Label - { - id: printerTypeLabel - text: modelData - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.NativeRendering - font: UM.Theme.getFont("very_small") - color: UM.Theme.getColor("text") - } + text: modelData } } } diff --git a/resources/qml/PrinterSelector/PrinterTypeLabel.qml b/resources/qml/PrinterSelector/PrinterTypeLabel.qml new file mode 100644 index 0000000000..cd9f3b9743 --- /dev/null +++ b/resources/qml/PrinterSelector/PrinterTypeLabel.qml @@ -0,0 +1,34 @@ +// 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 UM 1.1 as UM + +// This component creates a label with the abbreviated name of a printer, with a rectangle surrounding the label. +// It is created in a separated place in order to be reused whenever needed. +Item +{ + property alias text: printerTypeLabel.text + + width: UM.Theme.getSize("printer_type_label").width + height: UM.Theme.getSize("printer_type_label").height + + Rectangle + { + anchors.fill: parent + color: UM.Theme.getColor("printer_type_label_background") + } + + Label + { + id: printerTypeLabel + text: "CFFFP" // As an abbreviated name of the Custom FFF Printer + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + renderType: Text.NativeRendering + font: UM.Theme.getFont("very_small") + color: UM.Theme.getColor("text") + } +} \ No newline at end of file diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 458338c78a..67388100ca 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -10,4 +10,5 @@ NozzleMenu 1.0 NozzleMenu.qml ActionPanelWidget 1.0 ActionPanelWidget.qml IconLabel 1.0 IconLabel.qml OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml -ExpandableComponent 1.0 ExpandableComponent.qml \ No newline at end of file +ExpandableComponent 1.0 ExpandableComponent.qml +PrinterTypeLabel 1.0 PrinterTypeLabel.qml \ No newline at end of file From 2d2f24251dcaac15bed5bba3e0ec782161743181 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 22 Nov 2018 15:07:49 +0100 Subject: [PATCH 248/558] Fix MonitorMainView for USB printing CURA-5943 --- plugins/MonitorStage/MonitorMainView.qml | 106 +++++++++++++---------- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/plugins/MonitorStage/MonitorMainView.qml b/plugins/MonitorStage/MonitorMainView.qml index c48f6d0aab..57dd033792 100644 --- a/plugins/MonitorStage/MonitorMainView.qml +++ b/plugins/MonitorStage/MonitorMainView.qml @@ -1,45 +1,61 @@ -// Copyright (c) 2017 Ultimaker B.V. - -import QtQuick 2.2 -import QtQuick.Controls 1.1 - -import UM 1.3 as UM -import Cura 1.0 as Cura - -Item -{ - // parent could be undefined as this component is not visible at all times - width: parent ? parent.width : 0 - height: parent ? parent.height : 0 - - // We show a nice overlay on the 3D viewer when the current output device has no monitor view - Rectangle - { - id: viewportOverlay - - color: UM.Theme.getColor("viewport_overlay") - width: parent.width - height: parent.height - - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true - } - } - - Loader - { - id: monitorViewComponent - - width: parent.width - height: parent.height - - property real maximumWidth: parent.width - property real maximumHeight: parent.height - - sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null - visible: sourceComponent != null - } -} +// Copyright (c) 2017 Ultimaker B.V. + +import QtQuick 2.10 +import QtQuick.Controls 1.4 + +import UM 1.3 as UM +import Cura 1.0 as Cura + + +Item +{ + // parent could be undefined as this component is not visible at all times + width: parent ? parent.width : 0 + height: parent ? parent.height : 0 + + // We show a nice overlay on the 3D viewer when the current output device has no monitor view + Rectangle + { + id: viewportOverlay + + color: UM.Theme.getColor("viewport_overlay") + width: parent.width + height: parent.height + + MouseArea + { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true + } + } + + Loader + { + id: monitorViewComponent + + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + + width: parent.width * 0.7 + height: parent.height + + property real maximumWidth: parent.width + property real maximumHeight: parent.height + + sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null + } + + Loader + { + id: monitorSidebarComponent + + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: monitorViewComponent.right + anchors.right: parent.right + + source: UM.Controller.activeStage.sidebarComponent != null ? UM.Controller.activeStage.sidebarComponent : "" + } +} From 3f4d379908add0ec7054eb65e87ae91587ffaebd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 22 Nov 2018 15:35:40 +0100 Subject: [PATCH 249/558] Added shadow to slice button CURA-5959 --- resources/qml/ActionButton.qml | 18 +++++++++++ .../qml/ActionPanel/SliceProcessWidget.qml | 31 +++++++++---------- resources/themes/cura-light/theme.json | 2 ++ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 69d65e1c3f..8cd53b5d7e 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -5,6 +5,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 // For the dropshadow + import UM 1.1 as UM Button @@ -26,6 +28,9 @@ Button property color outlineHoverColor: hoverColor property color outlineDisabledColor: outlineColor + property alias shadowColor: shadow.color + property alias shadowEnabled: shadow.visible + // This property is used to indicate whether the button has a fixed width or the width would depend on the contents // Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case, // we elide the text to the right so the text will be cut off with the three dots at the end. @@ -70,6 +75,19 @@ Button border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor } + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: backgroundRect + source: backgroundRect + verticalOffset: 2 + visible: false + // Should always be drawn behind the background. + z: backgroundRect.z - 1 + } + ToolTip { id: tooltip diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 2d4a7b6b89..4f10e6879b 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -87,28 +87,27 @@ Column width: parent.width height: UM.Theme.getSize("action_panel_button").height fixedWidthMode: true - text: - { - if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) - { - return catalog.i18nc("@button", "Slice") - } - if (autoSlice) - { - return catalog.i18nc("@button", "Auto slicing...") - } - return catalog.i18nc("@button", "Cancel") - } - enabled: !autoSlice && !disabledSlice // Get the current value from the preferences property bool autoSlice: UM.Preferences.getValue("general/auto_slice") // Disable the slice process when property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 - disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent" - textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") - outlineDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_border") : "transparent" + text: + { + if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) + { + return catalog.i18nc("@button", "Slice") + } + return catalog.i18nc("@button", "Cancel") + } + enabled: !autoSlice && !disabledSlice + visible: !autoSlice + + disabledColor: UM.Theme.getColor("action_button_disabled") + textDisabledColor: UM.Theme.getColor("action_button_disabled_text") + shadowEnabled: true + shadowColor: enabled ? UM.Theme.getColor("action_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") onClicked: sliceOrStopSlicing() } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index fefc4adc14..748a4e2643 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -173,6 +173,8 @@ "action_button_disabled": [245, 245, 245, 255], "action_button_disabled_text": [127, 127, 127, 255], "action_button_disabled_border": [245, 245, 245, 255], + "action_button_shadow": [64, 47, 205, 255], + "action_button_disabled_shadow": [228, 228, 228, 255], "print_button_ready": [50, 130, 255, 255], "print_button_ready_border": [50, 130, 255, 255], From 692868a0b4f25ba4aa8f2a1fedfe05fe36c9f0c9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 15:45:38 +0100 Subject: [PATCH 250/558] Create a function that given a printer type name, it will return and abbreviated name. Contributes to CURA-5942. --- cura/PrintInformation.py | 16 +------------- cura/Settings/MachineManager.py | 21 +++++++++++++++++++ .../PrinterSelector/MachineSelectorButton.qml | 2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index e11f70a54c..f1d8e81b3a 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -395,21 +395,7 @@ class PrintInformation(QObject): return active_machine_type_name = global_container_stack.definition.getName() - abbr_machine = "" - for word in re.findall(r"[\w']+", active_machine_type_name): - if word.lower() == "ultimaker": - abbr_machine += "UM" - elif word.isdigit(): - abbr_machine += word - else: - stripped_word = self._stripAccents(word.upper()) - # - use only the first character if the word is too long (> 3 characters) - # - use the whole word if it's not too long (<= 3 characters) - if len(stripped_word) > 3: - stripped_word = stripped_word[0] - abbr_machine += stripped_word - - self._abbr_machine = abbr_machine + self._abbr_machine = self._application.getMachineManager().getAbbreviatedMachineName(active_machine_type_name) ## Utility method that strips accents from characters (eg: â -> a) def _stripAccents(self, to_strip: str) -> str: diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index f321ce94a6..a65d2ed302 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -3,6 +3,8 @@ import collections import time +import re +import unicodedata from typing import Any, Callable, List, Dict, TYPE_CHECKING, Optional, cast from UM.ConfigurationErrorMessage import ConfigurationErrorMessage @@ -1537,3 +1539,22 @@ class MachineManager(QObject): with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue): self.updateMaterialWithVariant(None) self._updateQualityWithMaterial() + + ## This function will translate any printer type name to an abbreviated printer type name + @pyqtSlot(str, result = str) + def getAbbreviatedMachineName(self, machine_type_name: str) -> str: + abbr_machine = "" + for word in re.findall(r"[\w']+", machine_type_name): + if word.lower() == "ultimaker": + abbr_machine += "UM" + elif word.isdigit(): + abbr_machine += word + else: + stripped_word = ''.join(char for char in unicodedata.normalize('NFD', word.upper()) if unicodedata.category(char) != 'Mn') + # - use only the first character if the word is too long (> 3 characters) + # - use the whole word if it's not too long (<= 3 characters) + if len(stripped_word) > 3: + stripped_word = stripped_word[0] + abbr_machine += stripped_word + + return abbr_machine diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index e98036dbc8..e7b44a4447 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -65,7 +65,7 @@ Button model: printerTypesList delegate: Cura.PrinterTypeLabel { - text: modelData + text: Cura.MachineManager.getAbbreviatedMachineName(modelData) } } } From 4c26262054877c502e9244d06df9c2dce138c365 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Nov 2018 17:06:56 +0100 Subject: [PATCH 251/558] Use re-usable TabRow component Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index d424f35ebe..50ff108431 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -29,22 +29,19 @@ Item } } - TabBar + UM.TabRow { id: tabBar - onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) anchors.top: header.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width - height: 50 + + onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + Repeater { model: extrudersModel - - delegate: TabButton + delegate: UM.TabRowButton { - width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 - height: parent.height contentItem: Item { Cura.ExtruderIcon From 1d84bd735660cc8c8b98157854fc15b46d5cd55e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 17:37:10 +0100 Subject: [PATCH 252/558] Improve the machine selector header to show an icon in case it is a network printer. Contributes to CURA-5942. --- .../qml/ActionPanel/OutputProcessWidget.qml | 2 ++ .../qml/ActionPanel/SliceProcessWidget.qml | 1 + resources/qml/IconLabel.qml | 13 ++++++----- .../qml/PrinterSelector/MachineSelector.qml | 22 ++++++++++++++----- ...us_connected.svg => printer_connected.svg} | 0 .../themes/cura-light/icons/printer_group.svg | 22 +++++++++++++------ .../cura-light/icons/printer_single.svg | 15 ++++++------- .../cura-light/icons/tab_status_busy.svg | 13 ----------- .../cura-light/icons/tab_status_finished.svg | 13 ----------- .../cura-light/icons/tab_status_paused.svg | 13 ----------- .../cura-light/icons/tab_status_stopped.svg | 13 ----------- .../cura-light/icons/tab_status_unknown.svg | 13 ----------- resources/themes/cura-light/theme.json | 1 + 13 files changed, 50 insertions(+), 91 deletions(-) rename resources/themes/cura-light/icons/{tab_status_connected.svg => printer_connected.svg} (100%) delete mode 100644 resources/themes/cura-light/icons/tab_status_busy.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_finished.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_paused.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_stopped.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_unknown.svg diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 3c4386f079..87f9d2015d 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -47,6 +47,7 @@ Column { id: estimatedTime width: parent.width + height: childrenRect.height text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") @@ -57,6 +58,7 @@ Column { id: estimatedCosts width: parent.width + height: childrenRect.height property var printMaterialLengths: PrintInformation.materialLengths property var printMaterialWeights: PrintInformation.materialWeights diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 2d4a7b6b89..9c46539220 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,6 +44,7 @@ Column { id: message width: parent.width + height: childrenRect.height visible: widget.backendState == UM.Backend.Error text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 7c90382892..90930e91c7 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -16,32 +16,35 @@ Item property alias source: icon.source property alias color: label.color property alias font: label.font - - height: childrenRect.height + property alias iconSize: icon.width UM.RecolorImage { id: icon anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter - source: UM.Theme.getIcon("dot") + source: "" width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height + height: width sourceSize.width: width sourceSize.height: height color: label.color + visible: source != "" } Label { id: label - anchors.left: icon.right + anchors.left: icon.visible ? icon.right : parent.left + anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("thin_margin").width anchors.verticalCenter: icon.verticalCenter text: "Empty label" + elide: Text.ElideRight color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") renderType: Text.NativeRendering diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 66ed4d4a2c..d10478227a 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -14,6 +14,7 @@ Cura.ExpandableComponent id: machineSelector property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null popupPadding: 0 popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft @@ -25,15 +26,24 @@ Cura.ExpandableComponent name: "cura" } - headerItem: Label + headerItem: Cura.IconLabel { text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName - verticalAlignment: Text.AlignVCenter - height: parent.height - elide: Text.ElideRight - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") + source: + { + if (isNetworkPrinter && machineSelector.outputDevice != null) + { + if (machineSelector.outputDevice.clusterSize > 1) + { + return UM.Theme.getIcon("printer_group") + } + return UM.Theme.getIcon("printer_single") + } + return "" + } + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") + iconSize: UM.Theme.getSize("machine_selector_icon").width } popupItem: Item diff --git a/resources/themes/cura-light/icons/tab_status_connected.svg b/resources/themes/cura-light/icons/printer_connected.svg similarity index 100% rename from resources/themes/cura-light/icons/tab_status_connected.svg rename to resources/themes/cura-light/icons/printer_connected.svg diff --git a/resources/themes/cura-light/icons/printer_group.svg b/resources/themes/cura-light/icons/printer_group.svg index 614bea90b8..5e439faca4 100644 --- a/resources/themes/cura-light/icons/printer_group.svg +++ b/resources/themes/cura-light/icons/printer_group.svg @@ -1,12 +1,20 @@ - - - icn_groupPrinters + + + Icon/ group printer/ disconnected Created with Sketch. - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/printer_single.svg b/resources/themes/cura-light/icons/printer_single.svg index f7dc83987d..69c4e212bc 100644 --- a/resources/themes/cura-light/icons/printer_single.svg +++ b/resources/themes/cura-light/icons/printer_single.svg @@ -1,13 +1,12 @@ - - - icn_singlePrinter + + + Icon/ single printer/ disconnected Created with Sketch. - - - - - + + + + diff --git a/resources/themes/cura-light/icons/tab_status_busy.svg b/resources/themes/cura-light/icons/tab_status_busy.svg deleted file mode 100644 index debe4f6360..0000000000 --- a/resources/themes/cura-light/icons/tab_status_busy.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Busy - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_finished.svg b/resources/themes/cura-light/icons/tab_status_finished.svg deleted file mode 100644 index 2519f2f862..0000000000 --- a/resources/themes/cura-light/icons/tab_status_finished.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Wait cleanup - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_paused.svg b/resources/themes/cura-light/icons/tab_status_paused.svg deleted file mode 100644 index bab6c9ca6b..0000000000 --- a/resources/themes/cura-light/icons/tab_status_paused.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - paused - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_stopped.svg b/resources/themes/cura-light/icons/tab_status_stopped.svg deleted file mode 100644 index c9b150db3a..0000000000 --- a/resources/themes/cura-light/icons/tab_status_stopped.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Aborted - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_unknown.svg b/resources/themes/cura-light/icons/tab_status_unknown.svg deleted file mode 100644 index 9f413baffc..0000000000 --- a/resources/themes/cura-light/icons/tab_status_unknown.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Unknown - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 61b7600384..8f110db65d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -396,6 +396,7 @@ "machine_selector_widget": [20.0, 4.0], "machine_selector_widget_content": [25.0, 32.0], + "machine_selector_icon": [2.66, 2.66], "views_selector": [16.0, 4.5], From fa59a6a7dba646b18ab543dbf58c4e349e6eda4e Mon Sep 17 00:00:00 2001 From: THeijmans Date: Fri, 23 Nov 2018 09:17:32 +0100 Subject: [PATCH 253/558] UM3 ABS first layer temperature Fixed the first layer temperature for ABS Fine and Extra Fine profiles on the UM3 (ST-2281). --- resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg | 1 + .../quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg index 9ceab110e9..4e79728945 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg @@ -17,6 +17,7 @@ machine_nozzle_cool_down_speed = 0.8 machine_nozzle_heat_up_speed = 1.5 material_standby_temperature = 100 material_print_temperature = =default_material_print_temperature - 5 +material_print_temperature_layer_0 = =material_print_temperature + 15 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 prime_tower_enable = False diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg index e5b699c35f..3bded3b97c 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg @@ -14,6 +14,7 @@ variant = AA 0.4 [values] machine_nozzle_cool_down_speed = 0.85 machine_nozzle_heat_up_speed = 1.5 +material_print_temperature_layer_0 = =material_print_temperature + 10 material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 From 67dc415b58eec45b497b3cd29eedee538514ec0a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 23 Nov 2018 10:46:55 +0100 Subject: [PATCH 254/558] Add the connected icon to the printer selector that shows a blue icon when the printer is connected. If not connected then there is no icon. Contributes to CURA-5942. --- .../qml/PrinterSelector/MachineSelector.qml | 36 +++++++++++++++++-- .../themes/cura-light/icons/connected.svg | 5 --- .../themes/cura-light/icons/disconnected.svg | 6 ---- resources/themes/cura-light/theme.json | 2 +- 4 files changed, 35 insertions(+), 14 deletions(-) delete mode 100644 resources/themes/cura-light/icons/connected.svg delete mode 100644 resources/themes/cura-light/icons/disconnected.svg diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index d10478227a..a33c54ed88 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -14,6 +14,7 @@ Cura.ExpandableComponent id: machineSelector property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property bool isPrinterConnected: Cura.MachineManager.printerConnected property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null popupPadding: 0 @@ -31,9 +32,9 @@ Cura.ExpandableComponent text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName source: { - if (isNetworkPrinter && machineSelector.outputDevice != null) + if (isNetworkPrinter) { - if (machineSelector.outputDevice.clusterSize > 1) + if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1) { return UM.Theme.getIcon("printer_group") } @@ -44,6 +45,37 @@ Cura.ExpandableComponent font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") iconSize: UM.Theme.getSize("machine_selector_icon").width + + UM.RecolorImage + { + id: icon + + anchors.bottom: parent.bottom + x: UM.Theme.getSize("thick_margin").width + + source: UM.Theme.getIcon("printer_connected") + width: UM.Theme.getSize("printer_status_icon").width + height: UM.Theme.getSize("printer_status_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: UM.Theme.getColor("primary") + visible: isNetworkPrinter && isPrinterConnected + + // Make a themable circle in the background so we can change it in other themes + Rectangle + { + id: iconBackground + anchors.centerIn: parent + // Make it a bit bigger so there is an outline + width: parent.width + 2 + height: parent.height + 2 + radius: Math.round(width / 2) + color: UM.Theme.getColor("main_background") + z: parent.z - 1 + } + } } popupItem: Item diff --git a/resources/themes/cura-light/icons/connected.svg b/resources/themes/cura-light/icons/connected.svg deleted file mode 100644 index 18423bb6c4..0000000000 --- a/resources/themes/cura-light/icons/connected.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/disconnected.svg b/resources/themes/cura-light/icons/disconnected.svg deleted file mode 100644 index 019dff117e..0000000000 --- a/resources/themes/cura-light/icons/disconnected.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 8f110db65d..23b1ffcada 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -449,7 +449,7 @@ "favorites_button": [2, 2], "favorites_button_icon": [1.2, 1.2], - "printer_status_icon": [1.8, 1.8], + "printer_status_icon": [1.0, 1.0], "printer_sync_icon": [1.2, 1.2], "button_tooltip": [1.0, 1.3], From 3ba4b9fd81ac3b38aa393d71697f9e1514ecb6d7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 23 Nov 2018 11:20:53 +0100 Subject: [PATCH 255/558] Add shadows to various used actionbuttons CURA-5959 --- .../ActionPanel/OutputDevicesActionButton.qml | 6 +++++- .../qml/ActionPanel/OutputProcessWidget.qml | 3 +++ .../qml/ActionPanel/SliceProcessWidget.qml | 17 ++++++++--------- resources/themes/cura-light/theme.json | 2 ++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index be79a1893e..9682dddf14 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -17,7 +17,8 @@ Item id: saveToButton height: parent.height fixedWidthMode: true - + shadowEnabled: true + shadowColor: UM.Theme.getColor("primary_shadow") anchors { top: parent.top @@ -42,6 +43,9 @@ Item id: deviceSelectionMenu height: parent.height + shadowEnabled: true + shadowColor: UM.Theme.getColor("primary_shadow") + anchors { top: parent.top diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 3c4386f079..79b9898e49 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -115,6 +115,9 @@ Column textHoverColor: UM.Theme.getColor("text") onClicked: UM.Controller.setActiveStage("PreviewStage") visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage" + + shadowEnabled: true + shadowColor: UM.Theme.getColor("action_button_disabled_shadow") } Cura.OutputDevicesActionButton diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 4f10e6879b..7cce323905 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -93,21 +93,20 @@ Column // Disable the slice process when property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 - text: - { - if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) - { - return catalog.i18nc("@button", "Slice") - } - return catalog.i18nc("@button", "Cancel") - } + property bool isSlicing: [UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) == -1 + + text: isSlicing ? catalog.i18nc("@button", "Cancel") : catalog.i18nc("@button", "Slice") + enabled: !autoSlice && !disabledSlice visible: !autoSlice + color: isSlicing ? UM.Theme.getColor("secondary"): UM.Theme.getColor("primary") + textColor: isSlicing ? UM.Theme.getColor("primary"): UM.Theme.getColor("button_text") + disabledColor: UM.Theme.getColor("action_button_disabled") textDisabledColor: UM.Theme.getColor("action_button_disabled_text") shadowEnabled: true - shadowColor: enabled ? UM.Theme.getColor("action_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") + shadowColor: isSlicing ? UM.Theme.getColor("secondary_shadow") : enabled ? UM.Theme.getColor("action_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") onClicked: sliceOrStopSlicing() } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 748a4e2643..c5802b6a7e 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -83,10 +83,12 @@ "primary": [50, 130, 255, 255], + "primary_shadow": [64, 47, 205, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], "secondary": [245, 245, 245, 255], + "secondary_shadow": [228, 228, 228, 255], "main_window_header_background": [10, 8, 80, 255], "main_window_header_button_text_active": [10, 8, 80, 255], From 666ed595e5ed91cf4140b164abb745a021da03e7 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 23 Nov 2018 11:36:31 +0100 Subject: [PATCH 256/558] Added space --- resources/qml/PrintSetupSelector.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 61cc06b426..7cb47002a7 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -348,6 +348,7 @@ Cura.ExpandableComponent } } } + Component.onCompleted: { var index = Math.round(UM.Preferences.getValue("cura/active_mode")) From 1a8df9e10ecff985d8ae70ff960b4337e294f721 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 23 Nov 2018 11:46:38 +0100 Subject: [PATCH 257/558] Removed blue border if slicing is not possible CURA-5959 --- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 7cce323905..9a9f40ffac 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -102,7 +102,7 @@ Column color: isSlicing ? UM.Theme.getColor("secondary"): UM.Theme.getColor("primary") textColor: isSlicing ? UM.Theme.getColor("primary"): UM.Theme.getColor("button_text") - + outlineColor: "transparent" disabledColor: UM.Theme.getColor("action_button_disabled") textDisabledColor: UM.Theme.getColor("action_button_disabled_text") shadowEnabled: true From c4d0207cc13abfb75da88a8c50c3a9c19147b964 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 23 Nov 2018 13:10:48 +0100 Subject: [PATCH 258/558] Added close button in right top corner CURA-5941 --- resources/qml/PrintSetupSelector.qml | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 7cb47002a7..8271484e6a 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -151,7 +151,7 @@ Cura.ExpandableComponent color: UM.Theme.getColor("text") height: parent.height anchors.topMargin: UM.Theme.getSize("sidebar_margin").height - anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height +// anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("print_setup_selector_margin").height } @@ -165,6 +165,37 @@ Cura.ExpandableComponent } + + Button + { + id: closeButton; + width: UM.Theme.getSize("message_close").width; + height: UM.Theme.getSize("message_close").height; + + anchors + { + right: parent.right; + rightMargin: UM.Theme.getSize("default_margin").width; + top: parent.top; + topMargin: 10 + } + + UM.RecolorImage + { + anchors.fill: parent; + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("message_text") + source: UM.Theme.getIcon("cross1") + } + + onClicked: base.model.hideMessage(model.id) + + background: Rectangle + { + color: UM.Theme.getColor("message_background") + } + } } Rectangle From a3bcdaf3b625087204a04867e8a9a374c9bfa857 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 23 Nov 2018 16:58:57 +0100 Subject: [PATCH 259/558] Make the popup in the printer selector resizable depending on the contents. Also there is a maximum height that will fit 9 printers. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 3 + .../qml/PrinterSelector/MachineSelector.qml | 78 ++----------------- .../PrinterSelector/MachineSelectorList.qml | 78 +++++++++++++++++++ 3 files changed, 89 insertions(+), 70 deletions(-) create mode 100644 resources/qml/PrinterSelector/MachineSelectorList.qml diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index eed1da0ad8..a99426acd8 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -1,3 +1,6 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.4 diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index a33c54ed88..c73836ad6a 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -82,87 +82,24 @@ Cura.ExpandableComponent { id: popup width: UM.Theme.getSize("machine_selector_widget_content").width - height: UM.Theme.getSize("machine_selector_widget_content").height ScrollView { id: scroll width: parent.width - anchors.top: parent.top - anchors.bottom: separator.top clip: true - Column + MachineSelectorList { - id: column - // Can't use parent.width since the parent is the flickable component and not the ScrollView width: scroll.width - 2 * UM.Theme.getSize("default_lining").width x: UM.Theme.getSize("default_lining").width + property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height - Label + onHeightChanged: { - text: catalog.i18nc("@label", "Network connected printers") - visible: networkedPrintersModel.items.length > 0 - leftPadding: UM.Theme.getSize("default_margin").width - height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 - renderType: Text.NativeRendering - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text_medium") - verticalAlignment: Text.AlignVCenter - } - - Repeater - { - id: networkedPrinters - - model: UM.ContainerStacksModel - { - id: networkedPrintersModel - filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} - } - - delegate: MachineSelectorButton - { - text: model.metadata["connect_group_name"] - checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] - outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - - Connections - { - target: Cura.MachineManager - onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] - } - } - } - - Label - { - text: catalog.i18nc("@label", "Preset printers") - visible: virtualPrintersModel.items.length > 0 - leftPadding: UM.Theme.getSize("default_margin").width - height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 - renderType: Text.NativeRendering - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text_medium") - verticalAlignment: Text.AlignVCenter - } - - Repeater - { - id: virtualPrinters - - model: UM.ContainerStacksModel - { - id: virtualPrintersModel - filter: {"type": "machine", "um_network_key": null} - } - - delegate: MachineSelectorButton - { - text: model.name - checked: Cura.MachineManager.activeMachineId == model.id - } + scroll.height = Math.min(height, maximumHeight) + popup.height = scroll.height + buttonRow.height } } } @@ -171,7 +108,7 @@ Cura.ExpandableComponent { id: separator - anchors.bottom: buttonRow.top + anchors.top: scroll.bottom width: parent.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") @@ -181,7 +118,8 @@ Cura.ExpandableComponent { id: buttonRow - anchors.bottom: parent.bottom + // The separator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. + anchors.top: separator.top anchors.horizontalCenter: parent.horizontalCenter padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml new file mode 100644 index 0000000000..11a61194b7 --- /dev/null +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -0,0 +1,78 @@ +// 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.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Column +{ + id: machineSelectorList + + Label + { + text: catalog.i18nc("@label", "Network connected printers") + visible: networkedPrintersModel.items.length > 0 + leftPadding: UM.Theme.getSize("default_margin").width + height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text_medium") + verticalAlignment: Text.AlignVCenter + } + + Repeater + { + id: networkedPrinters + + model: UM.ContainerStacksModel + { + id: networkedPrintersModel + filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} + } + + delegate: MachineSelectorButton + { + text: model.metadata["connect_group_name"] + checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + + Connections + { + target: Cura.MachineManager + onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + } + } + } + + Label + { + text: catalog.i18nc("@label", "Preset printers") + visible: virtualPrintersModel.items.length > 0 + leftPadding: UM.Theme.getSize("default_margin").width + height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text_medium") + verticalAlignment: Text.AlignVCenter + } + + Repeater + { + id: virtualPrinters + + model: UM.ContainerStacksModel + { + id: virtualPrintersModel + filter: {"type": "machine", "um_network_key": null} + } + + delegate: MachineSelectorButton + { + text: model.name + checked: Cura.MachineManager.activeMachineId == model.id + } + } +} \ No newline at end of file From e1f3e07f049376240293cc2956c0afce4fd18432 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 23 Nov 2018 17:11:20 +0100 Subject: [PATCH 260/558] Changed Marketplace button to no longer use the action button The actionButton is weirdly named and overly used. That being said, the marketplace button is unique, so there is little sense in re-using it --- resources/qml/MainWindow/MainWindowHeader.qml | 35 ++++++++++++------- resources/themes/cura-light/theme.json | 7 ---- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 59ec542e6b..ceb27dd726 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -2,6 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 +import QtQuick.Controls 2.0 as Controls2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.1 @@ -73,25 +74,35 @@ Rectangle } // Shortcut button to quick access the Toolbox - Cura.ActionButton + Controls2.Button { + id: marketplaceButton + text: catalog.i18nc("@action:button", "Marketplace") + height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) + onClicked: Cura.Actions.browsePackages.trigger() + + background: Rectangle + { + radius: UM.Theme.getSize("action_button_radius").width + color: "transparent" + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("primary_text") + } + + contentItem: Label + { + id: label + text: marketplaceButton.text + color: UM.Theme.getColor("primary_text") + width: contentWidth + } + anchors { right: accountWidget.left rightMargin: UM.Theme.getSize("default_margin").width verticalCenter: parent.verticalCenter } - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:button", "Marketplace") - height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) - color: UM.Theme.getColor("main_window_header_secondary_button_background_active") - hoverColor: UM.Theme.getColor("main_window_header_secondary_button_background_hovered") - outlineColor: UM.Theme.getColor("main_window_header_secondary_button_outline_active") - outlineHoverColor: UM.Theme.getColor("main_window_header_secondary_button_outline_hovered") - textColor: UM.Theme.getColor("main_window_header_secondary_button_text_active") - textHoverColor: UM.Theme.getColor("main_window_header_secondary_button_text_hovered") - onClicked: Cura.Actions.browsePackages.trigger() } AccountWidget diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index c5802b6a7e..888bc9bfa6 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -98,13 +98,6 @@ "main_window_header_button_background_inactive": [255, 255, 255, 0], "main_window_header_button_background_hovered": [255, 255, 255, 102], - "main_window_header_secondary_button_text_active": [255, 255, 255, 255], - "main_window_header_secondary_button_text_hovered": [10, 8, 80, 255], - "main_window_header_secondary_button_background_active": [255, 255, 255, 0], - "main_window_header_secondary_button_background_hovered": [255, 255, 255, 255], - "main_window_header_secondary_button_outline_active": [255, 255, 255, 255], - "main_window_header_secondary_button_outline_hovered": [255, 255, 255, 255], - "account_widget_outline_active": [70, 66, 126, 255], "machine_selector_bar": [31, 36, 39, 255], From 2e262dd9d22add74f7ee5b638a64c1b9bc63ff27 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 23 Nov 2018 17:35:55 +0100 Subject: [PATCH 261/558] Added Icons to SidebarSimple --- resources/qml/SidebarSimple.qml | 58 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 5e723a3d70..52fc9320f2 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -187,12 +187,11 @@ Item } } - Label + IconWithText { id: qualityRowTitle + source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") } // Show titles for the each quality slider ticks @@ -532,17 +531,19 @@ Item width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width - Label + IconWithText { id: infillLabel - text: catalog.i18nc("@label", "Infill") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + source: UM.Theme.getIcon("category_infill") + text: catalog.i18nc("@label", "Infill") + " (%)" - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width + anchors + { + top: parent.top + topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) + left: parent.left + leftMargin: UM.Theme.getSize("thick_margin").width + } } } @@ -855,23 +856,23 @@ Item // // Enable support // - Label + IconWithText { id: enableSupportLabel visible: enableSupportCheckBox.visible + source: UM.Theme.getIcon("category_support") + text: catalog.i18nc("@label", "Support") - anchors.top: infillCellRight.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - anchors.right: infillCellLeft.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - anchors.verticalCenter: enableSupportCheckBox.verticalCenter - - text: catalog.i18nc("@label", "Generate Support") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - elide: Text.ElideRight + anchors + { + top: infillCellRight.bottom + topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) + left: parent.left + leftMargin: UM.Theme.getSize("thick_margin").width + right: infillCellLeft.right + rightMargin: UM.Theme.getSize("thick_margin").width + verticalCenter: enableSupportCheckBox.verticalCenter + } } CheckBox @@ -980,15 +981,12 @@ Item } - Label + IconWithText { id: adhesionHelperLabel visible: adhesionCheckBox.visible - - text: catalog.i18nc("@label", "Build Plate Adhesion") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - elide: Text.ElideRight + source: UM.Theme.getIcon("category_adhesion") + text: catalog.i18nc("@label", "Adhesion") anchors { From af1ee535788b4d64945ef578bde3764551297ab4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 23 Nov 2018 17:41:58 +0100 Subject: [PATCH 262/558] Fix the hover effect of action button CURA-5959 --- resources/qml/ActionButton.qml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 8cd53b5d7e..6dd5839bb9 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -12,7 +12,6 @@ import UM 1.1 as UM Button { id: button - property alias cursorShape: mouseArea.cursorShape property alias iconSource: buttonIcon.source property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius @@ -22,12 +21,14 @@ Button property color hoverColor: UM.Theme.getColor("primary_hover") property color disabledColor: color property color textColor: UM.Theme.getColor("button_text") - property color textHoverColor: UM.Theme.getColor("button_text_hover") + property color textHoverColor: textColor property color textDisabledColor: textColor property color outlineColor: color property color outlineHoverColor: hoverColor property color outlineDisabledColor: outlineColor + hoverEnabled: true + property alias shadowColor: shadow.color property alias shadowEnabled: shadow.visible @@ -95,13 +96,4 @@ Button delay: 500 visible: text != "" && button.hovered } - - MouseArea - { - id: mouseArea - anchors.fill: parent - // Ensure that the button will still accept the clicks on it's own. - onPressed: mouse.accepted = false - hoverEnabled: true - } } From b82ea58bc815b28815cd6991230d5a3b4d8ca78d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 23 Nov 2018 18:07:50 +0100 Subject: [PATCH 263/558] Changed all the action buttons to either use primary or secondary button CURA-5959 --- resources/qml/Account/GeneralOperations.qml | 8 +-- resources/qml/Account/UserOperations.qml | 8 +-- .../ActionPanel/OutputDevicesActionButton.qml | 5 +- .../qml/ActionPanel/OutputProcessWidget.qml | 9 +--- .../qml/ActionPanel/SliceProcessWidget.qml | 49 ++++++++++--------- resources/qml/PrimaryButton.qml | 18 +++++++ resources/qml/SecondaryButton.qml | 18 +++++++ resources/themes/cura-light/theme.json | 10 ++++ 8 files changed, 81 insertions(+), 44 deletions(-) create mode 100644 resources/qml/PrimaryButton.qml create mode 100644 resources/qml/SecondaryButton.qml diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 4614c4ba88..b9f1025d5e 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -11,20 +11,16 @@ Row { spacing: UM.Theme.getSize("default_margin").width - Cura.ActionButton + Cura.SecondaryButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height text: catalog.i18nc("@button", "Create account") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("main_window_header_button_text_active") - textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com/app/create") fixedWidthMode: true } - Cura.ActionButton + Cura.PrimaryButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index c167813425..b9ffa395d6 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -11,20 +11,16 @@ Row { spacing: UM.Theme.getSize("default_margin").width - Cura.ActionButton + Cura.SecondaryButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height text: catalog.i18nc("@button", "Manage account") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("main_window_header_button_text_active") - textHoverColor: UM.Theme.getColor("main_window_header_button_text_active") onClicked: Qt.openUrlExternally("https://account.ultimaker.com") fixedWidthMode: true } - Cura.ActionButton + Cura.PrimaryButton { width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 9682dddf14..d24d440241 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -12,13 +12,12 @@ Item { id: widget - Cura.ActionButton + Cura.PrimaryButton { id: saveToButton height: parent.height fixedWidthMode: true - shadowEnabled: true - shadowColor: UM.Theme.getColor("primary_shadow") + anchors { top: parent.top diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 79b9898e49..ddbe709a84 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -101,18 +101,13 @@ Column spacing: UM.Theme.getSize("default_margin").width width: parent.width - Cura.ActionButton + Cura.SecondaryButton { id: previewStageShortcut - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_panel_button").height text: catalog.i18nc("@button", "Preview") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") + onClicked: UM.Controller.setActiveStage("PreviewStage") visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage" diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 9a9f40ffac..199b94ab33 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -81,36 +81,41 @@ Column } } - Cura.ActionButton - { - id: prepareButton - width: parent.width - height: UM.Theme.getSize("action_panel_button").height - fixedWidthMode: true + Item + { + id: prepareButtons // Get the current value from the preferences property bool autoSlice: UM.Preferences.getValue("general/auto_slice") // Disable the slice process when - property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 - property bool isSlicing: [UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) == -1 - - text: isSlicing ? catalog.i18nc("@button", "Cancel") : catalog.i18nc("@button", "Slice") - - enabled: !autoSlice && !disabledSlice + width: parent.width + height: UM.Theme.getSize("action_panel_button").height visible: !autoSlice + Cura.PrimaryButton + { + id: sliceButton + fixedWidthMode: true + anchors.fill: parent + text: catalog.i18nc("@button", "Slice") + enabled: !autoSlice && widget.backendState != UM.Backend.Error + visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error + onClicked: sliceOrStopSlicing() + } - color: isSlicing ? UM.Theme.getColor("secondary"): UM.Theme.getColor("primary") - textColor: isSlicing ? UM.Theme.getColor("primary"): UM.Theme.getColor("button_text") - outlineColor: "transparent" - disabledColor: UM.Theme.getColor("action_button_disabled") - textDisabledColor: UM.Theme.getColor("action_button_disabled_text") - shadowEnabled: true - shadowColor: isSlicing ? UM.Theme.getColor("secondary_shadow") : enabled ? UM.Theme.getColor("action_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") - - onClicked: sliceOrStopSlicing() + Cura.SecondaryButton + { + id: cancelButton + fixedWidthMode: true + anchors.fill: parent + text: catalog.i18nc("@button", "Cancel") + enabled: sliceButton.enabled + visible: !sliceButton.visible + onClicked: sliceOrStopSlicing() + } } + // React when the user changes the preference of having the auto slice enabled Connections { @@ -118,7 +123,7 @@ Column onPreferenceChanged: { var autoSlice = UM.Preferences.getValue("general/auto_slice") - prepareButton.autoSlice = autoSlice + prepareButtons.autoSlice = autoSlice } } diff --git a/resources/qml/PrimaryButton.qml b/resources/qml/PrimaryButton.qml new file mode 100644 index 0000000000..8450e524e2 --- /dev/null +++ b/resources/qml/PrimaryButton.qml @@ -0,0 +1,18 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + + +Cura.ActionButton +{ + shadowEnabled: true + shadowColor: enabled ? UM.Theme.getColor("primary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") + color: UM.Theme.getColor("primary_button") + textColor: UM.Theme.getColor("primary_button_text") + outlineColor: "transparent" + disabledColor: UM.Theme.getColor("action_button_disabled") + textDisabledColor: UM.Theme.getColor("action_button_disabled_text") + hoverColor: UM.Theme.getColor("primary_button_hover") +} \ No newline at end of file diff --git a/resources/qml/SecondaryButton.qml b/resources/qml/SecondaryButton.qml new file mode 100644 index 0000000000..0e6b79b3a7 --- /dev/null +++ b/resources/qml/SecondaryButton.qml @@ -0,0 +1,18 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM +import Cura 1.1 as Cura + + +Cura.ActionButton +{ + shadowEnabled: true + shadowColor: enabled ? UM.Theme.getColor("secondary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") + color: UM.Theme.getColor("secondary_button") + textColor: UM.Theme.getColor("secondary_button_text") + outlineColor: "transparent" + disabledColor: UM.Theme.getColor("action_button_disabled") + textDisabledColor: UM.Theme.getColor("action_button_disabled_text") + hoverColor: UM.Theme.getColor("secondary_button_hover") +} \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 888bc9bfa6..cbdc37caa1 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -90,6 +90,16 @@ "secondary": [245, 245, 245, 255], "secondary_shadow": [228, 228, 228, 255], + "primary_button": [38,113,231,255], + "primary_button_shadow": [27,95,202, 255], + "primary_button_hover": [81,145,247, 255], + "primary_button_text": [255, 255, 255, 255], + + "secondary_button": [240,240,240, 255], + "secondary_button_shadow": [228, 228, 228, 255], + "secondary_button_hover": [228,228,228, 255], + "secondary_button_text": [30,102,215, 255], + "main_window_header_background": [10, 8, 80, 255], "main_window_header_button_text_active": [10, 8, 80, 255], "main_window_header_button_text_inactive": [255, 255, 255, 255], From 9e92542eeec397440f2f383d68650c291e30c8d7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 25 Nov 2018 18:14:01 +0100 Subject: [PATCH 264/558] Fix the height of the IconLabel to avoid getting binding loops. Contributes to CURA-5942. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 2 -- resources/qml/ActionPanel/SliceProcessWidget.qml | 1 - resources/qml/IconLabel.qml | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 87f9d2015d..3c4386f079 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -47,7 +47,6 @@ Column { id: estimatedTime width: parent.width - height: childrenRect.height text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") @@ -58,7 +57,6 @@ Column { id: estimatedCosts width: parent.width - height: childrenRect.height property var printMaterialLengths: PrintInformation.materialLengths property var printMaterialWeights: PrintInformation.materialWeights diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 9c46539220..2d4a7b6b89 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,7 +44,6 @@ Column { id: message width: parent.width - height: childrenRect.height visible: widget.backendState == UM.Backend.Error text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 90930e91c7..0941254e7b 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -18,6 +18,8 @@ Item property alias font: label.font property alias iconSize: icon.width + implicitHeight: icon.height + UM.RecolorImage { id: icon From f3bf20ca1b8f17a9b63aa14f57df56a2e17b95f4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 25 Nov 2018 18:24:21 +0100 Subject: [PATCH 265/558] Separate the view selector into a different file. --- plugins/PreviewStage/PreviewMenu.qml | 72 +--------------- .../qml/PrinterSelector/MachineSelector.qml | 2 - resources/qml/ViewsSelector.qml | 82 +++++++++++++++++++ resources/qml/qmldir | 3 +- 4 files changed, 86 insertions(+), 73 deletions(-) create mode 100644 resources/qml/ViewsSelector.qml diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index d660db549b..a1f59cd4ca 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -29,80 +29,12 @@ Item anchors.centerIn: parent height: parent.height - Cura.ExpandableComponent + Cura.ViewsSelector { - id: viewSelector - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") + id: viewsSelector height: parent.height width: UM.Theme.getSize("views_selector").width headerCornerSide: Cura.RoundedRectangle.Direction.Left - - property var viewModel: UM.ViewModel { } - - property var activeView: - { - for (var i = 0; i < viewModel.rowCount(); i++) - { - if (viewModel.items[i].active) - { - return viewModel.items[i] - } - } - return null - } - - Component.onCompleted: - { - // Nothing was active, so just return the first one (the list is sorted by priority, so the most - // important one should be returned) - if (activeView == null) - { - UM.Controller.setActiveView(viewModel.getItem(0).id) - } - } - - headerItem: Label - { - text: viewSelector.activeView ? viewSelector.activeView.name : "" - verticalAlignment: Text.AlignVCenter - height: parent.height - elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - } - - popupItem: Column - { - id: viewSelectorPopup - width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width - - // For some reason the height/width of the column gets set to 0 if this is not set... - Component.onCompleted: - { - height = implicitHeight - width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width - } - - Repeater - { - id: viewsList - model: viewSelector.viewModel - RoundButton - { - text: name - radius: UM.Theme.getSize("default_radius").width - checkable: true - checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false - onClicked: - { - viewSelector.togglePopup() - UM.Controller.setActiveView(id) - } - } - } - - } } // Separator line diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index c73836ad6a..b14734dfb1 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -3,8 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml new file mode 100644 index 0000000000..0e11cccc5a --- /dev/null +++ b/resources/qml/ViewsSelector.qml @@ -0,0 +1,82 @@ +// 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.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Cura.ExpandableComponent +{ + id: viewSelector + + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") + + property var viewModel: UM.ViewModel { } + + property var activeView: + { + for (var i = 0; i < viewModel.rowCount(); i++) + { + if (viewModel.items[i].active) + { + return viewModel.items[i] + } + } + return null + } + + Component.onCompleted: + { + // Nothing was active, so just return the first one (the list is sorted by priority, so the most + // important one should be returned) + if (activeView == null) + { + UM.Controller.setActiveView(viewModel.getItem(0).id) + } + } + + headerItem: Label + { + text: viewSelector.activeView ? viewSelector.activeView.name : "" + verticalAlignment: Text.AlignVCenter + height: parent.height + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + + popupItem: Column + { + id: viewSelectorPopup + width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + + // For some reason the height/width of the column gets set to 0 if this is not set... + Component.onCompleted: + { + height = implicitHeight + width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + } + + Repeater + { + id: viewsList + model: viewSelector.viewModel + RoundButton + { + text: name + radius: UM.Theme.getSize("default_radius").width + checkable: true + checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false + onClicked: + { + viewSelector.togglePopup() + UM.Controller.setActiveView(id) + } + } + } + + } +} \ No newline at end of file diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 67388100ca..43ae4411af 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -11,4 +11,5 @@ ActionPanelWidget 1.0 ActionPanelWidget.qml IconLabel 1.0 IconLabel.qml OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml ExpandableComponent 1.0 ExpandableComponent.qml -PrinterTypeLabel 1.0 PrinterTypeLabel.qml \ No newline at end of file +PrinterTypeLabel 1.0 PrinterTypeLabel.qml +ViewsSelector 1.0 ViewsSelector.qml \ No newline at end of file From 68c96a25775c6be13bdcdba64544e68837cc41c2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 25 Nov 2018 19:42:00 +0100 Subject: [PATCH 266/558] Modify the header item of the view selector. --- resources/qml/ViewsSelector.qml | 36 +++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index 0e11cccc5a..b9048803a2 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -37,15 +37,35 @@ Cura.ExpandableComponent } } - headerItem: Label + headerItem: Item { - text: viewSelector.activeView ? viewSelector.activeView.name : "" - verticalAlignment: Text.AlignVCenter - height: parent.height - elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering + Label + { + id: title + text: catalog.i18nc("@button", "View types") + verticalAlignment: Text.AlignVCenter + height: parent.height + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering + } + + Label + { + text: viewSelector.activeView ? viewSelector.activeView.name : "" + verticalAlignment: Text.AlignVCenter + anchors + { + left: title.right + leftMargin: UM.Theme.getSize("default_margin").width + } + height: parent.height + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } } popupItem: Column From c5d0ed26513e12045b2fb84d6408a79f729a81df Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 25 Nov 2018 20:13:56 +0100 Subject: [PATCH 267/558] Define the look and feel of the view selector button. Adjust the sizes. --- .../qml/PrinterSelector/MachineSelector.qml | 5 +-- resources/qml/ViewsSelector.qml | 39 ++++++++++++++++--- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index b14734dfb1..b6657f112e 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -15,7 +15,7 @@ Cura.ExpandableComponent property bool isPrinterConnected: Cura.MachineManager.printerConnected property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - popupPadding: 0 + popupPadding: UM.Theme.getSize("default_lining").width popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") @@ -90,8 +90,7 @@ Cura.ExpandableComponent MachineSelectorList { // Can't use parent.width since the parent is the flickable component and not the ScrollView - width: scroll.width - 2 * UM.Theme.getSize("default_lining").width - x: UM.Theme.getSize("default_lining").width + width: scroll.width property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height onHeightChanged: diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index b9048803a2..e9fdd57177 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -11,6 +11,8 @@ Cura.ExpandableComponent { id: viewSelector + popupPadding: UM.Theme.getSize("default_lining").width + popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") property var viewModel: UM.ViewModel { } @@ -71,25 +73,51 @@ Cura.ExpandableComponent popupItem: Column { id: viewSelectorPopup - width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + width: viewSelector.width - 2 * viewSelector.popupPadding // For some reason the height/width of the column gets set to 0 if this is not set... Component.onCompleted: { height = implicitHeight - width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width + width = viewSelector.width - 2 * viewSelector.popupPadding } Repeater { id: viewsList model: viewSelector.viewModel - RoundButton + + delegate: Button { - text: name - radius: UM.Theme.getSize("default_radius").width + id: viewsSelectorButton + text: model.name + width: parent.width + height: UM.Theme.getSize("action_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width checkable: true checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false + + contentItem: Label + { + id: buttonText + text: viewsSelectorButton.text + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("action_button") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle + { + id: backgroundRect + color: viewsSelectorButton.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: viewsSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent" + } + onClicked: { viewSelector.togglePopup() @@ -97,6 +125,5 @@ Cura.ExpandableComponent } } } - } } \ No newline at end of file From 09af7a9435178bc9a6e811c7ade4889880a745f9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 09:34:27 +0100 Subject: [PATCH 268/558] Slice button will now be disabled on error CURA-5959 --- resources/qml/ActionPanel/SliceProcessWidget.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 199b94ab33..05a9345585 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -42,7 +42,7 @@ Column Cura.IconLabel { - id: message + id: unableToSliceMessage width: parent.width visible: widget.backendState == UM.Backend.Error @@ -98,7 +98,7 @@ Column fixedWidthMode: true anchors.fill: parent text: catalog.i18nc("@button", "Slice") - enabled: !autoSlice && widget.backendState != UM.Backend.Error + enabled: widget.backendState != UM.Backend.Error visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error onClicked: sliceOrStopSlicing() } From c8e065d7a78f3d62b26cded3cd0063e5a05fead4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 10:21:15 +0100 Subject: [PATCH 269/558] Fix code-style Contributes to CURA-5942. Co-Authored-By: diegopradogesto --- resources/qml/ExpandableComponent.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 80c65f12a7..ccfb9c6da2 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -12,7 +12,8 @@ Item id: base // Enumeration with the different possible alignments of the popup with respect of the headerItem - enum PopupAlignment { + enum PopupAlignment + { AlignLeft, AlignRight } From 5b940b524204ca56b5fafe05bad28d5e477b8ea7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 10:28:36 +0100 Subject: [PATCH 270/558] Use thick margin and change some anchors. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelector.qml | 8 ++++++-- resources/qml/PrinterSelector/MachineSelectorButton.qml | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index b6657f112e..d721ed5b83 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -48,8 +48,12 @@ Cura.ExpandableComponent { id: icon - anchors.bottom: parent.bottom - x: UM.Theme.getSize("thick_margin").width + anchors + { + bottom: parent.bottom + left: parent.left + leftMargin: UM.Theme.getSize("thick_margin").width + } source: UM.Theme.getIcon("printer_connected") width: UM.Theme.getSize("printer_status_icon").width diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index e7b44a4447..fef6867e35 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -13,8 +13,8 @@ Button width: parent.width height: UM.Theme.getSize("action_button").height - leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) - rightPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) + leftPadding: UM.Theme.getSize("thick_margin").width + rightPadding: UM.Theme.getSize("thick_margin").width checkable: true property var outputDevice: null From 63fab9f038e8615432a8c592138e915351131386 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 10:49:43 +0100 Subject: [PATCH 271/558] Use theme sizes. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelector.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index d721ed5b83..120ce02edd 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -71,8 +71,8 @@ Cura.ExpandableComponent id: iconBackground anchors.centerIn: parent // Make it a bit bigger so there is an outline - width: parent.width + 2 - height: parent.height + 2 + width: parent.width + 2 * UM.Theme.getSize("default_lining").width + height: parent.height + 2 * UM.Theme.getSize("default_lining").height radius: Math.round(width / 2) color: UM.Theme.getColor("main_background") z: parent.z - 1 From fa1ef5c45c70ebdebaef3d9d19b026e6586523b2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 10:51:08 +0100 Subject: [PATCH 272/558] Rename function name to be more clear to what it does. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelectorButton.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index fef6867e35..992ea55b1d 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -20,7 +20,7 @@ Button property var outputDevice: null property var printerTypesList: [] - function setPrinterTypesList() + function updatePrinterTypesList() { printerTypesList = (checked && (outputDevice != null)) ? outputDevice.uniquePrinterTypes : [] } @@ -97,14 +97,14 @@ Button Connections { target: outputDevice - onUniqueConfigurationsChanged: setPrinterTypesList() + onUniqueConfigurationsChanged: updatePrinterTypesList() } Connections { target: Cura.MachineManager - onOutputDevicesChanged: setPrinterTypesList() + onOutputDevicesChanged: updatePrinterTypesList() } - Component.onCompleted: setPrinterTypesList() + Component.onCompleted: updatePrinterTypesList() } From 4990f205662aeba91bce43c57fe41a94abd1d545 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 10:55:32 +0100 Subject: [PATCH 273/558] Use QStringList instead of QVariantList since the return value is a list of strings. Co-Authored-By: diegopradogesto --- cura/PrinterOutputDevice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index f8a663f0e4..99c48189cc 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -212,7 +212,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self.uniqueConfigurationsChanged.emit() # Returns the unique configurations of the printers within this output device - @pyqtProperty("QVariantList", notify = uniqueConfigurationsChanged) + @pyqtProperty("QStringList", notify = uniqueConfigurationsChanged) def uniquePrinterTypes(self) -> List[str]: return list(set([configuration.printerType for configuration in self._unique_configurations])) @@ -243,4 +243,4 @@ class PrinterOutputDevice(QObject, OutputDevice): if not self._firmware_updater: return - self._firmware_updater.updateFirmware(firmware_file) \ No newline at end of file + self._firmware_updater.updateFirmware(firmware_file) From 21bfa6e4c20819e09b8cb2f27f62427dc71c8476 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 10:58:38 +0100 Subject: [PATCH 274/558] Fix code style. Add brackets in new line. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelectorList.qml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 11a61194b7..5ef04b7351 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -30,7 +30,10 @@ Column model: UM.ContainerStacksModel { id: networkedPrintersModel - filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} + filter: + { + "type": "machine", "um_network_key": "*", "hidden": "False" + } } delegate: MachineSelectorButton @@ -66,7 +69,10 @@ Column model: UM.ContainerStacksModel { id: virtualPrintersModel - filter: {"type": "machine", "um_network_key": null} + filter: + { + "type": "machine", "um_network_key": null + } } delegate: MachineSelectorButton From 72d972c8b428e8ad8d6bf0b831b67d6301058049 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 11:03:58 +0100 Subject: [PATCH 275/558] Remove PrinterStatusIcon that is not used anymore. Contributes to CURA-5942. --- resources/qml/Menus/PrinterStatusIcon.qml | 27 ----------------------- 1 file changed, 27 deletions(-) delete mode 100644 resources/qml/Menus/PrinterStatusIcon.qml diff --git a/resources/qml/Menus/PrinterStatusIcon.qml b/resources/qml/Menus/PrinterStatusIcon.qml deleted file mode 100644 index 6ff6b07af8..0000000000 --- a/resources/qml/Menus/PrinterStatusIcon.qml +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Item -{ - property var status: "disconnected" - width: childrenRect.width - height: childrenRect.height - UM.RecolorImage - { - id: statusIcon - width: UM.Theme.getSize("printer_status_icon").width - height: UM.Theme.getSize("printer_status_icon").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("tab_status_" + parent.status) - source: UM.Theme.getIcon(parent.status) - } -} - - - From 5397cda2b4d3077a76ca5a3d9444e09cf386a318 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 12:00:06 +0100 Subject: [PATCH 276/558] Add a label to the action panel when auto slice is ON, indicating that the process runs automatically. Contributes to CURA-5942. --- resources/qml/ActionPanel/SliceProcessWidget.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 05a9345585..3329ac4b23 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -40,6 +40,18 @@ Column } } + Label + { + id: autoSlicingLabel + width: parent.width + visible: prepareButtons.autoSlice && widget.backendState == UM.Backend.Processing + + text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...") + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("very_small") + renderType: Text.NativeRendering + } + Cura.IconLabel { id: unableToSliceMessage From 845b3209819f8e7b1449c15118c6c995b2c548c3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 26 Nov 2018 13:08:30 +0100 Subject: [PATCH 277/558] Fix adjustable monitor component width CURA-5943 - Add rounding - If there's no sidebar, use full width --- plugins/MonitorStage/MonitorMainView.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/MonitorStage/MonitorMainView.qml b/plugins/MonitorStage/MonitorMainView.qml index 57dd033792..f5696bbf54 100644 --- a/plugins/MonitorStage/MonitorMainView.qml +++ b/plugins/MonitorStage/MonitorMainView.qml @@ -38,7 +38,10 @@ Item anchors.bottom: parent.bottom anchors.left: parent.left - width: parent.width * 0.7 + // If the sidebar is not set, the view should take the complete space. + property var widthFactor: monitorSidebarComponent.source == "" ? 1.0 : 0.7 + + width: Math.round(parent.width * widthFactor) height: parent.height property real maximumWidth: parent.width From 6bb010e74a09a95c68bc9010cfcf8ea9dfffb454 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 26 Nov 2018 13:14:24 +0100 Subject: [PATCH 278/558] Move MonitorButtonStyle to styles.qml CURA-5943 --- .../PrinterOutput/ManualPrinterControl.qml | 21 ++--- .../qml/PrinterOutput/MonitorButtonStyle.qml | 88 ------------------- resources/themes/cura-light/styles.qml | 80 +++++++++++++++++ 3 files changed, 88 insertions(+), 101 deletions(-) delete mode 100644 resources/qml/PrinterOutput/MonitorButtonStyle.qml diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 1a719c379e..5d07bd5fc8 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -21,11 +21,6 @@ Item implicitWidth: parent.width implicitHeight: childrenRect.height - MonitorButtonStyle - { - id: monitorButtonStyle - } - Column { enabled: @@ -108,7 +103,7 @@ Item Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("arrow_top"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -125,7 +120,7 @@ Item Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("arrow_left"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -142,7 +137,7 @@ Item Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("arrow_right"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -159,7 +154,7 @@ Item Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("arrow_bottom"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -176,7 +171,7 @@ Item Layout.preferredWidth: width Layout.preferredHeight: height iconSource: UM.Theme.getIcon("home"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -206,7 +201,7 @@ Item Button { iconSource: UM.Theme.getIcon("arrow_top"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -219,7 +214,7 @@ Item Button { iconSource: UM.Theme.getIcon("home"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height @@ -232,7 +227,7 @@ Item Button { iconSource: UM.Theme.getIcon("arrow_bottom"); - style: monitorButtonStyle + style: UM.Theme.styles.monitor_button_style width: height height: UM.Theme.getSize("setting_control").height diff --git a/resources/qml/PrinterOutput/MonitorButtonStyle.qml b/resources/qml/PrinterOutput/MonitorButtonStyle.qml deleted file mode 100644 index 7bb1b91e55..0000000000 --- a/resources/qml/PrinterOutput/MonitorButtonStyle.qml +++ /dev/null @@ -1,88 +0,0 @@ -import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.3 - -import UM 1.2 as UM -import Cura 1.0 as Cura - - -Component -{ - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.floor(control.width / 2) - height: Math.floor(control.height / 2) - sourceSize.width: width - sourceSize.height: width - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - source: control.iconSource - } - } - } -} diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 723b393efa..ee9c530d9b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -1200,4 +1200,84 @@ QtObject } } } + + property Component monitor_button_style: Component + { + ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + return UM.Theme.getColor("action_button_border"); + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + return UM.Theme.getColor("action_button"); + } + Behavior on color + { + ColorAnimation + { + duration: 50 + } + } + } + + label: Item + { + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: Math.floor(control.width / 2) + height: Math.floor(control.height / 2) + sourceSize.width: width + sourceSize.height: width + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } + source: control.iconSource + } + } + } + } } From d6614941dc1b63aca417e0b27d9cc45c2e9477fe Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 26 Nov 2018 13:15:23 +0100 Subject: [PATCH 279/558] Update QtQuick import versions in styles.qml CURA-5943 --- resources/themes/cura-light/styles.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index ee9c530d9b..010e5564f1 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -1,9 +1,9 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick 2.10 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM From 6bed1c1390b33720621ae781668a93135f1a7fba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 26 Nov 2018 13:21:52 +0100 Subject: [PATCH 280/558] Move monitor_checkable_button_style out to styles.qml CURA-5943 --- .../PrinterOutput/ManualPrinterControl.qml | 67 +----------------- resources/themes/cura-light/styles.qml | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 5d07bd5fc8..106ae7db03 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -279,72 +279,7 @@ Item checked: distancesRow.currentDistance == model.value onClicked: distancesRow.currentDistance = model.value - style: ButtonStyle { - background: Rectangle { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color { ColorAnimation { duration: 50; } } - Label { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - font: UM.Theme.getFont("default") - text: control.text - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideMiddle - } - } - label: Item { } - } + style: UM.Theme.styles.monitor_checkable_button_style } } } diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 010e5564f1..f982b1eac8 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -1280,4 +1280,74 @@ QtObject } } } + + property Component monitor_checkable_button_style: Component + { + ButtonStyle { + background: Rectangle { + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + return UM.Theme.getColor("action_button_border"); + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + return UM.Theme.getColor("action_button"); + } + Behavior on color { ColorAnimation { duration: 50; } } + Label { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } + font: UM.Theme.getFont("default") + text: control.text + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideMiddle + } + } + label: Item { } + } + } } From eea6490e75cea6cd30555edc674bd58969fcd72b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 13:27:26 +0100 Subject: [PATCH 281/558] Hover of output device now spans the popup CURA-5959 --- resources/qml/ActionPanel/OutputDevicesActionButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index d24d440241..e4b4884794 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -68,7 +68,7 @@ Item closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - contentItem: Column + contentItem: ColumnLayout { Repeater { @@ -80,7 +80,7 @@ Item color: "transparent" cornerRadius: 0 hoverColor: UM.Theme.getColor("primary") - + Layout.fillWidth: true onClicked: { UM.OutputDeviceManager.setActiveDevice(model.id) From 098714254d8a5d366f22d1894083fba4fee4aaad Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 13:35:02 +0100 Subject: [PATCH 282/558] Remove unused code CURA-5959 --- resources/qml/SaveButton.qml | 478 ----------------------------------- 1 file changed, 478 deletions(-) delete mode 100644 resources/qml/SaveButton.qml diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml deleted file mode 100644 index c2d310e30c..0000000000 --- a/resources/qml/SaveButton.qml +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 - -import UM 1.1 as UM -import Cura 1.0 as Cura - -// This widget does so much more than "just" being a save button, so it should be refactored at some point in time. -Item -{ - id: base; - UM.I18nCatalog { id: catalog; name: "cura"} - - property real progress: UM.Backend.progress - property int backendState: UM.Backend.state - property bool activity: CuraApplication.platformActivity - - property alias buttonRowWidth: saveRow.width - - property string fileBaseName - property string statusText: - { - if(!activity) - { - return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model"); - } - - switch(base.backendState) - { - case 1: - return catalog.i18nc("@label:PrintjobStatus", "Ready to slice"); - case 2: - return catalog.i18nc("@label:PrintjobStatus", "Slicing..."); - case 3: - return catalog.i18nc("@label:PrintjobStatus %1 is target operation", "Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription); - case 4: - return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice"); - case 5: - return catalog.i18nc("@label:PrintjobStatus", "Slicing unavailable"); - default: - return ""; - } - } - - function sliceOrStopSlicing() - { - try - { - if ([1, 5].indexOf(base.backendState) != -1) - { - CuraApplication.backend.forceSlice(); - } - else - { - CuraApplication.backend.stopSlicing(); - } - } - catch (e) - { - console.log("Could not start or stop slicing.", e) - } - } - - Label - { - id: statusLabel - width: parent.width - 2 * UM.Theme.getSize("thick_margin").width - anchors.top: parent.top - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default_bold") - text: statusText; - } - - Rectangle - { - id: progressBar - width: parent.width - 2 * UM.Theme.getSize("thick_margin").width - height: UM.Theme.getSize("progressbar").height - anchors.top: statusLabel.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4) - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - - Rectangle - { - width: Math.max(parent.width * base.progress) - height: parent.height - color: UM.Theme.getColor("progressbar_control") - radius: UM.Theme.getSize("progressbar_radius").width - visible: base.backendState == 2 - } - } - - // Shortcut for "save as/print/..." - Action - { - shortcut: "Ctrl+P" - onTriggered: - { - // only work when the button is enabled - if (saveToButton.enabled) - { - saveToButton.clicked(); - } - // prepare button - if (prepareButton.enabled) - { - sliceOrStopSlicing(); - } - } - } - - Item - { - id: saveRow - width: { - // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect - var children_width = UM.Theme.getSize("default_margin").width; - for (var index in children) - { - var child = children[index]; - if(child.visible) - { - children_width += child.width + child.anchors.rightMargin; - } - } - return Math.min(children_width, base.width - UM.Theme.getSize("thick_margin").width); - } - height: saveToButton.height - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("thick_margin").height - anchors.right: parent.right - clip: true - - Row - { - id: additionalComponentsRow - anchors.top: parent.top - anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right) - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - spacing: UM.Theme.getSize("default_margin").width - } - - Component.onCompleted: - { - saveRow.addAdditionalComponents("saveButton") - } - - Connections - { - target: CuraApplication - onAdditionalComponentsChanged: saveRow.addAdditionalComponents("saveButton") - } - - function addAdditionalComponents (areaId) - { - if(areaId == "saveButton") - { - for (var component in CuraApplication.additionalComponents["saveButton"]) - { - CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow - } - } - } - - Connections - { - target: UM.Preferences - onPreferenceChanged: - { - var autoSlice = UM.Preferences.getValue("general/auto_slice"); - prepareButton.autoSlice = autoSlice; - saveToButton.autoSlice = autoSlice; - } - } - - // Prepare button, only shows if auto_slice is off - Button - { - id: prepareButton - - tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process") - // 1 = not started, 2 = Processing - enabled: ([1, 2].indexOf(base.backendState) != -1) && base.activity - visible: !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity - property bool autoSlice - height: UM.Theme.getSize("save_button_save_to_button").height - - anchors.top: parent.top - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - // 1 = not started, 4 = error, 5 = disabled - text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel") - onClicked: - { - sliceOrStopSlicing(); - } - - style: ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - - Behavior on color { ColorAnimation { duration: 50; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("action_button") - text: control.text; - } - } - label: Item {} - } - } - - Button - { - id: saveToButton - - tooltip: UM.OutputDeviceManager.activeDeviceDescription; - // 3 = done, 5 = disabled - enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true - visible: base.backendState != "undefined" && autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true) - property bool autoSlice - height: UM.Theme.getSize("save_button_save_to_button").height - - anchors.top: parent.top - anchors.right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right - anchors.rightMargin: deviceSelectionMenu.visible ? -3 * UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thick_margin").width - - text: UM.OutputDeviceManager.activeDeviceShortDescription - onClicked: - { - forceActiveFocus(); - UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, - { "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats }); - } - - style: ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered_border"); - } - else - { - return UM.Theme.getColor("print_button_ready_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed"); - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered"); - } - else - { - return UM.Theme.getColor("print_button_ready"); - } - } - - Behavior on color { ColorAnimation { duration: 50; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") - font: UM.Theme.getFont("action_button") - text: control.text - } - } - label: Item { } - } - } - - Button - { - id: deviceSelectionMenu - tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); - anchors.top: parent.top - anchors.right: parent.right - - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - width: UM.Theme.getSize("save_button_save_to_button").height - height: UM.Theme.getSize("save_button_save_to_button").height - - // 3 = Done, 5 = Disabled - enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true - visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true - - - style: ButtonStyle - { - background: Rectangle - { - id: deviceSelectionIcon - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border") - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed_border") - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered_border") - } - else - { - return UM.Theme.getColor("print_button_ready_border") - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled") - } - else if(control.pressed) - { - return UM.Theme.getColor("print_button_ready_pressed") - } - else if(control.hovered) - { - return UM.Theme.getColor("print_button_ready_hovered") - } - else - { - return UM.Theme.getColor("print_button_ready") - } - } - Behavior on color { ColorAnimation { duration: 50; } } - anchors.left: parent.left - anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2); - width: parent.height - height: parent.height - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: height - color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") - source: UM.Theme.getIcon("arrow_bottom") - } - } - } - - menu: Menu - { - id: devicesMenu; - Instantiator - { - model: devicesModel; - MenuItem - { - text: model.description - checkable: true; - checked: model.id == UM.OutputDeviceManager.activeDevice - exclusiveGroup: devicesMenuGroup - onTriggered: - { - UM.OutputDeviceManager.setActiveDevice(model.id); - } - } - onObjectAdded: devicesMenu.insertItem(index, object) - onObjectRemoved: devicesMenu.removeItem(object) - } - ExclusiveGroup { id: devicesMenuGroup } - } - } - UM.OutputDevicesModel { id: devicesModel } - } -} From 1fe65013584b6bb1130a8fc4a7bac3e3ddff618c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 13:35:41 +0100 Subject: [PATCH 283/558] Removed unused entries from theme --- resources/themes/cura-light/theme.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index cbdc37caa1..59927da663 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -181,14 +181,6 @@ "action_button_shadow": [64, 47, 205, 255], "action_button_disabled_shadow": [228, 228, 228, 255], - "print_button_ready": [50, 130, 255, 255], - "print_button_ready_border": [50, 130, 255, 255], - "print_button_ready_text": [255, 255, 255, 255], - "print_button_ready_hovered": [30, 186, 245, 243], - "print_button_ready_hovered_border": [30, 186, 245, 243], - "print_button_ready_pressed": [30, 186, 245, 243], - "print_button_ready_pressed_border": [30, 186, 245, 243], - "scrollbar_background": [255, 255, 255, 255], "scrollbar_handle": [31, 36, 39, 255], "scrollbar_handle_hover": [12, 159, 227, 255], From 3c86c0ae6c691c4eb1be17f0fe15b1ff1cc5919f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 13:36:45 +0100 Subject: [PATCH 284/558] Fix spacing CURA-5959 --- resources/themes/cura-light/theme.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 59927da663..001818c2f8 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -80,8 +80,7 @@ "thick_lining": [127, 127, 127, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], - - + "primary": [50, 130, 255, 255], "primary_shadow": [64, 47, 205, 255], "primary_hover": [48, 182, 231, 255], @@ -90,15 +89,15 @@ "secondary": [245, 245, 245, 255], "secondary_shadow": [228, 228, 228, 255], - "primary_button": [38,113,231,255], - "primary_button_shadow": [27,95,202, 255], - "primary_button_hover": [81,145,247, 255], + "primary_button": [38, 113, 231, 255], + "primary_button_shadow": [27, 95, 202, 255], + "primary_button_hover": [81, 145, 247, 255], "primary_button_text": [255, 255, 255, 255], - "secondary_button": [240,240,240, 255], - "secondary_button_shadow": [228, 228, 228, 255], - "secondary_button_hover": [228,228,228, 255], - "secondary_button_text": [30,102,215, 255], + "secondary_button": [240, 240, 240, 255], + "secondary_button_shadow": [228, 228, 228, 255], + "secondary_button_hover": [228, 228, 228, 255], + "secondary_button_text": [30, 102, 215, 255], "main_window_header_background": [10, 8, 80, 255], "main_window_header_button_text_active": [10, 8, 80, 255], From ebae4347a841e90f257d3296b24ca3e8531e6852 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 13:44:32 +0100 Subject: [PATCH 285/558] Fix unit tests that were failing after adding the getAbbreviatedMachineName to the machine manager. Contributes to CURA-5942. --- tests/TestPrintInformation.py | 52 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/tests/TestPrintInformation.py b/tests/TestPrintInformation.py index a226a437c6..baa36fb338 100644 --- a/tests/TestPrintInformation.py +++ b/tests/TestPrintInformation.py @@ -1,5 +1,7 @@ +import functools from cura import PrintInformation +from cura.Settings.MachineManager import MachineManager from unittest.mock import MagicMock, patch from UM.Application import Application @@ -11,14 +13,20 @@ def getPrintInformation(printer_name) -> PrintInformation: mock_application = MagicMock() global_container_stack = MagicMock() - global_container_stack.definition.getName = MagicMock(return_value=printer_name) - mock_application.getGlobalContainerStack = MagicMock(return_value=global_container_stack) + global_container_stack.definition.getName = MagicMock(return_value = printer_name) + mock_application.getGlobalContainerStack = MagicMock(return_value = global_container_stack) - multiBuildPlateModel = MagicMock() - multiBuildPlateModel.maxBuildPlate = 0 - mock_application.getMultiBuildPlateModel = MagicMock(return_value=multiBuildPlateModel) + multi_build_plate_model = MagicMock() + multi_build_plate_model.maxBuildPlate = 0 + mock_application.getMultiBuildPlateModel = MagicMock(return_value = multi_build_plate_model) - Application.getInstance = MagicMock(return_type=mock_application) + # Mock-up the entire machine manager except the function that needs to be tested: getAbbreviatedMachineName + original_get_abbreviated_name = MachineManager.getAbbreviatedMachineName + mock_machine_manager = MagicMock() + mock_machine_manager.getAbbreviatedMachineName = functools.partial(original_get_abbreviated_name, mock_machine_manager) + mock_application.getMachineManager = MagicMock(return_value = mock_machine_manager) + + Application.getInstance = MagicMock(return_type = mock_application) with patch("json.loads", lambda x: {}): print_information = PrintInformation.PrintInformation(mock_application) @@ -28,17 +36,17 @@ def getPrintInformation(printer_name) -> PrintInformation: def setup_module(): MimeTypeDatabase.addMimeType( MimeType( - name="application/vnd.ms-package.3dmanufacturing-3dmodel+xml", - comment="3MF", - suffixes=["3mf"] + name = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml", + comment = "3MF", + suffixes = ["3mf"] ) ) MimeTypeDatabase.addMimeType( MimeType( - name="application/x-cura-gcode-file", - comment="Cura GCode File", - suffixes=["gcode"] + name = "application/x-cura-gcode-file", + comment = "Cura GCode File", + suffixes = ["gcode"] ) ) @@ -49,42 +57,42 @@ def test_setProjectName(): print_information = getPrintInformation("ultimaker") # Test simple name - project_name = ["HelloWorld",".3mf"] + project_name = ["HelloWorld", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test the name with one dot - project_name = ["Hello.World",".3mf"] + project_name = ["Hello.World", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test the name with two dot - project_name = ["Hello.World.World",".3mf"] + project_name = ["Hello.World.World", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test the name with dot at the beginning - project_name = [".Hello.World",".3mf"] + project_name = [".Hello.World", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test the name with underline - project_name = ["Hello_World",".3mf"] + project_name = ["Hello_World", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test gcode extension - project_name = ["Hello_World",".gcode"] + project_name = ["Hello_World", ".gcode"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] == print_information._job_name # Test empty project name - project_name = ["",""] + project_name = ["", ""] print_information.setProjectName(project_name[0] + project_name[1]) assert print_information.UNTITLED_JOB_NAME == print_information._job_name # Test wrong file extension - project_name = ["Hello_World",".test"] + project_name = ["Hello_World", ".test"] print_information.setProjectName(project_name[0] + project_name[1]) assert "UM_" + project_name[0] != print_information._job_name @@ -93,7 +101,7 @@ def test_setJobName(): print_information = getPrintInformation("ultimaker") print_information._abbr_machine = "UM" - print_information.setJobName("UM_HelloWorld", is_user_specified_job_name=False) + print_information.setJobName("UM_HelloWorld", is_user_specified_job_name = False) def test_defineAbbreviatedMachineName(): @@ -102,6 +110,6 @@ def test_defineAbbreviatedMachineName(): print_information = getPrintInformation(printer_name) # Test not ultimaker printer, name suffix should have first letter from the printer name - project_name = ["HelloWorld",".3mf"] + project_name = ["HelloWorld", ".3mf"] print_information.setProjectName(project_name[0] + project_name[1]) assert printer_name[0] + "_" + project_name[0] == print_information._job_name \ No newline at end of file From a6544997525f0a066429223da1bd432eb3653ec5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 13:47:22 +0100 Subject: [PATCH 286/558] Re-enable hover for marketplace button CURA-5959 --- plugins/Toolbox/resources/qml/ToolboxDetailPage.qml | 2 +- resources/qml/MainWindow/MainWindowHeader.qml | 6 ++++-- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index 437a2ef351..0c04dc2bab 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -37,7 +37,7 @@ Item leftMargin: UM.Theme.getSize("wide_margin").width topMargin: UM.Theme.getSize("wide_margin").height } - color: white //Always a white background for image (regardless of theme). + color: "white" //Always a white background for image (regardless of theme). Image { anchors.fill: parent diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index ceb27dd726..a24af7ee45 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -81,10 +81,12 @@ Rectangle height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) onClicked: Cura.Actions.browsePackages.trigger() + hoverEnabled: true + background: Rectangle { radius: UM.Theme.getSize("action_button_radius").width - color: "transparent" + color: marketplaceButton.hovered ? UM.Theme.getColor("primary_text") : UM.Theme.getColor("main_window_header_background") border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("primary_text") } @@ -93,7 +95,7 @@ Rectangle { id: label text: marketplaceButton.text - color: UM.Theme.getColor("primary_text") + color: marketplaceButton.hovered ? UM.Theme.getColor("main_window_header_background") : UM.Theme.getColor("primary_text") width: contentWidth } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 001818c2f8..2343cd3f2a 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -80,7 +80,7 @@ "thick_lining": [127, 127, 127, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], - + "primary": [50, 130, 255, 255], "primary_shadow": [64, 47, 205, 255], "primary_hover": [48, 182, 231, 255], From b63c4f7a74a06f6b167f6c48d3538b9566fc2e9f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 14:06:34 +0100 Subject: [PATCH 287/558] Add header in new files. Remove unused imports. Contributes to CURA-5959. --- resources/qml/ActionButton.qml | 1 - resources/qml/PrimaryButton.qml | 4 +++- resources/qml/SecondaryButton.qml | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 6dd5839bb9..b9a04f3b46 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -3,7 +3,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 // For the dropshadow diff --git a/resources/qml/PrimaryButton.qml b/resources/qml/PrimaryButton.qml index 8450e524e2..fca63d2cdb 100644 --- a/resources/qml/PrimaryButton.qml +++ b/resources/qml/PrimaryButton.qml @@ -1,5 +1,7 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.2 -import QtQuick.Controls 1.1 import UM 1.4 as UM import Cura 1.1 as Cura diff --git a/resources/qml/SecondaryButton.qml b/resources/qml/SecondaryButton.qml index 0e6b79b3a7..f03d8acdfa 100644 --- a/resources/qml/SecondaryButton.qml +++ b/resources/qml/SecondaryButton.qml @@ -1,5 +1,7 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.2 -import QtQuick.Controls 1.1 import UM 1.4 as UM import Cura 1.1 as Cura From 90a73f351da7bfa695ab5fcb6e9e9361e6200a44 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 14:12:34 +0100 Subject: [PATCH 288/558] Fix positioning of tabs in custom menu The label's bottom side is at its top, so we must add its height so that it gets positioned correctly. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 50ff108431..25111a9365 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -33,7 +33,7 @@ Item { id: tabBar anchors.top: header.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.topMargin: UM.Theme.getSize("default_margin").height + header.height onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) @@ -114,7 +114,7 @@ Item property var hasActiveExtruder: activeExtruder != null property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true - property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported + property var valueWarning: !Cura.MachineManager.isActiveQualitySupported text: currentRootMaterialName tooltip: currentRootMaterialName @@ -131,7 +131,6 @@ Item { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } - } } From 12f78fa21ad022d9f1f278fb5f3d56ced7e65f60 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 14:29:42 +0100 Subject: [PATCH 289/558] Remove border of the popup selector for the output devices. Contributes to CURA-5959. --- resources/qml/ActionPanel/OutputDevicesActionButton.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index e4b4884794..2111038cfc 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -94,10 +94,7 @@ Item { opacity: visible ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } - radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("action_panel_secondary") - border.color: UM.Theme.getColor("lining") - border.width: UM.Theme.getSize("default_lining").width } } } From 0a1c0e18d1bca499168b062f1e0538665768cd85 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 14:38:43 +0100 Subject: [PATCH 290/558] Reuse the component SecondaryButton in the printer selector. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelector.qml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 120ce02edd..93e5103aa8 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -125,15 +125,11 @@ Cura.ExpandableComponent padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width - Cura.ActionButton + Cura.SecondaryButton { leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Add printer") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") onClicked: { togglePopup() @@ -141,15 +137,11 @@ Cura.ExpandableComponent } } - Cura.ActionButton + Cura.SecondaryButton { leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Manage printers") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") onClicked: { togglePopup() From 84f263f1111a58d46817c2d9d6572e7676a8dcf3 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 15:08:33 +0100 Subject: [PATCH 291/558] Fix style for the open file button in the prepare menu. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 41 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index a99426acd8..a953c2b5d1 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -3,7 +3,7 @@ import QtQuick 2.7 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura @@ -27,14 +27,14 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButtonBackground.width + itemRow.width + UM.Theme.getSize("default_margin").width + width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height RowLayout { id: itemRow - anchors.left: openFileButtonBackground.right + anchors.left: openFileButton.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: Math.round(0.9 * prepareMenu.width) @@ -44,7 +44,7 @@ Item Cura.MachineSelector { id: machineSelection - z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. + z: openFileButton.z - 1 //Ensure that the tooltip of the open file button stays above the item row. headerCornerSide: Cura.RoundedRectangle.Direction.Left Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width @@ -86,24 +86,31 @@ Item } } - Rectangle + Button { - id: openFileButtonBackground + id: openFileButton height: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height + onClicked: Cura.Actions.open.trigger() - radius: UM.Theme.getSize("default_radius").width - color: UM.Theme.getColor("toolbar_background") - - Button + contentItem: UM.RecolorImage { - id: openFileButton - text: catalog.i18nc("@action:button", "Open File") - iconSource: UM.Theme.getIcon("load") - style: UM.Theme.styles.toolbar_button - tooltip: "" - action: Cura.Actions.open - anchors.centerIn: parent + id: buttonIcon + source: UM.Theme.getIcon("load") + width: UM.Theme.getSize("button_icon").width + height: UM.Theme.getSize("button_icon").height + color: UM.Theme.getColor("toolbar_button_text") + + sourceSize: UM.Theme.getSize("button_icon") + } + + background: Rectangle + { + height: UM.Theme.getSize("stage_menu").height + width: UM.Theme.getSize("stage_menu").height + + radius: UM.Theme.getSize("default_radius").width + color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } } } From 9732099250f9085137883907293f5dbd1080691a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 15:14:32 +0100 Subject: [PATCH 292/558] Add border to rounded rectangle. It's designed so that it works in exactly the same way as rectangle. --- resources/qml/BorderGroup.qml | 7 +++++++ resources/qml/RoundedRectangle.qml | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 resources/qml/BorderGroup.qml diff --git a/resources/qml/BorderGroup.qml b/resources/qml/BorderGroup.qml new file mode 100644 index 0000000000..94d0d68594 --- /dev/null +++ b/resources/qml/BorderGroup.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject +{ + property real width: 0 + property color color: "black" +} diff --git a/resources/qml/RoundedRectangle.qml b/resources/qml/RoundedRectangle.qml index 9ad2230be5..3ca05e2125 100644 --- a/resources/qml/RoundedRectangle.qml +++ b/resources/qml/RoundedRectangle.qml @@ -5,6 +5,7 @@ import UM 1.2 as UM // The rounded rectangle works mostly like a regular rectangle, but provides the option to have rounded corners on only one side of the rectangle. Item { + id: roundedRectangle // As per the regular rectangle property color color: "transparent" @@ -15,6 +16,9 @@ Item // 1 is down, 2 is left, 3 is up and 4 is right. property int cornerSide: RoundedRectangle.Direction.None + // Simple object to ensure that border.width and border.color work + property BorderGroup border: BorderGroup {} + enum Direction { None = 0, @@ -31,6 +35,8 @@ Item anchors.fill: parent radius: cornerSide != RoundedRectangle.Direction.None ? parent.radius : 0 color: parent.color + border.width: parent.border.width + border.color: parent.border.color } // The item that covers 2 of the corners to make them not rounded. @@ -45,5 +51,22 @@ Item right: cornerSide == RoundedRectangle.Direction.Left ? parent.right: undefined bottom: cornerSide == RoundedRectangle.Direction.Up ? parent.bottom: undefined } + + border.width: parent.border.width + border.color: parent.border.color + + Rectangle + { + color: roundedRectangle.color + height: cornerSide % 2 ? roundedRectangle.border.width: roundedRectangle.height - 2 * roundedRectangle.border.width + width: cornerSide % 2 ? roundedRectangle.width - 2 * roundedRectangle.border.width: roundedRectangle.border.width + anchors + { + right: cornerSide == RoundedRectangle.Direction.Right ? parent.right : undefined + bottom: cornerSide == RoundedRectangle.Direction.Down ? parent.bottom: undefined + horizontalCenter: cornerSide % 2 ? parent.horizontalCenter: undefined + verticalCenter: cornerSide % 2 ? undefined: parent.verticalCenter + } + } } } From 9afc5748a8ec1eb7bbbdb8ba7395f7b3d2554a49 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 15:39:34 +0100 Subject: [PATCH 293/558] Add copyright header. --- resources/qml/BorderGroup.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/qml/BorderGroup.qml b/resources/qml/BorderGroup.qml index 94d0d68594..38ad9fadff 100644 --- a/resources/qml/BorderGroup.qml +++ b/resources/qml/BorderGroup.qml @@ -1,3 +1,6 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.0 QtObject From ac5f79ba2ced74cb13fe1fc00fe328f0b7d5a8a0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 15:47:32 +0100 Subject: [PATCH 294/558] Add tab style to tabbed content It now gets a proper background colour, lining and radius. Contributes to issue CURA-5876. --- .../ConfigurationMenu/CustomConfiguration.qml | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 25111a9365..1f7673cd0a 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Controls 1.1 as OldControls @@ -33,7 +33,7 @@ Item { id: tabBar anchors.top: header.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + header.height + anchors.topMargin: UM.Theme.getSize("default_margin").height onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) @@ -57,17 +57,46 @@ Item } } - Item + Rectangle { id: tabControl width: parent.width height: childrenRect.height anchors.top: tabBar.bottom + + radius: UM.Theme.getSize("default_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("secondary") + + //Remove rounding and lining at the top. + Rectangle + { + width: parent.width + height: parent.radius + anchors.top: parent.top + color: UM.Theme.getColor("lining") + Rectangle + { + anchors + { + left: parent.left + leftMargin: parent.parent.border.width + right: parent.right + rightMargin: parent.parent.border.width + top: parent.top + } + height: parent.parent.radius + color: parent.parent.color + } + } + property var model: extrudersModel.items[tabBar.currentIndex] property real textWidth: Math.round(width * 0.3) property real controlWidth: width - textWidth Column { + padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").height Row From 3d1157522a4d9c318a2c2d3f068c3326e3e3b81c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 15:51:36 +0100 Subject: [PATCH 295/558] Reuse the RoundedRectangle component and indicate that only the bottom part of the popup should be rounded. Contributes to CURA-5942. --- resources/qml/ExpandableComponent.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index ccfb9c6da2..9b2826daed 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -2,6 +2,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 import UM 1.2 as UM +import Cura 1.0 as Cura // The expandable component has 3 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded @@ -162,8 +163,9 @@ Item padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent - background: Rectangle + background: Cura.RoundedRectangle { + cornerSide: Cura.RoundedRectangle.Direction.Down color: popupBackgroundColor border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") From 4b897ffd67a5572f305a981cba79ace625d086d9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 16:03:40 +0100 Subject: [PATCH 296/558] Fix width of content in tabbed content Contributes to issue CURA-5876. --- .../ConfigurationMenu/CustomConfiguration.qml | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 1f7673cd0a..78448d5be5 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -59,7 +59,6 @@ Item Rectangle { - id: tabControl width: parent.width height: childrenRect.height anchors.top: tabBar.bottom @@ -91,14 +90,18 @@ Item } } - property var model: extrudersModel.items[tabBar.currentIndex] - property real textWidth: Math.round(width * 0.3) - property real controlWidth: width - textWidth Column { + id: selectors padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").height + property var model: extrudersModel.items[tabBar.currentIndex] + + readonly property real paddedWidth: parent.width - padding * 2 + property real textWidth: Math.round(paddedWidth * 0.3) + property real controlWidth: paddedWidth - textWidth + Row { height: UM.Theme.getSize("print_setup_item").height @@ -110,13 +113,13 @@ Item font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") height: parent.height - width: tabControl.textWidth + width: selectors.textWidth } OldControls.CheckBox { - checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false - onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) + checked: selectors.model != null ? Cura.MachineManager.getExtruder(selectors.model.index).isEnabled: false + onClicked: Cura.MachineManager.setExtruderEnabled(selectors.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox } @@ -132,7 +135,7 @@ Item font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") height: parent.height - width: tabControl.textWidth + width: selectors.textWidth } OldControls.ToolButton @@ -152,7 +155,7 @@ Item enabled: Cura.ExtruderManager.activeExtruderIndex > -1 height: UM.Theme.getSize("setting_control").height - width: tabControl.controlWidth + width: selectors.controlWidth style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true @@ -174,7 +177,7 @@ Item font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") height: parent.height - width: tabControl.textWidth + width: selectors.textWidth } OldControls.ToolButton @@ -185,7 +188,7 @@ Item visible: Cura.MachineManager.hasVariants height: UM.Theme.getSize("setting_control").height - width: tabControl.controlWidth + width: selectors.controlWidth style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; From d85aee1c53cb27983f73d153685a1681efa78b58 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 16:40:29 +0100 Subject: [PATCH 297/558] Ensure that no weird data is set in the printSetupSelector on first start CURA-5961 --- resources/qml/PrintSetupSelector.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 2ecdc9e546..9b90d8589f 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -54,12 +54,12 @@ Cura.ExpandableComponent IconWithText { source: UM.Theme.getIcon("category_layer_height") - text: Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" + text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : "" UM.SettingPropertyProvider { id: layerHeight - containerStackId: Cura.MachineManager.activeStackId + containerStack: Cura.MachineManager.activeStack key: "layer_height" watchedProperties: ["value"] } @@ -68,12 +68,12 @@ Cura.ExpandableComponent IconWithText { source: UM.Theme.getIcon("category_infill") - text: parseInt(infillDensity.properties.value) + "%" + text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%" UM.SettingPropertyProvider { id: infillDensity - containerStackId: Cura.MachineManager.activeStackId + containerStack: Cura.MachineManager.activeStack key: "infill_sparse_density" watchedProperties: ["value"] } From 87a0dc65e17742760fe7b551e2b8b5c4db0035a2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:09:36 +0100 Subject: [PATCH 298/558] Add list of available configurations to AutoConfiguration This is the main item it needs to display. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/AutoConfiguration.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index cde18ab488..8e86549e17 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -5,6 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import UM 1.3 as UM +import Cura 1.0 as Cura Item { @@ -26,4 +27,13 @@ Item right: parent.right } } + + ConfigurationListView + { + anchors.top: header.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").width + width: parent.width + + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + } } \ No newline at end of file From a825daea9565cdb5cfe405a1bb58750a76cdf988 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 17:10:48 +0100 Subject: [PATCH 299/558] Cleanup the Theme.json There were a lot of sizes that weren't used --- resources/qml/Dialogs/AddMachineDialog.qml | 1 - resources/themes/cura-dark/theme.json | 4 - resources/themes/cura-light/styles.qml | 248 --------------------- resources/themes/cura-light/theme.json | 20 -- 4 files changed, 273 deletions(-) diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index aa160acd4d..8b2b9d1868 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -298,7 +298,6 @@ UM.Dialog id: machineName text: getMachineName() width: Math.floor(parent.width * 0.75) - implicitWidth: UM.Theme.getSize("standard_list_input").width maximumLength: 40 //validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed. validator: RegExpValidator diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 62b1dbfa0f..34b944b25b 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -133,7 +133,6 @@ "slider_groove_border": [127, 127, 127, 255], "slider_groove_fill": [245, 245, 245, 255], "slider_handle": [255, 255, 255, 255], - "slider_handle_hover": [77, 182, 226, 255], "slider_handle_active": [68, 192, 255, 255], "slider_text_background": [255, 255, 255, 255], @@ -209,9 +208,6 @@ "quality_slider_unavailable": [179, 179, 179, 255], "quality_slider_available": [255, 255, 255, 255], - "quality_slider_handle": [255, 255, 255, 255], - "quality_slider_handle_hover": [127, 127, 127, 255], - "quality_slider_text": [255, 255, 255, 255], "toolbox_header_button_text_active": [255, 255, 255, 255], "toolbox_header_button_text_inactive": [128, 128, 128, 255], diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 723b393efa..f4aeb95bb3 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -599,198 +599,6 @@ QtObject } } - property Component sidebar_category: Component - { - ButtonStyle - { - background: Rectangle - { - anchors.fill: parent - anchors.left: parent.left - anchors.leftMargin: Theme.getSize("thick_margin").width - anchors.right: parent.right - anchors.rightMargin: Theme.getSize("thick_margin").width - implicitHeight: Theme.getSize("section").height - color: - { - if(control.color) - { - return control.color; - } - else if(!control.enabled) - { - return Theme.getColor("setting_category_disabled"); - } - else if(control.hovered && control.checkable && control.checked) - { - return Theme.getColor("setting_category_active_hover"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("setting_category_active"); - } - else if(control.hovered) - { - return Theme.getColor("setting_category_hover"); - } - else - { - return Theme.getColor("setting_category"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - Rectangle - { - height: Theme.getSize("default_lining").height - width: parent.width - anchors.bottom: parent.bottom - color: - { - if(!control.enabled) - { - return Theme.getColor("setting_category_disabled_border"); - } - else if((control.hovered || control.activeFocus) && control.checkable && control.checked) - { - return Theme.getColor("setting_category_active_hover_border"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("setting_category_active_border"); - } - else if(control.hovered || control.activeFocus) - { - return Theme.getColor("setting_category_hover_border"); - } - else - { - return Theme.getColor("setting_category_border"); - } - } - } - } - label: Item - { - anchors.fill: parent - anchors.left: parent.left - Item - { - id: icon - anchors.left: parent.left - height: parent.height - width: Theme.getSize("section_icon_column").width - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Theme.getSize("thick_margin").width - color: - { - if(!control.enabled) - { - return Theme.getColor("setting_category_disabled_text"); - } - else if((control.hovered || control.activeFocus) && control.checkable && control.checked) - { - return Theme.getColor("setting_category_active_hover_text"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("setting_category_active_text"); - } - else if(control.hovered || control.activeFocus) - { - return Theme.getColor("setting_category_hover_text"); - } - else - { - return Theme.getColor("setting_category_text"); - } - } - source: control.iconSource; - width: Theme.getSize("section_icon").width; - height: Theme.getSize("section_icon").height; - sourceSize.width: width + 15 * screenScaleFactor - sourceSize.height: width + 15 * screenScaleFactor - } - } - - Label - { - anchors - { - left: icon.right - leftMargin: Theme.getSize("default_margin").width - right: parent.right - verticalCenter: parent.verticalCenter - } - text: control.text - font: Theme.getFont("setting_category") - color: - { - if(!control.enabled) - { - return Theme.getColor("setting_category_disabled_text"); - } - else if((control.hovered || control.activeFocus) && control.checkable && control.checked) - { - return Theme.getColor("setting_category_active_hover_text"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("setting_category_active_text"); - } - else if(control.hovered || control.activeFocus) - { - return Theme.getColor("setting_category_hover_text"); - } - else - { - return Theme.getColor("setting_category_text"); - } - } - fontSizeMode: Text.HorizontalFit - minimumPointSize: 8 - } - UM.RecolorImage - { - id: category_arrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Theme.getSize("default_margin").width * 3 - Math.round(width / 2) - width: Theme.getSize("standard_arrow").width - height: Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: width - color: - { - if(!control.enabled) - { - return Theme.getColor("setting_category_disabled_text"); - } - else if((control.hovered || control.activeFocus) && control.checkable && control.checked) - { - return Theme.getColor("setting_category_active_hover_text"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("setting_category_active_text"); - } - else if(control.hovered || control.activeFocus) - { - return Theme.getColor("setting_category_hover_text"); - } - else - { - return Theme.getColor("setting_category_text"); - } - } - source: control.checked ? Theme.getIcon("arrow_bottom") : Theme.getIcon("arrow_left") - } - } - } - } - property Component scrollview: Component { ScrollViewStyle @@ -1144,60 +952,4 @@ QtObject label: Item { } } } - - property Component toolbox_action_button: Component - { - ButtonStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: - { - if (control.installed) - { - return UM.Theme.getColor("action_button_disabled"); - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("primary_hover"); - } - else - { - return UM.Theme.getColor("primary"); - } - } - - } - } - label: Label - { - text: control.text - color: - { - if (control.installed) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("button_text_hover"); - } - else - { - return UM.Theme.getColor("button_text"); - } - } - } - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font: UM.Theme.getFont("default_bold") - } - } - } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2343cd3f2a..67e0c701c2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -122,7 +122,6 @@ "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], "text_inactive": [174, 174, 174, 255], - "text_hover": [70, 84, 113, 255], "text_pressed": [50, 130, 255, 255], "text_subtext": [0, 0, 0, 255], "text_medium": [128, 128, 128, 255], @@ -228,15 +227,11 @@ "slider_groove": [223, 223, 223, 255], "slider_groove_fill": [10, 8, 80, 255], "slider_handle": [10, 8, 80, 255], - "slider_handle_hover": [77, 182, 226, 255], "slider_handle_active": [50, 130, 255, 255], "slider_text_background": [255, 255, 255, 255], "quality_slider_unavailable": [179, 179, 179, 255], "quality_slider_available": [0, 0, 0, 255], - "quality_slider_handle": [0, 0, 0, 255], - "quality_slider_handle_hover": [127, 127, 127, 255], - "quality_slider_text": [0, 0, 0, 255], "checkbox": [255, 255, 255, 255], "checkbox_hover": [255, 255, 255, 255], @@ -245,15 +240,6 @@ "checkbox_mark": [119, 122, 124, 255], "checkbox_text": [27, 27, 27, 255], - "mode_switch": [255, 255, 255, 255], - "mode_switch_hover": [255, 255, 255, 255], - "mode_switch_border": [127, 127, 127, 255], - "mode_switch_border_hover": [50, 130, 255, 255], - "mode_switch_handle": [31, 36, 39, 255], - "mode_switch_text": [31, 36, 39, 255], - "mode_switch_text_hover": [31, 36, 39, 255], - "mode_switch_text_checked": [50, 130, 255, 255], - "tooltip": [68, 192, 255, 255], "tooltip_text": [255, 255, 255, 255], @@ -384,7 +370,6 @@ "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], - "configuration_selector_widget": [35.0, 4.5], "configuration_selector_mode_tabs": [0.0, 3.0], "action_panel_widget": [25.0, 0.0], @@ -412,9 +397,6 @@ "extruder_icon": [1.8, 1.8], - "simple_mode_infill_caption": [0.0, 5.0], - "simple_mode_infill_height": [0.0, 8.0], - "section": [0.0, 2.2], "section_icon": [1.6, 1.6], "section_icon_column": [2.8, 0.0], @@ -428,7 +410,6 @@ "setting_text_maxwidth": [40.0, 0.0], "standard_list_lineheight": [1.5, 1.5], - "standard_list_input": [20.0, 25.0], "standard_arrow": [0.8, 0.8], "button": [4, 4], @@ -482,7 +463,6 @@ "modal_window_minimum": [60.0, 45], "license_window_minimum": [45, 45], - "wizard_progress": [10.0, 0.0], "message": [30.0, 5.0], "message_close": [1, 1], From a268c95559fcfda0e90048c666a1c9e3ed62f002 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:10:56 +0100 Subject: [PATCH 300/558] Remove double header This header is no longer necessary since the AutoConfiguration item provides its own header that doesn't scroll along. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/ConfigurationListView.qml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 7aaf87b4df..ef967dfa35 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -12,7 +12,6 @@ Column { id: base property var outputDevice: null - property var computedHeight: container.height + configurationListHeading.height + 3 * padding height: childrenRect.height + 2 * padding padding: UM.Theme.getSize("default_margin").width spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) @@ -27,15 +26,6 @@ Column } } - Label - { - id: configurationListHeading - text: catalog.i18nc("@label:header configurations", "Available configurations") - font: UM.Theme.getFont("large") - width: parent.width - 2 * parent.padding - color: UM.Theme.getColor("configuration_item_text") - } - Component { id: sectionHeading From 3b219e3ac331e3404867433e1f968d2a29be4fa6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:13:25 +0100 Subject: [PATCH 301/558] Remove padding The padding is already done by the enveloping Column and its parent popupItem. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index ef967dfa35..be9aad6d04 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -13,7 +13,6 @@ Column id: base property var outputDevice: null height: childrenRect.height + 2 * padding - padding: UM.Theme.getSize("default_margin").width spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) function forceModelUpdate() From a03e1be6011362cb044cc589373640e60aab1e5a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:19:32 +0100 Subject: [PATCH 302/558] Simplify sectionHeading element No need to define that component in a higher location, just define it where you need it. Also, no need to use a Rectangle for this if it has no colour, just use an Item, but the Item itself is also not necessary if you just need the padding. Contributes to issue CURA-5876. --- .../ConfigurationListView.qml | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index be9aad6d04..25dc3fac11 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -25,21 +25,6 @@ Column } } - Component - { - id: sectionHeading - Rectangle - { - height: childrenRect.height + UM.Theme.getSize("default_margin").height - Label - { - text: section - font: UM.Theme.getFont("default_bold") - color: UM.Theme.getColor("configuration_item_text") - } - } - } - ScrollView { id: container @@ -58,7 +43,13 @@ Column section.property: "modelData.printerType" section.criteria: ViewSection.FullString - section.delegate: sectionHeading + section.delegate: Label + { + text: section + font: UM.Theme.getFont("default_bold") + color: UM.Theme.getColor("configuration_item_text") + bottomPadding: UM.Theme.getSize("default_margin").height + } model: (outputDevice != null) ? outputDevice.uniqueConfigurations : [] delegate: ConfigurationItem From a3fe9839baafe17c2c221a50c16f590d5b1acd39 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:33:37 +0100 Subject: [PATCH 303/558] Change all uses of 'small' and 'very small' fonts to default These two fonts are exactly the same, but I want to use the 'small' font to be something a bit smaller. I'm 'removing' the superfluous font but will be re-using it immediately to look a bit smaller. Contributes to issue CURA-5876. --- .../Toolbox/resources/qml/ToolboxAuthorPage.qml | 8 ++++---- .../resources/qml/ToolboxCompatibilityChart.qml | 2 +- .../Toolbox/resources/qml/ToolboxDetailPage.qml | 16 ++++++++-------- .../resources/qml/ToolboxDownloadsGridTile.qml | 2 +- .../qml/MonitorBuildplateConfiguration.qml | 2 +- .../qml/MonitorExtruderConfiguration.qml | 4 ++-- .../qml/ActionPanel/OutputProcessWidget.qml | 4 ++-- .../qml/ActionPanel/PrintJobInformation.qml | 8 ++++---- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 +- resources/qml/IconLabel.qml | 2 +- resources/qml/JobSpecs.qml | 2 +- .../ConfigurationMenu/ConfigurationListView.qml | 2 +- resources/qml/PrinterOutput/ExtruderBox.qml | 2 +- resources/qml/PrinterOutput/HeatedBedBox.qml | 2 +- .../qml/PrinterOutput/OutputDeviceHeader.qml | 4 ++-- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml index 4aaea20813..9c1df0c49e 100644 --- a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml @@ -86,13 +86,13 @@ Item Label { text: catalog.i18nc("@label", "Website") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } Label { text: catalog.i18nc("@label", "Email") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } } @@ -118,7 +118,7 @@ Item } return "" } - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) @@ -134,7 +134,7 @@ Item } return "" } - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml index 62e1e3ab86..6a01d7ff2f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -210,7 +210,7 @@ Item } return result } - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index 437a2ef351..90f372cf87 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -82,25 +82,25 @@ Item Label { text: catalog.i18nc("@label", "Version") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } Label { text: catalog.i18nc("@label", "Last updated") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } Label { text: catalog.i18nc("@label", "Author") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } Label { text: catalog.i18nc("@label", "Downloads") + ":" - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } } @@ -119,7 +119,7 @@ Item Label { text: details === null ? "" : (details.version || catalog.i18nc("@label", "Unknown")) - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } Label @@ -133,7 +133,7 @@ Item var date = new Date(details.last_updated) return date.toLocaleString(UM.Preferences.getValue("general/language")) } - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } Label @@ -153,7 +153,7 @@ Item return "" + details.author_name + "" } } - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) @@ -161,7 +161,7 @@ Item Label { text: details === null ? "" : (details.download_count || catalog.i18nc("@label", "Unknown")) - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index 887140bbfa..be44c0f374 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -81,7 +81,7 @@ Item width: parent.width wrapMode: Text.WordWrap color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 9ffb1eabb4..7edeb81a96 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -52,7 +52,7 @@ Item id: buildplateLabel color: "#191919" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("very_small") // 12pt, regular + font: UM.Theme.getFont("default") // 12pt, regular text: "" // FIXED-LINE-HEIGHT: diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml index afbd4c3641..1e53191d8c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml @@ -49,7 +49,7 @@ Item } color: "#191919" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("very_small") // 12pt, regular + font: UM.Theme.getFont("default") // 12pt, regular text: "" // FIXED-LINE-HEIGHT: @@ -66,7 +66,7 @@ Item } color: "#191919" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("small") // 12pt, bold + font: UM.Theme.getFont("default_bold") // 12pt, bold text: "" // FIXED-LINE-HEIGHT: diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 6f9e6a02c3..296ee2fc16 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -50,7 +50,7 @@ Column text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") } Cura.IconLabel @@ -79,7 +79,7 @@ Column return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } source: UM.Theme.getIcon("spool") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") } } diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml index e53a92a994..b1172a91e0 100644 --- a/resources/qml/ActionPanel/PrintJobInformation.qml +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -31,7 +31,7 @@ Column { text: catalog.i18nc("@label", "Time specification").toUpperCase() color: UM.Theme.getColor("primary") - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") renderType: Text.NativeRendering } @@ -62,7 +62,7 @@ Column } width: parent.width - 2 * UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering textFormat: Text.RichText } @@ -81,7 +81,7 @@ Column { text: catalog.i18nc("@label", "Material specification").toUpperCase() color: UM.Theme.getColor("primary") - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") renderType: Text.NativeRendering } @@ -153,7 +153,7 @@ Column } width: parent.width - 2 * UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering textFormat: Text.RichText } diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 09e0b2584a..9ce86463f8 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -49,7 +49,7 @@ Column text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") source: UM.Theme.getIcon("warning") color: UM.Theme.getColor("warning") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") } // Progress bar, only visible when the backend is in the process of slice the printjob diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 7c90382892..1f15e0823f 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -43,7 +43,7 @@ Item anchors.verticalCenter: icon.verticalCenter text: "Empty label" color: UM.Theme.getColor("text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering } } \ No newline at end of file diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 45111992c1..717d6e925b 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -124,7 +124,7 @@ Item { } height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") color: UM.Theme.getColor("text_scene") text: CuraApplication.getSceneBoundingBoxString } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 25dc3fac11..8a7094497e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -46,7 +46,7 @@ Column section.delegate: Label { text: section - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("configuration_item_text") bottomPadding: UM.Theme.getSize("default_margin").height } diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 510a44f9da..d72f9ba0b2 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -45,7 +45,7 @@ Item { id: extruderTargetTemperature text: Math.round(extruderModel.targetHotendTemperature) + "°C" - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") color: UM.Theme.getColor("text_inactive") anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 962ffa9b01..59f7fa7bc6 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -34,7 +34,7 @@ Item { id: bedTargetTemperature text: printerModel != null ? printerModel.targetBedTemperature + "°C" : "" - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") color: UM.Theme.getColor("text_inactive") anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrinterOutput/OutputDeviceHeader.qml b/resources/qml/PrinterOutput/OutputDeviceHeader.qml index b5ed1b7b4e..4e81d852bb 100644 --- a/resources/qml/PrinterOutput/OutputDeviceHeader.qml +++ b/resources/qml/PrinterOutput/OutputDeviceHeader.qml @@ -43,7 +43,7 @@ Item { id: outputDeviceAddressLabel text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : "" - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default_bold") color: UM.Theme.getColor("text_inactive") anchors.top: parent.top anchors.right: parent.right @@ -54,7 +54,7 @@ Item { text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.") color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") wrapMode: Text.WordWrap anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width From a3b45ff2039c22981643ff501780ee016f9a2bef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 17:35:23 +0100 Subject: [PATCH 304/558] Simplify the viewOrientation controls --- resources/qml/ViewOrientationButton.qml | 16 +++++++++++++++ resources/qml/ViewOrientationControls.qml | 24 +++++++---------------- 2 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 resources/qml/ViewOrientationButton.qml diff --git a/resources/qml/ViewOrientationButton.qml b/resources/qml/ViewOrientationButton.qml new file mode 100644 index 0000000000..682fd71b4e --- /dev/null +++ b/resources/qml/ViewOrientationButton.qml @@ -0,0 +1,16 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 + +import UM 1.4 as UM + +UM.SimpleButton +{ + width: UM.Theme.getSize("small_button").width + height: UM.Theme.getSize("small_button").height + hoverBackgroundColor: UM.Theme.getColor("small_button_hover") + hoverColor: UM.Theme.getColor("small_button_text_hover") + color: UM.Theme.getColor("small_button_text") + iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width +} \ No newline at end of file diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index acf75b1b48..51ed6e3dcb 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM -// View orientation Item +// A row of buttons that control the view direction Row { id: viewOrientationControl @@ -16,43 +16,33 @@ Row height: childrenRect.height width: childrenRect.width - // #1 3d view - Button + ViewOrientationButton { iconSource: UM.Theme.getIcon("view_3d") - style: UM.Theme.styles.small_tool_button - onClicked:UM.Controller.rotateView("3d", 0) + onClicked: UM.Controller.rotateView("3d", 0) } - // #2 Front view - Button + ViewOrientationButton { iconSource: UM.Theme.getIcon("view_front") - style: UM.Theme.styles.small_tool_button onClicked: UM.Controller.rotateView("home", 0) } - // #3 Top view - Button + ViewOrientationButton { iconSource: UM.Theme.getIcon("view_top") - style: UM.Theme.styles.small_tool_button onClicked: UM.Controller.rotateView("y", 90) } - // #4 Left view - Button + ViewOrientationButton { iconSource: UM.Theme.getIcon("view_left") - style: UM.Theme.styles.small_tool_button onClicked: UM.Controller.rotateView("x", 90) } - // #5 Right view - Button + ViewOrientationButton { iconSource: UM.Theme.getIcon("view_right") - style: UM.Theme.styles.small_tool_button onClicked: UM.Controller.rotateView("x", -90) } } From 7f2f2090da66caa3686de27c3f5d6474aeeab8fe Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Nov 2018 17:35:58 +0100 Subject: [PATCH 305/558] Make small and very_small fonts actually smaller Rather than the same as default_bold and default. This also makes the extruder_icon font obsolete. Turns out it's actually just a very small font. Contributes to issue CURA-5876. --- resources/qml/ExtruderIcon.qml | 2 +- resources/themes/cura-light/theme.json | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index c103ee245c..7151719fb9 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -49,7 +49,7 @@ Item id: extruderNumberText anchors.centerIn: parent text: index + 1 - font: UM.Theme.getFont("extruder_icon") + font: UM.Theme.getFont("very_small") width: contentWidth height: contentHeight visible: extruderEnabled diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 57007827a8..a51b397262 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -41,12 +41,12 @@ "family": "Noto Sans" }, "small": { - "size": 1.0, - "weight": 63, + "size": 0.85, + "weight": 50, "family": "Noto Sans" }, "very_small": { - "size": 1.0, + "size": 0.7, "weight": 50, "family": "Noto Sans" }, @@ -64,12 +64,6 @@ "size": 1.15, "weight": 50, "family": "Noto Sans" - }, - "extruder_icon": - { - "size": 0.7, - "weight": 50, - "family": "Noto Sans" } }, From 5ddb3ff90994bd5e5579fc6a8f8ecaeac81a6859 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 26 Nov 2018 17:40:34 +0100 Subject: [PATCH 306/558] Factor out superfluous use of small_tool_button style The style was overly complicated for what it should do --- .../SimulationViewMainComponent.qml | 11 +- resources/themes/cura-light/styles.qml | 112 ------------------ 2 files changed, 8 insertions(+), 115 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 4e038a1cf1..16b9aeaae6 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.1 -import UM 1.0 as UM +import UM 1.4 as UM import Cura 1.0 as Cura Item @@ -55,11 +55,16 @@ Item } - Button + UM.SimpleButton { id: playButton iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg" - style: UM.Theme.styles.small_tool_button + width: UM.Theme.getSize("small_button").width + height: UM.Theme.getSize("small_button").height + hoverBackgroundColor: UM.Theme.getColor("small_button_hover") + hoverColor: UM.Theme.getColor("small_button_text_hover") + color: UM.Theme.getColor("small_button_text") + iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width visible: !UM.SimulationView.compatibilityMode Connections diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index f4aeb95bb3..f00aab44c0 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -436,118 +436,6 @@ QtObject } } - property Component small_tool_button: Component - { - ButtonStyle - { - background: Item - { - implicitWidth: Theme.getSize("small_button").width; - implicitHeight: Theme.getSize("small_button").height; - - Rectangle - { - id: smallButtonFace; - - anchors.fill: parent; - property bool down: control.pressed || (control.checkable && control.checked); - - color: - { - if(control.customColor !== undefined && control.customColor !== null) - { - return control.customColor - } - else if(control.checkable && control.checked && control.hovered) - { - return Theme.getColor("small_button_active_hover"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("small_button_active"); - } - else if(control.hovered) - { - return Theme.getColor("small_button_hover"); - } - else - { - return Theme.getColor("small_button"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - - border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 - border.color: Theme.getColor("tool_button_border") - - UM.RecolorImage - { - id: smallToolButtonArrow - - width: 5 - height: 5 - sourceSize.width: 5 - sourceSize.height: 5 - visible: control.menu != null; - color: - { - if(control.checkable && control.checked && control.hovered) - { - return Theme.getColor("small_button_text_active_hover"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("small_button_text_active"); - } - else if(control.hovered) - { - return Theme.getColor("small_button_text_hover"); - } - else - { - return Theme.getColor("small_button_text"); - } - } - source: Theme.getIcon("arrow_bottom") - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.centerIn: parent - opacity: !control.enabled ? 0.2 : 1.0 - source: control.iconSource; - width: Theme.getSize("small_button_icon").width - height: Theme.getSize("small_button_icon").height - color: - { - if(control.checkable && control.checked && control.hovered) - { - return Theme.getColor("small_button_text_active_hover"); - } - else if(control.pressed || (control.checkable && control.checked)) - { - return Theme.getColor("small_button_text_active"); - } - else if(control.hovered) - { - return Theme.getColor("small_button_text_hover"); - } - else - { - return Theme.getColor("small_button_text"); - } - } - - sourceSize: Theme.getSize("small_button_icon") - } - } - } - } - property Component progressbar: Component { ProgressBarStyle From ad3fa9548a2c78f484fef42336670be822335e8f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 26 Nov 2018 17:53:38 +0100 Subject: [PATCH 307/558] Add sourceSize to the open file button. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index a953c2b5d1..81799206a0 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -101,7 +101,8 @@ Item height: UM.Theme.getSize("button_icon").height color: UM.Theme.getColor("toolbar_button_text") - sourceSize: UM.Theme.getSize("button_icon") + sourceSize.width: width + sourceSize.height: height } background: Rectangle From ec63e6c13066d307238a7e176f04adee8df1dbf3 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 09:27:25 +0100 Subject: [PATCH 308/558] Added icons CURA-5941 --- resources/qml/SidebarSimple.qml | 53 ++++++--------------------------- 1 file changed, 9 insertions(+), 44 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 52fc9320f2..2e0f0d6c4c 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -192,13 +192,15 @@ Item id: qualityRowTitle source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") + anchors.bottom: speedSlider.bottom + } // Show titles for the each quality slider ticks Item { - y: -5; anchors.left: speedSlider.left + anchors.top: speedSlider.bottom Repeater { model: qualityModel @@ -206,8 +208,7 @@ Item Label { anchors.verticalCenter: parent.verticalCenter - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) + anchors.top: parent.bottom color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") text: { @@ -258,7 +259,7 @@ Item } //Print speed slider - Item + Rectangle { id: speedSlider width: Math.round(base.width * 0.55) @@ -367,12 +368,12 @@ Item Rectangle { - anchors.verticalCenter: parent.verticalCenter color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - width: 1 * screenScaleFactor - height: 6 * screenScaleFactor - y: 0 + implicitWidth: 5 * screenScaleFactor + implicitHeight: implicitWidth + anchors.verticalCenter: qualitySlider.verticalCenter x: Math.round(qualityModel.qualitySliderStepWidth * index) + radius: Math.round(implicitWidth / 2) } } @@ -453,42 +454,6 @@ Item } } - Label - { - id: speedLabel - anchors.top: speedSlider.bottom - - anchors.left: parent.left - - text: catalog.i18nc("@label", "Print Speed") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - width: Math.round(UM.Theme.getSize("print_setup_widget").width * 0.35) - elide: Text.ElideRight - } - - Label - { - anchors.bottom: speedLabel.bottom - anchors.left: speedSlider.left - - text: catalog.i18nc("@label", "Slower") - font: UM.Theme.getFont("default") - color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - horizontalAlignment: Text.AlignLeft - } - - Label - { - anchors.bottom: speedLabel.bottom - anchors.right: speedSlider.right - - text: catalog.i18nc("@label", "Faster") - font: UM.Theme.getFont("default") - color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - horizontalAlignment: Text.AlignRight - } - UM.SimpleButton { id: customisedSettings From 4be8af7cb278fc8f1a7118d1cfbc9ba02d47cd80 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 09:38:32 +0100 Subject: [PATCH 309/558] Restyle printer type headers It's now a grey box with the printer type name inside and some padding and such. Contributes to issue CURA-5876. --- .../ConfigurationListView.qml | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 8a7094497e..2f5bf0b1a2 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -43,12 +43,24 @@ Column section.property: "modelData.printerType" section.criteria: ViewSection.FullString - section.delegate: Label + section.delegate: Item { - text: section - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("configuration_item_text") - bottomPadding: UM.Theme.getSize("default_margin").height + height: printerTypeLabelBox.height + UM.Theme.getSize("default_margin").height + Rectangle + { + id: printerTypeLabelBox + color: UM.Theme.getColor("text_detail") + width: childrenRect.width + height: childrenRect.height + + Label + { + text: section + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("configuration_item_text") + padding: UM.Theme.getSize("narrow_margin").width + } + } } model: (outputDevice != null) ? outputDevice.uniqueConfigurations : [] From 8e7e8354e7196b1e449f43f89c7aa521b9d43931 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 09:41:45 +0100 Subject: [PATCH 310/558] Set colors to the correct ones --- resources/themes/cura-light/theme.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 67e0c701c2..fdc5b2a2de 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -86,8 +86,8 @@ "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], - "secondary": [245, 245, 245, 255], - "secondary_shadow": [228, 228, 228, 255], + "secondary": [240, 240, 240, 255], + "secondary_shadow": [216, 216, 216, 255], "primary_button": [38, 113, 231, 255], "primary_button_shadow": [27, 95, 202, 255], @@ -95,7 +95,7 @@ "primary_button_text": [255, 255, 255, 255], "secondary_button": [240, 240, 240, 255], - "secondary_button_shadow": [228, 228, 228, 255], + "secondary_button_shadow": [216, 216, 216, 255], "secondary_button_hover": [228, 228, 228, 255], "secondary_button_text": [30, 102, 215, 255], From c489f911fb2b16bef7dfa5a4bac76ee83620d13b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 11:04:41 +0100 Subject: [PATCH 311/558] Use QtQuick 2.0 and simplify ConfigurationItem It now uses a ButtonGroup (from QtQuick2). Also, all the mess with when the border and background colours are updated and force-updated and such is now cleaned up. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationItem.qml | 189 +++++++----------- .../ConfigurationListView.qml | 10 +- 2 files changed, 83 insertions(+), 116 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 7427b5ddff..d825a8cc6e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -7,143 +7,108 @@ import QtQuick.Controls 2.0 import UM 1.2 as UM import Cura 1.0 as Cura -Rectangle +Button { id: configurationItem property var configuration: null - property var selected: false signal activateConfiguration() height: childrenRect.height - border.width: UM.Theme.getSize("default_lining").width - border.color: updateBorderColor() - color: selected ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item") - property var textColor: selected ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text") - function updateBorderColor() + property var textColor: checked ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text") + + contentItem: Rectangle { - border.color = selected ? UM.Theme.getColor("configuration_item_border_active") : UM.Theme.getColor("configuration_item_border") - } + height: childrenRect.height + color: parent.checked ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item") + border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width - Column - { - id: contentColumn - width: parent.width - padding: UM.Theme.getSize("default_margin").width - spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) - - Row + Column { - id: extruderRow + id: contentColumn + width: parent.width + padding: UM.Theme.getSize("default_margin").width + spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) - width: parent.width - 2 * parent.padding - height: childrenRect.height - - spacing: UM.Theme.getSize("default_margin").width - - Repeater + Row { - id: repeater + id: extruderRow + + width: parent.width - 2 * parent.padding height: childrenRect.height - model: configuration.extruderConfigurations - delegate: PrintCoreConfiguration + + spacing: UM.Theme.getSize("default_margin").width + + Repeater { - width: Math.round(parent.width / 2) - printCoreConfiguration: modelData - mainColor: textColor + id: repeater + height: childrenRect.height + model: configuration.extruderConfigurations + delegate: PrintCoreConfiguration + { + width: Math.round(parent.width / 2) + printCoreConfiguration: modelData + mainColor: textColor + } + } + } + + //Buildplate row separator + Rectangle + { + id: separator + + visible: buildplateInformation.visible + width: parent.width - 2 * parent.padding + height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 + color: textColor + } + + Item + { + id: buildplateInformation + width: parent.width - 2 * parent.padding + height: childrenRect.height + visible: configuration.buildplateConfiguration != "" + + UM.RecolorImage { + id: buildplateIcon + anchors.left: parent.left + width: UM.Theme.getSize("main_window_header_button_icon").width + height: UM.Theme.getSize("main_window_header_button_icon").height + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("buildplate") + color: textColor + } + + Label + { + id: buildplateLabel + anchors.left: buildplateIcon.right + anchors.verticalCenter: buildplateIcon.verticalCenter + anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) + text: configuration.buildplateConfiguration + renderType: Text.NativeRendering + color: textColor } } } - //Buildplate row separator - Rectangle + Connections { - id: separator - - visible: buildplateInformation.visible - width: parent.width - 2 * parent.padding - height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 - color: textColor - } - - Item - { - id: buildplateInformation - width: parent.width - 2 * parent.padding - height: childrenRect.height - visible: configuration.buildplateConfiguration != "" - - UM.RecolorImage { - id: buildplateIcon - anchors.left: parent.left - width: UM.Theme.getSize("main_window_header_button_icon").width - height: UM.Theme.getSize("main_window_header_button_icon").height - sourceSize.width: width - sourceSize.height: height - source: UM.Theme.getIcon("buildplate") - color: textColor - } - - Label + target: Cura.MachineManager + onCurrentConfigurationChanged: { - id: buildplateLabel - anchors.left: buildplateIcon.right - anchors.verticalCenter: buildplateIcon.verticalCenter - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) - text: configuration.buildplateConfiguration - renderType: Text.NativeRendering - color: textColor + configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration) } } - } - MouseArea - { - id: mouse - anchors.fill: parent - onClicked: activateConfiguration() - cursorShape: Qt.PointingHandCursor - hoverEnabled: true - onEntered: + Component.onCompleted: { - parent.border.color = UM.Theme.getColor("configuration_item_border_hover") - if (configurationItem.selected == false) - { - configurationItem.color = UM.Theme.getColor("wide_lining") - } - } - onExited: - { - updateBorderColor() - if (configurationItem.selected == false) - { - configurationItem.color = UM.Theme.getColor("configuration_item") - } - } - } - - Connections - { - target: Cura.MachineManager - onCurrentConfigurationChanged: { - configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration) - updateBorderColor() - } - } - - Component.onCompleted: - { - configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration) - updateBorderColor() - } - - onVisibleChanged: - { - if(visible) - { - // I cannot trigger function updateBorderColor() after visibility change - color = selected ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item") + configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration) } } } \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 2f5bf0b1a2..7df93b9cbe 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.4 import UM 1.2 as UM import Cura 1.0 as Cura @@ -31,8 +30,10 @@ Column width: parent.width - parent.padding height: Math.min(configurationList.contentHeight, 350 * screenScaleFactor) - style: UM.Theme.styles.scrollview - __wheelAreaScrollSpeed: 75 // Scroll three lines in one scroll event + ButtonGroup + { + buttons: configurationList.children + } ListView { @@ -64,6 +65,7 @@ Column } model: (outputDevice != null) ? outputDevice.uniqueConfigurations : [] + delegate: ConfigurationItem { width: parent.width - UM.Theme.getSize("default_margin").width From e05566865a9d5333d1dbf444b62a3ecbd4a29445 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 11:19:03 +0100 Subject: [PATCH 312/558] Use ExtruderIcon component to display extruder icon Since we already have that component pre-designed, let's use it. Contributes to issue CURA-5876. --- .../PrintCoreConfiguration.qml | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 97b5bee745..e8cadda05e 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import UM 1.2 as UM - +import Cura 1.0 as Cura Column { @@ -33,37 +33,13 @@ Column color: mainColor } - // Rounded item to show the extruder number - Item + Cura.ExtruderIcon { - id: extruderIconItem - anchors.verticalCenter: extruderLabel.verticalCenter - anchors.left: extruderLabel.right - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) - width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - - UM.RecolorImage { - id: mainCircle - anchors.fill: parent - - anchors.centerIn: parent - sourceSize.width: parent.width - sourceSize.height: parent.height - source: UM.Theme.getIcon("extruder_button") - color: mainColor - } - - Label - { - id: extruderNumberText - anchors.centerIn: parent - text: printCoreConfiguration.position + 1 - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") - color: mainColor - } + materialColor: mainColor + anchors.left: extruderLabel.right + anchors.leftMargin: UM.Theme.getSize("narrow_margin").width } } From e6c2238fd51a5eec44a645ad4a1e798120bf58a5 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 11:24:09 +0100 Subject: [PATCH 313/558] Added popup spacing by Y coordinate CURA-5941 --- resources/qml/ExpandableComponent.qml | 5 ++++- resources/qml/PrintSetupSelector.qml | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 262c6bfd3f..3b1105ddd6 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -24,6 +24,9 @@ Item // How much spacing is needed around the popupItem property alias popupPadding: popup.padding + // How much spacing is needed for the popupItem by Y coordinate + property var popupSpacingY: 0 + // How much padding is needed around the header & button property alias headerPadding: background.padding @@ -143,7 +146,7 @@ Item id: popup // Ensure that the popup is located directly below the headerItem - y: headerItemLoader.height + 2 * background.padding + y: headerItemLoader.height + 2 * background.padding + popupSpacingY // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between // the button & text. diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 8271484e6a..5f593f9ba2 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -29,6 +29,7 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("pencil") popupPadding : 0 + popupSpacingY: 10 onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) @@ -150,10 +151,13 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter color: UM.Theme.getColor("text") height: parent.height - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height -// anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + + anchors + { + topMargin: UM.Theme.getSize("sidebar_margin").height + left: parent.left + leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + } } Rectangle From e2f85fcdc4922fada1ec7d259cab11a9c452df87 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 11:25:43 +0100 Subject: [PATCH 314/558] Add extra space to printer button. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelector.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 93e5103aa8..15cd773c90 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -90,11 +90,13 @@ Cura.ExpandableComponent id: scroll width: parent.width clip: true + leftPadding: UM.Theme.getSize("default_lining").width + rightPadding: UM.Theme.getSize("default_lining").width MachineSelectorList { // Can't use parent.width since the parent is the flickable component and not the ScrollView - width: scroll.width + width: scroll.width - scroll.leftPadding - scroll.rightPadding property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height onHeightChanged: From 75b827d3732f128bd3eacb14d8803d90fa057a4c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 11:26:20 +0100 Subject: [PATCH 315/558] Modify the hover behavior by removing the mouse area. Contributes to CURA-5942. --- resources/qml/PrinterSelector/MachineSelectorButton.qml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 992ea55b1d..369e75cede 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -16,6 +16,7 @@ Button leftPadding: UM.Theme.getSize("thick_margin").width rightPadding: UM.Theme.getSize("thick_margin").width checkable: true + hoverEnabled: true property var outputDevice: null property var printerTypesList: [] @@ -86,14 +87,6 @@ Button Cura.MachineManager.setActiveMachine(model.id) } - MouseArea - { - id: mouseArea - anchors.fill: parent - onPressed: mouse.accepted = false - hoverEnabled: true - } - Connections { target: outputDevice From 6876c12106e32d74a1d492eac6d95fc9130a8474 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 11:43:32 +0100 Subject: [PATCH 316/558] Remove weird padding from button I don't know why the default Button has padding everywhere, but I don't want it. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index d825a8cc6e..a6778702d1 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -15,6 +15,9 @@ Button signal activateConfiguration() height: childrenRect.height + padding: 0 //Stupid QML button has spacing by default. + rightPadding: 0 + leftPadding: 0 property var textColor: checked ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text") @@ -73,7 +76,8 @@ Button height: childrenRect.height visible: configuration.buildplateConfiguration != "" - UM.RecolorImage { + UM.RecolorImage + { id: buildplateIcon anchors.left: parent.left width: UM.Theme.getSize("main_window_header_button_icon").width From a2b1f5397962d5e4da7511e54eef4e7a1ad235a0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 11:53:17 +0100 Subject: [PATCH 317/558] Use normal text colour instead of specialised configuration item text They were the same anyway, and they should always be the same. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 10 ++++------ .../Menus/ConfigurationMenu/ConfigurationListView.qml | 2 +- resources/themes/cura-light/theme.json | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index a6778702d1..6a6f0ea834 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -19,8 +19,6 @@ Button rightPadding: 0 leftPadding: 0 - property var textColor: checked ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text") - contentItem: Rectangle { height: childrenRect.height @@ -53,7 +51,7 @@ Button { width: Math.round(parent.width / 2) printCoreConfiguration: modelData - mainColor: textColor + mainColor: UM.Theme.getColor("text") } } } @@ -66,7 +64,7 @@ Button visible: buildplateInformation.visible width: parent.width - 2 * parent.padding height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 - color: textColor + color: UM.Theme.getColor("text") } Item @@ -85,7 +83,7 @@ Button sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("buildplate") - color: textColor + color: UM.Theme.getColor("text") } Label @@ -96,7 +94,7 @@ Button anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) text: configuration.buildplateConfiguration renderType: Text.NativeRendering - color: textColor + color: UM.Theme.getColor("text") } } } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 7df93b9cbe..2b7444be01 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -58,7 +58,7 @@ Column { text: section font: UM.Theme.getFont("small") - color: UM.Theme.getColor("configuration_item_text") + color: UM.Theme.getColor("text") padding: UM.Theme.getSize("narrow_margin").width } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a51b397262..383159fd91 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -319,8 +319,6 @@ "configuration_item": [255, 255, 255, 0], "configuration_item_active": [12, 169, 227, 32], - "configuration_item_text": [0, 0, 0, 255], - "configuration_item_text_active": [0, 0, 0, 255], "configuration_item_border": [127, 127, 127, 255], "configuration_item_border_active": [12, 169, 227, 32], "configuration_item_border_hover": [50, 130, 255, 255], From 44c415ff78fbc085a81e2fc6da08e91c44c0ea8e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 11:58:32 +0100 Subject: [PATCH 318/558] Add shadow to ExpandableComponent --- resources/qml/ExpandableComponent.qml | 23 ++++++++++++++++++++++- resources/themes/cura-light/theme.json | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 9b2826daed..b438f0398c 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -4,6 +4,8 @@ import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura +import QtGraphicalEffects 1.0 // For the dropshadow + // The expandable component has 3 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded // * The popupItem; The content that needs to be shown if the component is expanded. @@ -58,6 +60,12 @@ Item // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. property alias headerCornerSide: background.cornerSide + property alias headerShadowColor: shadow.color + + property alias enableHeaderShadow: shadow.visible + + property int shadowOffset: 2 + function togglePopup() { if(popup.visible) @@ -149,13 +157,26 @@ Item onExited: background.color = headerBackgroundColor } } + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: background + source: background + verticalOffset: base.shadowOffset + visible: true + color: UM.Theme.getColor("action_button_shadow") + // Should always be drawn behind the background. + z: background.z - 1 + } Popup { id: popup // Ensure that the popup is located directly below the headerItem - y: headerItemLoader.height + 2 * background.padding + y: headerItemLoader.height + 2 * background.padding + base.shadowOffset // Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 0cfa36fd2e..cc33d82b7d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -178,7 +178,7 @@ "action_button_disabled": [245, 245, 245, 255], "action_button_disabled_text": [127, 127, 127, 255], "action_button_disabled_border": [245, 245, 245, 255], - "action_button_shadow": [64, 47, 205, 255], + "action_button_shadow": [223, 223, 223, 255], "action_button_disabled_shadow": [228, 228, 228, 255], "scrollbar_background": [255, 255, 255, 255], From e04f14b50c8967d063c90731b6e367ba5c996a9e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 12:01:05 +0100 Subject: [PATCH 319/558] Also add shadow to openFile button --- plugins/PrepareStage/PrepareMenu.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 81799206a0..31a78ed290 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -8,6 +8,7 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.1 as Cura +import QtGraphicalEffects 1.0 // For the dropshadow Item { @@ -107,12 +108,26 @@ Item background: Rectangle { + id: background height: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height radius: UM.Theme.getSize("default_radius").width color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: background + source: background + verticalOffset: 2 + visible: true + color: UM.Theme.getColor("action_button_shadow") + // Should always be drawn behind the background. + z: background.z - 1 + } } } } From 1a6822436ddd22d53553c0d2ddcf549084bf763c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 12:01:43 +0100 Subject: [PATCH 320/558] Add missing HoverEnabled property Some systems, like mine, don't have the hoverEnabled default set to true. --- plugins/PrepareStage/PrepareMenu.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 31a78ed290..4212911011 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -93,6 +93,7 @@ Item height: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height onClicked: Cura.Actions.open.trigger() + hoverEnabled: true contentItem: UM.RecolorImage { @@ -115,6 +116,7 @@ Item radius: UM.Theme.getSize("default_radius").width color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } + DropShadow { id: shadow From e58409b1ef07885a7e7d1807cbf243fc15deaf47 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 12:51:52 +0100 Subject: [PATCH 321/558] Correct colours for the selected configuration This should always be the same as the ExpandableComponent's background, so white when it's not active and light blue when it's active, regardless of theme. The naming of this theme entry is a bit weird because the ActionButton theme is used for ExpandableComponent and now for ConfigurationItem as well, but that's why we should NEVER name these theme entries to something specific to one item. Oh well, I'm not about to refactor that now with all the branches going on everywhere. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 6a6f0ea834..98f777d3f3 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -22,7 +22,7 @@ Button contentItem: Rectangle { height: childrenRect.height - color: parent.checked ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item") + color: parent.checked ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width From 0be2453daf29080111f622e371708fd970946336 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 12:55:07 +0100 Subject: [PATCH 322/558] Update style of border of configuration items Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 98f777d3f3..278381dc5a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -23,8 +23,8 @@ Button { height: childrenRect.height color: parent.checked ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") - border.width: UM.Theme.getSize("default_lining").width + border.color: parent.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") + border.width: parent.hovered ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width Column { From e751b59b1cd13855b413d79ef8a950bb53b7287b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 12:55:58 +0100 Subject: [PATCH 323/558] Remove unused configuration item theme entries The theme of configuration items is now in sync with the rest of the interface. Contributes to issue CURA-5876. --- resources/themes/cura-dark/theme.json | 8 -------- resources/themes/cura-light/theme.json | 6 ------ 2 files changed, 14 deletions(-) diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 62b1dbfa0f..40016c5a94 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -197,14 +197,6 @@ "layerview_support_interface": [64, 192, 255, 255], "layerview_nozzle": [181, 166, 66, 120], - "configuration_item": [0, 0, 0, 0], - "configuration_item_active": [12, 169, 227, 179], - "configuration_item_text": [255, 255, 255, 255], - "configuration_item_text_active": [255, 255, 255, 255], - "configuration_item_border": [255, 255, 255, 255], - "configuration_item_border_active": [12, 169, 227, 179], - "configuration_item_border_hover": [12, 169, 227, 179], - "material_compatibility_warning": [255, 255, 255, 255], "quality_slider_unavailable": [179, 179, 179, 255], diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 383159fd91..de9b48c7f0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -317,12 +317,6 @@ "layerview_support_interface": [64, 192, 255, 255], "layerview_nozzle": [181, 166, 66, 50], - "configuration_item": [255, 255, 255, 0], - "configuration_item_active": [12, 169, 227, 32], - "configuration_item_border": [127, 127, 127, 255], - "configuration_item_border_active": [12, 169, 227, 32], - "configuration_item_border_hover": [50, 130, 255, 255], - "tab_status_connected": [50, 130, 255, 255], "tab_status_disconnected": [200, 200, 200, 255], From fb84b344ecac3683848dbdd71d20e5079bd11818 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 12:58:06 +0100 Subject: [PATCH 324/558] Add gradient to header bar --- resources/qml/Cura.qml | 27 ++++++++++++++++++- resources/qml/MainWindow/MainWindowHeader.qml | 27 ++++++++++++++++++- resources/themes/cura-light/theme.json | 1 + 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2814bb9eb2..63888a4ee4 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -6,6 +6,7 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.2 +import QtGraphicalEffects 1.0 import UM 1.3 as UM import Cura 1.1 as Cura @@ -153,7 +154,31 @@ UM.MainWindow } visible: stageMenu.source != "" height: Math.round(UM.Theme.getSize("stage_menu").height / 2) - color: UM.Theme.getColor("main_window_header_background") + + LinearGradient + { + anchors.fill: parent + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) + gradient: Gradient + { + GradientStop + { + position: 0.0 + color: UM.Theme.getColor("main_window_header_background") + } + GradientStop + { + position: 0.5 + color: UM.Theme.getColor("main_window_header_background_gradient") + } + GradientStop + { + position: 1.0 + color: UM.Theme.getColor("main_window_header_background") + } + } + } } Connections diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index a24af7ee45..2942a9feb3 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -8,6 +8,7 @@ import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import QtGraphicalEffects 1.0 import "../Account" @@ -17,7 +18,31 @@ Rectangle implicitHeight: UM.Theme.getSize("main_window_header").height implicitWidth: UM.Theme.getSize("main_window_header").width - color: UM.Theme.getColor("main_window_header_background") + + LinearGradient + { + anchors.fill: parent + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) + gradient: Gradient + { + GradientStop + { + position: 0.0 + color: UM.Theme.getColor("main_window_header_background") + } + GradientStop + { + position: 0.5 + color: UM.Theme.getColor("main_window_header_background_gradient") + } + GradientStop + { + position: 1.0 + color: UM.Theme.getColor("main_window_header_background") + } + } + } Image { diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index cc33d82b7d..157adcf6a5 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -100,6 +100,7 @@ "secondary_button_text": [30, 102, 215, 255], "main_window_header_background": [10, 8, 80, 255], + "main_window_header_background_gradient": [25, 23, 91, 255], "main_window_header_button_text_active": [10, 8, 80, 255], "main_window_header_button_text_inactive": [255, 255, 255, 255], "main_window_header_button_text_hovered": [255, 255, 255, 255], From 81cadf702cedea664c1071d46e5261c1dc592b93 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:00:51 +0100 Subject: [PATCH 325/558] Give configuration items a rounded radius Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 278381dc5a..f04e856705 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -25,6 +25,7 @@ Button color: parent.checked ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") border.color: parent.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") border.width: parent.hovered ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width + radius: UM.Theme.getSize("default_radius").width Column { From c6a9aca34602c0e5a32c7f308055fcd9815a2bbb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:05:32 +0100 Subject: [PATCH 326/558] Switch checked and hovered themes I misunderstood the theme as it was in the screenshots. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index f04e856705..2988ab9eec 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -22,9 +22,9 @@ Button contentItem: Rectangle { height: childrenRect.height - color: parent.checked ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - border.color: parent.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") - border.width: parent.hovered ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width + color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") + border.width: parent.checked ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width radius: UM.Theme.getSize("default_radius").width Column From 89126c7323a6764cbe3c961953e3361f4581b641 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:08:41 +0100 Subject: [PATCH 327/558] Use background instead of contentItem This way the padding and such doesn't matter any more. And the original background disappears, which was unthemed and still behind the original contentItem. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 2988ab9eec..297c95d1d1 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -15,11 +15,8 @@ Button signal activateConfiguration() height: childrenRect.height - padding: 0 //Stupid QML button has spacing by default. - rightPadding: 0 - leftPadding: 0 - contentItem: Rectangle + background: Rectangle { height: childrenRect.height color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") From b15c272d235c36edc5056aace5293f287d430144 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:24:13 +0100 Subject: [PATCH 328/558] Fix applying configuration when clicking Also no longer use that signal for it. It was completely unnecessary. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 6 +++++- .../qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 297c95d1d1..69c0b11882 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -12,7 +12,6 @@ Button id: configurationItem property var configuration: null - signal activateConfiguration() height: childrenRect.height @@ -111,4 +110,9 @@ Button configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration) } } + + onClicked: + { + Cura.MachineManager.applyRemoteConfiguration(configuration) + } } \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 2b7444be01..86deae9c4e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -70,11 +70,6 @@ Column { width: parent.width - UM.Theme.getSize("default_margin").width configuration: modelData - onActivateConfiguration: - { - switchPopupState() - Cura.MachineManager.applyRemoteConfiguration(configuration) - } } } } From fcde6e3a34d7b8f51da08473fedf7aac98b6565f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 13:28:28 +0100 Subject: [PATCH 329/558] Fix the open file button Now it has the correct size and it doesn't look blurry. Contributes to CURA-5942. --- plugins/PrepareStage/PrepareMenu.qml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 4212911011..10b4262f01 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -95,16 +95,21 @@ Item onClicked: Cura.Actions.open.trigger() hoverEnabled: true - contentItem: UM.RecolorImage + contentItem: Item { - id: buttonIcon - source: UM.Theme.getIcon("load") - width: UM.Theme.getSize("button_icon").width - height: UM.Theme.getSize("button_icon").height - color: UM.Theme.getColor("toolbar_button_text") + anchors.fill: parent + UM.RecolorImage + { + id: buttonIcon + anchors.centerIn: parent + source: UM.Theme.getIcon("load") + width: UM.Theme.getSize("button_icon").width + height: UM.Theme.getSize("button_icon").height + color: UM.Theme.getColor("toolbar_button_text") - sourceSize.width: width - sourceSize.height: height + sourceSize.width: width + sourceSize.height: height + } } background: Rectangle From cf8d88054d8ded00237ee95587b5e0366060794e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:29:57 +0100 Subject: [PATCH 330/558] Use proper colour for material in configuration item No idea this would be so easy. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index e8cadda05e..ae21a19f5e 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -37,7 +37,7 @@ Column { width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - materialColor: mainColor + materialColor: printCoreConfiguration.material.color anchors.left: extruderLabel.right anchors.leftMargin: UM.Theme.getSize("narrow_margin").width } From e863c34f68b3fbe69218d76b3e6b549362468bf1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 13:33:35 +0100 Subject: [PATCH 331/558] Align the text to the center of the button Contributes to CURA-5942. --- resources/qml/MainWindow/MainWindowHeader.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 2942a9feb3..34936e9b5a 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -122,6 +122,8 @@ Rectangle text: marketplaceButton.text color: marketplaceButton.hovered ? UM.Theme.getColor("main_window_header_background") : UM.Theme.getColor("primary_text") width: contentWidth + verticalAlignment: Text.AlignVCenter + renderType: Text.NativeRendering } anchors From 6956a732a0453f6f51dea1f381451346fe241009 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 13:49:04 +0100 Subject: [PATCH 332/558] Use tapbar component from UM, change the print_setup_widget width --- resources/qml/PrintSetupSelector.qml | 17 +++++------------ resources/themes/cura-light/theme.json | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 5f593f9ba2..279254ec64 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 -import UM 1.2 as UM +import UM 1.3 as UM import Cura 1.0 as Cura import "Menus" import "Menus/ConfigurationMenu" @@ -217,25 +217,18 @@ Cura.ExpandableComponent rightMargin: 5 } - - TabBar + UM.TabRow { id: tabBar + anchors.top: popupItemHeader.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) - width: parent.width - height: UM.Theme.getSize("print_setup_tap_bar").width z: 1 Repeater { - id: extruder_model_repeater model: extrudersModel - - delegate: TabButton + delegate: UM.TabRowButton { - z: 2 - width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0 - implicitHeight: parent.height - contentItem: Rectangle { z: 2 diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 029da9c14b..e6889b50c0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -381,7 +381,7 @@ "account_button": [12, 3], - "print_setup_widget": [30.0, 42.0], + "print_setup_widget": [38.0, 42.0], "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], From bb9598afd1c2162d461ea8c456da6f0b54e228e9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 13:55:54 +0100 Subject: [PATCH 333/558] Redesign layout of configuration item contents This is the new design. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationItem.qml | 1 - .../PrintCoreConfiguration.qml | 73 ++++++++----------- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 33 insertions(+), 43 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 69c0b11882..ffe3b32926 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -48,7 +48,6 @@ Button { width: Math.round(parent.width / 2) printCoreConfiguration: modelData - mainColor: UM.Theme.getColor("text") } } } diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index ae21a19f5e..dc908fdb0b 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -7,61 +7,52 @@ import QtQuick.Controls 2.0 import UM 1.2 as UM import Cura 1.0 as Cura -Column +Row { id: extruderInfo property var printCoreConfiguration - property var mainColor: "black" - spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) height: childrenRect.height + spacing: UM.Theme.getSize("default_margin").width + //Extruder icon. Item { - id: extruder - width: parent.width - height: childrenRect.height - - Label - { - id: extruderLabel - text: catalog.i18nc("@label:extruder label", "Extruder") - renderType: Text.NativeRendering - elide: Text.ElideRight - anchors.left: parent.left - font: UM.Theme.getFont("default") - color: mainColor - } - + width: childrenRect.width + height: information.height Cura.ExtruderIcon { - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height materialColor: printCoreConfiguration.material.color - anchors.left: extruderLabel.right - anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + anchors.verticalCenter: parent.verticalCenter } } - Label + Column { - id: materialLabel - text: printCoreConfiguration.material.name - renderType: Text.NativeRendering - elide: Text.ElideRight - width: parent.width - font: UM.Theme.getFont("default_bold") - color: mainColor - } - - Label - { - id: printCoreTypeLabel - text: printCoreConfiguration.hotendID - renderType: Text.NativeRendering - elide: Text.ElideRight - width: parent.width - font: UM.Theme.getFont("default") - color: mainColor + id: information + Label + { + text: printCoreConfiguration.material.brand + renderType: Text.NativeRendering + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + Label + { + text: printCoreConfiguration.material.name + renderType: Text.NativeRendering + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + Label + { + text: printCoreConfiguration.hotendID + renderType: Text.NativeRendering + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index de9b48c7f0..824d4cf3ee 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -397,7 +397,7 @@ "thin_margin": [0.71, 0.71], "narrow_margin": [0.5, 0.5], - "extruder_icon": [1.8, 1.8], + "extruder_icon": [2.5, 2.5], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From 1555a1ab1787def2427449b1fbcde94d41893bbe Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 14:03:05 +0100 Subject: [PATCH 334/558] Make manufacturer and extruder labels lighter The proper colour would've been 'detail' but that seems to not be used much at all, and it's too light. In other places, 'inactive' is used in this place more often. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 2 +- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 4aa8d66caa..202bc22ce0 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -64,7 +64,7 @@ Cura.ExpandableComponent text: model.material_brand elide: Text.ElideRight font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("text_inactive") anchors { diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index dc908fdb0b..5709cc948c 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -36,7 +36,7 @@ Row renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("text_inactive") } Label { @@ -52,7 +52,7 @@ Row renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("text_inactive") } } } From b0e9f23eee3c053c6179beeabbd1687a4dba0543 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 14:06:07 +0100 Subject: [PATCH 335/558] Correct line colour when hovered A detail that I almost missed in the design examples. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index ffe3b32926..2fbbef7130 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -19,7 +19,7 @@ Button { height: childrenRect.height color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") + border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining") border.width: parent.checked ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width radius: UM.Theme.getSize("default_radius").width From 8784ecd49acad58d0cbbebb8b06bebfe520145e1 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 14:09:47 +0100 Subject: [PATCH 336/558] Change native rendering CURA-5941 --- resources/qml/PrintSetupSelector.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 279254ec64..371232372d 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -148,6 +148,7 @@ Cura.ExpandableComponent id: popupItemHeaderText text: catalog.i18nc("@label", "Print settings"); font: UM.Theme.getFont("default") + renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter color: UM.Theme.getColor("text") height: parent.height From 609f07399e7735801f728826990e53a390a5f206 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 14:20:47 +0100 Subject: [PATCH 337/558] Show extruder as disabled if either material or core is missing It basically just means you can't print with it. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 5709cc948c..cc6461ebc4 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -24,6 +24,7 @@ Row { materialColor: printCoreConfiguration.material.color anchors.verticalCenter: parent.verticalCenter + extruderEnabled: printCoreConfiguration.material.name !== "" && printCoreConfiguration.hotendID !== "" } } From 956741922d561e2e7405554cf68b6c634c00f616 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 14:41:48 +0100 Subject: [PATCH 338/558] Make elements retain their position if hotend or material is missing Just a space makes it keep the correct height. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index cc6461ebc4..8d2f0c0f7c 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -33,7 +33,7 @@ Row id: information Label { - text: printCoreConfiguration.material.brand + text: printCoreConfiguration.material.brand ? printCoreConfiguration.material.brand : " " //Use space so that the height is still correct. renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") @@ -41,7 +41,7 @@ Row } Label { - text: printCoreConfiguration.material.name + text: printCoreConfiguration.material.name ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct. renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") @@ -49,7 +49,7 @@ Row } Label { - text: printCoreConfiguration.hotendID + text: printCoreConfiguration.hotendID ? printCoreConfiguration.hotendID : " " //Use space so that the height is still correct. renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") From 0a71a9dd3ecd5c16fa82a498698f3e937619b842 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 14:47:18 +0100 Subject: [PATCH 339/558] Increase margins around configuration item As per the design. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 2fbbef7130..3ea220c91e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -27,7 +27,7 @@ Button { id: contentColumn width: parent.width - padding: UM.Theme.getSize("default_margin").width + padding: UM.Theme.getSize("wide_margin").width spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) Row From 077b34b4336fee026ee37f43a27e7bb13c9b9b4a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 14:49:01 +0100 Subject: [PATCH 340/558] Fix size of the extruder icon Now it should look the same in all places. --- resources/qml/ExtruderButton.qml | 14 +++++++++----- resources/qml/ExtruderIcon.qml | 2 -- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 8a1f0af44a..d7cbdc52bc 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -19,12 +19,16 @@ Button enabled: UM.Selection.hasSelection && extruder.stack.isEnabled background: Item {} - contentItem: ExtruderIcon + contentItem: Item { - width: UM.Theme.getSize("button_icon").width - materialColor: model.color - extruderEnabled: extruder.stack.isEnabled - property int index: extruder.index + // For some reason if the extruder icon is not enclosed to the item, the size changes to fill the size of the button + ExtruderIcon + { + anchors.centerIn: parent + materialColor: model.color + extruderEnabled: extruder.stack.isEnabled + property int index: extruder.index + } } onClicked: diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 8f312adb85..c1a202050b 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -51,8 +51,6 @@ Item anchors.centerIn: parent text: index + 1 font: UM.Theme.getFont("extruder_icon") - width: contentWidth - height: contentHeight visible: extruderEnabled renderType: Text.NativeRendering horizontalAlignment: Text.AlignHCenter diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 157adcf6a5..d2358e36ff 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -402,7 +402,7 @@ "thin_margin": [0.71, 0.71], "narrow_margin": [0.5, 0.5], - "extruder_icon": [1.8, 1.8], + "extruder_icon": [2.33, 2.33], "section": [0.0, 2.2], "section_icon": [1.6, 1.6], From 82ea562dc389b6e3f8872b24c84e4a70f382ffe3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 14:54:49 +0100 Subject: [PATCH 341/558] Add missing hoverEnabled property --- resources/qml/Settings/SettingCategory.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 7995619af0..00d23580b2 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -14,6 +14,7 @@ Button anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.rightMargin: UM.Theme.getSize("thick_margin").width + hoverEnabled: true background: Rectangle { id: backgroundRectangle From 92d07170964a8a4906ca2742eeb3675e4619487b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 15:00:50 +0100 Subject: [PATCH 342/558] Hide the toolbar and don't show time and material information when loading a gcode Contributes to CURA-5979. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 8 +++++++- resources/qml/Cura.qml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index ddbe709a84..45cb1fdb41 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -18,6 +18,7 @@ Column id: widget spacing: UM.Theme.getSize("thin_margin").height + property bool preSlicedData: PrintInformation.preSliced UM.I18nCatalog { @@ -48,7 +49,7 @@ Column id: estimatedTime width: parent.width - text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) + text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("small") } @@ -63,6 +64,10 @@ Column text: { + if (preSlicedData) + { + return catalog.i18nc("@label", "No cost estimation available") + } var totalLengths = 0 var totalWeights = 0 if (printMaterialLengths) @@ -86,6 +91,7 @@ Column PrintInformationWidget { id: printInformationPanel + visible: !preSlicedData anchors { diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 63888a4ee4..36f5758fa3 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -212,7 +212,7 @@ UM.MainWindow verticalCenter: parent.verticalCenter left: parent.left } - visible: CuraApplication.platformActivity + visible: CuraApplication.platformActivity && !PrintInformation.preSliced } ObjectsList From 4fab546425450142f17a3aaf05511fe1de98b019 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Nov 2018 15:00:57 +0100 Subject: [PATCH 343/558] Fix codestyle issues Boyscouting --- resources/qml/Settings/SettingCategory.qml | 199 +++++++++++---------- 1 file changed, 109 insertions(+), 90 deletions(-) diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 00d23580b2..aafe36c546 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -15,23 +15,31 @@ Button anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.rightMargin: UM.Theme.getSize("thick_margin").width hoverEnabled: true + background: Rectangle { id: backgroundRectangle implicitHeight: UM.Theme.getSize("section").height - color: { - if (base.color) { - return base.color; - } else if (!base.enabled) { - return UM.Theme.getColor("setting_category_disabled"); - } else if (base.hovered && base.checkable && base.checked) { - return UM.Theme.getColor("setting_category_active_hover"); - } else if (base.pressed || (base.checkable && base.checked)) { - return UM.Theme.getColor("setting_category_active"); - } else if (base.hovered) { - return UM.Theme.getColor("setting_category_hover"); - } else { - return UM.Theme.getColor("setting_category"); + color: + { + if (base.color) + { + return base.color + } else if (!base.enabled) + { + return UM.Theme.getColor("setting_category_disabled") + } else if (base.hovered && base.checkable && base.checked) + { + return UM.Theme.getColor("setting_category_active_hover") + } else if (base.pressed || (base.checkable && base.checked)) + { + return UM.Theme.getColor("setting_category_active") + } else if (base.hovered) + { + return UM.Theme.getColor("setting_category_hover") + } else + { + return UM.Theme.getColor("setting_category") } } Behavior on color { ColorAnimation { duration: 50; } } @@ -41,17 +49,23 @@ Button height: UM.Theme.getSize("default_lining").height width: parent.width anchors.bottom: parent.bottom - color: { - if (!base.enabled) { - return UM.Theme.getColor("setting_category_disabled_border"); - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) { - return UM.Theme.getColor("setting_category_active_hover_border"); - } else if (base.pressed || (base.checkable && base.checked)) { - return UM.Theme.getColor("setting_category_active_border"); - } else if (base.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_category_hover_border"); - } else { - return UM.Theme.getColor("setting_category_border"); + color: + { + if (!base.enabled) + { + return UM.Theme.getColor("setting_category_disabled_border") + } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) + { + return UM.Theme.getColor("setting_category_active_hover_border") + } else if (base.pressed || (base.checkable && base.checked)) + { + return UM.Theme.getColor("setting_category_active_border") + } else if (base.hovered || base.activeFocus) + { + return UM.Theme.getColor("setting_category_hover_border") + } else + { + return UM.Theme.getColor("setting_category_border") } } } @@ -66,18 +80,19 @@ Button property var focusItem: base - contentItem: Item { + contentItem: Item + { anchors.fill: parent - anchors.left: parent.left - Label { + Label + { id: settingNameLabel anchors { left: parent.left leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width - right: parent.right; - verticalCenter: parent.verticalCenter; + right: parent.right + verticalCenter: parent.verticalCenter } text: definition.label textFormat: Text.PlainText @@ -85,21 +100,27 @@ Button font: UM.Theme.getFont("setting_category") color: { - if (!base.enabled) { - return UM.Theme.getColor("setting_category_disabled_text"); - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) { - return UM.Theme.getColor("setting_category_active_hover_text"); - } else if (base.pressed || (base.checkable && base.checked)) { - return UM.Theme.getColor("setting_category_active_text"); - } else if (base.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_category_hover_text"); - } else { - return UM.Theme.getColor("setting_category_text"); + if (!base.enabled) + { + return UM.Theme.getColor("setting_category_disabled_text") + } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) + { + return UM.Theme.getColor("setting_category_active_hover_text") + } else if (base.pressed || (base.checkable && base.checked)) + { + return UM.Theme.getColor("setting_category_active_text") + } else if (base.hovered || base.activeFocus) + { + return UM.Theme.getColor("setting_category_hover_text") + } else + { + return UM.Theme.getColor("setting_category_text") } } fontSizeMode: Text.HorizontalFit minimumPointSize: 8 } + UM.RecolorImage { id: category_arrow @@ -112,16 +133,21 @@ Button sourceSize.height: width color: { - if (!base.enabled) { - return UM.Theme.getColor("setting_category_disabled_text"); - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) { - return UM.Theme.getColor("setting_category_active_hover_text"); - } else if (base.pressed || (base.checkable && base.checked)) { - return UM.Theme.getColor("setting_category_active_text"); - } else if (base.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_category_hover_text"); - } else { - return UM.Theme.getColor("setting_category_text"); + if (!base.enabled) + { + return UM.Theme.getColor("setting_category_disabled_text") + } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) + { + return UM.Theme.getColor("setting_category_active_hover_text") + } else if (base.pressed || (base.checkable && base.checked)) + { + return UM.Theme.getColor("setting_category_active_text") + } else if (base.hovered || base.activeFocus) + { + return UM.Theme.getColor("setting_category_hover_text") + } else + { + return UM.Theme.getColor("setting_category_text") } } source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") @@ -136,21 +162,26 @@ Button anchors.leftMargin: UM.Theme.getSize("default_margin").width color: { - if (!base.enabled) { - return UM.Theme.getColor("setting_category_disabled_text"); - } else if((base.hovered || base.activeFocus) && base.checkable && base.checked) { - return UM.Theme.getColor("setting_category_active_hover_text"); - } else if(base.pressed || (base.checkable && base.checked)) { - return UM.Theme.getColor("setting_category_active_text"); - } else if(base.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_category_hover_text"); - } else { - return UM.Theme.getColor("setting_category_text"); + if (!base.enabled) + { + return UM.Theme.getColor("setting_category_disabled_text") + } else if((base.hovered || base.activeFocus) && base.checkable && base.checked) + { + return UM.Theme.getColor("setting_category_active_hover_text") + } else if(base.pressed || (base.checkable && base.checked)) + { + return UM.Theme.getColor("setting_category_active_text") + } else if(base.hovered || base.activeFocus) + { + return UM.Theme.getColor("setting_category_hover_text") + } else + { + return UM.Theme.getColor("setting_category_text") } } source: UM.Theme.getIcon(definition.icon) - width: UM.Theme.getSize("section_icon").width; - height: UM.Theme.getSize("section_icon").height; + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height sourceSize.width: width + 15 * screenScaleFactor sourceSize.height: width + 15 * screenScaleFactor } @@ -160,31 +191,26 @@ Button onClicked: { - if (definition.expanded) { - settingDefinitionsModel.collapse(definition.key); + if (definition.expanded) + { + settingDefinitionsModel.collapse(definition.key) } else { - settingDefinitionsModel.expandRecursive(definition.key); + settingDefinitionsModel.expandRecursive(definition.key) } //Set focus so that tab navigation continues from this point on. //NB: This must be set AFTER collapsing/expanding the category so that the scroll position is correct. - forceActiveFocus(); + forceActiveFocus() } onActiveFocusChanged: { if(activeFocus) { - base.focusReceived(); + base.focusReceived() } } - Keys.onTabPressed: - { - base.setActiveFocusToNextSetting(true) - } - Keys.onBacktabPressed: - { - base.setActiveFocusToNextSetting(false) - } + Keys.onTabPressed: base.setActiveFocusToNextSetting(true) + Keys.onBacktabPressed: base.setActiveFocusToNextSetting(false) UM.SimpleButton { @@ -194,9 +220,10 @@ Button height: Math.round(base.height * 0.6) width: Math.round(base.height * 0.6) - anchors { + anchors + { right: inheritButton.visible ? inheritButton.left : parent.right - // use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons + // Use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9) verticalCenter: parent.verticalCenter } @@ -205,9 +232,7 @@ Button hoverColor: UM.Theme.getColor("setting_control_button_hover") iconSource: UM.Theme.getIcon("settings") - onClicked: { - Cura.Actions.configureSettingVisibility.trigger(definition) - } + onClicked: Cura.Actions.configureSettingVisibility.trigger(definition) } UM.SimpleButton @@ -240,24 +265,18 @@ Button onClicked: { - settingDefinitionsModel.expandRecursive(definition.key); - base.checked = true; - base.showAllHiddenInheritedSettings(definition.key); + settingDefinitionsModel.expandRecursive(definition.key) + base.checked = true + base.showAllHiddenInheritedSettings(definition.key) } color: UM.Theme.getColor("setting_control_button") hoverColor: UM.Theme.getColor("setting_control_button_hover") iconSource: UM.Theme.getIcon("notice") - onEntered: - { - base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible.")) - } + onEntered: base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible.")) - onExited: - { - base.hideTooltip(); - } + onExited: base.hideTooltip() UM.I18nCatalog { id: catalog; name: "cura" } } From d47806de509d9aeeeebff5c5c410fb17ab35f26d Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 15:05:35 +0100 Subject: [PATCH 344/558] Change style, added close popitem close behaviour CURA-5941 --- resources/qml/ExpandableComponent.qml | 3 +++ resources/qml/PrintSetupSelector.qml | 37 ++++++++++++-------------- resources/themes/cura-light/theme.json | 2 -- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3b1105ddd6..707b947c7f 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -49,6 +49,9 @@ Item // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. property alias headerCornerSide: background.cornerSide + // Change the popupItem close behaviour + property alias popupClosePolicy : popup.closePolicy + function togglePopup() { if(popup.visible) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 371232372d..b20d8e116b 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -29,7 +29,9 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("pencil") popupPadding : 0 - popupSpacingY: 10 + popupSpacingY: UM.Theme.getSize("narrow_margin").width + + popupClosePolicy: Popup.CloseOnEscape onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) @@ -124,7 +126,7 @@ Cura.ExpandableComponent popupItem: Rectangle { - property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("print_setup_selector_margin").height * 2 + property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 id: popupItemWrapper height: total_height @@ -157,7 +159,7 @@ Cura.ExpandableComponent { topMargin: UM.Theme.getSize("sidebar_margin").height left: parent.left - leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height } } @@ -194,7 +196,7 @@ Cura.ExpandableComponent source: UM.Theme.getIcon("cross1") } - onClicked: base.model.hideMessage(model.id) + onClicked: base.togglePopup() // Will hide the popup item background: Rectangle { @@ -211,17 +213,16 @@ Cura.ExpandableComponent anchors { top: popupItemHeader.bottom - topMargin: UM.Theme.getSize("print_setup_selector_margin").height + topMargin: UM.Theme.getSize("narrow_margin").height right: parent.right left: parent.left - leftMargin: 5 - rightMargin: 5 + leftMargin: UM.Theme.getSize("thick_margin").width / 1.5 + rightMargin: UM.Theme.getSize("thick_margin").width / 1.5 } UM.TabRow { id: tabBar - anchors.top: popupItemHeader.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) z: 1 @@ -309,7 +310,7 @@ Cura.ExpandableComponent { id: footerControll anchors.top: popupItemContent.bottom - anchors.topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 width: parent.width height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 Rectangle @@ -337,10 +338,10 @@ Cura.ExpandableComponent anchors { top: parent.top - topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 - bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 right: parent.right - rightMargin: UM.Theme.getSize("print_setup_selector_margin").height + rightMargin: UM.Theme.getSize("narrow_margin").height } onClicked: currentModeIndex = 1 @@ -361,19 +362,15 @@ Cura.ExpandableComponent anchors { top: parent.top - topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 - bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 left: parent.left - leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height } -// onClicked: currentModeIndex = 0 MouseArea { anchors.fill: parent - onClicked: { - currentModeIndex = 0 - - } + onClicked: currentModeIndex = 0 } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e6889b50c0..1228e52b9d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -535,9 +535,7 @@ "monitor_shadow_radius": [0.4, 0.4], "monitor_shadow_offset": [0.15, 0.15], - "print_setup_selector_margin": [0.5, 0.5], "print_setup_action_button": [13, 5], - "print_setup_tap_bar": [4, 4], "print_setup_content_top_margin": [3, 3] } } From 55dd9be0629b5ac091628ea9184416da7edae972 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 15:11:13 +0100 Subject: [PATCH 345/558] Move PrinterTypeLabel to a more central location So that we can re-use it in other places too. Contributes to issue CURA-5876. --- resources/qml/{PrinterSelector => }/PrinterTypeLabel.qml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/qml/{PrinterSelector => }/PrinterTypeLabel.qml (100%) diff --git a/resources/qml/PrinterSelector/PrinterTypeLabel.qml b/resources/qml/PrinterTypeLabel.qml similarity index 100% rename from resources/qml/PrinterSelector/PrinterTypeLabel.qml rename to resources/qml/PrinterTypeLabel.qml From c1bb1a9b982d7e44b9dd0bc68b9b7e993dfc3712 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 15:12:44 +0100 Subject: [PATCH 346/558] Use normal font size for shorthand label This element had been designed when very_small was in the theme equal to default. I changed the entire application to use default instead of very_small and made very_small a smaller font, but didn't change that on the branch that this element was designed on. So now also change it here. Contributes to issue CURA-5876. --- resources/qml/PrinterTypeLabel.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterTypeLabel.qml b/resources/qml/PrinterTypeLabel.qml index cd9f3b9743..7feae32e16 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -28,7 +28,7 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter renderType: Text.NativeRendering - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } } \ No newline at end of file From 3ad2e4f62a5a7612ecf2372e0230a2362d7f3f66 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 15:24:58 +0100 Subject: [PATCH 347/558] Re-use PrinterTypeLabel component and use abbreviated name Contributes to issue CURA-5876. --- .../ConfigurationListView.qml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 393c2715b2..c40eb5b9e9 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -46,21 +46,11 @@ Column section.criteria: ViewSection.FullString section.delegate: Item { - height: printerTypeLabelBox.height + UM.Theme.getSize("default_margin").height - Rectangle + height: printerTypeLabel.height + UM.Theme.getSize("default_margin").height + Cura.PrinterTypeLabel { - id: printerTypeLabelBox - color: UM.Theme.getColor("text_detail") - width: childrenRect.width - height: childrenRect.height - - Label - { - text: section - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text") - padding: UM.Theme.getSize("narrow_margin").width - } + id: printerTypeLabel + text: Cura.MachineManager.getAbbreviatedMachineName(section) } } From 41a5f05391dbc06dc4afde0321364e596ab8452b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 15:57:26 +0100 Subject: [PATCH 348/558] Remove SyncButton It hasn't been used now for a while. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/SyncButton.qml | 102 ------------------ 1 file changed, 102 deletions(-) delete mode 100644 resources/qml/Menus/ConfigurationMenu/SyncButton.qml diff --git a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml deleted file mode 100644 index 558ae1e477..0000000000 --- a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Button -{ - id: base - property var outputDevice: null - property var matched: updateOnSync() - text: matched == true ? catalog.i18nc("@label:extruder label", "Yes") : catalog.i18nc("@label:extruder label", "No") - width: parent.width - height: parent.height - - function updateOnSync() - { - if (outputDevice != undefined) - { - for (var index in outputDevice.uniqueConfigurations) - { - var configuration = outputDevice.uniqueConfigurations[index] - if (Cura.MachineManager.matchesConfiguration(configuration)) - { - base.matched = true; - return; - } - } - } - base.matched = false; - } - - style: ButtonStyle - { - background: Rectangle - { - color: - { - if(control.pressed) - { - return UM.Theme.getColor("machine_selector_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("machine_selector_hover"); - } - else - { - return UM.Theme.getColor("machine_selector_bar"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - - UM.RecolorImage - { - id: downArrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - 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_emphasis") - source: UM.Theme.getIcon("arrow_bottom") - } - UM.RecolorImage - { - id: sidebarComboBoxLabel - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter; - - width: UM.Theme.getSize("printer_sync_icon").width - height: UM.Theme.getSize("printer_sync_icon").height - - color: control.matched ? UM.Theme.getColor("printer_config_matched") : UM.Theme.getColor("printer_config_mismatch") - source: UM.Theme.getIcon("tab_status_connected") - sourceSize.width: width - sourceSize.height: height - } - } - label: Label {} - } - - Connections - { - target: outputDevice - onUniqueConfigurationsChanged: updateOnSync() - } - - Connections - { - target: Cura.MachineManager - onCurrentConfigurationChanged: updateOnSync() - onOutputDevicesChanged: updateOnSync() - } -} \ No newline at end of file From dad2031e4b5b8750a6721e6fdb3a24620eaf3cc7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 16:06:37 +0100 Subject: [PATCH 349/558] Switch to the preview stage before to switch to simulation view ... since now the list of views are in a different stage. Contributes to CURA-5979. --- cura/CuraApplication.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6e52a97518..b43e4d5e0e 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1663,7 +1663,9 @@ class CuraApplication(QtApplication): is_non_sliceable = "." + file_extension in self._non_sliceable_extensions if is_non_sliceable: - self.callLater(lambda: self.getController().setActiveView("SimulationView")) + # Need to switch first to the preview stage and then to layer view + self.callLater(lambda: (self.getController().setActiveStage("PreviewStage"), + self.getController().setActiveView("SimulationView"))) block_slicing_decorator = BlockSlicingDecorator() node.addDecorator(block_slicing_decorator) From ff851b0382b688b6c190d48127be3e0a369a2960 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 16:36:27 +0100 Subject: [PATCH 350/558] Added margins CURA-5941 --- resources/qml/PrintSetupSelector.qml | 4 ++-- resources/qml/SidebarSimple.qml | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index b20d8e116b..6edb297721 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -216,8 +216,8 @@ Cura.ExpandableComponent topMargin: UM.Theme.getSize("narrow_margin").height right: parent.right left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width / 1.5 - rightMargin: UM.Theme.getSize("thick_margin").width / 1.5 + leftMargin: UM.Theme.getSize("default_margin").width + rightMargin: UM.Theme.getSize("default_margin").width } UM.TabRow diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 2e0f0d6c4c..f2e998f526 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -38,6 +38,8 @@ Item width: childrenRect.width height: childrenRect.height + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width // // Quality profile // @@ -48,7 +50,6 @@ Item height: UM.Theme.getSize("thick_margin").height anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.right: parent.right Timer @@ -193,7 +194,6 @@ Item source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") anchors.bottom: speedSlider.bottom - } // Show titles for the each quality slider ticks @@ -507,7 +507,6 @@ Item top: parent.top topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width } } } @@ -526,9 +525,7 @@ Item Label { id: selectedInfillRateText - //anchors.top: parent.top anchors.left: infillSlider.left - anchors.leftMargin: Math.round((infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor) anchors.right: parent.right text: parseInt(infillDensity.properties.value) + "%" @@ -833,7 +830,6 @@ Item top: infillCellRight.bottom topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width right: infillCellLeft.right rightMargin: UM.Theme.getSize("thick_margin").width verticalCenter: enableSupportCheckBox.verticalCenter @@ -956,7 +952,6 @@ Item anchors { left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width right: infillCellLeft.right rightMargin: UM.Theme.getSize("thick_margin").width verticalCenter: adhesionCheckBox.verticalCenter @@ -1037,7 +1032,6 @@ Item { id: tipsText anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("thick_margin").width anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.top: parent.top From 26c7558a53b571deaea91d8d2acd39ee9f5a005d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 16:44:16 +0100 Subject: [PATCH 351/558] Don't show labels if controls themselves are not shown The height of the popup is luckily automatically adjusted now. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 78448d5be5..87096c3a14 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -136,6 +136,7 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth + visible: materialSelection.visible } OldControls.ToolButton @@ -178,6 +179,7 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth + visible: variantSelection.visible } OldControls.ToolButton From 0b8a56458d5d6bea6dc88c8674c3459fa5eee402 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Nov 2018 17:11:32 +0100 Subject: [PATCH 352/558] Remove unused CustomConfigurationSelector I checked. It is no longer used. Contributes to issue CURA-5876. --- resources/qml/CustomConfigurationSelector.qml | 357 ------------------ 1 file changed, 357 deletions(-) delete mode 100644 resources/qml/CustomConfigurationSelector.qml diff --git a/resources/qml/CustomConfigurationSelector.qml b/resources/qml/CustomConfigurationSelector.qml deleted file mode 100644 index c78ca700da..0000000000 --- a/resources/qml/CustomConfigurationSelector.qml +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Rectangle -{ - implicitWidth: parent.width - implicitHeight: parent.height - - id: base - color: UM.Theme.getColor("main_background") - - // Height has an extra 2x margin for the top & bottom margin. - height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width - - Cura.ExtrudersModel { id: extrudersModel } - - ListView - { - // Horizontal list that shows the extruders - id: extrudersList - visible: extrudersModel.items.length > 1 - property var index: 0 - - height: UM.Theme.getSize("configuration_selector_mode_tabs").height - boundsBehavior: Flickable.StopAtBounds - - anchors - { - left: parent.left - right: parent.right - top: parent.top - margins: UM.Theme.getSize("thick_margin").width - } - - ExclusiveGroup { id: extruderMenuGroup } - - orientation: ListView.Horizontal - - model: extrudersModel - - Connections - { - target: Cura.MachineManager - onGlobalContainerChanged: forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - } - - delegate: Button - { - height: parent.height - width: Math.round(ListView.view.width / extrudersModel.rowCount()) - - text: model.name - tooltip: model.name - exclusiveGroup: extruderMenuGroup - checked: Cura.ExtruderManager.activeExtruderIndex == index - - property bool extruder_enabled: true - - MouseArea // TODO; This really should be fixed. It makes absolutely no sense to have a button AND a mouse area. - { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: - { - switch (mouse.button) - { - case Qt.LeftButton: - extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled - if (extruder_enabled) - { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - Cura.ExtruderManager.setActiveExtruderIndex(index) - } - break - case Qt.RightButton: - extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled - extruderMenu.popup() - break - } - } - } - - Menu - { - id: extruderMenu - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Enable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) - visible: !extruder_enabled // using an intermediate variable prevents an empty popup that occured now and then - } - - MenuItem - { - text: catalog.i18nc("@action:inmenu", "Disable Extruder") - onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false) - visible: extruder_enabled - enabled: Cura.MachineManager.numberExtrudersEnabled > 1 - } - } - - style: ButtonStyle - { - background: Rectangle - { - anchors.fill: parent - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: - { - if (Cura.MachineManager.getExtruder(index).isEnabled) - { - if(control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_border") - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border") - } - return UM.Theme.getColor("action_button_border") - } - return UM.Theme.getColor("action_button_disabled_border") - } - color: - { - if (Cura.MachineManager.getExtruder(index).isEnabled) - { - if(control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered") - } - return UM.Theme.getColor("action_button") - } - return UM.Theme.getColor("action_button_disabled") - } - Behavior on color { ColorAnimation { duration: 50; } } - - Item - { - id: extruderButtonFace - anchors.centerIn: parent - width: childrenRect.width - - Label - { - // Static text that holds the "Extruder" label - id: extruderStaticText - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - - color: - { - if (Cura.MachineManager.getExtruder(index).isEnabled) - { - if(control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text") - } - return UM.Theme.getColor("action_button_text") - } - return UM.Theme.getColor("action_button_disabled_text") - } - - font: UM.Theme.getFont("large_nonbold") - text: catalog.i18nc("@label", "Extruder") - visible: width < (control.width - extruderIcon.width - UM.Theme.getSize("default_margin").width) - elide: Text.ElideRight - } - - ExtruderIcon - { - // Round icon with the extruder number and material color indicator. - id: extruderIcon - - anchors.verticalCenter: parent.verticalCenter - anchors.left: extruderStaticText.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: control.height - Math.round(UM.Theme.getSize("default_margin").width / 2) - height: width - - checked: control.checked - materialColor: model.color - textColor: extruderStaticText.color - } - } - } - - label: Item {} - } - } - } - - Item - { - id: materialRow - height: UM.Theme.getSize("print_setup_item").height - visible: Cura.MachineManager.hasMaterials - - anchors - { - left: parent.left - right: parent.right - top: extrudersList.bottom - margins: UM.Theme.getSize("thick_margin").width - } - - Label - { - id: materialLabel - text: catalog.i18nc("@label", "Material"); - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: materialSelection - - property var activeExtruder: Cura.MachineManager.activeStack - property var hasActiveExtruder: activeExtruder != null - property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" - - text: currentRootMaterialName - tooltip: currentRootMaterialName - visible: Cura.MachineManager.hasMaterials - - enabled: !extrudersList.visible || Cura.ExtruderManager.activeExtruderIndex > -1 - - height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7) + UM.Theme.getSize("thick_margin").width - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - menu: Cura.MaterialMenu - { - extruderIndex: Cura.ExtruderManager.activeExtruderIndex - } - - property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true - property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported - } - } - - Item - { - id: variantRow - height: UM.Theme.getSize("print_setup_item").height - visible: Cura.MachineManager.hasVariants - - anchors - { - left: parent.left - right: parent.right - top: materialRow.bottom - margins: UM.Theme.getSize("thick_margin").width - } - - Label - { - id: variantLabel - text: Cura.MachineManager.activeDefinitionVariantsName; - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width) - height: parent.height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - ToolButton - { - id: variantSelection - text: Cura.MachineManager.activeVariantName - tooltip: Cura.MachineManager.activeVariantName; - visible: Cura.MachineManager.hasVariants - - height: UM.Theme.getSize("setting_control").height - width: Math.round(parent.width * 0.7 + UM.Theme.getSize("thick_margin").width) - anchors.right: parent.right - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true; - - menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } - } - } - - Item - { - id: materialCompatibilityLink - height: UM.Theme.getSize("print_setup_item").height - - anchors.right: parent.right - anchors.top: variantRow.bottom - anchors.margins: UM.Theme.getSize("thick_margin").width - UM.RecolorImage - { - id: warningImage - - anchors.right: materialInfoLabel.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - source: UM.Theme.getIcon("warning") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - - sourceSize.width: width - sourceSize.height: height - - color: UM.Theme.getColor("material_compatibility_warning") - - visible: !Cura.MachineManager.isCurrentSetupSupported - } - - Label - { - id: materialInfoLabel - wrapMode: Text.WordWrap - text: "" + catalog.i18nc("@label", "Check compatibility") + "" - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - linkColor: UM.Theme.getColor("text_link") - - verticalAlignment: Text.AlignTop - - anchors.right: parent.right - - MouseArea - { - anchors.fill: parent - - onClicked: - { - // open the material URL with web browser - Qt.openUrlExternally("https://ultimaker.com/incoming-links/cura/material-compatibilty"); - } - } - } - } -} From 309061ce3113df6dd7f7c9e9762526b1ce0973c5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 17:16:52 +0100 Subject: [PATCH 353/558] Add a new ToolbarButton Now also the Extruder button is a toolbar button since it will show in the toolbar. --- resources/qml/ExtruderButton.qml | 18 +++---- resources/qml/Toolbar.qml | 25 ++++++--- resources/qml/ToolbarButton.qml | 92 ++++++++++++++++++++++++++++++++ resources/qml/qmldir | 3 +- 4 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 resources/qml/ToolbarButton.qml diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index d7cbdc52bc..feb399d528 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -7,7 +7,7 @@ import QtQuick.Controls 2.0 import UM 1.2 as UM import Cura 1.0 as Cura -Button +Cura.ToolbarButton { id: base @@ -18,22 +18,16 @@ Button checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1 enabled: UM.Selection.hasSelection && extruder.stack.isEnabled - background: Item {} - contentItem: Item + toolItem: ExtruderIcon { - // For some reason if the extruder icon is not enclosed to the item, the size changes to fill the size of the button - ExtruderIcon - { - anchors.centerIn: parent - materialColor: model.color - extruderEnabled: extruder.stack.isEnabled - property int index: extruder.index - } + materialColor: extruder.color + extruderEnabled: extruder.stack.isEnabled + property int index: extruder.index } onClicked: { forceActiveFocus() //First grab focus, so all the text fields are updated - CuraActions.setExtruderForSelection(extruder.id); + CuraActions.setExtruderForSelection(extruder.id) } } diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 0240aaab26..3a4e7704c0 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -55,17 +55,25 @@ Item model: UM.ToolModel { id: toolsModel } width: childrenRect.width height: childrenRect.height - Button + + delegate: ToolbarButton { text: model.name + (model.shortcut ? (" (" + model.shortcut + ")") : "") - iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon checkable: true checked: model.active enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled - style: UM.Theme.styles.toolbar_button - property bool isFirstElement: toolsModel.getItem(0).id == model.id - property bool isLastElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id + topElement: toolsModel.getItem(0).id == model.id + bottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id + + toolItem: UM.RecolorImage + { + opacity: parent.enabled ? 1.0 : 0.2 + source: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon + color: UM.Theme.getColor("toolbar_button_text") + + sourceSize: UM.Theme.getSize("button_icon") + } onCheckedChanged: { @@ -128,11 +136,12 @@ Item height: childrenRect.height property var _model: Cura.ExtrudersModel { id: extrudersModel } model: _model.items.length > 1 ? _model : 0 - ExtruderButton + + delegate: ExtruderButton { extruder: model - height: UM.Theme.getSize("button").width - width: UM.Theme.getSize("button").width + topElement: extrudersModel.getItem(0).id == model.id + bottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id } } } diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml new file mode 100644 index 0000000000..7241b489b6 --- /dev/null +++ b/resources/qml/ToolbarButton.qml @@ -0,0 +1,92 @@ +// 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.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Button +{ + id: base + + property alias toolItem: contentItemLoader.sourceComponent + property bool topElement: false + property bool bottomElement: false + + hoverEnabled: true + + background: Rectangle + { + implicitWidth: UM.Theme.getSize("button").width + implicitHeight: UM.Theme.getSize("button").height + color: + { + if (base.checked && base.hovered) + { + return UM.Theme.getColor("toolbar_button_active_hover") + } + else if (base.checked) + { + return "red" //UM.Theme.getColor("toolbar_button_active") + } + else if(base.hovered) + { + return UM.Theme.getColor("toolbar_button_hover") + } + return UM.Theme.getColor("toolbar_background") + } + radius: UM.Theme.getSize("default_radius").width + + Rectangle + { + id: topSquare + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + height: parent.radius + color: base.topElement ? "transparent" : parent.color + } + + Rectangle + { + id: bottomSquare + anchors + { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: parent.radius + color: base.bottomElement ? "transparent" : parent.color + } + + Rectangle + { + id: leftSquare + anchors + { + left: parent.left + top: parent.top + bottom: parent.bottom + } + width: parent.radius + color: parent.color + } + } + + contentItem: Item + { + Loader + { + id: contentItemLoader + anchors.centerIn: parent + width: UM.Theme.getSize("button_icon").width + height: UM.Theme.getSize("button_icon").height + } + } +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 43ae4411af..2475f398f8 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -12,4 +12,5 @@ IconLabel 1.0 IconLabel.qml OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml ExpandableComponent 1.0 ExpandableComponent.qml PrinterTypeLabel 1.0 PrinterTypeLabel.qml -ViewsSelector 1.0 ViewsSelector.qml \ No newline at end of file +ViewsSelector 1.0 ViewsSelector.qml +ToolbarButton 1.0 ToolbarButton.qml \ No newline at end of file From 14b460a626bfbb58b0bc8eff6621f46e8d400ecb Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 27 Nov 2018 17:25:10 +0100 Subject: [PATCH 354/558] Remove unused styles --- resources/qml/Toolbar.qml | 5 +- resources/qml/ToolbarButton.qml | 3 +- resources/themes/cura-light/styles.qml | 117 ------------------------- 3 files changed, 3 insertions(+), 122 deletions(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 3a4e7704c0..0207c8ec49 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -2,9 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura @@ -68,7 +66,6 @@ Item toolItem: UM.RecolorImage { - opacity: parent.enabled ? 1.0 : 0.2 source: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon color: UM.Theme.getColor("toolbar_button_text") diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index 7241b489b6..b5e5aab475 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -29,7 +29,7 @@ Button } else if (base.checked) { - return "red" //UM.Theme.getColor("toolbar_button_active") + return UM.Theme.getColor("toolbar_button_active") } else if(base.hovered) { @@ -81,6 +81,7 @@ Button contentItem: Item { + opacity: parent.enabled ? 1.0 : 0.2 Loader { id: contentItemLoader diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index f00aab44c0..e040d91df9 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -171,123 +171,6 @@ QtObject } } - property Component toolbar_button: Component - { - ButtonStyle - { - background: Rectangle - { - implicitWidth: Theme.getSize("button").width - implicitHeight: Theme.getSize("button").height - color: - { - if (control.checked && control.hovered) - { - return Theme.getColor("toolbar_button_active_hover") - } - else if (control.checked) - { - return Theme.getColor("toolbar_button_active") - } - else if(control.hovered) - { - return Theme.getColor("toolbar_button_hover") - } - return Theme.getColor("toolbar_background") - } - radius: UM.Theme.getSize("default_radius").width - - Rectangle - { - id: topSquare - anchors - { - left: parent.left - right: parent.right - top: parent.top - } - height: parent.radius - color: control.isFirstElement ? "transparent" : parent.color - } - - Rectangle - { - id: bottomSquare - anchors - { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: parent.radius - color: control.isLastElement ? "transparent" : parent.color - } - - Rectangle - { - id: leftSquare - anchors - { - left: parent.left - top: parent.top - bottom: parent.bottom - } - width: parent.radius - color: parent.color - } - - // This is the tooltip - UM.PointingRectangle - { - id: button_tooltip - - anchors.left: parent.right - anchors.leftMargin: Theme.getSize("button_tooltip_arrow").width * 2 - anchors.verticalCenter: parent.verticalCenter - - target: Qt.point(parent.x, y + Math.round(height/2)) - arrowSize: Theme.getSize("button_tooltip_arrow").width - color: Theme.getColor("button_tooltip") - opacity: control.hovered ? 1.0 : 0.0; - visible: control.text != "" - - width: control.hovered ? button_tip.width + Theme.getSize("button_tooltip").width : 0 - height: Theme.getSize("button_tooltip").height - - Behavior on width { NumberAnimation { duration: 100; } } - Behavior on opacity { NumberAnimation { duration: 100; } } - - Label - { - id: button_tip - - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter; - - text: control.text; - font: Theme.getFont("button_tooltip"); - color: Theme.getColor("tooltip_text"); - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.centerIn: parent; - opacity: !control.enabled ? 0.2 : 1.0 - source: control.iconSource; - width: Theme.getSize("button_icon").width; - height: Theme.getSize("button_icon").height; - color: Theme.getColor("toolbar_button_text"); - - sourceSize: Theme.getSize("button_icon") - } - } - } - } - property Component tool_button: Component { ButtonStyle From c1c5eb221913dd7ce7538ef9d4120f7b69866729 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 28 Nov 2018 09:44:37 +0100 Subject: [PATCH 355/558] Rename the properties to quickly identify that they are a boolean Contributes to CURA-5984. --- resources/qml/Toolbar.qml | 8 ++++---- resources/qml/ToolbarButton.qml | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 0207c8ec49..d16f949014 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -61,8 +61,8 @@ Item checked: model.active enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled - topElement: toolsModel.getItem(0).id == model.id - bottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id + isTopElement: toolsModel.getItem(0).id == model.id + isBottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id toolItem: UM.RecolorImage { @@ -137,8 +137,8 @@ Item delegate: ExtruderButton { extruder: model - topElement: extrudersModel.getItem(0).id == model.id - bottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id + isTopElement: extrudersModel.getItem(0).id == model.id + isBottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id } } } diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index b5e5aab475..9e81939ba2 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -12,8 +12,12 @@ Button id: base property alias toolItem: contentItemLoader.sourceComponent - property bool topElement: false - property bool bottomElement: false + + // These two properties indicate whether the toolbar button is at the top of the toolbar column or at the bottom. + // If it is somewhere in the middle, then both has to be false. If there is only one element in the column, then + // both properties have to be set to true. This is used to create a rounded corner. + property bool isTopElement: false + property bool isBottomElement: false hoverEnabled: true @@ -49,7 +53,7 @@ Button top: parent.top } height: parent.radius - color: base.topElement ? "transparent" : parent.color + color: base.isTopElement ? "transparent" : parent.color } Rectangle @@ -62,7 +66,7 @@ Button bottom: parent.bottom } height: parent.radius - color: base.bottomElement ? "transparent" : parent.color + color: base.isBottomElement ? "transparent" : parent.color } Rectangle From bfebb33123f34894887719f114c942485a48b540 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 28 Nov 2018 10:28:16 +0100 Subject: [PATCH 356/558] Code style CURA-5984 Co-Authored-By: diegopradogesto --- resources/qml/Toolbar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index d16f949014..07522dd535 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -66,7 +66,7 @@ Item toolItem: UM.RecolorImage { - source: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon + source: UM.Theme.getIcon(model.icon) != "" ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon color: UM.Theme.getColor("toolbar_button_text") sourceSize: UM.Theme.getSize("button_icon") From 454b47e3a0e7c9d50a5e8ebad5933182872f0782 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 28 Nov 2018 10:29:35 +0100 Subject: [PATCH 357/558] Change visibility behavior of the rectangle CURA-5984 Co-Authored-By: diegopradogesto --- resources/qml/ToolbarButton.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index 9e81939ba2..90e9160d3d 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -66,7 +66,8 @@ Button bottom: parent.bottom } height: parent.radius - color: base.isBottomElement ? "transparent" : parent.color + color: parent.color + visible: base.isBottomElement } Rectangle From d0da70a7eea8c6991afebc5488e7a2c39fae9ab1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 28 Nov 2018 10:29:53 +0100 Subject: [PATCH 358/558] Change visibility of the rectangle CURA-5984 Co-Authored-By: diegopradogesto --- resources/qml/ToolbarButton.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index 90e9160d3d..157c6a34ac 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -53,7 +53,8 @@ Button top: parent.top } height: parent.radius - color: base.isTopElement ? "transparent" : parent.color + color: parent.color + visible: base.isTopElement } Rectangle From bfa2ff5f5ed84a06460f29a79f1b5cd0e1979187 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 28 Nov 2018 10:46:07 +0100 Subject: [PATCH 359/558] Invert visibility of bottom & topsquare It got derped. --- resources/qml/ToolbarButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index 157c6a34ac..adff73fb7c 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -54,7 +54,7 @@ Button } height: parent.radius color: parent.color - visible: base.isTopElement + visible: !base.isTopElement } Rectangle @@ -68,7 +68,7 @@ Button } height: parent.radius color: parent.color - visible: base.isBottomElement + visible: !base.isBottomElement } Rectangle From 5ed2acadd09fa062553f0fc4fddd2a79610e1142 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 28 Nov 2018 11:09:34 +0100 Subject: [PATCH 360/558] Re-add wizard_progress size I was a bit over enthosiastic deleting it as it was still used for the UMO first run wizard --- resources/themes/cura-light/theme.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d2358e36ff..dfad5cfd17 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -470,6 +470,7 @@ "modal_window_minimum": [60.0, 45], "license_window_minimum": [45, 45], + "wizard_progress": [10.0, 0.0], "message": [30.0, 5.0], "message_close": [1, 1], From 85b34d60053b5c2c3d2f6cf279d2ecc243c2929b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 28 Nov 2018 13:07:39 +0100 Subject: [PATCH 361/558] Refactor the PrintSetupSelector The file was splitted in several other files to improve readability. There is a new folder called PrintSetupSelector where all those files will be. Contributes to CURA-5941. --- plugins/PrepareStage/PrepareMenu.qml | 1 - resources/qml/PrintSetupSelector.qml | 392 ------------------ .../CustomPrintSetup.qml} | 4 +- .../PrintSetupSelector/PrintSetupSelector.qml | 68 +++ .../PrintSetupSelectorContents.qml | 276 ++++++++++++ .../PrintSetupSelectorHeader.qml | 69 +++ .../RecommendedPrintSetup.qml} | 8 +- 7 files changed, 419 insertions(+), 399 deletions(-) delete mode 100644 resources/qml/PrintSetupSelector.qml rename resources/qml/{SidebarAdvanced.qml => PrintSetupSelector/CustomPrintSetup.qml} (68%) create mode 100644 resources/qml/PrintSetupSelector/PrintSetupSelector.qml create mode 100644 resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml create mode 100644 resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml rename resources/qml/{SidebarSimple.qml => PrintSetupSelector/RecommendedPrintSetup.qml} (99%) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 10b4262f01..7c01b1f8b0 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -45,7 +45,6 @@ Item Cura.MachineSelector { id: machineSelection - z: openFileButton.z - 1 //Ensure that the tooltip of the open file button stays above the item row. headerCornerSide: Cura.RoundedRectangle.Direction.Left Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml deleted file mode 100644 index 253a13c0f0..0000000000 --- a/resources/qml/PrintSetupSelector.qml +++ /dev/null @@ -1,392 +0,0 @@ -// 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.0 -import QtQuick.Layouts 1.3 - -import UM 1.3 as UM -import Cura 1.0 as Cura -import "Menus" -import "Menus/ConfigurationMenu" - -Cura.ExpandableComponent -{ - id: base - - property int currentModeIndex: -1 - property bool hideSettings: PrintInformation.preSliced - - property string enabledText: catalog.i18nc("@label:Should be short", "On") - property string disabledText: catalog.i18nc("@label:Should be short", "Off") - - // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - - implicitWidth: 200 * screenScaleFactor - height: childrenRect.height - iconSource: UM.Theme.getIcon("pencil") - - popupPadding : 0 - popupSpacingY: UM.Theme.getSize("narrow_margin").width - - popupClosePolicy: Popup.CloseOnEscape - - onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) - - Component.onCompleted: - { - popupItemWrapper.width = base.width - } - - UM.I18nCatalog - { - id: catalog - name: "cura" - } - - Timer - { - id: tooltipDelayTimer - interval: 500 - repeat: false - property var item - property string text - - onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) - } - - headerItem: RowLayout - { - anchors.fill: parent - - IconWithText - { - source: UM.Theme.getIcon("category_layer_height") - text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : "" - - UM.SettingPropertyProvider - { - id: layerHeight - containerStack: Cura.MachineManager.activeStack - key: "layer_height" - watchedProperties: ["value"] - } - } - - IconWithText - { - source: UM.Theme.getIcon("category_infill") - text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%" - - UM.SettingPropertyProvider - { - id: infillDensity - containerStack: Cura.MachineManager.activeStack - key: "infill_sparse_density" - watchedProperties: ["value"] - } - } - - IconWithText - { - source: UM.Theme.getIcon("category_support") - text: supportEnabled.properties.value == "True" ? enabledText : disabledText - - - UM.SettingPropertyProvider - { - id: supportEnabled - containerStack: Cura.MachineManager.activeMachine - key: "support_enable" - watchedProperties: ["value"] - } - } - - IconWithText - { - source: UM.Theme.getIcon("category_adhesion") - text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText - - UM.SettingPropertyProvider - { - id: platformAdhesionType - containerStack: Cura.MachineManager.activeMachine - key: "adhesion_type" - watchedProperties: [ "value"] - } - } - } - - Cura.ExtrudersModel - { - id: extrudersModel - } - - popupItem: Rectangle - { - property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 - id: popupItemWrapper - height: total_height - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - - Item - { - id: popupItemHeader - height: 36 - - anchors - { - top: parent.top - right: parent.right - left: parent.left - } - - Label - { - id: popupItemHeaderText - text: catalog.i18nc("@label", "Print settings"); - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") - height: parent.height - - anchors - { - topMargin: UM.Theme.getSize("sidebar_margin").height - left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height - } - } - - Rectangle - { - width: parent.width - height: UM.Theme.getSize("default_lining").height - anchors.top: popupItemHeaderText.bottom - color: UM.Theme.getColor("action_button_border") - - - } - - Button - { - id: closeButton; - width: UM.Theme.getSize("message_close").width; - height: UM.Theme.getSize("message_close").height; - - anchors - { - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - top: parent.top; - topMargin: 10 - } - - UM.RecolorImage - { - anchors.fill: parent; - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("message_text") - source: UM.Theme.getIcon("cross1") - } - - onClicked: base.togglePopup() // Will hide the popup item - - background: Rectangle - { - color: UM.Theme.getColor("message_background") - } - } - } - - Rectangle - { - id: popupItemContent - width: parent.width - height: tabBar.height + sidebarContents.height - anchors - { - top: popupItemHeader.bottom - topMargin: UM.Theme.getSize("narrow_margin").height - right: parent.right - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin: UM.Theme.getSize("default_margin").width - } - - UM.TabRow - { - id: tabBar - anchors.topMargin: UM.Theme.getSize("default_margin").height - onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) - z: 1 - Repeater - { - model: extrudersModel - delegate: UM.TabRowButton - { - contentItem: Rectangle - { - z: 2 - Cura.ExtruderIcon - { - anchors.horizontalCenter: parent.horizontalCenter - materialColor: model.color - extruderEnabled: model.enabled - width: parent.height - height: parent.height - } - } - - background: Rectangle - { - - width: parent.width - z: 1 - border.width: UM.Theme.getSize("default_lining").width * 2 - border.color: UM.Theme.getColor("action_button_border") - - visible: - { - return index == tabBar.currentIndex - } - - // overlap bottom border - Rectangle - { - width: parent.width - UM.Theme.getSize("default_lining").width * 4 - height: UM.Theme.getSize("default_lining").width * 4 - anchors.bottom: parent.bottom - anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2) - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.left: parent.left - - } - } - } - } - } - - Rectangle - { - id: sidebarContents - anchors.top: tabBar.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("print_setup_widget").height - - border.width: UM.Theme.getSize("default_lining").width * 2 - border.color: UM.Theme.getColor("action_button_border") - - SidebarSimple - { - anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.fill: parent - visible: currentModeIndex != 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - - SidebarAdvanced - { - anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.bottomMargin: 2 //don't overlap bottom border - anchors.fill: parent - visible: currentModeIndex == 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - } - } - - Item - { - id: footerControll - anchors.top: popupItemContent.bottom - anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 - width: parent.width - height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 - Rectangle - { - width: parent.width - height: UM.Theme.getSize("default_lining").height - color: UM.Theme.getColor("action_button_border") - } - - Cura.ActionButton - { - id: settingControlButton - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Custom") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSourceRight: UM.Theme.getIcon("arrow_right") - width: UM.Theme.getSize("print_setup_action_button").width - fixedWidthMode: true - visible: currentModeIndex == 0 - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 - right: parent.right - rightMargin: UM.Theme.getSize("narrow_margin").height - } - - onClicked: currentModeIndex = 1 - } - - Cura.ActionButton - { - height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Recommended") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.getIcon("arrow_left") - width: UM.Theme.getSize("print_setup_action_button").width - fixedWidthMode: true - visible: currentModeIndex == 1 - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 - left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height - } - - MouseArea { - anchors.fill: parent - onClicked: currentModeIndex = 0 - } - } - } - - Component.onCompleted: - { - var index = Math.round(UM.Preferences.getValue("cura/active_mode")) - - if(index != null && !isNaN(index)) - { - currentModeIndex = index - } - else - { - currentModeIndex = 0 - } - } - } -} \ No newline at end of file diff --git a/resources/qml/SidebarAdvanced.qml b/resources/qml/PrintSetupSelector/CustomPrintSetup.qml similarity index 68% rename from resources/qml/SidebarAdvanced.qml rename to resources/qml/PrintSetupSelector/CustomPrintSetup.qml index ff5f545c80..f58695b48f 100644 --- a/resources/qml/SidebarAdvanced.qml +++ b/resources/qml/PrintSetupSelector/CustomPrintSetup.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2015 Ultimaker B.V. +// 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.0 -import "Settings" +import "../Settings" SettingView { } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml new file mode 100644 index 0000000000..c69dd56520 --- /dev/null +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -0,0 +1,68 @@ +// 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.0 + +import UM 1.3 as UM +import Cura 1.0 as Cura + +Cura.ExpandableComponent +{ + id: base + + property int currentModeIndex: -1 + property bool hideSettings: PrintInformation.preSliced + + property string enabledText: catalog.i18nc("@label:Should be short", "On") + property string disabledText: catalog.i18nc("@label:Should be short", "Off") + + // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. + signal showTooltip(Item item, point location, string text) + signal hideTooltip() + + iconSource: UM.Theme.getIcon("pencil") + popupPadding: UM.Theme.getSize("default_lining").width + popupSpacingY: UM.Theme.getSize("narrow_margin").width + + popupClosePolicy: Popup.CloseOnEscape + + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + + Component.onCompleted: + { + popupItemWrapper.width = base.width + } + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + + Timer + { + id: tooltipDelayTimer + interval: 500 + repeat: false + property var item + property string text + + onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) + } + + headerItem: PrintSetupSelectorHeader + { + anchors.fill: parent + } + + Cura.ExtrudersModel + { + id: extrudersModel + } + + popupItem: PrintSetupSelectorContents + { + + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml new file mode 100644 index 0000000000..e7b3b94b11 --- /dev/null +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -0,0 +1,276 @@ +// 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.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.0 as Cura + +Rectangle +{ + property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 + id: popupItemWrapper + height: total_height + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + + Item + { + id: popupItemHeader + height: 36 + + anchors + { + top: parent.top + right: parent.right + left: parent.left + } + + Label + { + id: popupItemHeaderText + text: catalog.i18nc("@label", "Print settings"); + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + height: parent.height + + anchors + { + topMargin: UM.Theme.getSize("sidebar_margin").height + left: parent.left + leftMargin: UM.Theme.getSize("narrow_margin").height + } + } + + Rectangle + { + width: parent.width + height: UM.Theme.getSize("default_lining").height + anchors.top: popupItemHeaderText.bottom + color: UM.Theme.getColor("action_button_border") + + + } + + Button + { + id: closeButton; + width: UM.Theme.getSize("message_close").width; + height: UM.Theme.getSize("message_close").height; + + anchors + { + right: parent.right; + rightMargin: UM.Theme.getSize("default_margin").width; + top: parent.top; + topMargin: 10 + } + + UM.RecolorImage + { + anchors.fill: parent; + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("message_text") + source: UM.Theme.getIcon("cross1") + } + + onClicked: base.togglePopup() // Will hide the popup item + + background: Rectangle + { + color: UM.Theme.getColor("message_background") + } + } + } + + Rectangle + { + id: popupItemContent + width: parent.width + height: tabBar.height + sidebarContents.height + + anchors + { + top: popupItemHeader.bottom + topMargin: UM.Theme.getSize("narrow_margin").height + right: parent.right + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + rightMargin: UM.Theme.getSize("default_margin").width + } + + UM.TabRow + { + id: tabBar + anchors.topMargin: UM.Theme.getSize("default_margin").height + onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + z: 1 + Repeater + { + model: extrudersModel + delegate: UM.TabRowButton + { + contentItem: Rectangle + { + z: 2 + Cura.ExtruderIcon + { + anchors.horizontalCenter: parent.horizontalCenter + materialColor: model.color + extruderEnabled: model.enabled + width: parent.height + height: parent.height + } + } + + background: Rectangle + { + + width: parent.width + z: 1 + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: UM.Theme.getColor("action_button_border") + + visible: + { + return index == tabBar.currentIndex + } + + // overlap bottom border + Rectangle + { + width: parent.width - UM.Theme.getSize("default_lining").width * 4 + height: UM.Theme.getSize("default_lining").width * 4 + anchors.bottom: parent.bottom + anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2) + anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.left: parent.left + + } + } + } + } + } + + Rectangle + { + id: sidebarContents + anchors.top: tabBar.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: UM.Theme.getSize("print_setup_widget").height + + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: UM.Theme.getColor("action_button_border") + + RecommendedPrintSetup + { + anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height + anchors.fill: parent + visible: currentModeIndex != 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + + CustomPrintSetup + { + anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height + anchors.bottomMargin: 2 //don't overlap bottom border + anchors.fill: parent + visible: currentModeIndex == 1 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + } + } + + Item + { + id: footerControll + anchors.top: popupItemContent.bottom + anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 + width: parent.width + height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 + Rectangle + { + width: parent.width + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("action_button_border") + } + + Cura.ActionButton + { + id: settingControlButton + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Custom") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + iconSourceRight: UM.Theme.getIcon("arrow_right") + width: UM.Theme.getSize("print_setup_action_button").width + fixedWidthMode: true + visible: currentModeIndex == 0 + anchors + { + top: parent.top + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 + right: parent.right + rightMargin: UM.Theme.getSize("narrow_margin").height + } + + onClicked: currentModeIndex = 1 + } + + Cura.ActionButton + { + height: UM.Theme.getSize("action_panel_button").height + text: catalog.i18nc("@button", "Recommended") + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.getIcon("arrow_left") + width: UM.Theme.getSize("print_setup_action_button").width + fixedWidthMode: true + visible: currentModeIndex == 1 + anchors + { + top: parent.top + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 + left: parent.left + leftMargin: UM.Theme.getSize("narrow_margin").height + } + + MouseArea { + anchors.fill: parent + onClicked: currentModeIndex = 0 + } + } + } + + Component.onCompleted: + { + var index = Math.round(UM.Preferences.getValue("cura/active_mode")) + + if(index != null && !isNaN(index)) + { + currentModeIndex = index + } + else + { + currentModeIndex = 0 + } + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml new file mode 100644 index 0000000000..f8fb246085 --- /dev/null +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -0,0 +1,69 @@ +// 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.3 +import QtQuick.Layouts 1.3 + +import UM 1.3 as UM +import Cura 1.0 as Cura + +RowLayout +{ + Cura.IconLabel + { + source: UM.Theme.getIcon("category_layer_height") + text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : "" + + UM.SettingPropertyProvider + { + id: layerHeight + containerStack: Cura.MachineManager.activeStack + key: "layer_height" + watchedProperties: ["value"] + } + } + + Cura.IconLabel + { + source: UM.Theme.getIcon("category_infill") + text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%" + + UM.SettingPropertyProvider + { + id: infillDensity + containerStack: Cura.MachineManager.activeStack + key: "infill_sparse_density" + watchedProperties: ["value"] + } + } + + Cura.IconLabel + { + source: UM.Theme.getIcon("category_support") + text: supportEnabled.properties.value == "True" ? enabledText : disabledText + + + UM.SettingPropertyProvider + { + id: supportEnabled + containerStack: Cura.MachineManager.activeMachine + key: "support_enable" + watchedProperties: ["value"] + } + } + + Cura.IconLabel + { + source: UM.Theme.getIcon("category_adhesion") + text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + key: "adhesion_type" + watchedProperties: [ "value"] + } + } +} \ No newline at end of file diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml similarity index 99% rename from resources/qml/SidebarSimple.qml rename to resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml index f2e998f526..a11eae3218 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml @@ -188,7 +188,7 @@ Item } } - IconWithText + Cura.IconLabel { id: qualityRowTitle source: UM.Theme.getIcon("category_layer_height") @@ -496,7 +496,7 @@ Item width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width - IconWithText + Cura.IconLabel { id: infillLabel source: UM.Theme.getIcon("category_infill") @@ -818,7 +818,7 @@ Item // // Enable support // - IconWithText + Cura.IconLabel { id: enableSupportLabel visible: enableSupportCheckBox.visible @@ -942,7 +942,7 @@ Item } - IconWithText + Cura.IconLabel { id: adhesionHelperLabel visible: adhesionCheckBox.visible From 0fdaebaaf83b3d34d94995dd628e246f63c8322c Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 28 Nov 2018 13:51:54 +0100 Subject: [PATCH 362/558] Updated action button CURA-5941 --- resources/qml/ActionButton.qml | 50 +++++++++++----------------- resources/qml/PrintSetupSelector.qml | 24 +++++++------ 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 732858c67f..e754365033 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -1,22 +1,17 @@ // 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 QtGraphicalEffects 1.0 // For the dropshadow - import UM 1.1 as UM - Button { id: button - property alias iconSource: buttonIcon.source - property alias iconSourceRight: buttonIconRight.source + property alias iconSource: buttonIconLeft.source + property var iconOnRightSide: false property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text - property color color: UM.Theme.getColor("primary") property color hoverColor: UM.Theme.getColor("primary_hover") property color disabledColor: color @@ -26,33 +21,31 @@ Button property color outlineColor: color property color outlineHoverColor: hoverColor property color outlineDisabledColor: outlineColor - hoverEnabled: true - property alias shadowColor: shadow.color property alias shadowEnabled: shadow.visible - // This property is used to indicate whether the button has a fixed width or the width would depend on the contents // Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case, // we elide the text to the right so the text will be cut off with the three dots at the end. property var fixedWidthMode: false - - width: buttonIcon.width + buttonText.width + buttonIconRight.width - contentItem: Item + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("action_button").height + contentItem: Row { + //Icon if displayed on the left side. UM.RecolorImage { - id: buttonIcon + id: buttonIconLeft source: "" - height: Math.round(0.6 * parent.height) - width: height + height: buttonText.height + width: visible ? height : 0 sourceSize.width: width sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" + visible: source != "" && !button.iconOnRightSide anchors.verticalCenter: parent.verticalCenter } - Label { id: buttonText @@ -66,22 +59,21 @@ Button horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight } - + //Icon if displayed on the right side. UM.RecolorImage { id: buttonIconRight - source: "" - height: Math.round(0.6 * parent.height) - width: height + source: buttonIconLeft.source + anchors.right: parent.right + height: buttonText.height + width: visible ? height : 0 sourceSize.width: width sourceSize.height: height - color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" - anchors.verticalCenter: parent.verticalCenter - anchors.right: source != "" ? parent.right : undefined + color: buttonIconLeft.color + visible: source != "" && button.iconOnRightSide + anchors.verticalCenter: buttonIconLeft.verticalCenter } } - background: Rectangle { id: backgroundRect @@ -90,7 +82,6 @@ Button border.width: UM.Theme.getSize("default_lining").width border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor } - DropShadow { id: shadow @@ -103,7 +94,6 @@ Button // Should always be drawn behind the background. z: backgroundRect.z - 1 } - ToolTip { id: tooltip @@ -111,4 +101,4 @@ Button delay: 500 visible: text != "" && button.hovered } -} +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 253a13c0f0..85472bae8d 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -323,18 +323,9 @@ Cura.ExpandableComponent Cura.ActionButton { id: settingControlButton - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Custom") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSourceRight: UM.Theme.getIcon("arrow_right") - width: UM.Theme.getSize("print_setup_action_button").width - fixedWidthMode: true visible: currentModeIndex == 0 + text: catalog.i18nc("@button", "Custom") + width: UM.Theme.getSize("print_setup_action_button").width anchors { top: parent.top @@ -344,6 +335,13 @@ Cura.ExpandableComponent rightMargin: UM.Theme.getSize("narrow_margin").height } + color: UM.Theme.getColor("secondary") + hoverColor: UM.Theme.getColor("secondary") + textColor: UM.Theme.getColor("primary") + textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.getIcon("arrow_right") + iconOnRightSide: true + onClicked: currentModeIndex = 1 } @@ -351,13 +349,17 @@ Cura.ExpandableComponent { height: UM.Theme.getSize("action_panel_button").height text: catalog.i18nc("@button", "Recommended") + color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") + iconSource: UM.Theme.getIcon("arrow_left") + width: UM.Theme.getSize("print_setup_action_button").width fixedWidthMode: true + visible: currentModeIndex == 1 anchors { From 990c653af4eaf11e22dc49a9f9ea1c96d61a43d4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 28 Nov 2018 17:29:25 +0100 Subject: [PATCH 363/558] Refactor the code a bit more to better align the components in the recommended mode. Contributes to CURA-5941. --- resources/qml/ActionButton.qml | 18 +- resources/qml/ExpandableComponent.qml | 2 +- resources/qml/IconLabel.qml | 5 +- .../PrintSetupSelector/PrintSetupSelector.qml | 13 +- .../PrintSetupSelectorContents.qml | 294 +-- .../PrintSetupSelectorHeader.qml | 8 +- .../RecommendedPrintSetup.qml | 2034 ++++++++--------- resources/qml/qmldir | 1 + resources/themes/cura-light/theme.json | 1 + 9 files changed, 1134 insertions(+), 1242 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 732858c67f..b9a04f3b46 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -12,7 +12,6 @@ Button { id: button property alias iconSource: buttonIcon.source - property alias iconSourceRight: buttonIconRight.source property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text @@ -37,8 +36,7 @@ Button // we elide the text to the right so the text will be cut off with the three dots at the end. property var fixedWidthMode: false - width: buttonIcon.width + buttonText.width + buttonIconRight.width - contentItem: Item + contentItem: Row { UM.RecolorImage { @@ -66,20 +64,6 @@ Button horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight } - - UM.RecolorImage - { - id: buttonIconRight - source: "" - height: Math.round(0.6 * parent.height) - width: height - sourceSize.width: width - sourceSize.height: height - color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" - anchors.verticalCenter: parent.verticalCenter - anchors.right: source != "" ? parent.right : undefined - } } background: Rectangle diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 897d44d941..0c3a8f80b9 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -74,7 +74,7 @@ Item function togglePopup() { - if(popup.visible) + if (popup.visible) { popup.close() } diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 0941254e7b..ee4a1254ec 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.1 -import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.3 import UM 1.1 as UM @@ -48,7 +47,7 @@ Item text: "Empty label" elide: Text.ElideRight color: UM.Theme.getColor("text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering } } \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index c69dd56520..1794a54cdf 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -11,7 +11,6 @@ Cura.ExpandableComponent { id: base - property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced property string enabledText: catalog.i18nc("@label:Should be short", "On") @@ -27,13 +26,6 @@ Cura.ExpandableComponent popupClosePolicy: Popup.CloseOnEscape - onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) - - Component.onCompleted: - { - popupItemWrapper.width = base.width - } - UM.I18nCatalog { id: catalog @@ -61,8 +53,5 @@ Cura.ExpandableComponent id: extrudersModel } - popupItem: PrintSetupSelectorContents - { - - } + popupItem: PrintSetupSelectorContents {} } \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index e7b3b94b11..c36a0fbb80 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -3,24 +3,26 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 import UM 1.3 as UM import Cura 1.0 as Cura -Rectangle +Item { - property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 - id: popupItemWrapper - height: total_height + id: popup - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") + width: UM.Theme.getSize("print_setup_widget").width + height: childrenRect.height - Item + property int currentModeIndex: -1 + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + + // Header of the popup + Rectangle { - id: popupItemHeader - height: 36 + id: header + height: UM.Theme.getSize("print_setup_widget_header").height + color: UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here anchors { @@ -31,8 +33,8 @@ Rectangle Label { - id: popupItemHeaderText - text: catalog.i18nc("@label", "Print settings"); + id: headerLabel + text: catalog.i18nc("@label", "Print settings") font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter @@ -47,221 +49,153 @@ Rectangle } } - Rectangle - { - width: parent.width - height: UM.Theme.getSize("default_lining").height - anchors.top: popupItemHeaderText.bottom - color: UM.Theme.getColor("action_button_border") - - - } - Button { - id: closeButton; - width: UM.Theme.getSize("message_close").width; - height: UM.Theme.getSize("message_close").height; + id: closeButton + width: UM.Theme.getSize("message_close").width + height: UM.Theme.getSize("message_close").height anchors { - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - top: parent.top; - topMargin: 10 + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter } - UM.RecolorImage + contentItem: UM.RecolorImage { - anchors.fill: parent; + anchors.fill: parent sourceSize.width: width sourceSize.height: width color: UM.Theme.getColor("message_text") source: UM.Theme.getIcon("cross1") } - onClicked: base.togglePopup() // Will hide the popup item + background: Item {} - background: Rectangle - { - color: UM.Theme.getColor("message_background") - } + onClicked: togglePopup() // Will hide the popup item } } Rectangle { - id: popupItemContent - width: parent.width - height: tabBar.height + sidebarContents.height + id: topSeparator + anchors.bottom: header.bottom + width: parent.width + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") + } + + Loader + { + id: loader + width: parent.width anchors { - top: popupItemHeader.bottom - topMargin: UM.Theme.getSize("narrow_margin").height - right: parent.right - left: parent.left + top: header.bottom leftMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width } + sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup + } - UM.TabRow - { - id: tabBar - anchors.topMargin: UM.Theme.getSize("default_margin").height - onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) - z: 1 - Repeater - { - model: extrudersModel - delegate: UM.TabRowButton - { - contentItem: Rectangle - { - z: 2 - Cura.ExtruderIcon - { - anchors.horizontalCenter: parent.horizontalCenter - materialColor: model.color - extruderEnabled: model.enabled - width: parent.height - height: parent.height - } - } +// Item +// { +// id: content +// width: parent.width +// height: 100 +////// height: tabBar.height + sidebarContents.height +//// +// anchors +// { +// top: header.bottom +// leftMargin: UM.Theme.getSize("default_margin").width +// rightMargin: UM.Theme.getSize("default_margin").width +// } +//// +//// Rectangle +//// { +//// id: sidebarContents +//// anchors.top: tabBar.bottom +//// anchors.bottom: parent.bottom +//// anchors.left: parent.left +//// anchors.right: parent.right +//// height: UM.Theme.getSize("print_setup_widget").height +//// +//// border.width: UM.Theme.getSize("default_lining").width * 2 +//// border.color: UM.Theme.getColor("action_button_border") +//// } +// } - background: Rectangle - { + Rectangle + { + id: buttonsSeparator - width: parent.width - z: 1 - border.width: UM.Theme.getSize("default_lining").width * 2 - border.color: UM.Theme.getColor("action_button_border") - - visible: - { - return index == tabBar.currentIndex - } - - // overlap bottom border - Rectangle - { - width: parent.width - UM.Theme.getSize("default_lining").width * 4 - height: UM.Theme.getSize("default_lining").width * 4 - anchors.bottom: parent.bottom - anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2) - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.left: parent.left - - } - } - } - } - } - - Rectangle - { - id: sidebarContents - anchors.top: tabBar.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("print_setup_widget").height - - border.width: UM.Theme.getSize("default_lining").width * 2 - border.color: UM.Theme.getColor("action_button_border") - - RecommendedPrintSetup - { - anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.fill: parent - visible: currentModeIndex != 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - - CustomPrintSetup - { - anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.bottomMargin: 2 //don't overlap bottom border - anchors.fill: parent - visible: currentModeIndex == 1 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - } + anchors.top: loader.bottom + width: parent.width + height: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") } Item { - id: footerControll - anchors.top: popupItemContent.bottom - anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 - width: parent.width - height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 - Rectangle + id: buttonRow + height: childrenRect.height + + // The buttonsSeparator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. + anchors { - width: parent.width - height: UM.Theme.getSize("default_lining").height - color: UM.Theme.getColor("action_button_border") + top: buttonsSeparator.top + left: parent.left + right: parent.right } - Cura.ActionButton + Cura.SecondaryButton { - id: settingControlButton + anchors.left: parent.left leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Custom") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSourceRight: UM.Theme.getIcon("arrow_right") - width: UM.Theme.getSize("print_setup_action_button").width - fixedWidthMode: true - visible: currentModeIndex == 0 - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 - right: parent.right - rightMargin: UM.Theme.getSize("narrow_margin").height - } - - onClicked: currentModeIndex = 1 + text: catalog.i18nc("@button", "Recommended") + visible: currentModeIndex == 1 + onClicked: currentModeIndex = 0 } - Cura.ActionButton + Cura.SecondaryButton { - height: UM.Theme.getSize("action_panel_button").height - text: catalog.i18nc("@button", "Recommended") - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.getIcon("arrow_left") - width: UM.Theme.getSize("print_setup_action_button").width - fixedWidthMode: true - visible: currentModeIndex == 1 - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 - left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height - } - - MouseArea { - anchors.fill: parent - onClicked: currentModeIndex = 0 - } + anchors.right: parent.right + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@button", "Custom") + visible: currentModeIndex == 0 + onClicked: currentModeIndex = 1 } } + Component + { + id: recommendedPrintSetup + RecommendedPrintSetup + { + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + } + + Component + { + id: customPrintSetup + CustomPrintSetup + { + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + } + } + + Component.onCompleted: { + print(height, "!!!!!!!!!!!!!!!!!!!!!!!") var index = Math.round(UM.Preferences.getValue("cura/active_mode")) if(index != null && !isNaN(index)) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index f8fb246085..d4057289f6 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura RowLayout { - Cura.IconLabel + Cura.IconWithText { source: UM.Theme.getIcon("category_layer_height") text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : "" @@ -24,7 +24,7 @@ RowLayout } } - Cura.IconLabel + Cura.IconWithText { source: UM.Theme.getIcon("category_infill") text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%" @@ -38,7 +38,7 @@ RowLayout } } - Cura.IconLabel + Cura.IconWithText { source: UM.Theme.getIcon("category_support") text: supportEnabled.properties.value == "True" ? enabledText : disabledText @@ -53,7 +53,7 @@ RowLayout } } - Cura.IconLabel + Cura.IconWithText { source: UM.Theme.getIcon("category_adhesion") text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText diff --git a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml index a11eae3218..5d195bdde4 100644 --- a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura @@ -15,6 +14,7 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() + height: childrenRect.height property Action configureSettings @@ -26,1088 +26,1072 @@ Item name: "cura" } - ScrollView + // + // Quality profile + // + Item { - visible: Cura.MachineManager.activeMachineName != "" // If no printers added then the view is invisible - anchors.fill: parent - style: UM.Theme.styles.scrollview - flickableItem.flickableDirection: Flickable.VerticalFlick + id: qualityRow - Item + height: UM.Theme.getSize("thick_margin").height + anchors.topMargin: UM.Theme.getSize("thick_margin").height + anchors.left: parent.left + anchors.right: parent.right + + Timer { - width: childrenRect.width - height: childrenRect.height - - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - // - // Quality profile - // - Item + id: qualitySliderChangeTimer + interval: 50 + running: false + repeat: false + onTriggered: { - id: qualityRow + var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value); + Cura.MachineManager.activeQualityGroup = item.quality_group; + } + } - height: UM.Theme.getSize("thick_margin").height - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.left: parent.left - anchors.right: parent.right + Component.onCompleted: qualityModel.update() - Timer + Connections + { + target: Cura.QualityProfilesDropDownMenuModel + onItemsChanged: qualityModel.update() + } + + Connections { + target: base + onVisibleChanged: + { + // update needs to be called when the widgets are visible, otherwise the step width calculation + // will fail because the width of an invisible item is 0. + if (visible) { - id: qualitySliderChangeTimer - interval: 50 - running: false - repeat: false - onTriggered: - { - var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value); - Cura.MachineManager.activeQualityGroup = item.quality_group; - } + qualityModel.update(); } + } + } - Component.onCompleted: qualityModel.update() + ListModel + { + id: qualityModel - Connections + property var totalTicks: 0 + property var availableTotalTicks: 0 + property var existingQualityProfile: 0 + + property var qualitySliderActiveIndex: 0 + property var qualitySliderStepWidth: 0 + property var qualitySliderAvailableMin: 0 + property var qualitySliderAvailableMax: 0 + property var qualitySliderMarginRight: 0 + + function update () + { + reset() + + var availableMin = -1 + var availableMax = -1 + + for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) { - target: Cura.QualityProfilesDropDownMenuModel - onItemsChanged: qualityModel.update() - } + var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i) - Connections { - target: base - onVisibleChanged: + // Add each quality item to the UI quality model + qualityModel.append(qualityItem) + + // Set selected value + if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) { - // update needs to be called when the widgets are visible, otherwise the step width calculation - // will fail because the width of an invisible item is 0. - if (visible) + // set to -1 when switching to user created profile so all ticks are clickable + if (Cura.SimpleModeSettingsManager.isProfileUserCreated) { - qualityModel.update(); - } - } - } - - ListModel - { - id: qualityModel - - property var totalTicks: 0 - property var availableTotalTicks: 0 - property var existingQualityProfile: 0 - - property var qualitySliderActiveIndex: 0 - property var qualitySliderStepWidth: 0 - property var qualitySliderAvailableMin: 0 - property var qualitySliderAvailableMax: 0 - property var qualitySliderMarginRight: 0 - - function update () - { - reset() - - var availableMin = -1 - var availableMax = -1 - - for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) - { - var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i) - - // Add each quality item to the UI quality model - qualityModel.append(qualityItem) - - // Set selected value - if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) - { - // set to -1 when switching to user created profile so all ticks are clickable - if (Cura.SimpleModeSettingsManager.isProfileUserCreated) - { - qualityModel.qualitySliderActiveIndex = -1 - } - else - { - qualityModel.qualitySliderActiveIndex = i - } - - qualityModel.existingQualityProfile = 1 - } - - // Set min available - if (qualityItem.available && availableMin == -1) - { - availableMin = i - } - - // Set max available - if (qualityItem.available) - { - availableMax = i - } - } - - // Set total available ticks for active slider part - if (availableMin != -1) - { - qualityModel.availableTotalTicks = availableMax - availableMin + 1 - } - - // Calculate slider values - calculateSliderStepWidth(qualityModel.totalTicks) - calculateSliderMargins(availableMin, availableMax, qualityModel.totalTicks) - - qualityModel.qualitySliderAvailableMin = availableMin - qualityModel.qualitySliderAvailableMax = availableMax - } - - function calculateSliderStepWidth (totalTicks) - { - qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0 - } - - function calculateSliderMargins (availableMin, availableMax, totalTicks) - { - if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) - { - qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55) - } - else if (availableMin == availableMax) - { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth) + qualityModel.qualitySliderActiveIndex = -1 } else { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth) + qualityModel.qualitySliderActiveIndex = i } + + qualityModel.existingQualityProfile = 1 } - function reset () { - qualityModel.clear() - qualityModel.availableTotalTicks = 0 - qualityModel.existingQualityProfile = 0 + // Set min available + if (qualityItem.available && availableMin == -1) + { + availableMin = i + } - // check, the ticks count cannot be less than zero - qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1) + // Set max available + if (qualityItem.available) + { + availableMax = i } } - Cura.IconLabel + // Set total available ticks for active slider part + if (availableMin != -1) { - id: qualityRowTitle - source: UM.Theme.getIcon("category_layer_height") - text: catalog.i18nc("@label", "Layer Height") - anchors.bottom: speedSlider.bottom + qualityModel.availableTotalTicks = availableMax - availableMin + 1 } - // Show titles for the each quality slider ticks - Item + // Calculate slider values + calculateSliderStepWidth(qualityModel.totalTicks) + calculateSliderMargins(availableMin, availableMax, qualityModel.totalTicks) + + qualityModel.qualitySliderAvailableMin = availableMin + qualityModel.qualitySliderAvailableMax = availableMax + } + + function calculateSliderStepWidth (totalTicks) + { + qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0 + } + + function calculateSliderMargins (availableMin, availableMax, totalTicks) + { + if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) { - anchors.left: speedSlider.left - anchors.top: speedSlider.bottom - Repeater - { - model: qualityModel - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.top: parent.bottom - color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - text: - { - var result = "" - if(Cura.MachineManager.activeMachine != null) - { - result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height - - if(result == undefined) - { - result = ""; - } - else - { - result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... - if (result == undefined || result != result) //Parse failure. - { - result = ""; - } - } - } - return result - } - - x: - { - // Make sure the text aligns correctly with each tick - if (qualityModel.totalTicks == 0) - { - // If there is only one tick, align it centrally - return Math.round(((base.width * 0.55) - width) / 2) - } - else if (index == 0) - { - return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - } - else if (index == qualityModel.totalTicks) - { - return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width - } - else - { - return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)) - } - } - } - } + qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55) } - - //Print speed slider - Rectangle + else if (availableMin == availableMax) { - id: speedSlider - width: Math.round(base.width * 0.55) - height: UM.Theme.getSize("thick_margin").height - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("thick_margin").height - - // This Item is used only for tooltip, for slider area which is unavailable - Item - { - function showTooltip (showTooltip) - { - if (showTooltip) - { - var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - else - { - base.hideTooltip() - } - } - - id: unavailableLineToolTip - height: 20 * screenScaleFactor // hovered area height - z: parent.z + 1 // should be higher, otherwise the area can be hovered - x: 0 - anchors.verticalCenter: qualitySlider.verticalCenter - - Rectangle - { - id: leftArea - width: - { - if (qualityModel.availableTotalTicks == 0) - { - return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks - } - return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 - } - height: parent.height - color: "transparent" - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false - onEntered: unavailableLineToolTip.showTooltip(true) - onExited: unavailableLineToolTip.showTooltip(false) - } - } - - Item - { - id: rightArea - width: - { - if(qualityModel.availableTotalTicks == 0) - return 0 - - return qualityModel.qualitySliderMarginRight - 10 - } - height: parent.height - x: - { - if (qualityModel.availableTotalTicks == 0) - { - return 0 - } - - var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 - - return totalGap - } - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false - onEntered: unavailableLineToolTip.showTooltip(true) - onExited: unavailableLineToolTip.showTooltip(false) - } - } - } - - // Draw Unavailable line - Rectangle - { - id: groovechildrect - width: Math.round(base.width * 0.55) - height: 2 * screenScaleFactor - color: UM.Theme.getColor("quality_slider_unavailable") - anchors.verticalCenter: qualitySlider.verticalCenter - x: 0 - } - - // Draw ticks - Repeater - { - id: qualityRepeater - model: qualityModel.totalTicks > 0 ? qualityModel : 0 - - Rectangle - { - color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 5 * screenScaleFactor - implicitHeight: implicitWidth - anchors.verticalCenter: qualitySlider.verticalCenter - x: Math.round(qualityModel.qualitySliderStepWidth * index) - radius: Math.round(implicitWidth / 2) - } - } - - Slider - { - id: qualitySlider - height: UM.Theme.getSize("thick_margin").height - anchors.bottom: speedSlider.bottom - enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized - visible: qualityModel.availableTotalTicks > 0 - updateValueWhileDragging : false - - minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 - // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly - // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) - maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 - stepSize: 1 - - value: qualityModel.qualitySliderActiveIndex - - width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) - - anchors.right: parent.right - anchors.rightMargin: qualityModel.qualitySliderMarginRight - - style: SliderStyle - { - //Draw Available line - groove: Rectangle - { - implicitHeight: 2 * screenScaleFactor - color: UM.Theme.getColor("quality_slider_available") - radius: Math.round(height / 2) - } - handle: Item - { - Rectangle - { - id: qualityhandleButton - anchors.centerIn: parent - color: UM.Theme.getColor("quality_slider_available") - implicitWidth: 10 * screenScaleFactor - implicitHeight: implicitWidth - radius: Math.round(implicitWidth / 2) - visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile - } - } - } - - onValueChanged: - { - // only change if an active machine is set and the slider is visible at all. - if (Cura.MachineManager.activeMachine != null && visible) - { - // prevent updating during view initializing. Trigger only if the value changed by user - if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) - { - // start updating with short delay - qualitySliderChangeTimer.start() - } - } - } - } - - MouseArea - { - id: speedSliderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated - - onEntered: - { - var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - onExited: base.hideTooltip() - } + qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth) } - - UM.SimpleButton + else { - id: customisedSettings - - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated - height: Math.round(speedSlider.height * 0.8) - width: Math.round(speedSlider.height * 0.8) - - anchors.verticalCenter: speedSlider.verticalCenter - anchors.right: speedSlider.left - anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); - iconSource: UM.Theme.getIcon("reset"); - - onClicked: - { - // if the current profile is user-created, switch to a built-in quality - Cura.MachineManager.resetToUseDefaultQuality() - } - onEntered: - { - var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - onExited: base.hideTooltip() + qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth) } } - // - // Infill - // - Item - { - id: infillCellLeft + function reset () { + qualityModel.clear() + qualityModel.availableTotalTicks = 0 + qualityModel.existingQualityProfile = 0 - anchors.top: qualityRow.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height * 2 - anchors.left: parent.left - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width - - Cura.IconLabel - { - id: infillLabel - source: UM.Theme.getIcon("category_infill") - text: catalog.i18nc("@label", "Infill") + " (%)" - - anchors - { - top: parent.top - topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) - left: parent.left - } - } + // check, the ticks count cannot be less than zero + qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1) } + } - Item + Cura.IconWithText + { + id: qualityRowTitle + source: UM.Theme.getIcon("category_layer_height") + text: catalog.i18nc("@label", "Layer Height") + anchors.bottom: speedSlider.bottom + } + + // Show titles for the each quality slider ticks + Item + { + anchors.left: speedSlider.left + anchors.top: speedSlider.bottom + Repeater { - id: infillCellRight - - height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - - anchors.left: infillCellLeft.right - anchors.top: infillCellLeft.top - anchors.topMargin: UM.Theme.getSize("thick_margin").height - - Label { - id: selectedInfillRateText - - anchors.left: infillSlider.left - anchors.right: parent.right - - text: parseInt(infillDensity.properties.value) + "%" - horizontalAlignment: Text.AlignLeft - - color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - } - - // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider - Binding - { - target: infillSlider - property: "value" - value: parseInt(infillDensity.properties.value) - } - - Slider - { - id: infillSlider - - anchors.top: selectedInfillRateText.bottom - anchors.left: parent.left - anchors.right: infillIcon.left - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - height: UM.Theme.getSize("thick_margin").height - width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) - - minimumValue: 0 - maximumValue: 100 - stepSize: 1 - tickmarksEnabled: true - - // disable slider when gradual support is enabled - enabled: parseInt(infillSteps.properties.value) == 0 - - // set initial value from stack - value: parseInt(infillDensity.properties.value) - - onValueChanged: - { - - // Don't round the value if it's already the same - if (parseInt(infillDensity.properties.value) == infillSlider.value) - { - return - } - - // Round the slider value to the nearest multiple of 10 (simulate step size of 10) - var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 - - // Update the slider value to represent the rounded value - infillSlider.value = roundedSliderValue - - // Update value only if the Recomended mode is Active, - // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat - // same operation - var active_mode = UM.Preferences.getValue("cura/active_mode") - - if (active_mode == 0 || active_mode == "simple") - { - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) - Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") - } - } - - style: SliderStyle - { - groove: Rectangle - { - id: groove - implicitWidth: 200 * screenScaleFactor - implicitHeight: 2 * screenScaleFactor - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - radius: 1 - } - - handle: Item - { - Rectangle - { - id: handleButton - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 10 * screenScaleFactor - implicitHeight: 10 * screenScaleFactor - radius: 10 * screenScaleFactor - } - } - - tickmarks: Repeater - { - id: repeater - model: control.maximumValue / control.stepSize + 1 - - // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) - function shouldShowTick (index) - { - if (index % 10 == 0) - { - return true - } - return false - } - - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - width: 1 * screenScaleFactor - height: 6 * screenScaleFactor - x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) - visible: shouldShowTick(index) - } - } - } - } - - Rectangle - { - id: infillIcon - - width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) - height: width - - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) - - // we loop over all density icons and only show the one that has the current density and steps - Repeater - { - id: infillIconList - model: infillModel - anchors.fill: parent - - function activeIndex () - { - for (var i = 0; i < infillModel.count; i++) - { - var density = Math.round(infillDensity.properties.value) - var steps = Math.round(infillSteps.properties.value) - var infillModelItem = infillModel.get(i) - - if (infillModelItem != "undefined" - && density >= infillModelItem.percentageMin - && density <= infillModelItem.percentageMax - && steps >= infillModelItem.stepsMin - && steps <= infillModelItem.stepsMax) - { - return i - } - } - return -1 - } - - Rectangle - { - anchors.fill: parent - visible: infillIconList.activeIndex() == index - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("quality_slider_unavailable") - - UM.RecolorImage - { - anchors.fill: parent - anchors.margins: 2 * screenScaleFactor - sourceSize.width: width - sourceSize.height: width - source: UM.Theme.getIcon(model.icon) - color: UM.Theme.getColor("quality_slider_unavailable") - } - } - } - } - - // Gradual Support Infill Checkbox - CheckBox - { - id: enableGradualInfillCheckBox - property alias _hovered: enableGradualInfillMouseArea.containsMouse - - anchors.top: infillSlider.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - visible: infillSteps.properties.enabled == "True" - checked: parseInt(infillSteps.properties.value) > 0 - - MouseArea - { - id: enableGradualInfillMouseArea - - anchors.fill: parent - hoverEnabled: true - enabled: true - - property var previousInfillDensity: parseInt(infillDensity.properties.value) - - onClicked: - { - // Set to 90% only when enabling gradual infill - var newInfillDensity; - if (parseInt(infillSteps.properties.value) == 0) - { - previousInfillDensity = parseInt(infillDensity.properties.value) - newInfillDensity = 90 - } else { - newInfillDensity = previousInfillDensity - } - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) - - var infill_steps_value = 0 - if (parseInt(infillSteps.properties.value) == 0) - { - infill_steps_value = 5 - } - - Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) - } - - onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), - catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) - - onExited: base.hideTooltip() - - } - - Label - { - id: gradualInfillLabel - height: parent.height - anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - verticalAlignment: Text.AlignVCenter; - text: catalog.i18nc("@label", "Enable gradual") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - } - - // Infill list model for mapping icon - ListModel - { - id: infillModel - Component.onCompleted: - { - infillModel.append({ - percentageMin: -1, - percentageMax: 0, - stepsMin: -1, - stepsMax: 0, - icon: "hollow" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 40, - stepsMin: -1, - stepsMax: 0, - icon: "sparse" - }) - infillModel.append({ - percentageMin: 40, - percentageMax: 89, - stepsMin: -1, - stepsMax: 0, - icon: "dense" - }) - infillModel.append({ - percentageMin: 90, - percentageMax: 9999999999, - stepsMin: -1, - stepsMax: 0, - icon: "solid" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 9999999999, - stepsMin: 1, - stepsMax: 9999999999, - icon: "gradual" - }) - } - } - } - - // - // Enable support - // - Cura.IconLabel - { - id: enableSupportLabel - visible: enableSupportCheckBox.visible - source: UM.Theme.getIcon("category_support") - text: catalog.i18nc("@label", "Support") - - anchors - { - top: infillCellRight.bottom - topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) - left: parent.left - right: infillCellLeft.right - rightMargin: UM.Theme.getSize("thick_margin").width - verticalCenter: enableSupportCheckBox.verticalCenter - } - } - - CheckBox - { - id: enableSupportCheckBox - property alias _hovered: enableSupportMouseArea.containsMouse - - anchors.top: enableSupportLabel.top - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: supportEnabled.properties.enabled == "True" - checked: supportEnabled.properties.value == "True" - - MouseArea - { - id: enableSupportMouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") - - onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), - catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) - - onExited: base.hideTooltip() - - } - } - - ComboBox - { - id: supportExtruderCombobox - visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) - model: extruderModel - - property string color_override: "" // for manually setting values - property string color: // is evaluated automatically, but the first time is before extruderModel being filled - { - var current_extruder = extruderModel.get(currentIndex); - color_override = ""; - if (current_extruder === undefined) return "" - return (current_extruder.color) ? current_extruder.color : ""; - } - - textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started - - anchors.top: enableSupportCheckBox.top - - anchors.left: enableSupportCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width - height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 - - Behavior on height { NumberAnimation { duration: 100 } } - - style: UM.Theme.styles.combobox_color - enabled: base.settingsEnabled - property alias _hovered: supportExtruderMouseArea.containsMouse - - currentIndex: - { - if (supportExtruderNr.properties == null) - { - return Cura.MachineManager.defaultExtruderPosition - } - else - { - var extruder = parseInt(supportExtruderNr.properties.value) - if ( extruder === -1) - { - return Cura.MachineManager.defaultExtruderPosition - } - return extruder; - } - } - - onActivated: supportExtruderNr.setPropertyValue("value", String(index)) - - MouseArea - { - id: supportExtruderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - acceptedButtons: Qt.NoButton - onEntered: - { - base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), - catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); - } - onExited: base.hideTooltip() - - } - - function updateCurrentColor() - { - var current_extruder = extruderModel.get(currentIndex) - if (current_extruder !== undefined) - { - supportExtruderCombobox.color_override = current_extruder.color - } - } - - } - - Cura.IconLabel - { - id: adhesionHelperLabel - visible: adhesionCheckBox.visible - source: UM.Theme.getIcon("category_adhesion") - text: catalog.i18nc("@label", "Adhesion") - - anchors - { - left: parent.left - right: infillCellLeft.right - rightMargin: UM.Theme.getSize("thick_margin").width - verticalCenter: adhesionCheckBox.verticalCenter - } - } - - CheckBox - { - id: adhesionCheckBox - property alias _hovered: adhesionMouseArea.containsMouse - - anchors.top: enableSupportCheckBox.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.left: infillCellRight.left - - //: Setting enable printing build-plate adhesion helper checkbox - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: platformAdhesionType.properties.enabled == "True" - checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" - - MouseArea - { - id: adhesionMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - onClicked: - { - var adhesionType = "skirt" - if(!parent.checked) - { - // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft - platformAdhesionType.removeFromContainer(0) - adhesionType = platformAdhesionType.properties.value - if(adhesionType == "skirt" || adhesionType == "none") - { - // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim - adhesionType = "brim" - } - } - platformAdhesionType.setPropertyValue("value", adhesionType) - } - onEntered: - { - base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), - catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); - } - onExited: base.hideTooltip() - - } - } - - ListModel - { - id: extruderModel - Component.onCompleted: populateExtruderModel() - } - - //: Model used to populate the extrudelModel - Cura.ExtrudersModel - { - id: extruders - onModelChanged: populateExtruderModel() - } - - Item - { - id: tipsCell - anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 2) - anchors.left: parent.left - width: parent.width - height: tipsText.contentHeight * tipsText.lineCount + model: qualityModel Label { - id: tipsText - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - anchors.top: parent.top - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "Need help improving your prints?
Read the Ultimaker Troubleshooting Guides").arg("https://ultimaker.com/en/troubleshooting") - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - linkColor: UM.Theme.getColor("text_link") - onLinkActivated: Qt.openUrlExternally(link) + anchors.verticalCenter: parent.verticalCenter + anchors.top: parent.bottom + color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + text: + { + var result = "" + if(Cura.MachineManager.activeMachine != null) + { + result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height + + if(result == undefined) + { + result = ""; + } + else + { + result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... + if (result == undefined || result != result) //Parse failure. + { + result = ""; + } + } + } + return result + } + + x: + { + // Make sure the text aligns correctly with each tick + if (qualityModel.totalTicks == 0) + { + // If there is only one tick, align it centrally + return Math.round(((base.width * 0.55) - width) / 2) + } + else if (index == 0) + { + return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index + } + else if (index == qualityModel.totalTicks) + { + return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width + } + else + { + return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)) + } + } + } + } + } + + //Print speed slider + Rectangle + { + id: speedSlider + width: Math.round(base.width * 0.55) + height: UM.Theme.getSize("thick_margin").height + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("thick_margin").height + + // This Item is used only for tooltip, for slider area which is unavailable + Item + { + function showTooltip (showTooltip) + { + if (showTooltip) + { + var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + } + else + { + base.hideTooltip() + } + } + + id: unavailableLineToolTip + height: 20 * screenScaleFactor // hovered area height + z: parent.z + 1 // should be higher, otherwise the area can be hovered + x: 0 + anchors.verticalCenter: qualitySlider.verticalCenter + + Rectangle + { + id: leftArea + width: + { + if (qualityModel.availableTotalTicks == 0) + { + return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks + } + return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 + } + height: parent.height + color: "transparent" + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false + onEntered: unavailableLineToolTip.showTooltip(true) + onExited: unavailableLineToolTip.showTooltip(false) + } + } + + Item + { + id: rightArea + width: + { + if(qualityModel.availableTotalTicks == 0) + return 0 + + return qualityModel.qualitySliderMarginRight - 10 + } + height: parent.height + x: + { + if (qualityModel.availableTotalTicks == 0) + { + return 0 + } + + var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin + var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 + + return totalGap + } + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false + onEntered: unavailableLineToolTip.showTooltip(true) + onExited: unavailableLineToolTip.showTooltip(false) + } } } - UM.SettingPropertyProvider + // Draw Unavailable line + Rectangle { - id: infillExtruderNumber - containerStackId: Cura.MachineManager.activeStackId - key: "infill_extruder_nr" - watchedProperties: [ "value" ] - storeIndex: 0 + id: groovechildrect + width: Math.round(base.width * 0.55) + height: 2 * screenScaleFactor + color: UM.Theme.getColor("quality_slider_unavailable") + anchors.verticalCenter: qualitySlider.verticalCenter + x: 0 } - UM.SettingPropertyProvider + // Draw ticks + Repeater { - id: infillDensity - containerStackId: Cura.MachineManager.activeStackId - key: "infill_sparse_density" - watchedProperties: [ "value" ] - storeIndex: 0 + id: qualityRepeater + model: qualityModel.totalTicks > 0 ? qualityModel : 0 + + Rectangle + { + color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: 5 * screenScaleFactor + implicitHeight: implicitWidth + anchors.verticalCenter: qualitySlider.verticalCenter + x: Math.round(qualityModel.qualitySliderStepWidth * index) + radius: Math.round(implicitWidth / 2) + } } - UM.SettingPropertyProvider + Slider { - id: infillSteps - containerStackId: Cura.MachineManager.activeStackId - key: "gradual_infill_steps" - watchedProperties: ["value", "enabled"] - storeIndex: 0 + id: qualitySlider + height: UM.Theme.getSize("thick_margin").height + anchors.bottom: speedSlider.bottom + enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized + visible: qualityModel.availableTotalTicks > 0 + updateValueWhileDragging : false + + minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 + // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly + // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) + maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 + stepSize: 1 + + value: qualityModel.qualitySliderActiveIndex + + width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) + + anchors.right: parent.right + anchors.rightMargin: qualityModel.qualitySliderMarginRight + + style: SliderStyle + { + //Draw Available line + groove: Rectangle + { + implicitHeight: 2 * screenScaleFactor + color: UM.Theme.getColor("quality_slider_available") + radius: Math.round(height / 2) + } + handle: Item + { + Rectangle + { + id: qualityhandleButton + anchors.centerIn: parent + color: UM.Theme.getColor("quality_slider_available") + implicitWidth: 10 * screenScaleFactor + implicitHeight: implicitWidth + radius: Math.round(implicitWidth / 2) + visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile + } + } + } + + onValueChanged: + { + // only change if an active machine is set and the slider is visible at all. + if (Cura.MachineManager.activeMachine != null && visible) + { + // prevent updating during view initializing. Trigger only if the value changed by user + if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) + { + // start updating with short delay + qualitySliderChangeTimer.start() + } + } + } } - UM.SettingPropertyProvider + MouseArea { - id: platformAdhesionType - containerStack: Cura.MachineManager.activeMachine - removeUnusedValue: false //Doesn't work with settings that are resolved. - key: "adhesion_type" - watchedProperties: [ "value", "enabled" ] - storeIndex: 0 - } + id: speedSliderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated - UM.SettingPropertyProvider - { - id: supportEnabled - containerStack: Cura.MachineManager.activeMachine - key: "support_enable" - watchedProperties: [ "value", "enabled", "description" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: extrudersEnabledCount - containerStack: Cura.MachineManager.activeMachine - key: "extruders_enabled_count" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: supportExtruderNr - containerStack: Cura.MachineManager.activeMachine - key: "support_extruder_nr" - watchedProperties: [ "value" ] - storeIndex: 0 + onEntered: + { + var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + } + onExited: base.hideTooltip() } } + + UM.SimpleButton + { + id: customisedSettings + + visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated + height: Math.round(speedSlider.height * 0.8) + width: Math.round(speedSlider.height * 0.8) + + anchors.verticalCenter: speedSlider.verticalCenter + anchors.right: speedSlider.left + anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + + color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); + iconSource: UM.Theme.getIcon("reset"); + + onClicked: + { + // if the current profile is user-created, switch to a built-in quality + Cura.MachineManager.resetToUseDefaultQuality() + } + onEntered: + { + var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + } + onExited: base.hideTooltip() + } + } + + // + // Infill + // + Item + { + id: infillCellLeft + + anchors.top: qualityRow.bottom + anchors.topMargin: UM.Theme.getSize("thick_margin").height * 2 + anchors.left: parent.left + + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width + + Cura.IconWithText + { + id: infillLabel + source: UM.Theme.getIcon("category_infill") + text: catalog.i18nc("@label", "Infill") + " (%)" + + anchors + { + top: parent.top + topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) + left: parent.left + } + } + } + + Item + { + id: infillCellRight + + height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) + + anchors.left: infillCellLeft.right + anchors.top: infillCellLeft.top + anchors.topMargin: UM.Theme.getSize("thick_margin").height + + Label { + id: selectedInfillRateText + + anchors.left: infillSlider.left + anchors.right: parent.right + + text: parseInt(infillDensity.properties.value) + "%" + horizontalAlignment: Text.AlignLeft + + color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + } + + // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider + Binding + { + target: infillSlider + property: "value" + value: parseInt(infillDensity.properties.value) + } + + Slider + { + id: infillSlider + + anchors.top: selectedInfillRateText.bottom + anchors.left: parent.left + anchors.right: infillIcon.left + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + + height: UM.Theme.getSize("thick_margin").height + width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) + + minimumValue: 0 + maximumValue: 100 + stepSize: 1 + tickmarksEnabled: true + + // disable slider when gradual support is enabled + enabled: parseInt(infillSteps.properties.value) == 0 + + // set initial value from stack + value: parseInt(infillDensity.properties.value) + + onValueChanged: + { + + // Don't round the value if it's already the same + if (parseInt(infillDensity.properties.value) == infillSlider.value) + { + return + } + + // Round the slider value to the nearest multiple of 10 (simulate step size of 10) + var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 + + // Update the slider value to represent the rounded value + infillSlider.value = roundedSliderValue + + // Update value only if the Recomended mode is Active, + // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat + // same operation + var active_mode = UM.Preferences.getValue("cura/active_mode") + + if (active_mode == 0 || active_mode == "simple") + { + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) + Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") + } + } + + style: SliderStyle + { + groove: Rectangle + { + id: groove + implicitWidth: 200 * screenScaleFactor + implicitHeight: 2 * screenScaleFactor + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + radius: 1 + } + + handle: Item + { + Rectangle + { + id: handleButton + anchors.centerIn: parent + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: 10 * screenScaleFactor + implicitHeight: 10 * screenScaleFactor + radius: 10 * screenScaleFactor + } + } + + tickmarks: Repeater + { + id: repeater + model: control.maximumValue / control.stepSize + 1 + + // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) + function shouldShowTick (index) + { + if (index % 10 == 0) + { + return true + } + return false + } + + Rectangle + { + anchors.verticalCenter: parent.verticalCenter + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + width: 1 * screenScaleFactor + height: 6 * screenScaleFactor + x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) + visible: shouldShowTick(index) + } + } + } + } + + Rectangle + { + id: infillIcon + + width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) + height: width + + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) + + // we loop over all density icons and only show the one that has the current density and steps + Repeater + { + id: infillIconList + model: infillModel + anchors.fill: parent + + function activeIndex () + { + for (var i = 0; i < infillModel.count; i++) + { + var density = Math.round(infillDensity.properties.value) + var steps = Math.round(infillSteps.properties.value) + var infillModelItem = infillModel.get(i) + + if (infillModelItem != "undefined" + && density >= infillModelItem.percentageMin + && density <= infillModelItem.percentageMax + && steps >= infillModelItem.stepsMin + && steps <= infillModelItem.stepsMax) + { + return i + } + } + return -1 + } + + Rectangle + { + anchors.fill: parent + visible: infillIconList.activeIndex() == index + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("quality_slider_unavailable") + + UM.RecolorImage + { + anchors.fill: parent + anchors.margins: 2 * screenScaleFactor + sourceSize.width: width + sourceSize.height: width + source: UM.Theme.getIcon(model.icon) + color: UM.Theme.getColor("quality_slider_unavailable") + } + } + } + } + + // Gradual Support Infill Checkbox + CheckBox + { + id: enableGradualInfillCheckBox + property alias _hovered: enableGradualInfillMouseArea.containsMouse + + anchors.top: infillSlider.bottom + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category + anchors.left: infillCellRight.left + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + visible: infillSteps.properties.enabled == "True" + checked: parseInt(infillSteps.properties.value) > 0 + + MouseArea + { + id: enableGradualInfillMouseArea + + anchors.fill: parent + hoverEnabled: true + enabled: true + + property var previousInfillDensity: parseInt(infillDensity.properties.value) + + onClicked: + { + // Set to 90% only when enabling gradual infill + var newInfillDensity; + if (parseInt(infillSteps.properties.value) == 0) + { + previousInfillDensity = parseInt(infillDensity.properties.value) + newInfillDensity = 90 + } else { + newInfillDensity = previousInfillDensity + } + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) + + var infill_steps_value = 0 + if (parseInt(infillSteps.properties.value) == 0) + { + infill_steps_value = 5 + } + + Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) + } + + onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), + catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) + + onExited: base.hideTooltip() + + } + + Label + { + id: gradualInfillLabel + height: parent.height + anchors.left: enableGradualInfillCheckBox.right + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + verticalAlignment: Text.AlignVCenter; + text: catalog.i18nc("@label", "Enable gradual") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + } + + // Infill list model for mapping icon + ListModel + { + id: infillModel + Component.onCompleted: + { + infillModel.append({ + percentageMin: -1, + percentageMax: 0, + stepsMin: -1, + stepsMax: 0, + icon: "hollow" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 40, + stepsMin: -1, + stepsMax: 0, + icon: "sparse" + }) + infillModel.append({ + percentageMin: 40, + percentageMax: 89, + stepsMin: -1, + stepsMax: 0, + icon: "dense" + }) + infillModel.append({ + percentageMin: 90, + percentageMax: 9999999999, + stepsMin: -1, + stepsMax: 0, + icon: "solid" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 9999999999, + stepsMin: 1, + stepsMax: 9999999999, + icon: "gradual" + }) + } + } + } + + // + // Enable support + // + Cura.IconWithText + { + id: enableSupportLabel + visible: enableSupportCheckBox.visible + source: UM.Theme.getIcon("category_support") + text: catalog.i18nc("@label", "Support") + + anchors + { + top: infillCellRight.bottom + topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) + left: parent.left + right: infillCellLeft.right + rightMargin: UM.Theme.getSize("thick_margin").width + verticalCenter: enableSupportCheckBox.verticalCenter + } + } + + CheckBox + { + id: enableSupportCheckBox + property alias _hovered: enableSupportMouseArea.containsMouse + + anchors.top: enableSupportLabel.top + anchors.left: infillCellRight.left + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: supportEnabled.properties.enabled == "True" + checked: supportEnabled.properties.value == "True" + + MouseArea + { + id: enableSupportMouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") + + onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), + catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) + + onExited: base.hideTooltip() + + } + } + + ComboBox + { + id: supportExtruderCombobox + visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) + model: extruderModel + + property string color_override: "" // for manually setting values + property string color: // is evaluated automatically, but the first time is before extruderModel being filled + { + var current_extruder = extruderModel.get(currentIndex); + color_override = ""; + if (current_extruder === undefined) return "" + return (current_extruder.color) ? current_extruder.color : ""; + } + + textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started + + anchors.top: enableSupportCheckBox.top + + anchors.left: enableSupportCheckBox.right + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width + height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 + + Behavior on height { NumberAnimation { duration: 100 } } + + style: UM.Theme.styles.combobox_color + enabled: base.settingsEnabled + property alias _hovered: supportExtruderMouseArea.containsMouse + + currentIndex: + { + if (supportExtruderNr.properties == null) + { + return Cura.MachineManager.defaultExtruderPosition + } + else + { + var extruder = parseInt(supportExtruderNr.properties.value) + if ( extruder === -1) + { + return Cura.MachineManager.defaultExtruderPosition + } + return extruder; + } + } + + onActivated: supportExtruderNr.setPropertyValue("value", String(index)) + + MouseArea + { + id: supportExtruderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + acceptedButtons: Qt.NoButton + onEntered: + { + base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), + catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + } + onExited: base.hideTooltip() + + } + + function updateCurrentColor() + { + var current_extruder = extruderModel.get(currentIndex) + if (current_extruder !== undefined) + { + supportExtruderCombobox.color_override = current_extruder.color + } + } + + } + + Cura.IconWithText + { + id: adhesionHelperLabel + visible: adhesionCheckBox.visible + source: UM.Theme.getIcon("category_adhesion") + text: catalog.i18nc("@label", "Adhesion") + + anchors + { + left: parent.left + right: infillCellLeft.right + rightMargin: UM.Theme.getSize("thick_margin").width + verticalCenter: adhesionCheckBox.verticalCenter + } + } + + CheckBox + { + id: adhesionCheckBox + property alias _hovered: adhesionMouseArea.containsMouse + + anchors.top: enableSupportCheckBox.bottom + anchors.topMargin: UM.Theme.getSize("thick_margin").height + anchors.left: infillCellRight.left + + //: Setting enable printing build-plate adhesion helper checkbox + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: platformAdhesionType.properties.enabled == "True" + checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" + + MouseArea + { + id: adhesionMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + onClicked: + { + var adhesionType = "skirt" + if(!parent.checked) + { + // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft + platformAdhesionType.removeFromContainer(0) + adhesionType = platformAdhesionType.properties.value + if(adhesionType == "skirt" || adhesionType == "none") + { + // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim + adhesionType = "brim" + } + } + platformAdhesionType.setPropertyValue("value", adhesionType) + } + onEntered: + { + base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), + catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); + } + onExited: base.hideTooltip() + + } + } + + ListModel + { + id: extruderModel + Component.onCompleted: populateExtruderModel() + } + + //: Model used to populate the extrudelModel + Cura.ExtrudersModel + { + id: extruders + onModelChanged: populateExtruderModel() + } + + Item + { + id: tipsCell + anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 2) + anchors.left: parent.left + width: parent.width + height: tipsText.contentHeight * tipsText.lineCount + + Label + { + id: tipsText + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors.top: parent.top + wrapMode: Text.WordWrap + text: catalog.i18nc("@label", "Need help improving your prints?
Read the Ultimaker Troubleshooting Guides").arg("https://ultimaker.com/en/troubleshooting") + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + linkColor: UM.Theme.getColor("text_link") + onLinkActivated: Qt.openUrlExternally(link) + } + } + + UM.SettingPropertyProvider + { + id: infillExtruderNumber + containerStackId: Cura.MachineManager.activeStackId + key: "infill_extruder_nr" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: infillDensity + containerStackId: Cura.MachineManager.activeStackId + key: "infill_sparse_density" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: infillSteps + containerStackId: Cura.MachineManager.activeStackId + key: "gradual_infill_steps" + watchedProperties: ["value", "enabled"] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + removeUnusedValue: false //Doesn't work with settings that are resolved. + key: "adhesion_type" + watchedProperties: [ "value", "enabled" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: supportEnabled + containerStack: Cura.MachineManager.activeMachine + key: "support_enable" + watchedProperties: [ "value", "enabled", "description" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: extrudersEnabledCount + containerStack: Cura.MachineManager.activeMachine + key: "extruders_enabled_count" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: supportExtruderNr + containerStack: Cura.MachineManager.activeMachine + key: "support_extruder_nr" + watchedProperties: [ "value" ] + storeIndex: 0 } function populateExtruderModel() diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 2475f398f8..6db8e0c544 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -9,6 +9,7 @@ MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml ActionPanelWidget 1.0 ActionPanelWidget.qml IconLabel 1.0 IconLabel.qml +IconWithText 1.0 IconWithText.qml OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml ExpandableComponent 1.0 ExpandableComponent.qml PrinterTypeLabel 1.0 PrinterTypeLabel.qml diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 08ea73a7c5..dfaa9008f7 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -372,6 +372,7 @@ "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], + "print_setup_widget_header": [0.0, 3.0], "configuration_selector_mode_tabs": [0.0, 3.0], From b9d9a3586809b7e517550d402d31a9cf419e59ba Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 29 Nov 2018 00:00:22 +0100 Subject: [PATCH 364/558] Move profile dropdown to another file CURA-5941 --- resources/qml/GlobalProfileButton.qml | 89 ++++++++++++++++++++++++++ resources/qml/PrintSetupSelector.qml | 46 +++++++------ resources/qml/Settings/SettingView.qml | 89 +------------------------- 3 files changed, 115 insertions(+), 109 deletions(-) create mode 100644 resources/qml/GlobalProfileButton.qml diff --git a/resources/qml/GlobalProfileButton.qml b/resources/qml/GlobalProfileButton.qml new file mode 100644 index 0000000000..bac2732037 --- /dev/null +++ b/resources/qml/GlobalProfileButton.qml @@ -0,0 +1,89 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.2 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +import "Menus" + +Item +{ + id: globalProfileRow + height: UM.Theme.getSize("print_setup_item").height + + Label + { + id: globalProfileLabel + text: catalog.i18nc("@label","Profile:") + textFormat: Text.PlainText + width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2) + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignVCenter + anchors.top: parent.top + anchors.bottom: parent.bottom + } + + ToolButton + { + id: globalProfileSelection + + text: generateActiveQualityText() + width: Math.round(parent.width * 0.55) + height: UM.Theme.getSize("setting_control").height + anchors.left: globalProfileLabel.right + anchors.right: parent.right + tooltip: Cura.MachineManager.activeQualityOrQualityChangesName + style: UM.Theme.styles.sidebar_header_button + activeFocusOnPress: true + menu: ProfileMenu { } + + function generateActiveQualityText () { + var result = Cura.MachineManager.activeQualityOrQualityChangesName; + + if (Cura.MachineManager.isActiveQualitySupported) { + if (Cura.MachineManager.activeQualityLayerHeight > 0) { + result += " " + result += " - " + result += Cura.MachineManager.activeQualityLayerHeight + "mm" + result += "" + } + } + + return result + } + + UM.SimpleButton + { + id: customisedSettings + + visible: Cura.MachineManager.hasUserSettings + height: Math.round(parent.height * 0.6) + width: Math.round(parent.height * 0.6) + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width) + + color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); + iconSource: UM.Theme.getIcon("star"); + + onClicked: + { + forceActiveFocus(); + Cura.Actions.manageProfiles.trigger() + } + onEntered: + { + var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.") + base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content) + } + onExited: base.hideTooltip() + } + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 85472bae8d..855af9f9fa 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -126,7 +126,9 @@ Cura.ExpandableComponent popupItem: Rectangle { - property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 + + property var totalMargins: UM.Theme.getSize("narrow_margin").height * 11 + property var total_height: popupItemHeader.height + popupItemContent.height + totalMargins id: popupItemWrapper height: total_height @@ -157,9 +159,9 @@ Cura.ExpandableComponent anchors { - topMargin: UM.Theme.getSize("sidebar_margin").height + //topMargin: UM.Theme.getSize("sidebar_margin").height left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height * 2 } } @@ -169,8 +171,6 @@ Cura.ExpandableComponent height: UM.Theme.getSize("default_lining").height anchors.top: popupItemHeaderText.bottom color: UM.Theme.getColor("action_button_border") - - } Button @@ -209,21 +209,33 @@ Cura.ExpandableComponent { id: popupItemContent width: parent.width - height: tabBar.height + sidebarContents.height + height: globalProfileRow.height + tabBar.height + UM.Theme.getSize("print_setup_widget").height - UM.Theme.getSize("print_setup_item").height anchors { top: popupItemHeader.bottom - topMargin: UM.Theme.getSize("narrow_margin").height + topMargin: UM.Theme.getSize("default_margin").height * 1.5 right: parent.right left: parent.left leftMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width } + GlobalProfileButton + { + id: globalProfileRow + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + } + UM.TabRow { id: tabBar - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.top: globalProfileRow.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height * 1.5 onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) z: 1 Repeater @@ -280,8 +292,6 @@ Cura.ExpandableComponent anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - height: UM.Theme.getSize("print_setup_widget").height - border.width: UM.Theme.getSize("default_lining").width * 2 border.color: UM.Theme.getColor("action_button_border") @@ -296,8 +306,8 @@ Cura.ExpandableComponent SidebarAdvanced { - anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height - anchors.bottomMargin: 2 //don't overlap bottom border + anchors.topMargin: Math.round(UM.Theme.getSize("wide_margin").height / 1.7) + anchors.bottomMargin: 2 //prevent bottom line overlapping anchors.fill: parent visible: currentModeIndex == 1 onShowTooltip: base.showTooltip(item, location, text) @@ -312,7 +322,6 @@ Cura.ExpandableComponent anchors.top: popupItemContent.bottom anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 width: parent.width - height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 Rectangle { width: parent.width @@ -330,9 +339,8 @@ Cura.ExpandableComponent { top: parent.top topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 right: parent.right - rightMargin: UM.Theme.getSize("narrow_margin").height + rightMargin: UM.Theme.getSize("narrow_margin").height * 2 } color: UM.Theme.getColor("secondary") @@ -349,14 +357,11 @@ Cura.ExpandableComponent { height: UM.Theme.getSize("action_panel_button").height text: catalog.i18nc("@button", "Recommended") - color: UM.Theme.getColor("secondary") hoverColor: UM.Theme.getColor("secondary") textColor: UM.Theme.getColor("primary") textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.getIcon("arrow_left") - width: UM.Theme.getSize("print_setup_action_button").width fixedWidthMode: true @@ -365,9 +370,8 @@ Cura.ExpandableComponent { top: parent.top topMargin: UM.Theme.getSize("narrow_margin").height * 2 - bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height * 2 } MouseArea { @@ -376,7 +380,7 @@ Cura.ExpandableComponent } } } - + Component.onCompleted: { var index = Math.round(UM.Preferences.getValue("cura/active_mode")) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index cd9701aab6..3960f99aaa 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -21,92 +21,6 @@ Item signal showTooltip(Item item, point location, string text) signal hideTooltip() - Item - { - id: globalProfileRow - height: UM.Theme.getSize("print_setup_item").height - - anchors - { - top: parent.top - left: parent.left - leftMargin: Math.round(UM.Theme.getSize("thick_margin").width) - right: parent.right - rightMargin: Math.round(UM.Theme.getSize("thick_margin").width) - } - - Label - { - id: globalProfileLabel - text: catalog.i18nc("@label","Profile:") - textFormat: Text.PlainText - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2) - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - anchors.top: parent.top - anchors.bottom: parent.bottom - } - - ToolButton - { - id: globalProfileSelection - - text: generateActiveQualityText() - width: Math.round(parent.width * 0.55) - height: UM.Theme.getSize("setting_control").height - anchors.left: globalProfileLabel.right - anchors.right: parent.right - tooltip: Cura.MachineManager.activeQualityOrQualityChangesName - style: UM.Theme.styles.sidebar_header_button - activeFocusOnPress: true - menu: ProfileMenu { } - - function generateActiveQualityText () { - var result = Cura.MachineManager.activeQualityOrQualityChangesName; - - if (Cura.MachineManager.isActiveQualitySupported) { - if (Cura.MachineManager.activeQualityLayerHeight > 0) { - result += " " - result += " - " - result += Cura.MachineManager.activeQualityLayerHeight + "mm" - result += "" - } - } - - return result - } - - UM.SimpleButton - { - id: customisedSettings - - visible: Cura.MachineManager.hasUserSettings - height: Math.round(parent.height * 0.6) - width: Math.round(parent.height * 0.6) - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width) - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); - iconSource: UM.Theme.getIcon("star"); - - onClicked: - { - forceActiveFocus(); - Cura.Actions.manageProfiles.trigger() - } - onEntered: - { - var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.") - base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content) - } - onExited: base.hideTooltip() - } - } - } - ToolButton { id: settingVisibilityMenu @@ -115,7 +29,6 @@ Item height: UM.Theme.getSize("setting_control").height anchors { - top: globalProfileRow.bottom topMargin: UM.Theme.getSize("thick_margin").height right: parent.right rightMargin: UM.Theme.getSize("thick_margin").width @@ -168,7 +81,7 @@ Item anchors { - top: globalProfileRow.bottom + //top: globalProfileRow.bottom topMargin: UM.Theme.getSize("thick_margin").height left: parent.left leftMargin: UM.Theme.getSize("thick_margin").width From 706fc311bccb730e82e48bf6c752e4bd0a3bf856 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 29 Nov 2018 00:47:25 +0100 Subject: [PATCH 365/558] Added margins to the setting list CURA-5941 --- resources/qml/Settings/SettingCategory.qml | 4 ++-- resources/qml/Settings/SettingItem.qml | 4 ++-- resources/qml/Settings/SettingView.qml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index aafe36c546..4ec6294d61 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -12,8 +12,8 @@ Button id: base anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: UM.Theme.getSize("thick_margin").width - anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 hoverEnabled: true background: Rectangle diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index cad6a28bd6..036dcfeba4 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -108,7 +108,7 @@ Item { id: label; anchors.left: parent.left; - anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 + anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width / 1.2) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 anchors.right: settingControls.left; anchors.verticalCenter: parent.verticalCenter @@ -290,7 +290,7 @@ Item { enabled: propertyProvider.isValueUsed anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 anchors.verticalCenter: parent.verticalCenter; width: UM.Theme.getSize("setting_control").width; height: UM.Theme.getSize("setting_control").height diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 3960f99aaa..8a336a7ed1 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -81,10 +81,9 @@ Item anchors { - //top: globalProfileRow.bottom topMargin: UM.Theme.getSize("thick_margin").height left: parent.left - leftMargin: UM.Theme.getSize("thick_margin").width + leftMargin: UM.Theme.getSize("default_margin").width right: settingVisibilityMenu.left rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2) } @@ -202,6 +201,7 @@ Item anchors.right: parent.right; anchors.left: parent.left; anchors.topMargin: UM.Theme.getSize("thick_margin").height + anchors.rightMargin: UM.Theme.getSize("narrow_margin").height / 3 style: UM.Theme.styles.scrollview; flickableItem.flickableDirection: Flickable.VerticalFlick; From 7639983925f712a48a3a64bd71d221d2dcf3b4f2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 29 Nov 2018 08:54:04 +0100 Subject: [PATCH 366/558] Clean the recommended mode print setup Contributes to CURA-5941 --- .../PrintSetupSelectorContents.qml | 31 - .../RecommendedPrintSetup.qml | 1205 ++++++++--------- 2 files changed, 580 insertions(+), 656 deletions(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index c36a0fbb80..6e71526f25 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -94,40 +94,10 @@ Item anchors { top: header.bottom - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin: UM.Theme.getSize("default_margin").width } sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup } -// Item -// { -// id: content -// width: parent.width -// height: 100 -////// height: tabBar.height + sidebarContents.height -//// -// anchors -// { -// top: header.bottom -// leftMargin: UM.Theme.getSize("default_margin").width -// rightMargin: UM.Theme.getSize("default_margin").width -// } -//// -//// Rectangle -//// { -//// id: sidebarContents -//// anchors.top: tabBar.bottom -//// anchors.bottom: parent.bottom -//// anchors.left: parent.left -//// anchors.right: parent.right -//// height: UM.Theme.getSize("print_setup_widget").height -//// -//// border.width: UM.Theme.getSize("default_lining").width * 2 -//// border.color: UM.Theme.getColor("action_button_border") -//// } -// } - Rectangle { id: buttonsSeparator @@ -195,7 +165,6 @@ Item Component.onCompleted: { - print(height, "!!!!!!!!!!!!!!!!!!!!!!!") var index = Math.round(UM.Preferences.getValue("cura/active_mode")) if(index != null && !isNaN(index)) diff --git a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml index 5d195bdde4..b48282135b 100644 --- a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml @@ -8,17 +8,22 @@ import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.0 as Cura -Item +Column { id: base signal showTooltip(Item item, point location, string text) signal hideTooltip() - height: childrenRect.height + height: childrenRect.height + 2 * padding + + padding: UM.Theme.getSize("thick_margin").width + spacing: UM.Theme.getSize("default_margin").height property Action configureSettings property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 + property real labelColumnWidth: Math.round(width / 3) + property real settingsColumnWidth: width - labelColumnWidth UM.I18nCatalog { @@ -33,10 +38,9 @@ Item { id: qualityRow - height: UM.Theme.getSize("thick_margin").height - anchors.topMargin: UM.Theme.getSize("thick_margin").height anchors.left: parent.left anchors.right: parent.right + height: childrenRect.height Timer { @@ -145,14 +149,14 @@ Item function calculateSliderStepWidth (totalTicks) { - qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0 + qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((settingsColumnWidth) / (totalTicks)) : 0 } function calculateSliderMargins (availableMin, availableMax, totalTicks) { if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) { - qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55) + qualityModel.qualitySliderMarginRight = Math.round(settingsColumnWidth) } else if (availableMin == availableMax) { @@ -180,6 +184,7 @@ Item source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") anchors.bottom: speedSlider.bottom + width: labelColumnWidth } // Show titles for the each quality slider ticks @@ -187,6 +192,7 @@ Item { anchors.left: speedSlider.left anchors.top: speedSlider.bottom + Repeater { model: qualityModel @@ -194,7 +200,7 @@ Item Label { anchors.verticalCenter: parent.verticalCenter - anchors.top: parent.bottom + anchors.top: parent.top color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") text: { @@ -225,19 +231,19 @@ Item if (qualityModel.totalTicks == 0) { // If there is only one tick, align it centrally - return Math.round(((base.width * 0.55) - width) / 2) + return Math.round(((settingsColumnWidth) - width) / 2) } else if (index == 0) { - return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index + return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index } else if (index == qualityModel.totalTicks) { - return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width + return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width } else { - return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)) + return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) } } } @@ -248,126 +254,127 @@ Item Rectangle { id: speedSlider - width: Math.round(base.width * 0.55) - height: UM.Theme.getSize("thick_margin").height - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("thick_margin").height + + anchors + { + left: qualityRowTitle.right + right: parent.right + } // This Item is used only for tooltip, for slider area which is unavailable - Item - { - function showTooltip (showTooltip) - { - if (showTooltip) - { - var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - else - { - base.hideTooltip() - } - } - - id: unavailableLineToolTip - height: 20 * screenScaleFactor // hovered area height - z: parent.z + 1 // should be higher, otherwise the area can be hovered - x: 0 - anchors.verticalCenter: qualitySlider.verticalCenter - - Rectangle - { - id: leftArea - width: - { - if (qualityModel.availableTotalTicks == 0) - { - return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks - } - return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 - } - height: parent.height - color: "transparent" - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false - onEntered: unavailableLineToolTip.showTooltip(true) - onExited: unavailableLineToolTip.showTooltip(false) - } - } - - Item - { - id: rightArea - width: - { - if(qualityModel.availableTotalTicks == 0) - return 0 - - return qualityModel.qualitySliderMarginRight - 10 - } - height: parent.height - x: - { - if (qualityModel.availableTotalTicks == 0) - { - return 0 - } - - var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 - - return totalGap - } - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false - onEntered: unavailableLineToolTip.showTooltip(true) - onExited: unavailableLineToolTip.showTooltip(false) - } - } - } +// Item +// { +// function showTooltip (showTooltip) +// { +// if (showTooltip) +// { +// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") +// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) +// } +// else +// { +// base.hideTooltip() +// } +// } +// +// id: unavailableLineToolTip +// height: 20 * screenScaleFactor // hovered area height +// z: parent.z + 1 // should be higher, otherwise the area can be hovered +// x: 0 +// anchors.verticalCenter: qualitySlider.verticalCenter +// +// Rectangle +// { +// id: leftArea +// width: +// { +// if (qualityModel.availableTotalTicks == 0) +// { +// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks +// } +// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 +// } +// height: parent.height +// color: "transparent" +// +// MouseArea +// { +// anchors.fill: parent +// hoverEnabled: true +// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +// onEntered: unavailableLineToolTip.showTooltip(true) +// onExited: unavailableLineToolTip.showTooltip(false) +// } +// } +// +// Item +// { +// id: rightArea +// width: +// { +// if(qualityModel.availableTotalTicks == 0) +// return 0 +// +// return qualityModel.qualitySliderMarginRight - 10 +// } +// height: parent.height +// x: +// { +// if (qualityModel.availableTotalTicks == 0) +// { +// return 0 +// } +// +// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin +// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 +// +// return totalGap +// } +// +// MouseArea +// { +// anchors.fill: parent +// hoverEnabled: true +// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +// onEntered: unavailableLineToolTip.showTooltip(true) +// onExited: unavailableLineToolTip.showTooltip(false) +// } +// } +// } // Draw Unavailable line Rectangle { id: groovechildrect - width: Math.round(base.width * 0.55) + width: parent.width height: 2 * screenScaleFactor color: UM.Theme.getColor("quality_slider_unavailable") anchors.verticalCenter: qualitySlider.verticalCenter - x: 0 - } - // Draw ticks - Repeater - { - id: qualityRepeater - model: qualityModel.totalTicks > 0 ? qualityModel : 0 - - Rectangle + // Draw ticks + Repeater { - color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 5 * screenScaleFactor - implicitHeight: implicitWidth - anchors.verticalCenter: qualitySlider.verticalCenter - x: Math.round(qualityModel.qualitySliderStepWidth * index) - radius: Math.round(implicitWidth / 2) + id: qualityRepeater + model: qualityModel.totalTicks > 0 ? qualityModel : 0 + + Rectangle + { + color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: 4 * screenScaleFactor + implicitHeight: implicitWidth + anchors.verticalCenter: parent.verticalCenter + x: Math.round(qualityModel.qualitySliderStepWidth * index) + radius: Math.round(implicitWidth / 2) + } } } + // Draw available slider Slider { id: qualitySlider height: UM.Theme.getSize("thick_margin").height - anchors.bottom: speedSlider.bottom + anchors.bottom: parent.bottom enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized visible: qualityModel.availableTotalTicks > 0 updateValueWhileDragging : false @@ -394,18 +401,15 @@ Item color: UM.Theme.getColor("quality_slider_available") radius: Math.round(height / 2) } - handle: Item + + handle: Rectangle { - Rectangle - { - id: qualityhandleButton - anchors.centerIn: parent - color: UM.Theme.getColor("quality_slider_available") - implicitWidth: 10 * screenScaleFactor - implicitHeight: implicitWidth - radius: Math.round(implicitWidth / 2) - visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile - } + id: qualityhandleButton + color: UM.Theme.getColor("quality_slider_available") + implicitWidth: 12 * screenScaleFactor + implicitHeight: implicitWidth + radius: Math.round(implicitWidth / 2) + visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile } } @@ -433,7 +437,7 @@ Item onEntered: { - var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") + var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) } onExited: base.hideTooltip() @@ -474,329 +478,319 @@ Item // Item { - id: infillCellLeft - - anchors.top: qualityRow.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height * 2 anchors.left: parent.left - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width + anchors.right: parent.right + height: childrenRect.height Cura.IconWithText { - id: infillLabel + id: infillRowTitle source: UM.Theme.getIcon("category_infill") text: catalog.i18nc("@label", "Infill") + " (%)" - - anchors - { - top: parent.top - topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7) - left: parent.left - } + anchors.bottom: parent.bottom + width: labelColumnWidth } - } - Item - { - id: infillCellRight + Item + { + id: infillCellRight - height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) + height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) - anchors.left: infillCellLeft.right - anchors.top: infillCellLeft.top - anchors.topMargin: UM.Theme.getSize("thick_margin").height - - Label { - id: selectedInfillRateText - - anchors.left: infillSlider.left + anchors.left: infillRowTitle.right anchors.right: parent.right - text: parseInt(infillDensity.properties.value) + "%" - horizontalAlignment: Text.AlignLeft - - color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - } - - // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider - Binding - { - target: infillSlider - property: "value" - value: parseInt(infillDensity.properties.value) - } - - Slider - { - id: infillSlider - - anchors.top: selectedInfillRateText.bottom - anchors.left: parent.left - anchors.right: infillIcon.left - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - height: UM.Theme.getSize("thick_margin").height - width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) - - minimumValue: 0 - maximumValue: 100 - stepSize: 1 - tickmarksEnabled: true - - // disable slider when gradual support is enabled - enabled: parseInt(infillSteps.properties.value) == 0 - - // set initial value from stack - value: parseInt(infillDensity.properties.value) - - onValueChanged: - { - - // Don't round the value if it's already the same - if (parseInt(infillDensity.properties.value) == infillSlider.value) - { - return - } - - // Round the slider value to the nearest multiple of 10 (simulate step size of 10) - var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 - - // Update the slider value to represent the rounded value - infillSlider.value = roundedSliderValue - - // Update value only if the Recomended mode is Active, - // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat - // same operation - var active_mode = UM.Preferences.getValue("cura/active_mode") - - if (active_mode == 0 || active_mode == "simple") - { - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) - Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") - } - } - - style: SliderStyle - { - groove: Rectangle - { - id: groove - implicitWidth: 200 * screenScaleFactor - implicitHeight: 2 * screenScaleFactor - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - radius: 1 - } - - handle: Item - { - Rectangle - { - id: handleButton - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 10 * screenScaleFactor - implicitHeight: 10 * screenScaleFactor - radius: 10 * screenScaleFactor - } - } - - tickmarks: Repeater - { - id: repeater - model: control.maximumValue / control.stepSize + 1 - - // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) - function shouldShowTick (index) - { - if (index % 10 == 0) - { - return true - } - return false - } - - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - width: 1 * screenScaleFactor - height: 6 * screenScaleFactor - x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) - visible: shouldShowTick(index) - } - } - } - } - - Rectangle - { - id: infillIcon - - width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) - height: width - - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) - - // we loop over all density icons and only show the one that has the current density and steps - Repeater - { - id: infillIconList - model: infillModel - anchors.fill: parent - - function activeIndex () - { - for (var i = 0; i < infillModel.count; i++) - { - var density = Math.round(infillDensity.properties.value) - var steps = Math.round(infillSteps.properties.value) - var infillModelItem = infillModel.get(i) - - if (infillModelItem != "undefined" - && density >= infillModelItem.percentageMin - && density <= infillModelItem.percentageMax - && steps >= infillModelItem.stepsMin - && steps <= infillModelItem.stepsMax) - { - return i - } - } - return -1 - } - - Rectangle - { - anchors.fill: parent - visible: infillIconList.activeIndex() == index - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("quality_slider_unavailable") - - UM.RecolorImage - { - anchors.fill: parent - anchors.margins: 2 * screenScaleFactor - sourceSize.width: width - sourceSize.height: width - source: UM.Theme.getIcon(model.icon) - color: UM.Theme.getColor("quality_slider_unavailable") - } - } - } - } - - // Gradual Support Infill Checkbox - CheckBox - { - id: enableGradualInfillCheckBox - property alias _hovered: enableGradualInfillMouseArea.containsMouse - - anchors.top: infillSlider.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - visible: infillSteps.properties.enabled == "True" - checked: parseInt(infillSteps.properties.value) > 0 - - MouseArea - { - id: enableGradualInfillMouseArea - - anchors.fill: parent - hoverEnabled: true - enabled: true - - property var previousInfillDensity: parseInt(infillDensity.properties.value) - - onClicked: - { - // Set to 90% only when enabling gradual infill - var newInfillDensity; - if (parseInt(infillSteps.properties.value) == 0) - { - previousInfillDensity = parseInt(infillDensity.properties.value) - newInfillDensity = 90 - } else { - newInfillDensity = previousInfillDensity - } - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) - - var infill_steps_value = 0 - if (parseInt(infillSteps.properties.value) == 0) - { - infill_steps_value = 5 - } - - Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) - } - - onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), - catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) - - onExited: base.hideTooltip() - - } - Label { - id: gradualInfillLabel - height: parent.height - anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - verticalAlignment: Text.AlignVCenter; - text: catalog.i18nc("@label", "Enable gradual") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - } + id: selectedInfillRateText - // Infill list model for mapping icon - ListModel - { - id: infillModel - Component.onCompleted: + anchors.left: infillSlider.left + anchors.right: parent.right + + text: parseInt(infillDensity.properties.value) + "%" + horizontalAlignment: Text.AlignLeft + + color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + } + + // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider + Binding { - infillModel.append({ - percentageMin: -1, - percentageMax: 0, - stepsMin: -1, - stepsMax: 0, - icon: "hollow" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 40, - stepsMin: -1, - stepsMax: 0, - icon: "sparse" - }) - infillModel.append({ - percentageMin: 40, - percentageMax: 89, - stepsMin: -1, - stepsMax: 0, - icon: "dense" - }) - infillModel.append({ - percentageMin: 90, - percentageMax: 9999999999, - stepsMin: -1, - stepsMax: 0, - icon: "solid" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 9999999999, - stepsMin: 1, - stepsMax: 9999999999, - icon: "gradual" - }) + target: infillSlider + property: "value" + value: parseInt(infillDensity.properties.value) + } + + Slider + { + id: infillSlider + + anchors.top: selectedInfillRateText.bottom + anchors.left: parent.left + anchors.right: infillIcon.left + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + + height: UM.Theme.getSize("thick_margin").height + width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) + + minimumValue: 0 + maximumValue: 100 + stepSize: 1 + tickmarksEnabled: true + + // disable slider when gradual support is enabled + enabled: parseInt(infillSteps.properties.value) == 0 + + // set initial value from stack + value: parseInt(infillDensity.properties.value) + + onValueChanged: + { + + // Don't round the value if it's already the same + if (parseInt(infillDensity.properties.value) == infillSlider.value) + { + return + } + + // Round the slider value to the nearest multiple of 10 (simulate step size of 10) + var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 + + // Update the slider value to represent the rounded value + infillSlider.value = roundedSliderValue + + // Update value only if the Recomended mode is Active, + // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat + // same operation + var active_mode = UM.Preferences.getValue("cura/active_mode") + + if (active_mode == 0 || active_mode == "simple") + { + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) + Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") + } + } + + style: SliderStyle + { + groove: Rectangle + { + id: groove + implicitWidth: 200 * screenScaleFactor + implicitHeight: 2 * screenScaleFactor + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + radius: 1 + } + + handle: Item + { + Rectangle + { + id: handleButton + anchors.centerIn: parent + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: 10 * screenScaleFactor + implicitHeight: 10 * screenScaleFactor + radius: 10 * screenScaleFactor + } + } + + tickmarks: Repeater + { + id: repeater + model: control.maximumValue / control.stepSize + 1 + + // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) + function shouldShowTick (index) + { + if (index % 10 == 0) + { + return true + } + return false + } + + Rectangle + { + anchors.verticalCenter: parent.verticalCenter + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + width: 1 * screenScaleFactor + height: 6 * screenScaleFactor + x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) + visible: shouldShowTick(index) + } + } + } + } + + Rectangle + { + id: infillIcon + + width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) + height: width + + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) + + // we loop over all density icons and only show the one that has the current density and steps + Repeater + { + id: infillIconList + model: infillModel + anchors.fill: parent + + function activeIndex () + { + for (var i = 0; i < infillModel.count; i++) + { + var density = Math.round(infillDensity.properties.value) + var steps = Math.round(infillSteps.properties.value) + var infillModelItem = infillModel.get(i) + + if (infillModelItem != "undefined" + && density >= infillModelItem.percentageMin + && density <= infillModelItem.percentageMax + && steps >= infillModelItem.stepsMin + && steps <= infillModelItem.stepsMax) + { + return i + } + } + return -1 + } + + Rectangle + { + anchors.fill: parent + visible: infillIconList.activeIndex() == index + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("quality_slider_unavailable") + + UM.RecolorImage + { + anchors.fill: parent + anchors.margins: 2 * screenScaleFactor + sourceSize.width: width + sourceSize.height: width + source: UM.Theme.getIcon(model.icon) + color: UM.Theme.getColor("quality_slider_unavailable") + } + } + } + } + + // Gradual Support Infill Checkbox + CheckBox + { + id: enableGradualInfillCheckBox + property alias _hovered: enableGradualInfillMouseArea.containsMouse + + anchors.top: infillSlider.bottom + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category + anchors.left: infillCellRight.left + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + visible: infillSteps.properties.enabled == "True" + checked: parseInt(infillSteps.properties.value) > 0 + + MouseArea + { + id: enableGradualInfillMouseArea + + anchors.fill: parent + hoverEnabled: true + enabled: true + + property var previousInfillDensity: parseInt(infillDensity.properties.value) + + onClicked: + { + // Set to 90% only when enabling gradual infill + var newInfillDensity; + if (parseInt(infillSteps.properties.value) == 0) + { + previousInfillDensity = parseInt(infillDensity.properties.value) + newInfillDensity = 90 + } else { + newInfillDensity = previousInfillDensity + } + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) + + var infill_steps_value = 0 + if (parseInt(infillSteps.properties.value) == 0) + { + infill_steps_value = 5 + } + + Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) + } + + onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), + catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) + + onExited: base.hideTooltip() + + } + + Label + { + id: gradualInfillLabel + height: parent.height + anchors.left: enableGradualInfillCheckBox.right + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + verticalAlignment: Text.AlignVCenter; + text: catalog.i18nc("@label", "Enable gradual") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + } + + // Infill list model for mapping icon + ListModel + { + id: infillModel + Component.onCompleted: + { + infillModel.append({ + percentageMin: -1, + percentageMax: 0, + stepsMin: -1, + stepsMax: 0, + icon: "hollow" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 40, + stepsMin: -1, + stepsMax: 0, + icon: "sparse" + }) + infillModel.append({ + percentageMin: 40, + percentageMax: 89, + stepsMin: -1, + stepsMax: 0, + icon: "dense" + }) + infillModel.append({ + percentageMin: 90, + percentageMax: 9999999999, + stepsMin: -1, + stepsMax: 0, + icon: "solid" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 9999999999, + stepsMin: 1, + stepsMax: 9999999999, + icon: "gradual" + }) + } } } } @@ -804,191 +798,177 @@ Item // // Enable support // - Cura.IconWithText + Row { - id: enableSupportLabel - visible: enableSupportCheckBox.visible - source: UM.Theme.getIcon("category_support") - text: catalog.i18nc("@label", "Support") + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height - anchors + Cura.IconWithText { - top: infillCellRight.bottom - topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5) - left: parent.left - right: infillCellLeft.right - rightMargin: UM.Theme.getSize("thick_margin").width - verticalCenter: enableSupportCheckBox.verticalCenter - } - } - - CheckBox - { - id: enableSupportCheckBox - property alias _hovered: enableSupportMouseArea.containsMouse - - anchors.top: enableSupportLabel.top - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: supportEnabled.properties.enabled == "True" - checked: supportEnabled.properties.value == "True" - - MouseArea - { - id: enableSupportMouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") - - onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), - catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) - - onExited: base.hideTooltip() - - } - } - - ComboBox - { - id: supportExtruderCombobox - visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) - model: extruderModel - - property string color_override: "" // for manually setting values - property string color: // is evaluated automatically, but the first time is before extruderModel being filled - { - var current_extruder = extruderModel.get(currentIndex); - color_override = ""; - if (current_extruder === undefined) return "" - return (current_extruder.color) ? current_extruder.color : ""; + id: enableSupportLabel + visible: enableSupportCheckBox.visible + source: UM.Theme.getIcon("category_support") + text: catalog.i18nc("@label", "Support") + width: labelColumnWidth } - textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started - - anchors.top: enableSupportCheckBox.top - - anchors.left: enableSupportCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width - height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 - - Behavior on height { NumberAnimation { duration: 100 } } - - style: UM.Theme.styles.combobox_color - enabled: base.settingsEnabled - property alias _hovered: supportExtruderMouseArea.containsMouse - - currentIndex: + CheckBox { - if (supportExtruderNr.properties == null) + id: enableSupportCheckBox + property alias _hovered: enableSupportMouseArea.containsMouse + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: supportEnabled.properties.enabled == "True" + checked: supportEnabled.properties.value == "True" + + MouseArea { - return Cura.MachineManager.defaultExtruderPosition + id: enableSupportMouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") + + onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), + catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) + + onExited: base.hideTooltip() + } - else + } + + ComboBox + { + id: supportExtruderCombobox + visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) + model: extruderModel + + property string color_override: "" // for manually setting values + property string color: // is evaluated automatically, but the first time is before extruderModel being filled { - var extruder = parseInt(supportExtruderNr.properties.value) - if ( extruder === -1) + var current_extruder = extruderModel.get(currentIndex); + color_override = ""; + if (current_extruder === undefined) return "" + return (current_extruder.color) ? current_extruder.color : ""; + } + + textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started + + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width + height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 + + Behavior on height { NumberAnimation { duration: 100 } } + + style: UM.Theme.styles.combobox_color + enabled: base.settingsEnabled + property alias _hovered: supportExtruderMouseArea.containsMouse + + currentIndex: + { + if (supportExtruderNr.properties == null) { return Cura.MachineManager.defaultExtruderPosition } - return extruder; - } - } - - onActivated: supportExtruderNr.setPropertyValue("value", String(index)) - - MouseArea - { - id: supportExtruderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - acceptedButtons: Qt.NoButton - onEntered: - { - base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), - catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); - } - onExited: base.hideTooltip() - - } - - function updateCurrentColor() - { - var current_extruder = extruderModel.get(currentIndex) - if (current_extruder !== undefined) - { - supportExtruderCombobox.color_override = current_extruder.color - } - } - - } - - Cura.IconWithText - { - id: adhesionHelperLabel - visible: adhesionCheckBox.visible - source: UM.Theme.getIcon("category_adhesion") - text: catalog.i18nc("@label", "Adhesion") - - anchors - { - left: parent.left - right: infillCellLeft.right - rightMargin: UM.Theme.getSize("thick_margin").width - verticalCenter: adhesionCheckBox.verticalCenter - } - } - - CheckBox - { - id: adhesionCheckBox - property alias _hovered: adhesionMouseArea.containsMouse - - anchors.top: enableSupportCheckBox.bottom - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.left: infillCellRight.left - - //: Setting enable printing build-plate adhesion helper checkbox - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: platformAdhesionType.properties.enabled == "True" - checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" - - MouseArea - { - id: adhesionMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - onClicked: - { - var adhesionType = "skirt" - if(!parent.checked) + else { - // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft - platformAdhesionType.removeFromContainer(0) - adhesionType = platformAdhesionType.properties.value - if(adhesionType == "skirt" || adhesionType == "none") + var extruder = parseInt(supportExtruderNr.properties.value) + if ( extruder === -1) { - // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim - adhesionType = "brim" + return Cura.MachineManager.defaultExtruderPosition } + return extruder; } - platformAdhesionType.setPropertyValue("value", adhesionType) } - onEntered: - { - base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), - catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); - } - onExited: base.hideTooltip() + onActivated: supportExtruderNr.setPropertyValue("value", String(index)) + + MouseArea + { + id: supportExtruderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + acceptedButtons: Qt.NoButton + onEntered: + { + base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), + catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + } + onExited: base.hideTooltip() + + } + + function updateCurrentColor() + { + var current_extruder = extruderModel.get(currentIndex) + if (current_extruder !== undefined) + { + supportExtruderCombobox.color_override = current_extruder.color + } + } + + } + } + + // Adhesion + Row + { + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height + + Cura.IconWithText + { + id: adhesionHelperLabel + visible: adhesionCheckBox.visible + source: UM.Theme.getIcon("category_adhesion") + text: catalog.i18nc("@label", "Adhesion") + width: labelColumnWidth + } + + CheckBox + { + id: adhesionCheckBox + property alias _hovered: adhesionMouseArea.containsMouse + + //: Setting enable printing build-plate adhesion helper checkbox + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: platformAdhesionType.properties.enabled == "True" + checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" + + MouseArea + { + id: adhesionMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + onClicked: + { + var adhesionType = "skirt" + if(!parent.checked) + { + // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft + platformAdhesionType.removeFromContainer(0) + adhesionType = platformAdhesionType.properties.value + if(adhesionType == "skirt" || adhesionType == "none") + { + // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim + adhesionType = "brim" + } + } + platformAdhesionType.setPropertyValue("value", adhesionType) + } + onEntered: + { + base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), + catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); + } + onExited: base.hideTooltip() + } } } @@ -1005,31 +985,6 @@ Item onModelChanged: populateExtruderModel() } - Item - { - id: tipsCell - anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 2) - anchors.left: parent.left - width: parent.width - height: tipsText.contentHeight * tipsText.lineCount - - Label - { - id: tipsText - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - anchors.top: parent.top - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "Need help improving your prints?
Read the Ultimaker Troubleshooting Guides").arg("https://ultimaker.com/en/troubleshooting") - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - linkColor: UM.Theme.getColor("text_link") - onLinkActivated: Qt.openUrlExternally(link) - } - } - UM.SettingPropertyProvider { id: infillExtruderNumber @@ -1096,8 +1051,8 @@ Item function populateExtruderModel() { - extruderModel.clear(); - for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) + extruderModel.clear() + for (var extruderNumber = 0; extruderNumber < extruders.rowCount(); extruderNumber++) { extruderModel.append({ text: extruders.getItem(extruderNumber).name, From bc8bf8780959db152ba572a39a4dc545d1900006 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 29 Nov 2018 15:54:02 +0100 Subject: [PATCH 367/558] Align the buttons at the bottom of the panel Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 3 +- .../PrintSetupSelectorContents.qml | 71 +++++++++++-------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0c3a8f80b9..47fa226e9d 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -163,6 +163,7 @@ Item onExited: background.color = headerBackgroundColor } } + DropShadow { id: shadow @@ -182,7 +183,7 @@ Item id: popup // Ensure that the popup is located directly below the headerItem - y: headerItemLoader.height + 2 * background.padding + base.shadowOffset + popupSpacingY + y: background.height + base.shadowOffset + popupSpacingY // Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 6e71526f25..309d612fae 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -11,7 +11,7 @@ Item { id: popup - width: UM.Theme.getSize("print_setup_widget").width + width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height property int currentModeIndex: -1 @@ -87,22 +87,50 @@ Item color: UM.Theme.getColor("lining") } - Loader + Item { - id: loader - width: parent.width + id: contents + height: childrenRect.height + anchors { top: header.bottom + left: parent.left + right: parent.right + } + + RecommendedPrintSetup + { + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + visible: currentModeIndex == 0 + } + + CustomPrintSetup + { + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + visible: currentModeIndex == 1 } - sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup } Rectangle { id: buttonsSeparator - anchors.top: loader.bottom + anchors.top: contents.bottom width: parent.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") @@ -111,7 +139,8 @@ Item Item { id: buttonRow - height: childrenRect.height + property real padding: UM.Theme.getSize("default_margin").width + height: childrenRect.height + 2 * padding // The buttonsSeparator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. anchors @@ -123,46 +152,32 @@ Item Cura.SecondaryButton { + anchors.top: parent.top anchors.left: parent.left + anchors.margins: parent.padding leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Recommended") + iconSource: UM.Theme.getIcon("arrow_left") visible: currentModeIndex == 1 onClicked: currentModeIndex = 0 } Cura.SecondaryButton { + anchors.top: parent.top anchors.right: parent.right + anchors.margins: UM.Theme.getSize("default_margin").width leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Custom") + iconSource: UM.Theme.getIcon("arrow_right") + iconOnRightSide: true visible: currentModeIndex == 0 onClicked: currentModeIndex = 1 } } - Component - { - id: recommendedPrintSetup - RecommendedPrintSetup - { - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - } - - Component - { - id: customPrintSetup - CustomPrintSetup - { - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - } - - Component.onCompleted: { var index = Math.round(UM.Preferences.getValue("cura/active_mode")) From 1c96c81ba98f9887cae38fe8de939db4131da9e4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 11:11:17 +0100 Subject: [PATCH 368/558] Remove unnecessary extra setMetaDataEntry This is a relic from when you first had to add the metadata entry. Now it does nothing any more because it's being set directly afterwards to the actual value that is desired in the end. Contributes to issue CURA-5876. --- cura/Settings/ExtruderStack.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cura/Settings/ExtruderStack.py b/cura/Settings/ExtruderStack.py index d7faedb71c..ed758db183 100644 --- a/cura/Settings/ExtruderStack.py +++ b/cura/Settings/ExtruderStack.py @@ -52,8 +52,6 @@ class ExtruderStack(CuraContainerStack): return super().getNextStack() def setEnabled(self, enabled: bool) -> None: - if "enabled" not in self._metadata: - self.setMetaDataEntry("enabled", "True") self.setMetaDataEntry("enabled", str(enabled)) self.enabledChanged.emit() From 4e2f51e7e8cbc58b647260885cc96d06c00727df Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 11:13:04 +0100 Subject: [PATCH 369/558] Use public activeExtruderIndex rather than internal _activeExtruderIndex So that this getter still does what it needs to do if we ever decide to add side-effects. Contributes to issue CURA-5876. --- cura/Settings/ExtruderManager.py | 4 ++-- cura/Settings/MachineManager.py | 2 +- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 9089ba96e9..b0bcf3b100 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -63,7 +63,7 @@ class ExtruderManager(QObject): if not self._application.getGlobalContainerStack(): return None # No active machine, so no active extruder. try: - return self._extruder_trains[self._application.getGlobalContainerStack().getId()][str(self._active_extruder_index)].getId() + return self._extruder_trains[self._application.getGlobalContainerStack().getId()][str(self.activeExtruderIndex)].getId() except KeyError: # Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong. return None @@ -144,7 +144,7 @@ class ExtruderManager(QObject): @pyqtSlot(result = QObject) def getActiveExtruderStack(self) -> Optional["ExtruderStack"]: - return self.getExtruderStack(self._active_extruder_index) + return self.getExtruderStack(self.activeExtruderIndex) ## Get an extruder stack by index def getExtruderStack(self, index) -> Optional["ExtruderStack"]: diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 226a352602..40a3bfc563 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -866,7 +866,7 @@ class MachineManager(QObject): caution_message = Message(catalog.i18nc( "@info:generic", "Settings have been changed to match the current availability of extruders: [%s]" % ", ".join(add_user_changes)), - lifetime=0, + lifetime = 0, title = catalog.i18nc("@info:title", "Settings updated")) caution_message.show() diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 594bf3a43e..71c96880e8 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -195,7 +195,7 @@ class ProcessSlicedLayersJob(Job): if extruders: material_color_map = numpy.zeros((len(extruders), 4), dtype=numpy.float32) for extruder in extruders: - position = int(extruder.getMetaDataEntry("position", default="0")) # Get the position + position = int(extruder.getMetaDataEntry("position", default = "0")) try: default_color = ExtrudersModel.defaultColors[position] except IndexError: From 17945c6b16ca3d0be7274a6946f68f4d381c8d48 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 30 Nov 2018 11:32:24 +0100 Subject: [PATCH 370/558] [WIP] Separate components in different files Contributes to CURA-5941 --- resources/qml/ExpandableComponent.qml | 3 + .../{ => Custom}/CustomPrintSetup.qml | 4 +- .../PrintSetupSelectorContents.qml | 31 +- .../RecommendedInfillDensitySelector.qml | 348 ++++++ .../Recommended/RecommendedPrintSetup.qml | 162 +++ .../RecommendedQualityProfileSelector.qml | 464 +++++++ .../RecommendedSupportSelector.qml | 175 +++ .../RecommendedPrintSetup.qml | 1064 ----------------- resources/qml/qmldir | 3 +- 9 files changed, 1173 insertions(+), 1081 deletions(-) rename resources/qml/PrintSetupSelector/{ => Custom}/CustomPrintSetup.qml (77%) create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml delete mode 100644 resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 47fa226e9d..82747d1c5b 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -27,6 +27,9 @@ Item // The popupItem holds the QML item that is shown when the "open" button is pressed property var popupItem + // The popupItem holds the QML item that is shown when the "open" button is pressed + property var componentItem + property color popupBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") diff --git a/resources/qml/PrintSetupSelector/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml similarity index 77% rename from resources/qml/PrintSetupSelector/CustomPrintSetup.qml rename to resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index f58695b48f..51cd8eff0d 100644 --- a/resources/qml/PrintSetupSelector/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 -import "../Settings" +import Cura 1.0 as Cura -SettingView { +Cura.SettingView { } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 309d612fae..f21253acd7 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -7,6 +7,9 @@ import QtQuick.Controls 2.3 import UM 1.3 as UM import Cura 1.0 as Cura +import "Recommended" +import "Custom" + Item { id: popup @@ -22,7 +25,7 @@ Item { id: header height: UM.Theme.getSize("print_setup_widget_header").height - color: UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here + color: "transparent" //UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here anchors { @@ -111,19 +114,19 @@ Item onHideTooltip: base.hideTooltip() visible: currentModeIndex == 0 } - - CustomPrintSetup - { - anchors - { - left: parent.left - right: parent.right - top: parent.top - } - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - visible: currentModeIndex == 1 - } +// +// CustomPrintSetup +// { +// anchors +// { +// left: parent.left +// right: parent.right +// top: parent.top +// } +// onShowTooltip: base.showTooltip(item, location, text) +// onHideTooltip: base.hideTooltip() +// visible: currentModeIndex == 1 +// } } Rectangle diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml new file mode 100644 index 0000000000..34cb8f2f20 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -0,0 +1,348 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import UM 1.2 as UM +import Cura 1.0 as Cura + + +// +// Infill +// +Item +{ + id: infillRow + + Cura.IconWithText + { + id: infillRowTitle + source: UM.Theme.getIcon("category_infill") + text: catalog.i18nc("@label", "Infill") + " (%)" + anchors.bottom: parent.bottom + width: labelColumnWidth + } + + Item + { + id: infillCellRight + + height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) + + anchors.left: infillRowTitle.right + anchors.right: parent.right + + Label + { + id: selectedInfillRateText + + anchors.left: infillSlider.left + anchors.right: parent.right + + text: parseInt(infillDensity.properties.value) + "%" + horizontalAlignment: Text.AlignLeft + + color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + } + + // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider + Binding + { + target: infillSlider + property: "value" + value: parseInt(infillDensity.properties.value) + } + + Slider + { + id: infillSlider + + anchors.top: selectedInfillRateText.bottom + anchors.left: parent.left + anchors.right: infillIcon.left + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + + height: UM.Theme.getSize("thick_margin").height + width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) + + minimumValue: 0 + maximumValue: 100 + stepSize: 1 + tickmarksEnabled: true + + // disable slider when gradual support is enabled + enabled: parseInt(infillSteps.properties.value) == 0 + + // set initial value from stack + value: parseInt(infillDensity.properties.value) + + onValueChanged: + { + + // Don't round the value if it's already the same + if (parseInt(infillDensity.properties.value) == infillSlider.value) + { + return + } + + // Round the slider value to the nearest multiple of 10 (simulate step size of 10) + var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 + + // Update the slider value to represent the rounded value + infillSlider.value = roundedSliderValue + + // Update value only if the Recomended mode is Active, + // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat + // same operation + var active_mode = UM.Preferences.getValue("cura/active_mode") + + if (active_mode == 0 || active_mode == "simple") + { + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) + Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") + } + } + + style: SliderStyle + { + groove: Rectangle + { + id: groove + implicitWidth: 200 * screenScaleFactor + implicitHeight: 2 * screenScaleFactor + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + radius: 1 + } + + handle: Item + { + Rectangle + { + id: handleButton + anchors.centerIn: parent + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: 10 * screenScaleFactor + implicitHeight: 10 * screenScaleFactor + radius: 10 * screenScaleFactor + } + } + + tickmarks: Repeater + { + id: repeater + model: control.maximumValue / control.stepSize + 1 + + // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) + function shouldShowTick (index) + { + if (index % 10 == 0) + { + return true + } + return false + } + + Rectangle + { + anchors.verticalCenter: parent.verticalCenter + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + width: 1 * screenScaleFactor + height: 6 * screenScaleFactor + x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) + visible: shouldShowTick(index) + } + } + } + } + + Rectangle + { + id: infillIcon + + width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) + height: width + + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) + + // we loop over all density icons and only show the one that has the current density and steps + Repeater + { + id: infillIconList + model: infillModel + anchors.fill: parent + + function activeIndex () + { + for (var i = 0; i < infillModel.count; i++) + { + var density = Math.round(infillDensity.properties.value) + var steps = Math.round(infillSteps.properties.value) + var infillModelItem = infillModel.get(i) + + if (infillModelItem != "undefined" + && density >= infillModelItem.percentageMin + && density <= infillModelItem.percentageMax + && steps >= infillModelItem.stepsMin + && steps <= infillModelItem.stepsMax) + { + return i + } + } + return -1 + } + + Rectangle + { + anchors.fill: parent + visible: infillIconList.activeIndex() == index + + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("quality_slider_unavailable") + + UM.RecolorImage + { + anchors.fill: parent + anchors.margins: 2 * screenScaleFactor + sourceSize.width: width + sourceSize.height: width + source: UM.Theme.getIcon(model.icon) + color: UM.Theme.getColor("quality_slider_unavailable") + } + } + } + } + + // Gradual Support Infill Checkbox + CheckBox + { + id: enableGradualInfillCheckBox + property alias _hovered: enableGradualInfillMouseArea.containsMouse + + anchors.top: infillSlider.bottom + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category + anchors.left: infillCellRight.left + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + visible: infillSteps.properties.enabled == "True" + checked: parseInt(infillSteps.properties.value) > 0 + + MouseArea + { + id: enableGradualInfillMouseArea + + anchors.fill: parent + hoverEnabled: true + enabled: true + + property var previousInfillDensity: parseInt(infillDensity.properties.value) + + onClicked: + { + // Set to 90% only when enabling gradual infill + var newInfillDensity; + if (parseInt(infillSteps.properties.value) == 0) + { + previousInfillDensity = parseInt(infillDensity.properties.value) + newInfillDensity = 90 + } else { + newInfillDensity = previousInfillDensity + } + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) + + var infill_steps_value = 0 + if (parseInt(infillSteps.properties.value) == 0) + { + infill_steps_value = 5 + } + + Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) + } + + onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), + catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) + + onExited: base.hideTooltip() + + } + + Label + { + id: gradualInfillLabel + height: parent.height + anchors.left: enableGradualInfillCheckBox.right + anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + verticalAlignment: Text.AlignVCenter; + text: catalog.i18nc("@label", "Enable gradual") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + } + + // Infill list model for mapping icon + ListModel + { + id: infillModel + Component.onCompleted: + { + infillModel.append({ + percentageMin: -1, + percentageMax: 0, + stepsMin: -1, + stepsMax: 0, + icon: "hollow" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 40, + stepsMin: -1, + stepsMax: 0, + icon: "sparse" + }) + infillModel.append({ + percentageMin: 40, + percentageMax: 89, + stepsMin: -1, + stepsMax: 0, + icon: "dense" + }) + infillModel.append({ + percentageMin: 90, + percentageMax: 9999999999, + stepsMin: -1, + stepsMax: 0, + icon: "solid" + }) + infillModel.append({ + percentageMin: 0, + percentageMax: 9999999999, + stepsMin: 1, + stepsMax: 9999999999, + icon: "gradual" + }) + } + } + } + + UM.SettingPropertyProvider + { + id: infillDensity + containerStackId: Cura.MachineManager.activeStackId + key: "infill_sparse_density" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: infillSteps + containerStackId: Cura.MachineManager.activeStackId + key: "gradual_infill_steps" + watchedProperties: ["value", "enabled"] + storeIndex: 0 + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml new file mode 100644 index 0000000000..2d4308c8be --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -0,0 +1,162 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Rectangle +{ + id: base + + signal showTooltip(Item item, point location, string text) + signal hideTooltip() +// width: parent.width + height: childrenRect.height + 2 * padding + color: "red" + opacity: 0.5 + + property Action configureSettings + + property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 + property real padding: UM.Theme.getSize("thick_margin").width + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + +// Rectangle +// { +// width: parent.width - 2 * parent.padding +// anchors +// { +// left: parent.left +// right: parent.right +// top: parent.top +// margins: parent.padding +// } +// color: "blue" +// height: 50 +// } + + Column + { + width: parent.width - 2 * parent.padding + spacing: UM.Theme.getSize("default_margin").height + anchors + { + left: parent.left + right: parent.right + top: parent.top + margins: parent.padding + } + + // TODO + property real labelColumnWidth: Math.round(width / 3) + property real settingsColumnWidth: width - labelColumnWidth + + RecommendedQualityProfileSelector + { + width: parent.width + // TODO Create a reusable component with these properties to not define them separately for each component + property real labelColumnWidth: parent.labelColumnWidth + property real settingsColumnWidth: parent.settingsColumnWidth + } + +// RecommendedInfillDensitySelector +// { +// width: parent.width +// height: childrenRect.height +// // TODO Create a reusable component with these properties to not define them separately for each component +// property real labelColumnWidth: parent.labelColumnWidth +// property real settingsColumnWidth: parent.settingsColumnWidth +// } +// +// RecommendedSupportSelector +// { +// width: parent.width +// height: childrenRect.height +// // TODO Create a reusable component with these properties to not define them separately for each component +// property real labelColumnWidth: parent.labelColumnWidth +// property real settingsColumnWidth: parent.settingsColumnWidth +// } + + +// +// // Adhesion +// Row +// { +// anchors.left: parent.left +// anchors.right: parent.right +// height: childrenRect.height +// +// Cura.IconWithText +// { +// id: adhesionHelperLabel +// visible: adhesionCheckBox.visible +// source: UM.Theme.getIcon("category_adhesion") +// text: catalog.i18nc("@label", "Adhesion") +// width: labelColumnWidth +// } +// +// CheckBox +// { +// id: adhesionCheckBox +// property alias _hovered: adhesionMouseArea.containsMouse +// +// //: Setting enable printing build-plate adhesion helper checkbox +// style: UM.Theme.styles.checkbox +// enabled: base.settingsEnabled +// +// visible: platformAdhesionType.properties.enabled == "True" +// checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" +// +// MouseArea +// { +// id: adhesionMouseArea +// anchors.fill: parent +// hoverEnabled: true +// enabled: base.settingsEnabled +// onClicked: +// { +// var adhesionType = "skirt" +// if(!parent.checked) +// { +// // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft +// platformAdhesionType.removeFromContainer(0) +// adhesionType = platformAdhesionType.properties.value +// if(adhesionType == "skirt" || adhesionType == "none") +// { +// // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim +// adhesionType = "brim" +// } +// } +// platformAdhesionType.setPropertyValue("value", adhesionType) +// } +// onEntered: +// { +// base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), +// catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); +// } +// onExited: base.hideTooltip() +// } +// } +// } + } + + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + removeUnusedValue: false //Doesn't work with settings that are resolved. + key: "adhesion_type" + watchedProperties: [ "value", "enabled" ] + storeIndex: 0 + } +} diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml new file mode 100644 index 0000000000..3bf93c0c07 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -0,0 +1,464 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import UM 1.2 as UM +import Cura 1.0 as Cura + + +// +// Quality profile +// +Item +{ + id: qualityRow + height: childrenRect.height + + Timer + { + id: qualitySliderChangeTimer + interval: 50 + running: false + repeat: false + onTriggered: + { + var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value); + Cura.MachineManager.activeQualityGroup = item.quality_group; + } + } + + Component.onCompleted: qualityModel.update() + + Connections + { + target: Cura.QualityProfilesDropDownMenuModel + onItemsChanged: qualityModel.update() + } + + Connections { + target: base + onVisibleChanged: + { + // update needs to be called when the widgets are visible, otherwise the step width calculation + // will fail because the width of an invisible item is 0. + if (visible) + { + qualityModel.update(); + } + } + } + + ListModel + { + id: qualityModel + + property var totalTicks: 0 + property var availableTotalTicks: 0 + property var existingQualityProfile: 0 + + property var qualitySliderActiveIndex: 0 + property var qualitySliderStepWidth: 0 + property var qualitySliderAvailableMin: 0 + property var qualitySliderAvailableMax: 0 + property var qualitySliderMarginRight: 0 + + function update () + { + reset() + + var availableMin = -1 + var availableMax = -1 + + for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) + { + var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i) + + // Add each quality item to the UI quality model + qualityModel.append(qualityItem) + + // Set selected value + if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) + { + // set to -1 when switching to user created profile so all ticks are clickable + if (Cura.SimpleModeSettingsManager.isProfileUserCreated) + { + qualityModel.qualitySliderActiveIndex = -1 + } + else + { + qualityModel.qualitySliderActiveIndex = i + } + + qualityModel.existingQualityProfile = 1 + } + + // Set min available + if (qualityItem.available && availableMin == -1) + { + availableMin = i + } + + // Set max available + if (qualityItem.available) + { + availableMax = i + } + } + + // Set total available ticks for active slider part + if (availableMin != -1) + { + qualityModel.availableTotalTicks = availableMax - availableMin + 1 + } + + // Calculate slider values + calculateSliderStepWidth(qualityModel.totalTicks) + calculateSliderMargins(availableMin, availableMax, qualityModel.totalTicks) + + qualityModel.qualitySliderAvailableMin = availableMin + qualityModel.qualitySliderAvailableMax = availableMax + } + + function calculateSliderStepWidth (totalTicks) + { + qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((settingsColumnWidth) / (totalTicks)) : 0 + } + + function calculateSliderMargins (availableMin, availableMax, totalTicks) + { + if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) + { + qualityModel.qualitySliderMarginRight = Math.round(settingsColumnWidth) + } + else if (availableMin == availableMax) + { + qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth) + } + else + { + qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth) + } + } + + function reset () { + qualityModel.clear() + qualityModel.availableTotalTicks = 0 + qualityModel.existingQualityProfile = 0 + + // check, the ticks count cannot be less than zero + qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1) + } + } + + Cura.IconWithText + { + id: qualityRowTitle + source: UM.Theme.getIcon("category_layer_height") + text: catalog.i18nc("@label", "Layer Height") +// anchors.bottom: speedSlider.bottom + width: labelColumnWidth + } + + //Print speed slider + Rectangle + { + id: speedSlider + + anchors + { + left: qualityRowTitle.right + right: parent.right + } + + color: "green" + height: 20 + } +// +// // Show titles for the each quality slider ticks +// Item +// { +// anchors.left: speedSlider.left +// anchors.top: speedSlider.bottom +// +// Repeater +// { +// model: qualityModel +// +// Label +// { +// anchors.verticalCenter: parent.verticalCenter +// anchors.top: parent.top +// color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") +// text: +// { +// var result = "" +// if(Cura.MachineManager.activeMachine != null) +// { +// result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height +// +// if(result == undefined) +// { +// result = ""; +// } +// else +// { +// result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... +// if (result == undefined || result != result) //Parse failure. +// { +// result = ""; +// } +// } +// } +// return result +// } +// +// x: +// { +// // Make sure the text aligns correctly with each tick +// if (qualityModel.totalTicks == 0) +// { +// // If there is only one tick, align it centrally +// return Math.round(((settingsColumnWidth) - width) / 2) +// } +// else if (index == 0) +// { +// return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index +// } +// else if (index == qualityModel.totalTicks) +// { +// return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width +// } +// else +// { +// return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) +// } +// } +// } +// } +// } +// +// //Print speed slider +// Rectangle +// { +// id: speedSlider +// +// anchors +// { +// left: qualityRowTitle.right +// right: parent.right +// } +// +// // This Item is used only for tooltip, for slider area which is unavailable +//// Item +//// { +//// function showTooltip (showTooltip) +//// { +//// if (showTooltip) +//// { +//// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") +//// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) +//// } +//// else +//// { +//// base.hideTooltip() +//// } +//// } +//// +//// id: unavailableLineToolTip +//// height: 20 * screenScaleFactor // hovered area height +//// z: parent.z + 1 // should be higher, otherwise the area can be hovered +//// x: 0 +//// anchors.verticalCenter: qualitySlider.verticalCenter +//// +//// Rectangle +//// { +//// id: leftArea +//// width: +//// { +//// if (qualityModel.availableTotalTicks == 0) +//// { +//// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks +//// } +//// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 +//// } +//// height: parent.height +//// color: "transparent" +//// +//// MouseArea +//// { +//// anchors.fill: parent +//// hoverEnabled: true +//// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +//// onEntered: unavailableLineToolTip.showTooltip(true) +//// onExited: unavailableLineToolTip.showTooltip(false) +//// } +//// } +//// +//// Item +//// { +//// id: rightArea +//// width: +//// { +//// if(qualityModel.availableTotalTicks == 0) +//// return 0 +//// +//// return qualityModel.qualitySliderMarginRight - 10 +//// } +//// height: parent.height +//// x: +//// { +//// if (qualityModel.availableTotalTicks == 0) +//// { +//// return 0 +//// } +//// +//// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin +//// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 +//// +//// return totalGap +//// } +//// +//// MouseArea +//// { +//// anchors.fill: parent +//// hoverEnabled: true +//// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +//// onEntered: unavailableLineToolTip.showTooltip(true) +//// onExited: unavailableLineToolTip.showTooltip(false) +//// } +//// } +//// } +// +// // Draw Unavailable line +// Rectangle +// { +// id: groovechildrect +// width: parent.width +// height: 2 * screenScaleFactor +// color: UM.Theme.getColor("quality_slider_unavailable") +// anchors.verticalCenter: qualitySlider.verticalCenter +// +// // Draw ticks +// Repeater +// { +// id: qualityRepeater +// model: qualityModel.totalTicks > 0 ? qualityModel : 0 +// +// Rectangle +// { +// color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") +// implicitWidth: 4 * screenScaleFactor +// implicitHeight: implicitWidth +// anchors.verticalCenter: parent.verticalCenter +// x: Math.round(qualityModel.qualitySliderStepWidth * index) +// radius: Math.round(implicitWidth / 2) +// } +// } +// } +// +// // Draw available slider +// Slider +// { +// id: qualitySlider +// height: UM.Theme.getSize("thick_margin").height +// anchors.bottom: parent.bottom +// enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized +// visible: qualityModel.availableTotalTicks > 0 +// updateValueWhileDragging : false +// +// minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 +// // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly +// // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) +// maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 +// stepSize: 1 +// +// value: qualityModel.qualitySliderActiveIndex +// +// width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) +// +// anchors.right: parent.right +// anchors.rightMargin: qualityModel.qualitySliderMarginRight +// +// style: SliderStyle +// { +// //Draw Available line +// groove: Rectangle +// { +// implicitHeight: 2 * screenScaleFactor +// color: UM.Theme.getColor("quality_slider_available") +// radius: Math.round(height / 2) +// } +// +// handle: Rectangle +// { +// id: qualityhandleButton +// color: UM.Theme.getColor("quality_slider_available") +// implicitWidth: 12 * screenScaleFactor +// implicitHeight: implicitWidth +// radius: Math.round(implicitWidth / 2) +// visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile +// } +// } +// +// onValueChanged: +// { +// // only change if an active machine is set and the slider is visible at all. +// if (Cura.MachineManager.activeMachine != null && visible) +// { +// // prevent updating during view initializing. Trigger only if the value changed by user +// if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) +// { +// // start updating with short delay +// qualitySliderChangeTimer.start() +// } +// } +// } +// } +// +// MouseArea +// { +// id: speedSliderMouseArea +// anchors.fill: parent +// hoverEnabled: true +// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated +// +// onEntered: +// { +// var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") +// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) +// } +// onExited: base.hideTooltip() +// } +// } +// +// UM.SimpleButton +// { +// id: customisedSettings +// +// visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated +// height: Math.round(speedSlider.height * 0.8) +// width: Math.round(speedSlider.height * 0.8) +// +// anchors.verticalCenter: speedSlider.verticalCenter +// anchors.right: speedSlider.left +// anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) +// +// color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); +// iconSource: UM.Theme.getIcon("reset"); +// +// onClicked: +// { +// // if the current profile is user-created, switch to a built-in quality +// Cura.MachineManager.resetToUseDefaultQuality() +// } +// onEntered: +// { +// var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") +// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) +// } +// onExited: base.hideTooltip() +// } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml new file mode 100644 index 0000000000..9c4e5ed576 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -0,0 +1,175 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +// +// Enable support +// +Row +{ + + Cura.IconWithText + { + id: enableSupportLabel + visible: enableSupportCheckBox.visible + source: UM.Theme.getIcon("category_support") + text: catalog.i18nc("@label", "Support") + width: labelColumnWidth + } + + CheckBox + { + id: enableSupportCheckBox + property alias _hovered: enableSupportMouseArea.containsMouse + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: supportEnabled.properties.enabled == "True" + checked: supportEnabled.properties.value == "True" + + MouseArea + { + id: enableSupportMouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") + + onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), + catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) + + onExited: base.hideTooltip() + + } + } + + ComboBox + { + id: supportExtruderCombobox + visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) + model: extruderModel + + property string color_override: "" // for manually setting values + property string color: // is evaluated automatically, but the first time is before extruderModel being filled + { + var current_extruder = extruderModel.get(currentIndex); + color_override = ""; + if (current_extruder === undefined) return "" + return (current_extruder.color) ? current_extruder.color : ""; + } + + textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started + + width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width + height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 + + Behavior on height { NumberAnimation { duration: 100 } } + + style: UM.Theme.styles.combobox_color + enabled: base.settingsEnabled + property alias _hovered: supportExtruderMouseArea.containsMouse + + currentIndex: + { + if (supportExtruderNr.properties == null) + { + return Cura.MachineManager.defaultExtruderPosition + } + else + { + var extruder = parseInt(supportExtruderNr.properties.value) + if ( extruder === -1) + { + return Cura.MachineManager.defaultExtruderPosition + } + return extruder; + } + } + + onActivated: supportExtruderNr.setPropertyValue("value", String(index)) + + MouseArea + { + id: supportExtruderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + acceptedButtons: Qt.NoButton + onEntered: + { + base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), + catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + } + onExited: base.hideTooltip() + + } + + function updateCurrentColor() + { + var current_extruder = extruderModel.get(currentIndex) + if (current_extruder !== undefined) + { + supportExtruderCombobox.color_override = current_extruder.color + } + } + } + + ListModel + { + id: extruderModel + Component.onCompleted: populateExtruderModel() + } + + //: Model used to populate the extrudelModel + Cura.ExtrudersModel + { + id: extruders + onModelChanged: populateExtruderModel() + } + + UM.SettingPropertyProvider + { + id: supportEnabled + containerStack: Cura.MachineManager.activeMachine + key: "support_enable" + watchedProperties: [ "value", "enabled", "description" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: extrudersEnabledCount + containerStack: Cura.MachineManager.activeMachine + key: "extruders_enabled_count" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + UM.SettingPropertyProvider + { + id: supportExtruderNr + containerStack: Cura.MachineManager.activeMachine + key: "support_extruder_nr" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + function populateExtruderModel() + { + extruderModel.clear() + for (var extruderNumber = 0; extruderNumber < extruders.rowCount(); extruderNumber++) + { + extruderModel.append({ + text: extruders.getItem(extruderNumber).name, + color: extruders.getItem(extruderNumber).color + }) + } + supportExtruderCombobox.updateCurrentColor() + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml deleted file mode 100644 index b48282135b..0000000000 --- a/resources/qml/PrintSetupSelector/RecommendedPrintSetup.qml +++ /dev/null @@ -1,1064 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Column -{ - id: base - - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - height: childrenRect.height + 2 * padding - - padding: UM.Theme.getSize("thick_margin").width - spacing: UM.Theme.getSize("default_margin").height - - property Action configureSettings - - property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - property real labelColumnWidth: Math.round(width / 3) - property real settingsColumnWidth: width - labelColumnWidth - - UM.I18nCatalog - { - id: catalog - name: "cura" - } - - // - // Quality profile - // - Item - { - id: qualityRow - - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height - - Timer - { - id: qualitySliderChangeTimer - interval: 50 - running: false - repeat: false - onTriggered: - { - var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value); - Cura.MachineManager.activeQualityGroup = item.quality_group; - } - } - - Component.onCompleted: qualityModel.update() - - Connections - { - target: Cura.QualityProfilesDropDownMenuModel - onItemsChanged: qualityModel.update() - } - - Connections { - target: base - onVisibleChanged: - { - // update needs to be called when the widgets are visible, otherwise the step width calculation - // will fail because the width of an invisible item is 0. - if (visible) - { - qualityModel.update(); - } - } - } - - ListModel - { - id: qualityModel - - property var totalTicks: 0 - property var availableTotalTicks: 0 - property var existingQualityProfile: 0 - - property var qualitySliderActiveIndex: 0 - property var qualitySliderStepWidth: 0 - property var qualitySliderAvailableMin: 0 - property var qualitySliderAvailableMax: 0 - property var qualitySliderMarginRight: 0 - - function update () - { - reset() - - var availableMin = -1 - var availableMax = -1 - - for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) - { - var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i) - - // Add each quality item to the UI quality model - qualityModel.append(qualityItem) - - // Set selected value - if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) - { - // set to -1 when switching to user created profile so all ticks are clickable - if (Cura.SimpleModeSettingsManager.isProfileUserCreated) - { - qualityModel.qualitySliderActiveIndex = -1 - } - else - { - qualityModel.qualitySliderActiveIndex = i - } - - qualityModel.existingQualityProfile = 1 - } - - // Set min available - if (qualityItem.available && availableMin == -1) - { - availableMin = i - } - - // Set max available - if (qualityItem.available) - { - availableMax = i - } - } - - // Set total available ticks for active slider part - if (availableMin != -1) - { - qualityModel.availableTotalTicks = availableMax - availableMin + 1 - } - - // Calculate slider values - calculateSliderStepWidth(qualityModel.totalTicks) - calculateSliderMargins(availableMin, availableMax, qualityModel.totalTicks) - - qualityModel.qualitySliderAvailableMin = availableMin - qualityModel.qualitySliderAvailableMax = availableMax - } - - function calculateSliderStepWidth (totalTicks) - { - qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((settingsColumnWidth) / (totalTicks)) : 0 - } - - function calculateSliderMargins (availableMin, availableMax, totalTicks) - { - if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) - { - qualityModel.qualitySliderMarginRight = Math.round(settingsColumnWidth) - } - else if (availableMin == availableMax) - { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth) - } - else - { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth) - } - } - - function reset () { - qualityModel.clear() - qualityModel.availableTotalTicks = 0 - qualityModel.existingQualityProfile = 0 - - // check, the ticks count cannot be less than zero - qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1) - } - } - - Cura.IconWithText - { - id: qualityRowTitle - source: UM.Theme.getIcon("category_layer_height") - text: catalog.i18nc("@label", "Layer Height") - anchors.bottom: speedSlider.bottom - width: labelColumnWidth - } - - // Show titles for the each quality slider ticks - Item - { - anchors.left: speedSlider.left - anchors.top: speedSlider.bottom - - Repeater - { - model: qualityModel - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.top: parent.top - color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - text: - { - var result = "" - if(Cura.MachineManager.activeMachine != null) - { - result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height - - if(result == undefined) - { - result = ""; - } - else - { - result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... - if (result == undefined || result != result) //Parse failure. - { - result = ""; - } - } - } - return result - } - - x: - { - // Make sure the text aligns correctly with each tick - if (qualityModel.totalTicks == 0) - { - // If there is only one tick, align it centrally - return Math.round(((settingsColumnWidth) - width) / 2) - } - else if (index == 0) - { - return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - } - else if (index == qualityModel.totalTicks) - { - return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width - } - else - { - return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) - } - } - } - } - } - - //Print speed slider - Rectangle - { - id: speedSlider - - anchors - { - left: qualityRowTitle.right - right: parent.right - } - - // This Item is used only for tooltip, for slider area which is unavailable -// Item -// { -// function showTooltip (showTooltip) -// { -// if (showTooltip) -// { -// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") -// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) -// } -// else -// { -// base.hideTooltip() -// } -// } -// -// id: unavailableLineToolTip -// height: 20 * screenScaleFactor // hovered area height -// z: parent.z + 1 // should be higher, otherwise the area can be hovered -// x: 0 -// anchors.verticalCenter: qualitySlider.verticalCenter -// -// Rectangle -// { -// id: leftArea -// width: -// { -// if (qualityModel.availableTotalTicks == 0) -// { -// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks -// } -// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 -// } -// height: parent.height -// color: "transparent" -// -// MouseArea -// { -// anchors.fill: parent -// hoverEnabled: true -// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -// onEntered: unavailableLineToolTip.showTooltip(true) -// onExited: unavailableLineToolTip.showTooltip(false) -// } -// } -// -// Item -// { -// id: rightArea -// width: -// { -// if(qualityModel.availableTotalTicks == 0) -// return 0 -// -// return qualityModel.qualitySliderMarginRight - 10 -// } -// height: parent.height -// x: -// { -// if (qualityModel.availableTotalTicks == 0) -// { -// return 0 -// } -// -// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin -// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 -// -// return totalGap -// } -// -// MouseArea -// { -// anchors.fill: parent -// hoverEnabled: true -// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -// onEntered: unavailableLineToolTip.showTooltip(true) -// onExited: unavailableLineToolTip.showTooltip(false) -// } -// } -// } - - // Draw Unavailable line - Rectangle - { - id: groovechildrect - width: parent.width - height: 2 * screenScaleFactor - color: UM.Theme.getColor("quality_slider_unavailable") - anchors.verticalCenter: qualitySlider.verticalCenter - - // Draw ticks - Repeater - { - id: qualityRepeater - model: qualityModel.totalTicks > 0 ? qualityModel : 0 - - Rectangle - { - color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 4 * screenScaleFactor - implicitHeight: implicitWidth - anchors.verticalCenter: parent.verticalCenter - x: Math.round(qualityModel.qualitySliderStepWidth * index) - radius: Math.round(implicitWidth / 2) - } - } - } - - // Draw available slider - Slider - { - id: qualitySlider - height: UM.Theme.getSize("thick_margin").height - anchors.bottom: parent.bottom - enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized - visible: qualityModel.availableTotalTicks > 0 - updateValueWhileDragging : false - - minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 - // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly - // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) - maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 - stepSize: 1 - - value: qualityModel.qualitySliderActiveIndex - - width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) - - anchors.right: parent.right - anchors.rightMargin: qualityModel.qualitySliderMarginRight - - style: SliderStyle - { - //Draw Available line - groove: Rectangle - { - implicitHeight: 2 * screenScaleFactor - color: UM.Theme.getColor("quality_slider_available") - radius: Math.round(height / 2) - } - - handle: Rectangle - { - id: qualityhandleButton - color: UM.Theme.getColor("quality_slider_available") - implicitWidth: 12 * screenScaleFactor - implicitHeight: implicitWidth - radius: Math.round(implicitWidth / 2) - visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile - } - } - - onValueChanged: - { - // only change if an active machine is set and the slider is visible at all. - if (Cura.MachineManager.activeMachine != null && visible) - { - // prevent updating during view initializing. Trigger only if the value changed by user - if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) - { - // start updating with short delay - qualitySliderChangeTimer.start() - } - } - } - } - - MouseArea - { - id: speedSliderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated - - onEntered: - { - var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - onExited: base.hideTooltip() - } - } - - UM.SimpleButton - { - id: customisedSettings - - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated - height: Math.round(speedSlider.height * 0.8) - width: Math.round(speedSlider.height * 0.8) - - anchors.verticalCenter: speedSlider.verticalCenter - anchors.right: speedSlider.left - anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); - iconSource: UM.Theme.getIcon("reset"); - - onClicked: - { - // if the current profile is user-created, switch to a built-in quality - Cura.MachineManager.resetToUseDefaultQuality() - } - onEntered: - { - var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) - } - onExited: base.hideTooltip() - } - } - - // - // Infill - // - Item - { - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height - - Cura.IconWithText - { - id: infillRowTitle - source: UM.Theme.getIcon("category_infill") - text: catalog.i18nc("@label", "Infill") + " (%)" - anchors.bottom: parent.bottom - width: labelColumnWidth - } - - Item - { - id: infillCellRight - - height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) - - anchors.left: infillRowTitle.right - anchors.right: parent.right - - Label - { - id: selectedInfillRateText - - anchors.left: infillSlider.left - anchors.right: parent.right - - text: parseInt(infillDensity.properties.value) + "%" - horizontalAlignment: Text.AlignLeft - - color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - } - - // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider - Binding - { - target: infillSlider - property: "value" - value: parseInt(infillDensity.properties.value) - } - - Slider - { - id: infillSlider - - anchors.top: selectedInfillRateText.bottom - anchors.left: parent.left - anchors.right: infillIcon.left - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - height: UM.Theme.getSize("thick_margin").height - width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) - - minimumValue: 0 - maximumValue: 100 - stepSize: 1 - tickmarksEnabled: true - - // disable slider when gradual support is enabled - enabled: parseInt(infillSteps.properties.value) == 0 - - // set initial value from stack - value: parseInt(infillDensity.properties.value) - - onValueChanged: - { - - // Don't round the value if it's already the same - if (parseInt(infillDensity.properties.value) == infillSlider.value) - { - return - } - - // Round the slider value to the nearest multiple of 10 (simulate step size of 10) - var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 - - // Update the slider value to represent the rounded value - infillSlider.value = roundedSliderValue - - // Update value only if the Recomended mode is Active, - // Otherwise if I change the value in the Custom mode the Recomended view will try to repeat - // same operation - var active_mode = UM.Preferences.getValue("cura/active_mode") - - if (active_mode == 0 || active_mode == "simple") - { - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) - Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") - } - } - - style: SliderStyle - { - groove: Rectangle - { - id: groove - implicitWidth: 200 * screenScaleFactor - implicitHeight: 2 * screenScaleFactor - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - radius: 1 - } - - handle: Item - { - Rectangle - { - id: handleButton - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 10 * screenScaleFactor - implicitHeight: 10 * screenScaleFactor - radius: 10 * screenScaleFactor - } - } - - tickmarks: Repeater - { - id: repeater - model: control.maximumValue / control.stepSize + 1 - - // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) - function shouldShowTick (index) - { - if (index % 10 == 0) - { - return true - } - return false - } - - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - width: 1 * screenScaleFactor - height: 6 * screenScaleFactor - x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) - visible: shouldShowTick(index) - } - } - } - } - - Rectangle - { - id: infillIcon - - width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) - height: width - - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) - - // we loop over all density icons and only show the one that has the current density and steps - Repeater - { - id: infillIconList - model: infillModel - anchors.fill: parent - - function activeIndex () - { - for (var i = 0; i < infillModel.count; i++) - { - var density = Math.round(infillDensity.properties.value) - var steps = Math.round(infillSteps.properties.value) - var infillModelItem = infillModel.get(i) - - if (infillModelItem != "undefined" - && density >= infillModelItem.percentageMin - && density <= infillModelItem.percentageMax - && steps >= infillModelItem.stepsMin - && steps <= infillModelItem.stepsMax) - { - return i - } - } - return -1 - } - - Rectangle - { - anchors.fill: parent - visible: infillIconList.activeIndex() == index - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("quality_slider_unavailable") - - UM.RecolorImage - { - anchors.fill: parent - anchors.margins: 2 * screenScaleFactor - sourceSize.width: width - sourceSize.height: width - source: UM.Theme.getIcon(model.icon) - color: UM.Theme.getColor("quality_slider_unavailable") - } - } - } - } - - // Gradual Support Infill Checkbox - CheckBox - { - id: enableGradualInfillCheckBox - property alias _hovered: enableGradualInfillMouseArea.containsMouse - - anchors.top: infillSlider.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - visible: infillSteps.properties.enabled == "True" - checked: parseInt(infillSteps.properties.value) > 0 - - MouseArea - { - id: enableGradualInfillMouseArea - - anchors.fill: parent - hoverEnabled: true - enabled: true - - property var previousInfillDensity: parseInt(infillDensity.properties.value) - - onClicked: - { - // Set to 90% only when enabling gradual infill - var newInfillDensity; - if (parseInt(infillSteps.properties.value) == 0) - { - previousInfillDensity = parseInt(infillDensity.properties.value) - newInfillDensity = 90 - } else { - newInfillDensity = previousInfillDensity - } - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) - - var infill_steps_value = 0 - if (parseInt(infillSteps.properties.value) == 0) - { - infill_steps_value = 5 - } - - Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) - } - - onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), - catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) - - onExited: base.hideTooltip() - - } - - Label - { - id: gradualInfillLabel - height: parent.height - anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - verticalAlignment: Text.AlignVCenter; - text: catalog.i18nc("@label", "Enable gradual") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - } - - // Infill list model for mapping icon - ListModel - { - id: infillModel - Component.onCompleted: - { - infillModel.append({ - percentageMin: -1, - percentageMax: 0, - stepsMin: -1, - stepsMax: 0, - icon: "hollow" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 40, - stepsMin: -1, - stepsMax: 0, - icon: "sparse" - }) - infillModel.append({ - percentageMin: 40, - percentageMax: 89, - stepsMin: -1, - stepsMax: 0, - icon: "dense" - }) - infillModel.append({ - percentageMin: 90, - percentageMax: 9999999999, - stepsMin: -1, - stepsMax: 0, - icon: "solid" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 9999999999, - stepsMin: 1, - stepsMax: 9999999999, - icon: "gradual" - }) - } - } - } - } - - // - // Enable support - // - Row - { - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height - - Cura.IconWithText - { - id: enableSupportLabel - visible: enableSupportCheckBox.visible - source: UM.Theme.getIcon("category_support") - text: catalog.i18nc("@label", "Support") - width: labelColumnWidth - } - - CheckBox - { - id: enableSupportCheckBox - property alias _hovered: enableSupportMouseArea.containsMouse - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: supportEnabled.properties.enabled == "True" - checked: supportEnabled.properties.value == "True" - - MouseArea - { - id: enableSupportMouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") - - onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), - catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) - - onExited: base.hideTooltip() - - } - } - - ComboBox - { - id: supportExtruderCombobox - visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) - model: extruderModel - - property string color_override: "" // for manually setting values - property string color: // is evaluated automatically, but the first time is before extruderModel being filled - { - var current_extruder = extruderModel.get(currentIndex); - color_override = ""; - if (current_extruder === undefined) return "" - return (current_extruder.color) ? current_extruder.color : ""; - } - - textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width - height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 - - Behavior on height { NumberAnimation { duration: 100 } } - - style: UM.Theme.styles.combobox_color - enabled: base.settingsEnabled - property alias _hovered: supportExtruderMouseArea.containsMouse - - currentIndex: - { - if (supportExtruderNr.properties == null) - { - return Cura.MachineManager.defaultExtruderPosition - } - else - { - var extruder = parseInt(supportExtruderNr.properties.value) - if ( extruder === -1) - { - return Cura.MachineManager.defaultExtruderPosition - } - return extruder; - } - } - - onActivated: supportExtruderNr.setPropertyValue("value", String(index)) - - MouseArea - { - id: supportExtruderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - acceptedButtons: Qt.NoButton - onEntered: - { - base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), - catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); - } - onExited: base.hideTooltip() - - } - - function updateCurrentColor() - { - var current_extruder = extruderModel.get(currentIndex) - if (current_extruder !== undefined) - { - supportExtruderCombobox.color_override = current_extruder.color - } - } - - } - } - - // Adhesion - Row - { - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height - - Cura.IconWithText - { - id: adhesionHelperLabel - visible: adhesionCheckBox.visible - source: UM.Theme.getIcon("category_adhesion") - text: catalog.i18nc("@label", "Adhesion") - width: labelColumnWidth - } - - CheckBox - { - id: adhesionCheckBox - property alias _hovered: adhesionMouseArea.containsMouse - - //: Setting enable printing build-plate adhesion helper checkbox - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: platformAdhesionType.properties.enabled == "True" - checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" - - MouseArea - { - id: adhesionMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - onClicked: - { - var adhesionType = "skirt" - if(!parent.checked) - { - // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft - platformAdhesionType.removeFromContainer(0) - adhesionType = platformAdhesionType.properties.value - if(adhesionType == "skirt" || adhesionType == "none") - { - // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim - adhesionType = "brim" - } - } - platformAdhesionType.setPropertyValue("value", adhesionType) - } - onEntered: - { - base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), - catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); - } - onExited: base.hideTooltip() - } - } - } - - ListModel - { - id: extruderModel - Component.onCompleted: populateExtruderModel() - } - - //: Model used to populate the extrudelModel - Cura.ExtrudersModel - { - id: extruders - onModelChanged: populateExtruderModel() - } - - UM.SettingPropertyProvider - { - id: infillExtruderNumber - containerStackId: Cura.MachineManager.activeStackId - key: "infill_extruder_nr" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: infillDensity - containerStackId: Cura.MachineManager.activeStackId - key: "infill_sparse_density" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: infillSteps - containerStackId: Cura.MachineManager.activeStackId - key: "gradual_infill_steps" - watchedProperties: ["value", "enabled"] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: platformAdhesionType - containerStack: Cura.MachineManager.activeMachine - removeUnusedValue: false //Doesn't work with settings that are resolved. - key: "adhesion_type" - watchedProperties: [ "value", "enabled" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: supportEnabled - containerStack: Cura.MachineManager.activeMachine - key: "support_enable" - watchedProperties: [ "value", "enabled", "description" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: extrudersEnabledCount - containerStack: Cura.MachineManager.activeMachine - key: "extruders_enabled_count" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - UM.SettingPropertyProvider - { - id: supportExtruderNr - containerStack: Cura.MachineManager.activeMachine - key: "support_extruder_nr" - watchedProperties: [ "value" ] - storeIndex: 0 - } - - function populateExtruderModel() - { - extruderModel.clear() - for (var extruderNumber = 0; extruderNumber < extruders.rowCount(); extruderNumber++) - { - extruderModel.append({ - text: extruders.getItem(extruderNumber).name, - color: extruders.getItem(extruderNumber).color - }) - } - supportExtruderCombobox.updateCurrentColor() - } -} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 6db8e0c544..c0a8bac0ae 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -14,4 +14,5 @@ OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml ExpandableComponent 1.0 ExpandableComponent.qml PrinterTypeLabel 1.0 PrinterTypeLabel.qml ViewsSelector 1.0 ViewsSelector.qml -ToolbarButton 1.0 ToolbarButton.qml \ No newline at end of file +ToolbarButton 1.0 ToolbarButton.qml +SettingView 1.0 SettingView.qml \ No newline at end of file From 6d4a460e58d81c66e849bcf17b444c3b164272ef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 30 Nov 2018 13:53:53 +0100 Subject: [PATCH 371/558] Move USB sidebar into the main view of the monitorstage CURA-5943 --- plugins/MonitorStage/MonitorMain.qml | 40 +++ plugins/MonitorStage/MonitorMainView.qml | 64 ----- plugins/MonitorStage/MonitorMenu.qml | 14 + plugins/MonitorStage/MonitorStage.py | 17 +- plugins/USBPrinting/MonitorItem.qml | 27 ++ plugins/USBPrinting/USBPrinterOutputDevice.py | 5 +- resources/qml/Cura.qml | 11 +- resources/qml/PrintMonitor.qml | 256 ++++++++++-------- 8 files changed, 250 insertions(+), 184 deletions(-) create mode 100644 plugins/MonitorStage/MonitorMain.qml delete mode 100644 plugins/MonitorStage/MonitorMainView.qml create mode 100644 plugins/MonitorStage/MonitorMenu.qml create mode 100644 plugins/USBPrinting/MonitorItem.qml diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml new file mode 100644 index 0000000000..1f287fc0fa --- /dev/null +++ b/plugins/MonitorStage/MonitorMain.qml @@ -0,0 +1,40 @@ +// Copyright (c) 2017 Ultimaker B.V. + +import QtQuick 2.10 +import QtQuick.Controls 1.4 + +import UM 1.3 as UM +import Cura 1.0 as Cura + + +Item +{ + // We show a nice overlay on the 3D viewer when the current output device has no monitor view + Rectangle + { + id: viewportOverlay + + color: UM.Theme.getColor("viewport_overlay") + anchors.fill: parent + MouseArea + { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true + } + } + + Loader + { + id: monitorViewComponent + + anchors.fill: parent + + height: parent.height + + property real maximumWidth: parent.width + property real maximumHeight: parent.height + + sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null + } +} diff --git a/plugins/MonitorStage/MonitorMainView.qml b/plugins/MonitorStage/MonitorMainView.qml deleted file mode 100644 index f5696bbf54..0000000000 --- a/plugins/MonitorStage/MonitorMainView.qml +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. - -import QtQuick 2.10 -import QtQuick.Controls 1.4 - -import UM 1.3 as UM -import Cura 1.0 as Cura - - -Item -{ - // parent could be undefined as this component is not visible at all times - width: parent ? parent.width : 0 - height: parent ? parent.height : 0 - - // We show a nice overlay on the 3D viewer when the current output device has no monitor view - Rectangle - { - id: viewportOverlay - - color: UM.Theme.getColor("viewport_overlay") - width: parent.width - height: parent.height - - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true - } - } - - Loader - { - id: monitorViewComponent - - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - - // If the sidebar is not set, the view should take the complete space. - property var widthFactor: monitorSidebarComponent.source == "" ? 1.0 : 0.7 - - width: Math.round(parent.width * widthFactor) - height: parent.height - - property real maximumWidth: parent.width - property real maximumHeight: parent.height - - sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null - } - - Loader - { - id: monitorSidebarComponent - - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: monitorViewComponent.right - anchors.right: parent.right - - source: UM.Controller.activeStage.sidebarComponent != null ? UM.Controller.activeStage.sidebarComponent : "" - } -} diff --git a/plugins/MonitorStage/MonitorMenu.qml b/plugins/MonitorStage/MonitorMenu.qml new file mode 100644 index 0000000000..4dec719313 --- /dev/null +++ b/plugins/MonitorStage/MonitorMenu.qml @@ -0,0 +1,14 @@ +// 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.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +Item +{ + signal showTooltip(Item item, point location, string text) + signal hideTooltip() +} \ No newline at end of file diff --git a/plugins/MonitorStage/MonitorStage.py b/plugins/MonitorStage/MonitorStage.py index ace201e994..69b7f20f4e 100644 --- a/plugins/MonitorStage/MonitorStage.py +++ b/plugins/MonitorStage/MonitorStage.py @@ -65,15 +65,10 @@ class MonitorStage(CuraStage): # We can only connect now, as we need to be sure that everything is loaded (plugins get created quite early) Application.getInstance().getMachineManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) self._onOutputDevicesChanged() - self._updateMainOverlay() - self._updateSidebar() - def _updateMainOverlay(self): - main_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("MonitorStage"), - "MonitorMainView.qml") - self.addDisplayComponent("main", main_component_path) - - def _updateSidebar(self): - sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles), - "MonitorSidebar.qml") - self.addDisplayComponent("sidebar", sidebar_component_path) + plugin_path = Application.getInstance().getPluginRegistry().getPluginPath(self.getPluginId()) + if plugin_path is not None: + menu_component_path = os.path.join(plugin_path, "MonitorMenu.qml") + main_component_path = os.path.join(plugin_path, "MonitorMain.qml") + self.addDisplayComponent("menu", menu_component_path) + self.addDisplayComponent("main", main_component_path) diff --git a/plugins/USBPrinting/MonitorItem.qml b/plugins/USBPrinting/MonitorItem.qml new file mode 100644 index 0000000000..a93b3eb69b --- /dev/null +++ b/plugins/USBPrinting/MonitorItem.qml @@ -0,0 +1,27 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura +Component +{ + Item + { + Rectangle + { + anchors.right: parent.right + width: parent.width * 0.3 + anchors.top: parent.top + anchors.bottom: parent.bottom + + Cura.PrintMonitor + { + anchors.fill: parent + } + } + } +} \ No newline at end of file diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index e1c39ff8fa..1d42e70366 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -1,5 +1,6 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import os from UM.Logger import Logger from UM.i18n import i18nCatalog @@ -64,7 +65,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._accepts_commands = True self._paused = False - self._printer_busy = False # when printer is preheating and waiting (M190/M109), or when waiting for action on the printer + self._printer_busy = False # When printer is preheating and waiting (M190/M109), or when waiting for action on the printer self.setConnectionText(catalog.i18nc("@info:status", "Connected via USB")) @@ -77,6 +78,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._firmware_name_requested = False self._firmware_updater = AvrFirmwareUpdater(self) + self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml") + CuraApplication.getInstance().getOnExitCallbackManager().addCallback(self._checkActivePrintingUponAppExit) # This is a callback function that checks if there is any printing in progress via USB when the application tries diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 36f5758fa3..3578888886 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -146,6 +146,7 @@ UM.MainWindow Rectangle { + id: stageMenuBackground anchors { left: parent.left @@ -153,7 +154,7 @@ UM.MainWindow top: parent.top } visible: stageMenu.source != "" - height: Math.round(UM.Theme.getSize("stage_menu").height / 2) + height: visible ? Math.round(UM.Theme.getSize("stage_menu").height / 2) : 0 LinearGradient { @@ -254,7 +255,13 @@ UM.MainWindow // A stage can control this area. If nothing is set, it will therefore show the 3D view. id: main - anchors.fill: parent + anchors + { + top: stageMenuBackground.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : "" } diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 723279847a..3cc161cbe7 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -11,136 +11,180 @@ import Cura 1.0 as Cura import "PrinterOutput" -Column + +Rectangle { - id: printMonitor + id: base + UM.I18nCatalog { id: catalog; name: "cura"} + + function showTooltip(item, position, text) + { + tooltip.text = text; + position = item.mapToItem(base, position.x - UM.Theme.getSize("default_arrow").width, position.y); + tooltip.show(position); + } + + function hideTooltip() + { + tooltip.hide(); + } + + function strPadLeft(string, pad, length) { + return (new Array(length + 1).join(pad) + string).slice(-length); + } + + function getPrettyTime(time) + { + var hours = Math.floor(time / 3600) + time -= hours * 3600 + var minutes = Math.floor(time / 60); + time -= minutes * 60 + var seconds = Math.floor(time); + + var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2); + return finalTime; + } + property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null property var activePrinter: connectedDevice != null ? connectedDevice.activePrinter : null property var activePrintJob: activePrinter != null ? activePrinter.activePrintJob: null - Cura.ExtrudersModel + SidebarTooltip { - id: extrudersModel - simpleNames: true + id: tooltip } - OutputDeviceHeader + Column { - outputDevice: connectedDevice - } + id: printMonitor - Rectangle - { - color: UM.Theme.getColor("wide_lining") - width: parent.width - height: childrenRect.height + anchors.fill: parent - Flow + Cura.ExtrudersModel { - id: extrudersGrid - spacing: UM.Theme.getSize("thick_lining").width + id: extrudersModel + simpleNames: true + } + + OutputDeviceHeader + { + outputDevice: connectedDevice + } + + Rectangle + { + color: UM.Theme.getColor("wide_lining") width: parent.width + height: childrenRect.height - Repeater + Flow { - id: extrudersRepeater - model: activePrinter != null ? activePrinter.extruders : null + id: extrudersGrid + spacing: UM.Theme.getSize("thick_lining").width + width: parent.width - ExtruderBox + Repeater { - color: UM.Theme.getColor("main_background") - width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("thick_lining").width / 2) - extruderModel: modelData + id: extrudersRepeater + model: activePrinter != null ? activePrinter.extruders : null + + ExtruderBox + { + color: UM.Theme.getColor("main_background") + width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("thick_lining").width / 2) + extruderModel: modelData + } } } } - } - Rectangle - { - color: UM.Theme.getColor("wide_lining") - width: parent.width - height: UM.Theme.getSize("thick_lining").width - } - - HeatedBedBox - { - visible: { - if(activePrinter != null && activePrinter.bedTemperature != -1) - { - return true - } - return false - } - printerModel: activePrinter - } - - UM.SettingPropertyProvider - { - id: bedTemperature - containerStack: Cura.MachineManager.activeMachine - key: "material_bed_temperature" - watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] - storeIndex: 0 - - property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None" - } - - UM.SettingPropertyProvider - { - id: machineExtruderCount - containerStack: Cura.MachineManager.activeMachine - key: "machine_extruder_count" - watchedProperties: ["value"] - } - - ManualPrinterControl - { - printerModel: activePrinter - visible: activePrinter != null ? activePrinter.canControlManually : false - } - - - MonitorSection - { - label: catalog.i18nc("@label", "Active print") - width: base.width - visible: activePrinter != null - } - - - MonitorItem - { - label: catalog.i18nc("@label", "Job Name") - value: activePrintJob != null ? activePrintJob.name : "" - width: base.width - visible: activePrinter != null - } - - MonitorItem - { - label: catalog.i18nc("@label", "Printing Time") - value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal) : "" - width: base.width - visible: activePrinter != null - } - - MonitorItem - { - label: catalog.i18nc("@label", "Estimated time left") - value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal - activePrintJob.timeElapsed) : "" - visible: + Rectangle { - if(activePrintJob == null) + color: UM.Theme.getColor("wide_lining") + width: parent.width + height: UM.Theme.getSize("thick_lining").width + } + + HeatedBedBox + { + visible: { + if(activePrinter != null && activePrinter.bedTemperature != -1) + { + return true + } return false } - - return (activePrintJob.state == "printing" || - activePrintJob.state == "resuming" || - activePrintJob.state == "pausing" || - activePrintJob.state == "paused") + printerModel: activePrinter + } + + UM.SettingPropertyProvider + { + id: bedTemperature + containerStack: Cura.MachineManager.activeMachine + key: "material_bed_temperature" + watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] + storeIndex: 0 + + property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None" + } + + UM.SettingPropertyProvider + { + id: machineExtruderCount + containerStack: Cura.MachineManager.activeMachine + key: "machine_extruder_count" + watchedProperties: ["value"] + } + + ManualPrinterControl + { + printerModel: activePrinter + visible: activePrinter != null ? activePrinter.canControlManually : false + } + + + MonitorSection + { + label: catalog.i18nc("@label", "Active print") + width: base.width + visible: activePrinter != null + } + + + MonitorItem + { + label: catalog.i18nc("@label", "Job Name") + value: activePrintJob != null ? activePrintJob.name : "" + width: base.width + visible: activePrinter != null + } + + MonitorItem + { + label: catalog.i18nc("@label", "Printing Time") + value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal) : "" + width: base.width + visible: activePrinter != null + } + + MonitorItem + { + label: catalog.i18nc("@label", "Estimated time left") + value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal - activePrintJob.timeElapsed) : "" + visible: + { + if(activePrintJob == null) + { + return false + } + + return (activePrintJob.state == "printing" || + activePrintJob.state == "resuming" || + activePrintJob.state == "pausing" || + activePrintJob.state == "paused") + } + width: base.width } - width: base.width } -} +} \ No newline at end of file From 48bdb735f2bfa9ef044065e5a9e0ca2a60e17361 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 30 Nov 2018 13:58:44 +0100 Subject: [PATCH 372/558] Added MachineSelector to monitor menu CURA-5943 --- plugins/MonitorStage/MonitorMenu.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/MonitorStage/MonitorMenu.qml b/plugins/MonitorStage/MonitorMenu.qml index 4dec719313..bc95c276e8 100644 --- a/plugins/MonitorStage/MonitorMenu.qml +++ b/plugins/MonitorStage/MonitorMenu.qml @@ -11,4 +11,13 @@ Item { signal showTooltip(Item item, point location, string text) signal hideTooltip() + + Cura.MachineSelector + { + id: machineSelection + headerCornerSide: Cura.RoundedRectangle.Direction.All + width: UM.Theme.getSize("machine_selector_widget").width + height: parent.height + anchors.centerIn: parent + } } \ No newline at end of file From 59a81be65c395628962d3587d24d62819d69259c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 30 Nov 2018 14:10:42 +0100 Subject: [PATCH 373/558] Fixed some leftover graphical issues CURA-5943 --- plugins/USBPrinting/MonitorItem.qml | 19 +++++++++++++++++++ .../qml/PrinterOutput/OutputDeviceHeader.qml | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/MonitorItem.qml b/plugins/USBPrinting/MonitorItem.qml index a93b3eb69b..8041698ef0 100644 --- a/plugins/USBPrinting/MonitorItem.qml +++ b/plugins/USBPrinting/MonitorItem.qml @@ -22,6 +22,25 @@ Component { anchors.fill: parent } + + Rectangle + { + id: footerSeparator + width: parent.width + height: UM.Theme.getSize("wide_lining").height + color: UM.Theme.getColor("wide_lining") + anchors.bottom: monitorButton.top + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height + } + + // MonitorButton is actually the bottom footer panel. + Cura.MonitorButton + { + id: monitorButton + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } } } } \ No newline at end of file diff --git a/resources/qml/PrinterOutput/OutputDeviceHeader.qml b/resources/qml/PrinterOutput/OutputDeviceHeader.qml index b5ed1b7b4e..e6328546ef 100644 --- a/resources/qml/PrinterOutput/OutputDeviceHeader.qml +++ b/resources/qml/PrinterOutput/OutputDeviceHeader.qml @@ -45,8 +45,8 @@ Item text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : "" font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_inactive") - anchors.top: parent.top - anchors.right: parent.right + anchors.top: outputDeviceNameLabel.bottom + anchors.left: parent.left anchors.margins: UM.Theme.getSize("default_margin").width } From 1a778b30782f1e6c19aeca2f4882936d98d9c3c6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 30 Nov 2018 14:18:07 +0100 Subject: [PATCH 374/558] Fix qualiy slider alignments Contributes to CURA-5941. --- .../qml/MonitorBuildplateConfiguration.qml | 2 +- .../PrintSetupSelectorContents.qml | 27 +- .../RecommendedQualityProfileSelector.qml | 391 ++++++++++-------- resources/themes/cura-light/theme.json | 8 +- 4 files changed, 241 insertions(+), 187 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 9ffb1eabb4..75cbf3b11d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -27,7 +27,7 @@ Item Row { height: parent.height - spacing: 12 * screenScaleFactor // TODO: Theme! (Should be same as extruder spacing) + spacing: UM.Theme.getSize("print_setup_slider_handle").width // TODO: Theme! (Should be same as extruder spacing) // This wrapper ensures that the buildplate icon is located centered // below an extruder icon. diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index f21253acd7..5f22e4c337 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -114,19 +114,20 @@ Item onHideTooltip: base.hideTooltip() visible: currentModeIndex == 0 } -// -// CustomPrintSetup -// { -// anchors -// { -// left: parent.left -// right: parent.right -// top: parent.top -// } -// onShowTooltip: base.showTooltip(item, location, text) -// onHideTooltip: base.hideTooltip() -// visible: currentModeIndex == 1 -// } + + CustomPrintSetup + { + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + height: 500 + onShowTooltip: base.showTooltip(item, location, text) + onHideTooltip: base.hideTooltip() + visible: currentModeIndex == 1 + } } Rectangle diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 3bf93c0c07..c7a9439b00 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -124,22 +124,27 @@ Item function calculateSliderStepWidth (totalTicks) { - qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((settingsColumnWidth) / (totalTicks)) : 0 + // Do not use Math.round otherwise the tickmarks won't be aligned + qualityModel.qualitySliderStepWidth = totalTicks != 0 ? + ((settingsColumnWidth - UM.Theme.getSize("print_setup_slider_handle").width) / (totalTicks)) : 0 } function calculateSliderMargins (availableMin, availableMax, totalTicks) { if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) { - qualityModel.qualitySliderMarginRight = Math.round(settingsColumnWidth) + // Do not use Math.round otherwise the tickmarks won't be aligned + qualityModel.qualitySliderMarginRight = settingsColumnWidth } else if (availableMin == availableMax) { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth) + // Do not use Math.round otherwise the tickmarks won't be aligned + qualityModel.qualitySliderMarginRight = (totalTicks - availableMin) * qualitySliderStepWidth } else { - qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth) + // Do not use Math.round otherwise the tickmarks won't be aligned + qualityModel.qualitySliderMarginRight = (totalTicks - availableMax) * qualitySliderStepWidth } } @@ -162,20 +167,6 @@ Item width: labelColumnWidth } - //Print speed slider - Rectangle - { - id: speedSlider - - anchors - { - left: qualityRowTitle.right - right: parent.right - } - - color: "green" - height: 20 - } // // // Show titles for the each quality slider ticks // Item @@ -240,104 +231,107 @@ Item // } // } // -// //Print speed slider -// Rectangle -// { -// id: speedSlider + //Print speed slider + Rectangle + { + id: speedSlider + + anchors + { + left: qualityRowTitle.right + right: parent.right + } + + color: "green" + height: childrenRect.height + + // This Item is used only for tooltip, for slider area which is unavailable +// Item +// { +// function showTooltip (showTooltip) +// { +// if (showTooltip) +// { +// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") +// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) +// } +// else +// { +// base.hideTooltip() +// } +// } // -// anchors -// { -// left: qualityRowTitle.right -// right: parent.right -// } +// id: unavailableLineToolTip +// height: 20 * screenScaleFactor // hovered area height +// z: parent.z + 1 // should be higher, otherwise the area can be hovered +// x: 0 +// anchors.verticalCenter: qualitySlider.verticalCenter // -// // This Item is used only for tooltip, for slider area which is unavailable -//// Item -//// { -//// function showTooltip (showTooltip) -//// { -//// if (showTooltip) -//// { -//// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") -//// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) -//// } -//// else -//// { -//// base.hideTooltip() -//// } -//// } -//// -//// id: unavailableLineToolTip -//// height: 20 * screenScaleFactor // hovered area height -//// z: parent.z + 1 // should be higher, otherwise the area can be hovered -//// x: 0 -//// anchors.verticalCenter: qualitySlider.verticalCenter -//// -//// Rectangle -//// { -//// id: leftArea -//// width: -//// { -//// if (qualityModel.availableTotalTicks == 0) -//// { -//// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks -//// } -//// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 -//// } -//// height: parent.height -//// color: "transparent" -//// -//// MouseArea -//// { -//// anchors.fill: parent -//// hoverEnabled: true -//// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -//// onEntered: unavailableLineToolTip.showTooltip(true) -//// onExited: unavailableLineToolTip.showTooltip(false) -//// } -//// } -//// -//// Item -//// { -//// id: rightArea -//// width: -//// { -//// if(qualityModel.availableTotalTicks == 0) -//// return 0 -//// -//// return qualityModel.qualitySliderMarginRight - 10 -//// } -//// height: parent.height -//// x: -//// { -//// if (qualityModel.availableTotalTicks == 0) -//// { -//// return 0 -//// } -//// -//// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin -//// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 -//// -//// return totalGap -//// } -//// -//// MouseArea -//// { -//// anchors.fill: parent -//// hoverEnabled: true -//// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -//// onEntered: unavailableLineToolTip.showTooltip(true) -//// onExited: unavailableLineToolTip.showTooltip(false) -//// } -//// } -//// } +// Rectangle +// { +// id: leftArea +// width: +// { +// if (qualityModel.availableTotalTicks == 0) +// { +// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks +// } +// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 +// } +// height: parent.height +// color: "transparent" // +// MouseArea +// { +// anchors.fill: parent +// hoverEnabled: true +// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +// onEntered: unavailableLineToolTip.showTooltip(true) +// onExited: unavailableLineToolTip.showTooltip(false) +// } +// } +// +// Item +// { +// id: rightArea +// width: +// { +// if(qualityModel.availableTotalTicks == 0) +// return 0 +// +// return qualityModel.qualitySliderMarginRight - 10 +// } +// height: parent.height +// x: +// { +// if (qualityModel.availableTotalTicks == 0) +// { +// return 0 +// } +// +// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin +// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 +// +// return totalGap +// } +// +// MouseArea +// { +// anchors.fill: parent +// hoverEnabled: true +// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false +// onEntered: unavailableLineToolTip.showTooltip(true) +// onExited: unavailableLineToolTip.showTooltip(false) +// } +// } +// } + // // Draw Unavailable line // Rectangle // { // id: groovechildrect // width: parent.width -// height: 2 * screenScaleFactor +// height: 2 * UM.Theme.getSize("default_lining").height // color: UM.Theme.getColor("quality_slider_unavailable") // anchors.verticalCenter: qualitySlider.verticalCenter // @@ -358,66 +352,125 @@ Item // } // } // } -// -// // Draw available slider -// Slider -// { -// id: qualitySlider -// height: UM.Theme.getSize("thick_margin").height -// anchors.bottom: parent.bottom -// enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized -// visible: qualityModel.availableTotalTicks > 0 -// updateValueWhileDragging : false -// -// minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 -// // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly -// // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) -// maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 -// stepSize: 1 -// -// value: qualityModel.qualitySliderActiveIndex -// -// width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) -// -// anchors.right: parent.right -// anchors.rightMargin: qualityModel.qualitySliderMarginRight -// -// style: SliderStyle -// { -// //Draw Available line -// groove: Rectangle -// { -// implicitHeight: 2 * screenScaleFactor -// color: UM.Theme.getColor("quality_slider_available") -// radius: Math.round(height / 2) -// } -// -// handle: Rectangle -// { -// id: qualityhandleButton -// color: UM.Theme.getColor("quality_slider_available") -// implicitWidth: 12 * screenScaleFactor -// implicitHeight: implicitWidth -// radius: Math.round(implicitWidth / 2) -// visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile -// } -// } -// -// onValueChanged: -// { -// // only change if an active machine is set and the slider is visible at all. -// if (Cura.MachineManager.activeMachine != null && visible) -// { -// // prevent updating during view initializing. Trigger only if the value changed by user -// if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) -// { -// // start updating with short delay -// qualitySliderChangeTimer.start() -// } -// } -// } -// } -// + + // Draw unavailable slider + Slider + { + id: unavailableSlider + height: UM.Theme.getSize("thick_margin").height + updateValueWhileDragging : false + tickmarksEnabled: true + + minimumValue: 0 + // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly + // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) + maximumValue: qualityModel.totalTicks + stepSize: 1 + + width: parent.width + + style: SliderStyle + { + //Draw Unvailable line + groove: Item + { + Rectangle + { + height: UM.Theme.getSize("print_setup_slider_groove").height + width: control.width - UM.Theme.getSize("print_setup_slider_handle").width + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: UM.Theme.getColor("quality_slider_unavailable") + } + } + + handle: Item {} + + tickmarks: Repeater + { + id: qualityRepeater + model: qualityModel.totalTicks > 0 ? qualityModel : 0 + + Rectangle + { + color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: UM.Theme.getSize("print_setup_slider_tickmarks").width + implicitHeight: UM.Theme.getSize("print_setup_slider_tickmarks").height + anchors.verticalCenter: parent.verticalCenter + + // Do not use Math.round otherwise the tickmarks won't be aligned + x: ((UM.Theme.getSize("print_setup_slider_handle").width / 2) - (UM.Theme.getSize("print_setup_slider_tickmarks").width / 2) + (qualityModel.qualitySliderStepWidth * index)) + radius: Math.round(implicitWidth / 2) + } + } + } + } + + // Draw available slider + Slider + { + id: qualitySlider + height: UM.Theme.getSize("thick_margin").height + enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized + visible: qualityModel.availableTotalTicks > 0 + updateValueWhileDragging : false + + minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 + // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly + // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) + maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1 + stepSize: 1 + + value: qualityModel.qualitySliderActiveIndex + + width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) + UM.Theme.getSize("print_setup_slider_handle").width + + anchors.right: parent.right + anchors.rightMargin: qualityModel.qualitySliderMarginRight + + style: SliderStyle + { + // Draw Available line + groove: Item + { + Rectangle + { + height: UM.Theme.getSize("print_setup_slider_groove").height + width: control.width - UM.Theme.getSize("print_setup_slider_handle").width + anchors.verticalCenter: parent.verticalCenter + + // Do not use Math.round otherwise the tickmarks won't be aligned + x: UM.Theme.getSize("print_setup_slider_handle").width / 2 + color: UM.Theme.getColor("quality_slider_available") + } + } + + handle: Rectangle + { + id: qualityhandleButton + color: UM.Theme.getColor("primary") + implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width + implicitHeight: implicitWidth + radius: Math.round(implicitWidth / 2) + visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile + } + } + + onValueChanged: + { + // only change if an active machine is set and the slider is visible at all. + if (Cura.MachineManager.activeMachine != null && visible) + { + // prevent updating during view initializing. Trigger only if the value changed by user + if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) + { + // start updating with short delay + qualitySliderChangeTimer.start() + } + } + } + } + // MouseArea // { // id: speedSliderMouseArea @@ -432,7 +485,7 @@ Item // } // onExited: base.hideTooltip() // } -// } + } // // UM.SimpleButton // { diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index dfaa9008f7..9bf0bf19aa 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -373,6 +373,9 @@ "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], "print_setup_widget_header": [0.0, 3.0], + "print_setup_slider_groove": [0.16, 0.16], + "print_setup_slider_handle": [1.0, 1.0], + "print_setup_slider_tickmarks": [0.32, 0.32], "configuration_selector_mode_tabs": [0.0, 3.0], @@ -521,9 +524,6 @@ "monitor_thick_lining": [0.16, 0.16], "monitor_corner_radius": [0.3, 0.3], "monitor_shadow_radius": [0.4, 0.4], - "monitor_shadow_offset": [0.15, 0.15], - - "print_setup_action_button": [13, 5], - "print_setup_content_top_margin": [3, 3] + "monitor_shadow_offset": [0.15, 0.15] } } From 73568d74737fb32006ece5355c6ef4c13ce97ae7 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 30 Nov 2018 14:51:55 +0100 Subject: [PATCH 375/558] Added icon to the search field which filters settings CURA-5941 --- resources/qml/Settings/SettingView.qml | 4 ++-- resources/themes/cura-light/icons/search.svg | 25 ++++++++++++++++---- resources/themes/cura-light/theme.json | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 8a336a7ed1..0a7102ff45 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -105,12 +105,12 @@ Item anchors.right: clearFilterButton.left anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width) - placeholderText: catalog.i18nc("@label:textbox", "Search...") + placeholderText: "" + "
" + catalog.i18nc("@label:textbox", "search settings") style: TextFieldStyle { textColor: UM.Theme.getColor("setting_control_text"); - placeholderTextColor: UM.Theme.getColor("setting_control_text") + placeholderTextColor: UM.Theme.getColor("setting_filter_field") font: UM.Theme.getFont("default"); background: Item {} } diff --git a/resources/themes/cura-light/icons/search.svg b/resources/themes/cura-light/icons/search.svg index 8272991300..a9ccb612fd 100644 --- a/resources/themes/cura-light/icons/search.svg +++ b/resources/themes/cura-light/icons/search.svg @@ -1,4 +1,21 @@ - - - + + + + Shape + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index dfaa9008f7..4e39ffdf22 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -221,6 +221,7 @@ "setting_validation_warning_background": [255, 145, 62, 255], "setting_validation_warning": [127, 127, 127, 255], "setting_validation_ok": [255, 255, 255, 255], + "setting_filter_field" : [153, 153, 153, 255], "material_compatibility_warning": [0, 0, 0, 255], From e93bbf07a4e377bb55e7b5c62292487344fcc29a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 14:53:10 +0100 Subject: [PATCH 376/558] Fix circular dependency with tab index and active stack Only when actually clicking the tab should it change the active extruder index; not when the current index is changed for any other reason. Next up: Don't change the current index for any other reason. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 87096c3a14..8ad512349b 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -35,7 +35,7 @@ Item anchors.top: header.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) + currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) Repeater { @@ -53,6 +53,10 @@ Item height: parent.height } } + onClicked: + { + Cura.ExtruderManager.setActiveExtruderIndex(tabBar.currentIndex) + } } } } From 1fbcff2cb9a0df2b35c054ffef638e863eeb54f4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 30 Nov 2018 15:06:53 +0100 Subject: [PATCH 377/558] Fix the tooltips in the profile selector in the recommended mode Contributes to CURA-5941. --- .../Recommended/RecommendedPrintSetup.qml | 4 +- .../RecommendedQualityProfileSelector.qml | 226 ++++++------------ 2 files changed, 70 insertions(+), 160 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 2d4308c8be..40a1910c69 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -8,7 +8,7 @@ import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.0 as Cura -Rectangle +Item { id: base @@ -16,8 +16,6 @@ Rectangle signal hideTooltip() // width: parent.width height: childrenRect.height + 2 * padding - color: "red" - opacity: 0.5 property Action configureSettings diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index c7a9439b00..755af9311f 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -163,7 +163,6 @@ Item id: qualityRowTitle source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") -// anchors.bottom: speedSlider.bottom width: labelColumnWidth } @@ -232,9 +231,10 @@ Item // } // //Print speed slider - Rectangle + Item { id: speedSlider + height: childrenRect.height anchors { @@ -242,122 +242,11 @@ Item right: parent.right } - color: "green" - height: childrenRect.height - - // This Item is used only for tooltip, for slider area which is unavailable -// Item -// { -// function showTooltip (showTooltip) -// { -// if (showTooltip) -// { -// var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") -// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) -// } -// else -// { -// base.hideTooltip() -// } -// } -// -// id: unavailableLineToolTip -// height: 20 * screenScaleFactor // hovered area height -// z: parent.z + 1 // should be higher, otherwise the area can be hovered -// x: 0 -// anchors.verticalCenter: qualitySlider.verticalCenter -// -// Rectangle -// { -// id: leftArea -// width: -// { -// if (qualityModel.availableTotalTicks == 0) -// { -// return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks -// } -// return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 -// } -// height: parent.height -// color: "transparent" -// -// MouseArea -// { -// anchors.fill: parent -// hoverEnabled: true -// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -// onEntered: unavailableLineToolTip.showTooltip(true) -// onExited: unavailableLineToolTip.showTooltip(false) -// } -// } -// -// Item -// { -// id: rightArea -// width: -// { -// if(qualityModel.availableTotalTicks == 0) -// return 0 -// -// return qualityModel.qualitySliderMarginRight - 10 -// } -// height: parent.height -// x: -// { -// if (qualityModel.availableTotalTicks == 0) -// { -// return 0 -// } -// -// var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin -// var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 -// -// return totalGap -// } -// -// MouseArea -// { -// anchors.fill: parent -// hoverEnabled: true -// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false -// onEntered: unavailableLineToolTip.showTooltip(true) -// onExited: unavailableLineToolTip.showTooltip(false) -// } -// } -// } - -// // Draw Unavailable line -// Rectangle -// { -// id: groovechildrect -// width: parent.width -// height: 2 * UM.Theme.getSize("default_lining").height -// color: UM.Theme.getColor("quality_slider_unavailable") -// anchors.verticalCenter: qualitySlider.verticalCenter -// -// // Draw ticks -// Repeater -// { -// id: qualityRepeater -// model: qualityModel.totalTicks > 0 ? qualityModel : 0 -// -// Rectangle -// { -// color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") -// implicitWidth: 4 * screenScaleFactor -// implicitHeight: implicitWidth -// anchors.verticalCenter: parent.verticalCenter -// x: Math.round(qualityModel.qualitySliderStepWidth * index) -// radius: Math.round(implicitWidth / 2) -// } -// } -// } - // Draw unavailable slider Slider { id: unavailableSlider - height: UM.Theme.getSize("thick_margin").height + height: qualitySlider.height // Same height as the slider that is on top updateValueWhileDragging : false tickmarksEnabled: true @@ -404,13 +293,27 @@ Item } } } + + // Create a mouse area on top of the unavailable profiles to show a specific tooltip + MouseArea + { + anchors.fill: parent + hoverEnabled: true + enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated + onEntered: + { + var tooltipContent: catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), unavailableSlider.tooltipContent) + } + onExited: base.hideTooltip() + } } // Draw available slider Slider { id: qualitySlider - height: UM.Theme.getSize("thick_margin").height + height: UM.Theme.getSize("print_setup_slider_handle").height // The handle is the widest element of the slider enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized visible: qualityModel.availableTotalTicks > 0 updateValueWhileDragging : false @@ -469,49 +372,58 @@ Item } } } + + // This mouse area is only used to capture the onHover state and don't propagate it to the unavailable mouse area + MouseArea + { + anchors.fill: parent + hoverEnabled: true + enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated + } } -// MouseArea -// { -// id: speedSliderMouseArea -// anchors.fill: parent -// hoverEnabled: true -// enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated -// -// onEntered: -// { -// var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") -// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) -// } -// onExited: base.hideTooltip() -// } + // This mouse area will only take the mouse events and show a tooltip when the profile in use is + // a user created profile + MouseArea + { + anchors.fill: parent + hoverEnabled: true + visible: Cura.SimpleModeSettingsManager.isProfileUserCreated + + onEntered: + { + var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + } + onExited: base.hideTooltip() + } + } + + UM.SimpleButton + { + id: customisedSettings + + visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated + height: Math.round(speedSlider.height * 0.8) + width: Math.round(speedSlider.height * 0.8) + + anchors.verticalCenter: speedSlider.verticalCenter + anchors.right: speedSlider.left + anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) + + color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); + iconSource: UM.Theme.getIcon("reset"); + + onClicked: + { + // if the current profile is user-created, switch to a built-in quality + Cura.MachineManager.resetToUseDefaultQuality() + } + onEntered: + { + var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + } + onExited: base.hideTooltip() } -// -// UM.SimpleButton -// { -// id: customisedSettings -// -// visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated -// height: Math.round(speedSlider.height * 0.8) -// width: Math.round(speedSlider.height * 0.8) -// -// anchors.verticalCenter: speedSlider.verticalCenter -// anchors.right: speedSlider.left -// anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) -// -// color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); -// iconSource: UM.Theme.getIcon("reset"); -// -// onClicked: -// { -// // if the current profile is user-created, switch to a built-in quality -// Cura.MachineManager.resetToUseDefaultQuality() -// } -// onEntered: -// { -// var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") -// base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) -// } -// onExited: base.hideTooltip() -// } } \ No newline at end of file From 47b7d7bed8f1953297a78628ec7571e40c1cef78 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 30 Nov 2018 15:17:59 +0100 Subject: [PATCH 378/558] Make the slider available for clicking This was accidentally removed in the previous commit. Contributes to CURA-5941. --- .../RecommendedQualityProfileSelector.qml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 755af9311f..50da35814c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -231,6 +231,8 @@ Item // } // //Print speed slider + // Two sliders are created, one at the bottom with the unavailable qualities + // and the other at the top with the available quality profiles and so the handle to select them. Item { id: speedSlider @@ -302,8 +304,8 @@ Item enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated onEntered: { - var tooltipContent: catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), unavailableSlider.tooltipContent) + var tooltipContent = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) } onExited: base.hideTooltip() } @@ -378,6 +380,7 @@ Item { anchors.fill: parent hoverEnabled: true + acceptedButtons: Qt.NoButton enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated } } @@ -392,8 +395,8 @@ Item onEntered: { - var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + var tooltipContent = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) } onExited: base.hideTooltip() } @@ -421,8 +424,8 @@ Item } onEntered: { - var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) + var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) } onExited: base.hideTooltip() } From 2c5f5170c2d05f5ffce1da5c471ff14b8289cc5b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 30 Nov 2018 15:38:28 +0100 Subject: [PATCH 379/558] Add the labels of the layer height to the slider Contributes to CURA-5941. --- .../RecommendedQualityProfileSelector.qml | 205 +++++++++--------- 1 file changed, 108 insertions(+), 97 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 50da35814c..f7e1d870c9 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -158,78 +158,116 @@ Item } } - Cura.IconWithText + Item { - id: qualityRowTitle - source: UM.Theme.getIcon("category_layer_height") - text: catalog.i18nc("@label", "Layer Height") + id: titleRow width: labelColumnWidth + height: childrenRect.height + + Cura.IconWithText + { + id: qualityRowTitle + source: UM.Theme.getIcon("category_layer_height") + text: catalog.i18nc("@label", "Layer Height") + anchors.left: parent.left + anchors.right: customisedSettings.left + } + + UM.SimpleButton + { + id: customisedSettings + + visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated + height: visible ? Math.round(0.8 * qualityRowTitle.height) : 0 + width: height + anchors + { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + leftMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + + color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + iconSource: UM.Theme.getIcon("reset") + + onClicked: + { + // if the current profile is user-created, switch to a built-in quality + Cura.MachineManager.resetToUseDefaultQuality() + } + onEntered: + { + var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) + } + onExited: base.hideTooltip() + } + } + + // Show titles for the each quality slider ticks + Item + { + anchors.left: speedSlider.left + anchors.top: speedSlider.bottom + + Repeater + { + model: qualityModel + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.top: parent.top + color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + text: + { + var result = "" + if(Cura.MachineManager.activeMachine != null) + { + result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height + + if(result == undefined) + { + result = ""; + } + else + { + result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... + if (result == undefined || result != result) //Parse failure. + { + result = ""; + } + } + } + return result + } + + x: + { + // Make sure the text aligns correctly with each tick + if (qualityModel.totalTicks == 0) + { + // If there is only one tick, align it centrally + return Math.round(((settingsColumnWidth) - width) / 2) + } + else if (index == 0) + { + return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index + } + else if (index == qualityModel.totalTicks) + { + return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width + } + else + { + return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) + } + } + } + } } -// -// // Show titles for the each quality slider ticks -// Item -// { -// anchors.left: speedSlider.left -// anchors.top: speedSlider.bottom -// -// Repeater -// { -// model: qualityModel -// -// Label -// { -// anchors.verticalCenter: parent.verticalCenter -// anchors.top: parent.top -// color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") -// text: -// { -// var result = "" -// if(Cura.MachineManager.activeMachine != null) -// { -// result = Cura.QualityProfilesDropDownMenuModel.getItem(index).layer_height -// -// if(result == undefined) -// { -// result = ""; -// } -// else -// { -// result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult... -// if (result == undefined || result != result) //Parse failure. -// { -// result = ""; -// } -// } -// } -// return result -// } -// -// x: -// { -// // Make sure the text aligns correctly with each tick -// if (qualityModel.totalTicks == 0) -// { -// // If there is only one tick, align it centrally -// return Math.round(((settingsColumnWidth) - width) / 2) -// } -// else if (index == 0) -// { -// return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index -// } -// else if (index == qualityModel.totalTicks) -// { -// return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width -// } -// else -// { -// return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) -// } -// } -// } -// } -// } -// //Print speed slider // Two sliders are created, one at the bottom with the unavailable qualities // and the other at the top with the available quality profiles and so the handle to select them. @@ -240,8 +278,9 @@ Item anchors { - left: qualityRowTitle.right + left: titleRow.right right: parent.right + verticalCenter: titleRow.verticalCenter } // Draw unavailable slider @@ -401,32 +440,4 @@ Item onExited: base.hideTooltip() } } - - UM.SimpleButton - { - id: customisedSettings - - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated - height: Math.round(speedSlider.height * 0.8) - width: Math.round(speedSlider.height * 0.8) - - anchors.verticalCenter: speedSlider.verticalCenter - anchors.right: speedSlider.left - anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); - iconSource: UM.Theme.getIcon("reset"); - - onClicked: - { - // if the current profile is user-created, switch to a built-in quality - Cura.MachineManager.resetToUseDefaultQuality() - } - onEntered: - { - var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) - } - onExited: base.hideTooltip() - } } \ No newline at end of file From 1d9a13cac27c4e8c571c53757ec81882d1c8994a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 15:40:59 +0100 Subject: [PATCH 380/558] Reset tab index when repeater's model is rebuilt We can't prevent the model from being rebuilt. At least, not without a major refactor. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 8ad512349b..bdf5ccfaa1 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -39,6 +39,7 @@ Item Repeater { + id: repeater model: extrudersModel delegate: UM.TabRowButton { @@ -59,6 +60,18 @@ Item } } } + + //When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt. + //This causes the currentIndex of the tab to be in an invalid position which resets it to 0. + //Therefore we need to change it back to what it was: The active extruder index. + Connections + { + target: repeater.model + onModelChanged: + { + tabBar.currentIndex = Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) + } + } } Rectangle From 18bb403413330fa4891ec80d4cb6177b8caa71b3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 15:42:46 +0100 Subject: [PATCH 381/558] No longer switch away from extruder when disabling It feels confusing when this happens. Contributes to issue CURA-5876. --- cura/Settings/ExtrudersModel.py | 4 ++-- cura/Settings/MachineManager.py | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 14a8dadc69..955bd9dbb2 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, pyqtProperty, QTimer @@ -177,7 +177,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): machine_extruder_count = global_container_stack.getProperty("machine_extruder_count", "value") for extruder in Application.getInstance().getExtruderManager().getActiveExtruderStacks(): - position = extruder.getMetaDataEntry("position", default = "0") # Get the position + position = extruder.getMetaDataEntry("position", default = "0") try: position = int(position) except ValueError: diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 40a3bfc563..be4a4e2b4e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -993,10 +993,6 @@ class MachineManager(QObject): self.updateNumberExtrudersEnabled() self.correctExtruderSettings() - # In case this extruder is being disabled and it's the currently selected one, switch to the default extruder - if not enabled and position == ExtruderManager.getInstance().activeExtruderIndex: - ExtruderManager.getInstance().setActiveExtruderIndex(int(self._default_extruder_position)) - # ensure that the quality profile is compatible with current combination, or choose a compatible one if available self._updateQualityWithMaterial() self.extruderChanged.emit() From ede50ef3cad83e1c6c6a8b282bf27d9b261f17a9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 15:44:15 +0100 Subject: [PATCH 382/558] Simplify dependencies on activeStack The properties, being formulas, were not properly updated when the active stack changed. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index bdf5ccfaa1..8044d86347 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -135,7 +135,7 @@ Item OldControls.CheckBox { - checked: selectors.model != null ? Cura.MachineManager.getExtruder(selectors.model.index).isEnabled: false + checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false onClicked: Cura.MachineManager.setExtruderEnabled(selectors.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox @@ -160,14 +160,11 @@ Item { id: materialSelection - property var activeExtruder: Cura.MachineManager.activeStack - property var hasActiveExtruder: activeExtruder != null - property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : "" - property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true + property var valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true property var valueWarning: !Cura.MachineManager.isActiveQualitySupported - text: currentRootMaterialName - tooltip: currentRootMaterialName + text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" + tooltip: text visible: Cura.MachineManager.hasMaterials enabled: Cura.ExtruderManager.activeExtruderIndex > -1 From ed37e692a38e6effb5f25a97409623330c6ea78f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 15:45:04 +0100 Subject: [PATCH 383/558] Don't disable enable checkbox before machine is loaded It is unnecessary because you can't see it or click on it before adding a machine. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 8044d86347..605d0444e6 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -167,8 +167,6 @@ Item tooltip: text visible: Cura.MachineManager.hasMaterials - enabled: Cura.ExtruderManager.activeExtruderIndex > -1 - height: UM.Theme.getSize("setting_control").height width: selectors.controlWidth From 82d4897ba4e24ba9e1ed52a9d79dff0fc88e0096 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 16:18:46 +0100 Subject: [PATCH 384/558] Use MouseArea to catch click instead of onClicked This is necessary because when you click it, the 'checked' property no longer depends on the active extruder. So prevent it from being clicked at all and handle the click separately in this MouseArea. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 605d0444e6..08ba042948 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -136,9 +136,19 @@ Item OldControls.CheckBox { checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false - onClicked: Cura.MachineManager.setExtruderEnabled(selectors.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox + + /* Use a MouseArea to process the click on this checkbox. + This is necessary because actually clicking the checkbox + causes the "checked" property to be overwritten. After + it's been overwritten, the original link that made it + depend on the active extruder stack is broken. */ + MouseArea + { + anchors.fill: parent + onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked) + } } } From d5d49fcec8ea3888ff53b47285322c56407e555a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 16:43:48 +0100 Subject: [PATCH 385/558] Disable extruder enabled checkbox if it's the last one You can't disable the last extruder. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 08ba042948..6a3ab82ce2 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -10,6 +10,12 @@ import UM 1.3 as UM Item { + UM.I18nCatalog + { + id: catalog + name: "cura" + } + width: parent.width height: visible ? childrenRect.height : 0 @@ -136,6 +142,7 @@ Item OldControls.CheckBox { checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false + enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox @@ -148,6 +155,7 @@ Item { anchors.fill: parent onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked) + enabled: parent.enabled } } } From 6ab2ce76900777ca64597cf81125351492b8f0aa Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 30 Nov 2018 16:44:55 +0100 Subject: [PATCH 386/558] Decrease padding between time & material specification headers --- resources/qml/ActionPanel/PrintJobInformation.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml index e53a92a994..156111af4d 100644 --- a/resources/qml/ActionPanel/PrintJobInformation.qml +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -21,7 +21,6 @@ Column Column { id: timeSpecification - spacing: UM.Theme.getSize("thin_margin").width width: parent.width topPadding: UM.Theme.getSize("default_margin").height leftPadding: UM.Theme.getSize("default_margin").width @@ -71,7 +70,6 @@ Column Column { id: materialSpecification - spacing: UM.Theme.getSize("thin_margin").width width: parent.width bottomPadding: UM.Theme.getSize("default_margin").height leftPadding: UM.Theme.getSize("default_margin").width From f4950cf92b2ba797d62ff85a6c936762c68bb81f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 17:04:50 +0100 Subject: [PATCH 387/558] Give checkboxes a style if they're disabled Contributes to issue CURA-5876. --- resources/themes/cura-light/styles.qml | 2 +- resources/themes/cura-light/theme.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index f00aab44c0..97eae65d27 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -646,7 +646,7 @@ QtObject implicitWidth: Theme.getSize("checkbox").width implicitHeight: Theme.getSize("checkbox").height - color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox") + color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : (control.enabled ? Theme.getColor("checkbox") : Theme.getColor("checkbox_disabled")) Behavior on color { ColorAnimation { duration: 50; } } radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index bd7c632eb1..0d77ecf802 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -235,6 +235,7 @@ "checkbox_border": [64, 69, 72, 255], "checkbox_border_hover": [50, 130, 255, 255], "checkbox_mark": [119, 122, 124, 255], + "checkbox_disabled": [223, 223, 223, 255], "checkbox_text": [27, 27, 27, 255], "tooltip": [68, 192, 255, 255], From 0a6e420710ae3c76a9f707c69b0afaec5307ae8f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 17:05:25 +0100 Subject: [PATCH 388/558] Make active tab white Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 6a3ab82ce2..b269b95df2 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -89,7 +89,7 @@ Item radius: UM.Theme.getSize("default_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - color: UM.Theme.getColor("secondary") + color: UM.Theme.getColor("main_background") //Remove rounding and lining at the top. Rectangle From 29b7f42e0e2cb15df004fcbf5df023fbf17b9b0c Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 30 Nov 2018 18:33:53 +0100 Subject: [PATCH 389/558] Chaged settings visibility icon CURA-5941 --- resources/qml/Settings/SettingView.qml | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 0a7102ff45..28a64f3346 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Uranium is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -25,13 +25,15 @@ Item { id: settingVisibilityMenu + property var toolButtonIconColor: UM.Theme.getColor("setting_category_text") + width: height height: UM.Theme.getSize("setting_control").height anchors { topMargin: UM.Theme.getSize("thick_margin").height - right: parent.right - rightMargin: UM.Theme.getSize("thick_margin").width + left: filterContainer.right + leftMargin: UM.Theme.getSize("default_margin").width } style: ButtonStyle { @@ -39,12 +41,12 @@ Item UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + width: Math.round(parent.width * 0.6) + height: Math.round(parent.height * 0.6) sourceSize.width: width sourceSize.height: width - color: control.enabled ? UM.Theme.getColor("setting_category_text") : UM.Theme.getColor("setting_category_disabled_text") - source: UM.Theme.getIcon("menu") + color: settingVisibilityMenu.toolButtonIconColor + source: UM.Theme.getIcon("settings") } } label: Label{} @@ -57,6 +59,15 @@ Item filter.updateDefinitionModel(); } } + + MouseArea + { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.RightButton + onEntered: settingVisibilityMenu.toolButtonIconColor = UM.Theme.getColor("setting_control_button_hover") + onExited: settingVisibilityMenu.toolButtonIconColor = UM.Theme.getColor("setting_category_text") + } } Rectangle @@ -84,8 +95,8 @@ Item topMargin: UM.Theme.getSize("thick_margin").height left: parent.left leftMargin: UM.Theme.getSize("default_margin").width - right: settingVisibilityMenu.left - rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2) + right: scrollView.right + rightMargin: Math.floor(UM.Theme.getSize("wide_margin").width * 2) } height: UM.Theme.getSize("setting_control").height Timer @@ -196,6 +207,7 @@ Item ScrollView { + id: scrollView anchors.top: filterContainer.bottom; anchors.bottom: parent.bottom; anchors.right: parent.right; From 1238aa7304c24e3c7a706fdcceae09c14791409c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 12:03:58 +0100 Subject: [PATCH 390/558] Format the slider for the infill in the recommended mode Contributes to CURA-5941 --- .../PrintSetupSelectorContents.qml | 2 +- .../RecommendedInfillDensitySelector.qml | 488 +++++++++--------- .../Recommended/RecommendedPrintSetup.qml | 45 +- .../RecommendedQualityProfileSelector.qml | 28 +- 4 files changed, 268 insertions(+), 295 deletions(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 5f22e4c337..0210ece977 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -25,7 +25,7 @@ Item { id: header height: UM.Theme.getSize("print_setup_widget_header").height - color: "transparent" //UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here + color: UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here anchors { diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 34cb8f2f20..8b0b87d997 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -15,57 +15,37 @@ import Cura 1.0 as Cura Item { id: infillRow + height: childrenRect.height + property real labelColumnWidth: Math.round(width / 3) + + // Here are the elements that are shown in the left column Cura.IconWithText { id: infillRowTitle source: UM.Theme.getIcon("category_infill") text: catalog.i18nc("@label", "Infill") + " (%)" - anchors.bottom: parent.bottom width: labelColumnWidth } Item { - id: infillCellRight + id: infillSliderContainer + height: childrenRect.height - height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) - - anchors.left: infillRowTitle.right - anchors.right: parent.right - - Label + anchors { - id: selectedInfillRateText - - anchors.left: infillSlider.left - anchors.right: parent.right - - text: parseInt(infillDensity.properties.value) + "%" - horizontalAlignment: Text.AlignLeft - - color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - } - - // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider - Binding - { - target: infillSlider - property: "value" - value: parseInt(infillDensity.properties.value) + left: infillRowTitle.right + right: parent.right + verticalCenter: infillRowTitle.verticalCenter } Slider { id: infillSlider - anchors.top: selectedInfillRateText.bottom - anchors.left: parent.left - anchors.right: infillIcon.left - anchors.rightMargin: UM.Theme.getSize("thick_margin").width - - height: UM.Theme.getSize("thick_margin").height - width: parseInt(infillCellRight.width - UM.Theme.getSize("thick_margin").width - style.handleWidth) + width: parent.width + height: UM.Theme.getSize("print_setup_slider_handle").height // The handle is the widest element of the slider minimumValue: 0 maximumValue: 100 @@ -78,9 +58,62 @@ Item // set initial value from stack value: parseInt(infillDensity.properties.value) + style: SliderStyle + { + //Draw line + groove: Item + { + Rectangle + { + height: UM.Theme.getSize("print_setup_slider_groove").height + width: control.width - UM.Theme.getSize("print_setup_slider_handle").width + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + } + } + + handle: Rectangle + { + id: handleButton + color: control.enabled ? UM.Theme.getColor("primary") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width + implicitHeight: implicitWidth + radius: Math.round(implicitWidth / 2) + opacity: 0.5 + } + + tickmarks: Repeater + { + id: repeater + model: control.maximumValue / control.stepSize + 1 + + Rectangle + { + color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: UM.Theme.getSize("print_setup_slider_tickmarks").width + implicitHeight: UM.Theme.getSize("print_setup_slider_tickmarks").height + anchors.verticalCenter: parent.verticalCenter + + // Do not use Math.round otherwise the tickmarks won't be aligned + x: ((styleData.handleWidth / 2) - (implicitWidth / 2) + (index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)))) + radius: Math.round(implicitWidth / 2) + visible: (index % 10) == 0 // Only show steps of 10% + + Label + { + text: index + visible: (index % 20) == 0 // Only show steps of 20% + anchors.horizontalCenter: parent.horizontalCenter + y: UM.Theme.getSize("thin_margin").height + renderType: Text.NativeRendering + } + } + } + } + onValueChanged: { - // Don't round the value if it's already the same if (parseInt(infillDensity.properties.value) == infillSlider.value) { @@ -104,228 +137,177 @@ Item Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") } } - - style: SliderStyle - { - groove: Rectangle - { - id: groove - implicitWidth: 200 * screenScaleFactor - implicitHeight: 2 * screenScaleFactor - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - radius: 1 - } - - handle: Item - { - Rectangle - { - id: handleButton - anchors.centerIn: parent - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: 10 * screenScaleFactor - implicitHeight: 10 * screenScaleFactor - radius: 10 * screenScaleFactor - } - } - - tickmarks: Repeater - { - id: repeater - model: control.maximumValue / control.stepSize + 1 - - // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) - function shouldShowTick (index) - { - if (index % 10 == 0) - { - return true - } - return false - } - - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - width: 1 * screenScaleFactor - height: 6 * screenScaleFactor - x: Math.round(styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))) - visible: shouldShowTick(index) - } - } - } } - Rectangle - { - id: infillIcon - - width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) - height: width - - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) - - // we loop over all density icons and only show the one that has the current density and steps - Repeater - { - id: infillIconList - model: infillModel - anchors.fill: parent - - function activeIndex () - { - for (var i = 0; i < infillModel.count; i++) - { - var density = Math.round(infillDensity.properties.value) - var steps = Math.round(infillSteps.properties.value) - var infillModelItem = infillModel.get(i) - - if (infillModelItem != "undefined" - && density >= infillModelItem.percentageMin - && density <= infillModelItem.percentageMax - && steps >= infillModelItem.stepsMin - && steps <= infillModelItem.stepsMax) - { - return i - } - } - return -1 - } - - Rectangle - { - anchors.fill: parent - visible: infillIconList.activeIndex() == index - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("quality_slider_unavailable") - - UM.RecolorImage - { - anchors.fill: parent - anchors.margins: 2 * screenScaleFactor - sourceSize.width: width - sourceSize.height: width - source: UM.Theme.getIcon(model.icon) - color: UM.Theme.getColor("quality_slider_unavailable") - } - } - } - } - - // Gradual Support Infill Checkbox - CheckBox - { - id: enableGradualInfillCheckBox - property alias _hovered: enableGradualInfillMouseArea.containsMouse - - anchors.top: infillSlider.bottom - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category - anchors.left: infillCellRight.left - - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - visible: infillSteps.properties.enabled == "True" - checked: parseInt(infillSteps.properties.value) > 0 - - MouseArea - { - id: enableGradualInfillMouseArea - - anchors.fill: parent - hoverEnabled: true - enabled: true - - property var previousInfillDensity: parseInt(infillDensity.properties.value) - - onClicked: - { - // Set to 90% only when enabling gradual infill - var newInfillDensity; - if (parseInt(infillSteps.properties.value) == 0) - { - previousInfillDensity = parseInt(infillDensity.properties.value) - newInfillDensity = 90 - } else { - newInfillDensity = previousInfillDensity - } - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) - - var infill_steps_value = 0 - if (parseInt(infillSteps.properties.value) == 0) - { - infill_steps_value = 5 - } - - Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) - } - - onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillCellRight.x, 0), - catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) - - onExited: base.hideTooltip() - - } - - Label - { - id: gradualInfillLabel - height: parent.height - anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) - verticalAlignment: Text.AlignVCenter; - text: catalog.i18nc("@label", "Enable gradual") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - } - - // Infill list model for mapping icon - ListModel - { - id: infillModel - Component.onCompleted: - { - infillModel.append({ - percentageMin: -1, - percentageMax: 0, - stepsMin: -1, - stepsMax: 0, - icon: "hollow" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 40, - stepsMin: -1, - stepsMax: 0, - icon: "sparse" - }) - infillModel.append({ - percentageMin: 40, - percentageMax: 89, - stepsMin: -1, - stepsMax: 0, - icon: "dense" - }) - infillModel.append({ - percentageMin: 90, - percentageMax: 9999999999, - stepsMin: -1, - stepsMax: 0, - icon: "solid" - }) - infillModel.append({ - percentageMin: 0, - percentageMax: 9999999999, - stepsMin: 1, - stepsMax: 9999999999, - icon: "gradual" - }) - } - } +// Rectangle +// { +// id: infillIcon +// +// width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) +// height: width +// +// anchors.right: parent.right +// anchors.top: parent.top +// anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) +// +// // we loop over all density icons and only show the one that has the current density and steps +// Repeater +// { +// id: infillIconList +// model: infillModel +// anchors.fill: parent +// +// function activeIndex () +// { +// for (var i = 0; i < infillModel.count; i++) +// { +// var density = Math.round(infillDensity.properties.value) +// var steps = Math.round(infillSteps.properties.value) +// var infillModelItem = infillModel.get(i) +// +// if (infillModelItem != "undefined" +// && density >= infillModelItem.percentageMin +// && density <= infillModelItem.percentageMax +// && steps >= infillModelItem.stepsMin +// && steps <= infillModelItem.stepsMax) +// { +// return i +// } +// } +// return -1 +// } +// +// Rectangle +// { +// anchors.fill: parent +// visible: infillIconList.activeIndex() == index +// +// border.width: UM.Theme.getSize("default_lining").width +// border.color: UM.Theme.getColor("quality_slider_unavailable") +// +// UM.RecolorImage +// { +// anchors.fill: parent +// anchors.margins: 2 * screenScaleFactor +// sourceSize.width: width +// sourceSize.height: width +// source: UM.Theme.getIcon(model.icon) +// color: UM.Theme.getColor("quality_slider_unavailable") +// } +// } +// } +// } +// +// // Gradual Support Infill Checkbox +// CheckBox +// { +// id: enableGradualInfillCheckBox +// property alias _hovered: enableGradualInfillMouseArea.containsMouse +// +// anchors.top: infillSlider.bottom +// anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category +// anchors.left: infillSliderContainer.left +// +// style: UM.Theme.styles.checkbox +// enabled: base.settingsEnabled +// visible: infillSteps.properties.enabled == "True" +// checked: parseInt(infillSteps.properties.value) > 0 +// +// MouseArea +// { +// id: enableGradualInfillMouseArea +// +// anchors.fill: parent +// hoverEnabled: true +// enabled: true +// +// property var previousInfillDensity: parseInt(infillDensity.properties.value) +// +// onClicked: +// { +// // Set to 90% only when enabling gradual infill +// var newInfillDensity; +// if (parseInt(infillSteps.properties.value) == 0) +// { +// previousInfillDensity = parseInt(infillDensity.properties.value) +// newInfillDensity = 90 +// } else { +// newInfillDensity = previousInfillDensity +// } +// Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) +// +// var infill_steps_value = 0 +// if (parseInt(infillSteps.properties.value) == 0) +// { +// infill_steps_value = 5 +// } +// +// Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) +// } +// +// onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillSliderContainer.x, 0), +// catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) +// +// onExited: base.hideTooltip() +// +// } +// +// Label +// { +// id: gradualInfillLabel +// height: parent.height +// anchors.left: enableGradualInfillCheckBox.right +// anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) +// verticalAlignment: Text.AlignVCenter; +// text: catalog.i18nc("@label", "Enable gradual") +// font: UM.Theme.getFont("default") +// color: UM.Theme.getColor("text") +// } +// } +// +// // Infill list model for mapping icon +// ListModel +// { +// id: infillModel +// Component.onCompleted: +// { +// infillModel.append({ +// percentageMin: -1, +// percentageMax: 0, +// stepsMin: -1, +// stepsMax: 0, +// icon: "hollow" +// }) +// infillModel.append({ +// percentageMin: 0, +// percentageMax: 40, +// stepsMin: -1, +// stepsMax: 0, +// icon: "sparse" +// }) +// infillModel.append({ +// percentageMin: 40, +// percentageMax: 89, +// stepsMin: -1, +// stepsMax: 0, +// icon: "dense" +// }) +// infillModel.append({ +// percentageMin: 90, +// percentageMax: 9999999999, +// stepsMin: -1, +// stepsMax: 0, +// icon: "solid" +// }) +// infillModel.append({ +// percentageMin: 0, +// percentageMax: 9999999999, +// stepsMin: 1, +// stepsMax: 9999999999, +// icon: "gradual" +// }) +// } +// } } UM.SettingPropertyProvider diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 40a1910c69..0dabc3ea1e 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -12,10 +12,10 @@ Item { id: base + height: childrenRect.height + 2 * padding + signal showTooltip(Item item, point location, string text) signal hideTooltip() -// width: parent.width - height: childrenRect.height + 2 * padding property Action configureSettings @@ -28,24 +28,11 @@ Item name: "cura" } -// Rectangle -// { -// width: parent.width - 2 * parent.padding -// anchors -// { -// left: parent.left -// right: parent.right -// top: parent.top -// margins: parent.padding -// } -// color: "blue" -// height: 50 -// } - Column { width: parent.width - 2 * parent.padding - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("wide_margin").height + anchors { left: parent.left @@ -55,33 +42,27 @@ Item } // TODO - property real labelColumnWidth: Math.round(width / 3) - property real settingsColumnWidth: width - labelColumnWidth + property real firstColumnWidth: Math.round(width / 3) RecommendedQualityProfileSelector { width: parent.width // TODO Create a reusable component with these properties to not define them separately for each component - property real labelColumnWidth: parent.labelColumnWidth - property real settingsColumnWidth: parent.settingsColumnWidth + labelColumnWidth: parent.firstColumnWidth } -// RecommendedInfillDensitySelector -// { -// width: parent.width -// height: childrenRect.height -// // TODO Create a reusable component with these properties to not define them separately for each component -// property real labelColumnWidth: parent.labelColumnWidth -// property real settingsColumnWidth: parent.settingsColumnWidth -// } + RecommendedInfillDensitySelector + { + width: parent.width + // TODO Create a reusable component with these properties to not define them separately for each component + labelColumnWidth: parent.firstColumnWidth + } // // RecommendedSupportSelector // { // width: parent.width -// height: childrenRect.height // // TODO Create a reusable component with these properties to not define them separately for each component -// property real labelColumnWidth: parent.labelColumnWidth -// property real settingsColumnWidth: parent.settingsColumnWidth +// property real firstColumnWidth: parent.labelColumnWidth // } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index f7e1d870c9..cddf01a4dc 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -17,6 +17,9 @@ Item id: qualityRow height: childrenRect.height + property real labelColumnWidth: Math.round(width / 3) + property real settingsColumnWidth: width - labelColumnWidth + Timer { id: qualitySliderChangeTimer @@ -158,6 +161,7 @@ Item } } + // Here are the elements that are shown in the left column Item { id: titleRow @@ -210,6 +214,7 @@ Item { anchors.left: speedSlider.left anchors.top: speedSlider.bottom + height: childrenRect.height Repeater { @@ -219,6 +224,8 @@ Item { anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top + // The height has to be set manually, otherwise it's not automatically calculated in the repeater + height: UM.Theme.getSize("default_margin").height color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") text: { @@ -268,7 +275,7 @@ Item } } - //Print speed slider + // Print speed slider // Two sliders are created, one at the bottom with the unavailable qualities // and the other at the top with the available quality profiles and so the handle to select them. Item @@ -287,6 +294,8 @@ Item Slider { id: unavailableSlider + + width: parent.width height: qualitySlider.height // Same height as the slider that is on top updateValueWhileDragging : false tickmarksEnabled: true @@ -297,8 +306,6 @@ Item maximumValue: qualityModel.totalTicks stepSize: 1 - width: parent.width - style: SliderStyle { //Draw Unvailable line @@ -329,7 +336,7 @@ Item anchors.verticalCenter: parent.verticalCenter // Do not use Math.round otherwise the tickmarks won't be aligned - x: ((UM.Theme.getSize("print_setup_slider_handle").width / 2) - (UM.Theme.getSize("print_setup_slider_tickmarks").width / 2) + (qualityModel.qualitySliderStepWidth * index)) + x: ((UM.Theme.getSize("print_setup_slider_handle").width / 2) - (implicitWidth / 2) + (qualityModel.qualitySliderStepWidth * index)) radius: Math.round(implicitWidth / 2) } } @@ -354,11 +361,19 @@ Item Slider { id: qualitySlider + + width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) + UM.Theme.getSize("print_setup_slider_handle").width height: UM.Theme.getSize("print_setup_slider_handle").height // The handle is the widest element of the slider enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized visible: qualityModel.availableTotalTicks > 0 updateValueWhileDragging : false + anchors + { + right: parent.right + rightMargin: qualityModel.qualitySliderMarginRight + } + minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0 // maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly // speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available) @@ -367,11 +382,6 @@ Item value: qualityModel.qualitySliderActiveIndex - width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1) + UM.Theme.getSize("print_setup_slider_handle").width - - anchors.right: parent.right - anchors.rightMargin: qualityModel.qualitySliderMarginRight - style: SliderStyle { // Draw Available line From 4154ec2fe82a79334a2d1b10d2de745a1aa38b19 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 12:39:52 +0100 Subject: [PATCH 391/558] Add enable gradual checkbox to the infill panel Contributes to CURA-5941. --- .../RecommendedInfillDensitySelector.qml | 146 +++++++++--------- 1 file changed, 77 insertions(+), 69 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 8b0b87d997..4226acb790 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -23,11 +23,20 @@ Item Cura.IconWithText { id: infillRowTitle + anchors.top: parent.top + anchors.left: parent.left source: UM.Theme.getIcon("category_infill") text: catalog.i18nc("@label", "Infill") + " (%)" width: labelColumnWidth } + Rectangle + { + anchors.fill: infillSliderContainer + color: "red" + opacity: 0.5 + } + Item { id: infillSliderContainer @@ -80,7 +89,6 @@ Item implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width implicitHeight: implicitWidth radius: Math.round(implicitWidth / 2) - opacity: 0.5 } tickmarks: Repeater @@ -138,6 +146,74 @@ Item } } } + } + + // Gradual Support Infill Checkbox + CheckBox + { + id: enableGradualInfillCheckBox + property alias _hovered: enableGradualInfillMouseArea.containsMouse + + anchors.top: infillSliderContainer.bottom + anchors.topMargin: UM.Theme.getSize("wide_margin").height + anchors.left: infillSliderContainer.left + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + visible: infillSteps.properties.enabled == "True" + checked: parseInt(infillSteps.properties.value) > 0 + + MouseArea + { + id: enableGradualInfillMouseArea + + anchors.fill: parent + hoverEnabled: true + enabled: true + + property var previousInfillDensity: parseInt(infillDensity.properties.value) + + onClicked: + { + // Set to 90% only when enabling gradual infill + var newInfillDensity; + if (parseInt(infillSteps.properties.value) == 0) + { + previousInfillDensity = parseInt(infillDensity.properties.value) + newInfillDensity = 90 + } else { + newInfillDensity = previousInfillDensity + } + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) + + var infill_steps_value = 0 + if (parseInt(infillSteps.properties.value) == 0) + { + infill_steps_value = 5 + } + + Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) + } + + onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillSliderContainer.x - UM.Theme.getSize("thick_margin").width, 0), + catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) + + onExited: base.hideTooltip() + } + + Label + { + id: gradualInfillLabel + height: parent.height + anchors.left: enableGradualInfillCheckBox.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + verticalAlignment: Text.AlignVCenter + text: catalog.i18nc("@label", "Enable gradual") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + } // Rectangle // { @@ -198,73 +274,6 @@ Item // } // } // -// // Gradual Support Infill Checkbox -// CheckBox -// { -// id: enableGradualInfillCheckBox -// property alias _hovered: enableGradualInfillMouseArea.containsMouse -// -// anchors.top: infillSlider.bottom -// anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) // closer to slider since it belongs to the same category -// anchors.left: infillSliderContainer.left -// -// style: UM.Theme.styles.checkbox -// enabled: base.settingsEnabled -// visible: infillSteps.properties.enabled == "True" -// checked: parseInt(infillSteps.properties.value) > 0 -// -// MouseArea -// { -// id: enableGradualInfillMouseArea -// -// anchors.fill: parent -// hoverEnabled: true -// enabled: true -// -// property var previousInfillDensity: parseInt(infillDensity.properties.value) -// -// onClicked: -// { -// // Set to 90% only when enabling gradual infill -// var newInfillDensity; -// if (parseInt(infillSteps.properties.value) == 0) -// { -// previousInfillDensity = parseInt(infillDensity.properties.value) -// newInfillDensity = 90 -// } else { -// newInfillDensity = previousInfillDensity -// } -// Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity)) -// -// var infill_steps_value = 0 -// if (parseInt(infillSteps.properties.value) == 0) -// { -// infill_steps_value = 5 -// } -// -// Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value) -// } -// -// onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillSliderContainer.x, 0), -// catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) -// -// onExited: base.hideTooltip() -// -// } -// -// Label -// { -// id: gradualInfillLabel -// height: parent.height -// anchors.left: enableGradualInfillCheckBox.right -// anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) -// verticalAlignment: Text.AlignVCenter; -// text: catalog.i18nc("@label", "Enable gradual") -// font: UM.Theme.getFont("default") -// color: UM.Theme.getColor("text") -// } -// } -// // // Infill list model for mapping icon // ListModel // { @@ -308,7 +317,6 @@ Item // }) // } // } - } UM.SettingPropertyProvider { From 1caccfb57705ed75dc49d0d257a71204d9210827 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 13:40:41 +0100 Subject: [PATCH 392/558] Add a binding to react when the infill density changes in the custom panel Also make the icon dinamic, that will change when the infill density changes. Contributes to CURA-5941. --- .../RecommendedInfillDensitySelector.qml | 160 ++++-------------- resources/themes/cura-light/styles.qml | 3 +- resources/themes/cura-light/theme.json | 9 +- 3 files changed, 44 insertions(+), 128 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 4226acb790..0dd594176c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -19,6 +19,42 @@ Item property real labelColumnWidth: Math.round(width / 3) + // Create a binding to update the icon when the infill density changes + Binding + { + target: infillRowTitle + property: "source" + value: + { + var density = parseInt(infillDensity.properties.value) + if (parseInt(infillSteps.properties.value) != 0) + { + return UM.Theme.getIcon("gradual") + } + if (density <= 0) + { + return UM.Theme.getIcon("hollow") + } + if (density < 40) + { + return UM.Theme.getIcon("sparse") + } + if (density < 90) + { + return UM.Theme.getIcon("dense") + } + return UM.Theme.getIcon("solid") + } + } + + // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider + Binding + { + target: infillSlider + property: "value" + value: parseInt(infillDensity.properties.value) + } + // Here are the elements that are shown in the left column Cura.IconWithText { @@ -30,13 +66,6 @@ Item width: labelColumnWidth } - Rectangle - { - anchors.fill: infillSliderContainer - color: "red" - opacity: 0.5 - } - Item { id: infillSliderContainer @@ -158,6 +187,7 @@ Item anchors.topMargin: UM.Theme.getSize("wide_margin").height anchors.left: infillSliderContainer.left + text: catalog.i18nc("@label", "Gradual infill") style: UM.Theme.styles.checkbox enabled: base.settingsEnabled visible: infillSteps.properties.enabled == "True" @@ -200,124 +230,8 @@ Item onExited: base.hideTooltip() } - - Label - { - id: gradualInfillLabel - height: parent.height - anchors.left: enableGradualInfillCheckBox.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - verticalAlignment: Text.AlignVCenter - text: catalog.i18nc("@label", "Enable gradual") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - } } -// Rectangle -// { -// id: infillIcon -// -// width: Math.round((parent.width / 5) - (UM.Theme.getSize("thick_margin").width)) -// height: width -// -// anchors.right: parent.right -// anchors.top: parent.top -// anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 2) -// -// // we loop over all density icons and only show the one that has the current density and steps -// Repeater -// { -// id: infillIconList -// model: infillModel -// anchors.fill: parent -// -// function activeIndex () -// { -// for (var i = 0; i < infillModel.count; i++) -// { -// var density = Math.round(infillDensity.properties.value) -// var steps = Math.round(infillSteps.properties.value) -// var infillModelItem = infillModel.get(i) -// -// if (infillModelItem != "undefined" -// && density >= infillModelItem.percentageMin -// && density <= infillModelItem.percentageMax -// && steps >= infillModelItem.stepsMin -// && steps <= infillModelItem.stepsMax) -// { -// return i -// } -// } -// return -1 -// } -// -// Rectangle -// { -// anchors.fill: parent -// visible: infillIconList.activeIndex() == index -// -// border.width: UM.Theme.getSize("default_lining").width -// border.color: UM.Theme.getColor("quality_slider_unavailable") -// -// UM.RecolorImage -// { -// anchors.fill: parent -// anchors.margins: 2 * screenScaleFactor -// sourceSize.width: width -// sourceSize.height: width -// source: UM.Theme.getIcon(model.icon) -// color: UM.Theme.getColor("quality_slider_unavailable") -// } -// } -// } -// } -// -// // Infill list model for mapping icon -// ListModel -// { -// id: infillModel -// Component.onCompleted: -// { -// infillModel.append({ -// percentageMin: -1, -// percentageMax: 0, -// stepsMin: -1, -// stepsMax: 0, -// icon: "hollow" -// }) -// infillModel.append({ -// percentageMin: 0, -// percentageMax: 40, -// stepsMin: -1, -// stepsMax: 0, -// icon: "sparse" -// }) -// infillModel.append({ -// percentageMin: 40, -// percentageMax: 89, -// stepsMin: -1, -// stepsMax: 0, -// icon: "dense" -// }) -// infillModel.append({ -// percentageMin: 90, -// percentageMax: 9999999999, -// stepsMin: -1, -// stepsMax: 0, -// icon: "solid" -// }) -// infillModel.append({ -// percentageMin: 0, -// percentageMax: 9999999999, -// stepsMin: 1, -// stepsMax: 9999999999, -// icon: "gradual" -// }) -// } -// } - UM.SettingPropertyProvider { id: infillDensity diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index e040d91df9..96bf334c43 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -532,7 +532,7 @@ QtObject color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox") Behavior on color { ColorAnimation { duration: 50; } } - radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 + radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width border.width: Theme.getSize("default_lining").width border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border") @@ -557,6 +557,7 @@ QtObject color: Theme.getColor("checkbox_text") font: Theme.getFont("default") elide: Text.ElideRight + renderType: Text.NativeRendering } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 7cfd7b93e1..392b09303d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -239,10 +239,10 @@ "checkbox": [255, 255, 255, 255], "checkbox_hover": [255, 255, 255, 255], - "checkbox_border": [64, 69, 72, 255], + "checkbox_border": [199, 199, 199, 255], "checkbox_border_hover": [50, 130, 255, 255], - "checkbox_mark": [119, 122, 124, 255], - "checkbox_text": [27, 27, 27, 255], + "checkbox_mark": [50, 130, 255, 255], + "checkbox_text": [35, 35, 35, 255], "tooltip": [68, 192, 255, 255], "tooltip_text": [255, 255, 255, 255], @@ -459,7 +459,8 @@ "layerview_row": [11.0, 1.5], "layerview_row_spacing": [0.0, 0.5], - "checkbox": [2.0, 2.0], + "checkbox": [1.5, 1.5], + "checkbox_radius": [0.08, 0.08], "tooltip": [20.0, 10.0], "tooltip_margins": [1.0, 1.0], From 1cea36b08a5f6f1a8899667a39ec87285abab9c6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 19:01:54 +0100 Subject: [PATCH 393/558] Add the row for the support selection in the recommended mode Contributes to CURA-5941. --- .../Recommended/RecommendedPrintSetup.qml | 15 +- .../RecommendedSupportSelector.qml | 189 +++++++++++------- resources/themes/cura-light/styles.qml | 15 +- resources/themes/cura-light/theme.json | 10 +- 4 files changed, 134 insertions(+), 95 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 0dabc3ea1e..d246be560e 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -57,13 +57,13 @@ Item // TODO Create a reusable component with these properties to not define them separately for each component labelColumnWidth: parent.firstColumnWidth } -// -// RecommendedSupportSelector -// { -// width: parent.width -// // TODO Create a reusable component with these properties to not define them separately for each component -// property real firstColumnWidth: parent.labelColumnWidth -// } + + RecommendedSupportSelector + { + width: parent.width + // TODO Create a reusable component with these properties to not define them separately for each component + labelColumnWidth: parent.firstColumnWidth + } // @@ -128,7 +128,6 @@ Item // } } - UM.SettingPropertyProvider { id: platformAdhesionType diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 9c4e5ed576..2407b746b2 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -8,114 +8,142 @@ import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.0 as Cura + // // Enable support // -Row +Item { + id: enableSupportRow + height: childrenRect.height + + property real labelColumnWidth: Math.round(width / 3) Cura.IconWithText { - id: enableSupportLabel + id: enableSupportRowTitle + anchors.top: parent.top + anchors.left: parent.left visible: enableSupportCheckBox.visible source: UM.Theme.getIcon("category_support") text: catalog.i18nc("@label", "Support") width: labelColumnWidth } - CheckBox + Item { - id: enableSupportCheckBox - property alias _hovered: enableSupportMouseArea.containsMouse + id: enableSupportContainer + height: childrenRect.height - style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled - - visible: supportEnabled.properties.enabled == "True" - checked: supportEnabled.properties.value == "True" - - MouseArea + anchors { - id: enableSupportMouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") - - onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), - catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) - - onExited: base.hideTooltip() - - } - } - - ComboBox - { - id: supportExtruderCombobox - visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) - model: extruderModel - - property string color_override: "" // for manually setting values - property string color: // is evaluated automatically, but the first time is before extruderModel being filled - { - var current_extruder = extruderModel.get(currentIndex); - color_override = ""; - if (current_extruder === undefined) return "" - return (current_extruder.color) ? current_extruder.color : ""; + left: enableSupportRowTitle.right + right: parent.right + verticalCenter: enableSupportRowTitle.verticalCenter } - textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started - - width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width - height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 - - Behavior on height { NumberAnimation { duration: 100 } } - - style: UM.Theme.styles.combobox_color - enabled: base.settingsEnabled - property alias _hovered: supportExtruderMouseArea.containsMouse - - currentIndex: + CheckBox { - if (supportExtruderNr.properties == null) + id: enableSupportCheckBox + anchors.verticalCenter: parent.verticalCenter + + property alias _hovered: enableSupportMouseArea.containsMouse + + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: supportEnabled.properties.enabled == "True" + checked: supportEnabled.properties.value == "True" + + MouseArea { - return Cura.MachineManager.defaultExtruderPosition + id: enableSupportMouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") + + onEntered: + { + base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportContainer.x - UM.Theme.getSize("thick_margin").width, 0), + catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) + } + onExited: base.hideTooltip() } - else + } + + ComboBox + { + id: supportExtruderCombobox + + height: UM.Theme.getSize("print_setup_support_extruder_selector").height + anchors { - var extruder = parseInt(supportExtruderNr.properties.value) - if ( extruder === -1) + left: enableSupportCheckBox.right + right: parent.right + leftMargin: UM.Theme.getSize("thick_margin").width + rightMargin: UM.Theme.getSize("thick_margin").width + verticalCenter: parent.verticalCenter + } + + style: UM.Theme.styles.combobox_color + enabled: base.settingsEnabled + visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) + textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started + + model: extruderModel + + property alias _hovered: supportExtruderMouseArea.containsMouse + property string color_override: "" // for manually setting values + property string color: // is evaluated automatically, but the first time is before extruderModel being filled + { + var current_extruder = extruderModel.get(currentIndex); + color_override = ""; + if (current_extruder === undefined) return "" + return (current_extruder.color) ? current_extruder.color : ""; + } + + currentIndex: + { + if (supportExtruderNr.properties == null) { return Cura.MachineManager.defaultExtruderPosition } - return extruder; + else + { + var extruder = parseInt(supportExtruderNr.properties.value) + if ( extruder === -1) + { + return Cura.MachineManager.defaultExtruderPosition + } + return extruder; + } } - } - onActivated: supportExtruderNr.setPropertyValue("value", String(index)) + onActivated: supportExtruderNr.setPropertyValue("value", String(index)) - MouseArea - { - id: supportExtruderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - acceptedButtons: Qt.NoButton - onEntered: + MouseArea { - base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), - catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + id: supportExtruderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + acceptedButtons: Qt.NoButton + onEntered: + { + base.showTooltip(supportExtruderCombobox, Qt.point(-enableSupportContainer.x - supportExtruderCombobox.x - UM.Theme.getSize("thick_margin").width, 0), + catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + } + onExited: base.hideTooltip() + } - onExited: base.hideTooltip() - } - - function updateCurrentColor() - { - var current_extruder = extruderModel.get(currentIndex) - if (current_extruder !== undefined) + function updateCurrentColor() { - supportExtruderCombobox.color_override = current_extruder.color + var current_extruder = extruderModel.get(currentIndex) + if (current_extruder !== undefined) + { + supportExtruderCombobox.color_override = current_extruder.color + } } } } @@ -160,6 +188,15 @@ Row storeIndex: 0 } + UM.SettingPropertyProvider + { + id: machineExtruderCount + containerStack: Cura.MachineManager.activeMachine + key: "machine_extruder_count" + watchedProperties: ["value"] + storeIndex: 0 + } + function populateExtruderModel() { extruderModel.clear() diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 96bf334c43..5203cb0b0b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -413,11 +413,11 @@ QtObject border.width: Theme.getSize("default_lining").width; border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); + radius: UM.Theme.getSize("setting_control_radius").width } label: Item { - Label { anchors.left: parent.left @@ -465,11 +465,11 @@ QtObject color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") border.width: UM.Theme.getSize("default_lining").width border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + radius: UM.Theme.getSize("setting_control_radius").width } label: Item { - Label { anchors.left: parent.left @@ -486,7 +486,7 @@ QtObject verticalAlignment: Text.AlignVCenter } - Rectangle + UM.RecolorImage { id: swatch height: Math.round(UM.Theme.getSize("setting_control").height / 2) @@ -494,9 +494,9 @@ QtObject anchors.right: downArrow.left anchors.verticalCenter: parent.verticalCenter anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) - radius: Math.round(width / 2) - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") color: (control.color_override !== "") ? control.color_override : control.color } @@ -575,7 +575,7 @@ QtObject color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); Behavior on color { ColorAnimation { duration: 50; } } - radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 + radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width border.width: Theme.getSize("default_lining").width; border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); @@ -628,6 +628,7 @@ QtObject border.width: Theme.getSize("default_lining").width; border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); + radius: UM.Theme.getSize("setting_control_radius").width color: Theme.getColor("setting_validation_ok"); diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 392b09303d..afe40007f4 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -206,11 +206,11 @@ "setting_control": [255, 255, 255, 255], "setting_control_selected": [31, 36, 39, 255], "setting_control_highlight": [255, 255, 255, 255], - "setting_control_border": [127, 127, 127, 255], + "setting_control_border": [199, 199, 199, 255], "setting_control_border_highlight": [50, 130, 255, 255], - "setting_control_text": [27, 27, 27, 255], - "setting_control_depth_line": [127, 127, 127, 255], - "setting_control_button": [127, 127, 127, 255], + "setting_control_text": [35, 35, 35, 255], + "setting_control_depth_line": [199, 199, 199, 255], + "setting_control_button": [199, 199, 199, 255], "setting_control_button_hover": [70, 84, 113, 255], "setting_control_disabled": [245, 245, 245, 255], "setting_control_disabled_text": [127, 127, 127, 255], @@ -377,6 +377,7 @@ "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_tickmarks": [0.32, 0.32], + "print_setup_support_extruder_selector": [18.2, 2.5], "configuration_selector_mode_tabs": [0.0, 3.0], @@ -415,6 +416,7 @@ "setting": [25.0, 1.8], "setting_control": [10.0, 2.0], + "setting_control_radius": [0.15, 0.15], "setting_control_depth_margin": [1.4, 0.0], "setting_preferences_button_margin": [4, 0.0], "setting_control_margin": [0.0, 0.0], From adabb833e0b6dbc978bfb96f8b42004f03e28a84 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 19:14:34 +0100 Subject: [PATCH 394/558] Add row for the adhesion setting in the recommended mode Contributes to CURA-5941. --- .../RecommendedAdhesionSelector.qml | 99 +++++++++++++++++++ .../Recommended/RecommendedPrintSetup.qml | 77 ++------------- .../RecommendedSupportSelector.qml | 2 +- 3 files changed, 106 insertions(+), 72 deletions(-) create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml new file mode 100644 index 0000000000..a7e8b3ea75 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -0,0 +1,99 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import UM 1.2 as UM +import Cura 1.0 as Cura + + +// +// Adhesion +// +Item +{ + id: enableAdhesionRow + height: childrenRect.height + + property real labelColumnWidth: Math.round(width / 3) + + Cura.IconWithText + { + id: enableAdhesionRowTitle + anchors.top: parent.top + anchors.left: parent.left + source: UM.Theme.getIcon("category_adhesion") + text: catalog.i18nc("@label", "Adhesion") + width: labelColumnWidth + } + + Item + { + id: enableAdhesionContainer + height: childrenRect.height + + anchors + { + left: enableAdhesionRowTitle.right + right: parent.right + verticalCenter: enableAdhesionRowTitle.verticalCenter + } + + CheckBox + { + id: enableAdhesionCheckBox + anchors.verticalCenter: parent.verticalCenter + + //: Setting enable printing build-plate adhesion helper checkbox + style: UM.Theme.styles.checkbox + enabled: base.settingsEnabled + + visible: platformAdhesionType.properties.enabled == "True" + checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" + + MouseArea + { + id: adhesionMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + + onClicked: + { + var adhesionType = "skirt" + if (!parent.checked) + { + // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft + platformAdhesionType.removeFromContainer(0) + adhesionType = platformAdhesionType.properties.value + if(adhesionType == "skirt" || adhesionType == "none") + { + // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim + adhesionType = "brim" + } + } + platformAdhesionType.setPropertyValue("value", adhesionType) + } + + onEntered: + { + base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0), + catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); + } + onExited: base.hideTooltip() + } + } + } + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + removeUnusedValue: false //Doesn't work with settings that are resolved. + key: "adhesion_type" + watchedProperties: [ "value", "enabled" ] + storeIndex: 0 + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index d246be560e..a8fca47d6c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -65,76 +65,11 @@ Item labelColumnWidth: parent.firstColumnWidth } - -// -// // Adhesion -// Row -// { -// anchors.left: parent.left -// anchors.right: parent.right -// height: childrenRect.height -// -// Cura.IconWithText -// { -// id: adhesionHelperLabel -// visible: adhesionCheckBox.visible -// source: UM.Theme.getIcon("category_adhesion") -// text: catalog.i18nc("@label", "Adhesion") -// width: labelColumnWidth -// } -// -// CheckBox -// { -// id: adhesionCheckBox -// property alias _hovered: adhesionMouseArea.containsMouse -// -// //: Setting enable printing build-plate adhesion helper checkbox -// style: UM.Theme.styles.checkbox -// enabled: base.settingsEnabled -// -// visible: platformAdhesionType.properties.enabled == "True" -// checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" -// -// MouseArea -// { -// id: adhesionMouseArea -// anchors.fill: parent -// hoverEnabled: true -// enabled: base.settingsEnabled -// onClicked: -// { -// var adhesionType = "skirt" -// if(!parent.checked) -// { -// // Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft -// platformAdhesionType.removeFromContainer(0) -// adhesionType = platformAdhesionType.properties.value -// if(adhesionType == "skirt" || adhesionType == "none") -// { -// // If the rest of the stack doesn't prescribe an adhesion-type, default to a brim -// adhesionType = "brim" -// } -// } -// platformAdhesionType.setPropertyValue("value", adhesionType) -// } -// onEntered: -// { -// base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), -// catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); -// } -// onExited: base.hideTooltip() -// } -// } -// } - } - - UM.SettingPropertyProvider - { - id: platformAdhesionType - containerStack: Cura.MachineManager.activeMachine - removeUnusedValue: false //Doesn't work with settings that are resolved. - key: "adhesion_type" - watchedProperties: [ "value", "enabled" ] - storeIndex: 0 + RecommendedAdhesionSelector + { + width: parent.width + // TODO Create a reusable component with these properties to not define them separately for each component + labelColumnWidth: parent.firstColumnWidth + } } } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 2407b746b2..4e63242f05 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -33,7 +33,7 @@ Item Item { id: enableSupportContainer - height: childrenRect.height + height: enableSupportCheckBox.height anchors { From 7dc3320b0648142719b59c7a73dcf66da373335c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 2 Dec 2018 20:32:55 +0100 Subject: [PATCH 395/558] Remove all the signal propagation for the tooltip and allow only Cura.qml to handle them Contributes to CURA-5941. --- plugins/PrepareStage/PrepareMenu.qml | 4 ---- plugins/PreviewStage/PreviewMenu.qml | 3 --- resources/qml/Cura.qml | 9 --------- .../Custom/CustomPrintSetup.qml | 13 ++++++++++++- .../PrintSetupSelector/PrintSetupSelector.qml | 17 +---------------- .../PrintSetupSelectorContents.qml | 9 +++------ .../Recommended/RecommendedAdhesionSelector.qml | 7 ++++--- .../RecommendedInfillDensitySelector.qml | 2 +- .../Recommended/RecommendedPrintSetup.qml | 5 +---- .../Recommended/RecommendedSupportSelector.qml | 7 ++++--- resources/qml/Settings/SettingView.qml | 6 ++---- 11 files changed, 28 insertions(+), 54 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 7c01b1f8b0..0191396e7b 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -13,10 +13,6 @@ import QtGraphicalEffects 1.0 // For the dropshadow Item { id: prepareMenu - // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - UM.I18nCatalog { diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index a1f59cd4ca..1543536160 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -10,9 +10,6 @@ import Cura 1.1 as Cura Item { id: previewMenu - // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. - signal showTooltip(Item item, point location, string text) - signal hideTooltip() property real itemHeight: height - 2 * UM.Theme.getSize("default_lining").width diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 36f5758fa3..4effea5ba7 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -181,13 +181,6 @@ UM.MainWindow } } - Connections - { - target: stageMenu.item - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() - } - JobSpecs { id: jobSpecs @@ -280,8 +273,6 @@ UM.MainWindow // Every time the stage is changed. property var printSetupSelector: Cura.PrintSetupSelector { - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() width: UM.Theme.getSize("print_setup_widget").width height: UM.Theme.getSize("stage_menu").height headerCornerSide: RoundedRectangle.Direction.Right diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 51cd8eff0d..ea56a4471e 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -6,5 +6,16 @@ import QtQuick.Controls 2.0 import Cura 1.0 as Cura -Cura.SettingView { + +Item +{ + id: customPrintSetup + + // TODO: Hardcoded now but UX has to decide about the height of this item + height: 500 + + Cura.SettingView + { + anchors.fill: parent + } } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 1794a54cdf..5518ac6b60 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -9,17 +9,13 @@ import Cura 1.0 as Cura Cura.ExpandableComponent { - id: base + id: printSetupSelector property bool hideSettings: PrintInformation.preSliced property string enabledText: catalog.i18nc("@label:Should be short", "On") property string disabledText: catalog.i18nc("@label:Should be short", "Off") - // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - iconSource: UM.Theme.getIcon("pencil") popupPadding: UM.Theme.getSize("default_lining").width popupSpacingY: UM.Theme.getSize("narrow_margin").width @@ -32,17 +28,6 @@ Cura.ExpandableComponent name: "cura" } - Timer - { - id: tooltipDelayTimer - interval: 500 - repeat: false - property var item - property string text - - onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) - } - headerItem: PrintSetupSelectorHeader { anchors.fill: parent diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 0210ece977..77d1b59f4c 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -93,7 +93,7 @@ Item Item { id: contents - height: childrenRect.height + height: currentModeIndex == 0 ? recommendedPrintSetup.height : customPrintSetup.height anchors { @@ -104,28 +104,25 @@ Item RecommendedPrintSetup { + id: recommendedPrintSetup anchors { left: parent.left right: parent.right top: parent.top } - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() visible: currentModeIndex == 0 } CustomPrintSetup { + id: customPrintSetup anchors { left: parent.left right: parent.right top: parent.top } - height: 500 - onShowTooltip: base.showTooltip(item, location, text) - onHideTooltip: base.hideTooltip() visible: currentModeIndex == 1 } } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml index a7e8b3ea75..3092644d4e 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -32,7 +32,7 @@ Item Item { id: enableAdhesionContainer - height: childrenRect.height + height: enableAdhesionCheckBox.height anchors { @@ -46,9 +46,11 @@ Item id: enableAdhesionCheckBox anchors.verticalCenter: parent.verticalCenter + property alias _hovered: adhesionMouseArea.containsMouse + //: Setting enable printing build-plate adhesion helper checkbox style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled + enabled: recommendedPrintSettup.settingsEnabled visible: platformAdhesionType.properties.enabled == "True" checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" @@ -58,7 +60,6 @@ Item id: adhesionMouseArea anchors.fill: parent hoverEnabled: true - enabled: base.settingsEnabled onClicked: { diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 0dd594176c..7c026ac9de 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -189,7 +189,7 @@ Item text: catalog.i18nc("@label", "Gradual infill") style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled + enabled: recommendedPrintSettup.settingsEnabled visible: infillSteps.properties.enabled == "True" checked: parseInt(infillSteps.properties.value) > 0 diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index a8fca47d6c..194747271e 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -10,13 +10,10 @@ import Cura 1.0 as Cura Item { - id: base + id: recommendedPrintSettup height: childrenRect.height + 2 * padding - signal showTooltip(Item item, point location, string text) - signal hideTooltip() - property Action configureSettings property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 4e63242f05..25a5574a39 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -50,7 +50,7 @@ Item property alias _hovered: enableSupportMouseArea.containsMouse style: UM.Theme.styles.checkbox - enabled: base.settingsEnabled + enabled: recommendedPrintSettup.settingsEnabled visible: supportEnabled.properties.enabled == "True" checked: supportEnabled.properties.value == "True" @@ -60,6 +60,7 @@ Item id: enableSupportMouseArea anchors.fill: parent hoverEnabled: true + onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") onEntered: @@ -86,7 +87,7 @@ Item } style: UM.Theme.styles.combobox_color - enabled: base.settingsEnabled + enabled: recommendedPrintSettup.settingsEnabled visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started @@ -126,7 +127,7 @@ Item id: supportExtruderMouseArea anchors.fill: parent hoverEnabled: true - enabled: base.settingsEnabled + enabled: recommendedPrintSettup.settingsEnabled acceptedButtons: Qt.NoButton onEntered: { diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 0a7102ff45..270f04e70f 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -13,13 +13,11 @@ import "../Menus" Item { - id: base; + id: settingsView property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel() property Action configureSettings property bool findingSettings - signal showTooltip(Item item, point location, string text) - signal hideTooltip() ToolButton { @@ -359,7 +357,7 @@ Item contextMenu.provider = provider contextMenu.popup(); } - onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: Math.round(delegate.height / 2) }, text) + onShowTooltip: base.showTooltip(delegate, Qt.point(- UM.Theme.getSize("default_arrow").width, 0), text) onHideTooltip: base.hideTooltip() onShowAllHiddenInheritedSettings: { From 82e66eeaa1957184e8cf9b4ce1359ec47690f946 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 09:02:41 +0100 Subject: [PATCH 396/558] Remove tabs and lining with single-extruder printers There's no sense in showing tabs if the user can't use them. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index b269b95df2..957cd16b3e 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -40,6 +40,7 @@ Item id: tabBar anchors.top: header.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height + visible: Cura.MachineManager.numberExtrudersEnabled > 1 currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) @@ -86,8 +87,8 @@ Item height: childrenRect.height anchors.top: tabBar.bottom - radius: UM.Theme.getSize("default_radius").width - border.width: UM.Theme.getSize("default_lining").width + radius: tabBar.visible ? UM.Theme.getSize("default_radius").width : 0 + border.width: tabBar.visible ? UM.Theme.getSize("default_lining").width : 0 border.color: UM.Theme.getColor("lining") color: UM.Theme.getColor("main_background") @@ -98,6 +99,7 @@ Item height: parent.radius anchors.top: parent.top color: UM.Theme.getColor("lining") + visible: tabBar.visible Rectangle { anchors From db05d7853a3567da6bb328f676c3f89dfb74bfcc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 09:04:35 +0100 Subject: [PATCH 397/558] Remove background colour from tab window The colour is the same as what is behind it anyway. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 957cd16b3e..eae160b48a 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -90,7 +90,6 @@ Item radius: tabBar.visible ? UM.Theme.getSize("default_radius").width : 0 border.width: tabBar.visible ? UM.Theme.getSize("default_lining").width : 0 border.color: UM.Theme.getColor("lining") - color: UM.Theme.getColor("main_background") //Remove rounding and lining at the top. Rectangle From 90281c455b74a56fc49c45724fee3e4b3aa88f85 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 09:45:49 +0100 Subject: [PATCH 398/558] Add global profile selector to the custom print setup panel Also modify some styles to adjust to the designs. Contributes to CURA-5941. --- .../Custom/CustomPrintSetup.qml | 29 +++++++++- .../Custom/GlobalProfileSelector.qml} | 53 +++++++++++-------- .../PrintSetupSelector/PrintSetupSelector.qml | 2 - .../RecommendedQualityProfileSelector.qml | 4 +- .../RecommendedSupportSelector.qml | 2 +- resources/qml/qmldir | 3 +- resources/themes/cura-light/styles.qml | 6 ++- resources/themes/cura-light/theme.json | 3 +- 8 files changed, 71 insertions(+), 31 deletions(-) rename resources/qml/{GlobalProfileButton.qml => PrintSetupSelector/Custom/GlobalProfileSelector.qml} (67%) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index ea56a4471e..e0f0827b17 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -4,6 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 +import UM 1.3 as UM import Cura 1.0 as Cura @@ -14,8 +15,34 @@ Item // TODO: Hardcoded now but UX has to decide about the height of this item height: 500 + property real padding: UM.Theme.getSize("default_margin").width + + // Profile selector row + GlobalProfileSelector + { + id: globalProfileRow + anchors + { + top: parent.top + topMargin: parent.padding + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + } + } + Cura.SettingView { - anchors.fill: parent + anchors + { + top: globalProfileRow.bottom + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + bottom: parent.bottom + } } } diff --git a/resources/qml/GlobalProfileButton.qml b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml similarity index 67% rename from resources/qml/GlobalProfileButton.qml rename to resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml index bac2732037..91525d0f9e 100644 --- a/resources/qml/GlobalProfileButton.qml +++ b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml @@ -9,24 +9,25 @@ import QtQuick.Layouts 1.2 import UM 1.2 as UM import Cura 1.0 as Cura -import "Menus" - Item { id: globalProfileRow - height: UM.Theme.getSize("print_setup_item").height + height: childrenRect.height Label { id: globalProfileLabel - text: catalog.i18nc("@label","Profile:") - textFormat: Text.PlainText - width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2) + anchors + { + top: parent.top + bottom: parent.bottom + left: parent.left + right: globalProfileSelection.left + } + text: catalog.i18nc("@label", "Profile") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter - anchors.top: parent.top - anchors.bottom: parent.bottom } ToolButton @@ -34,20 +35,30 @@ Item id: globalProfileSelection text: generateActiveQualityText() - width: Math.round(parent.width * 0.55) - height: UM.Theme.getSize("setting_control").height - anchors.left: globalProfileLabel.right - anchors.right: parent.right + width: UM.Theme.getSize("print_setup_big_dropdown").width + height: UM.Theme.getSize("print_setup_big_dropdown").height + anchors + { + top: parent.top + right: parent.right + } tooltip: Cura.MachineManager.activeQualityOrQualityChangesName style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true - menu: ProfileMenu { } + menu: Cura.ProfileMenu { } - function generateActiveQualityText () { - var result = Cura.MachineManager.activeQualityOrQualityChangesName; + function generateActiveQualityText() + { + var result = Cura.MachineManager.activeQualityOrQualityChangesName + if (Cura.MachineManager.isActiveQualityExperimental) + { + result += " (Experimental)" + } - if (Cura.MachineManager.isActiveQualitySupported) { - if (Cura.MachineManager.activeQualityLayerHeight > 0) { + if (Cura.MachineManager.isActiveQualitySupported) + { + if (Cura.MachineManager.activeQualityLayerHeight > 0) + { result += " " result += " - " result += Cura.MachineManager.activeQualityLayerHeight + "mm" @@ -63,15 +74,15 @@ Item id: customisedSettings visible: Cura.MachineManager.hasUserSettings - height: Math.round(parent.height * 0.6) - width: Math.round(parent.height * 0.6) + width: UM.Theme.getSize("print_setup_icon").width + height: UM.Theme.getSize("print_setup_icon").height anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width) color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); - iconSource: UM.Theme.getIcon("star"); + iconSource: UM.Theme.getIcon("star") onClicked: { @@ -81,7 +92,7 @@ Item onEntered: { var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.") - base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content) + base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("default_margin").width, 0), content) } onExited: base.hideTooltip() } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 5518ac6b60..f1b424f7f2 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -11,8 +11,6 @@ Cura.ExpandableComponent { id: printSetupSelector - property bool hideSettings: PrintInformation.preSliced - property string enabledText: catalog.i18nc("@label:Should be short", "On") property string disabledText: catalog.i18nc("@label:Should be short", "Off") diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index cddf01a4dc..4963f10792 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -182,7 +182,7 @@ Item id: customisedSettings visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated - height: visible ? Math.round(0.8 * qualityRowTitle.height) : 0 + height: visible ? UM.Theme.getSize("print_setup_icon").height : 0 width: height anchors { @@ -203,7 +203,7 @@ Item onEntered: { var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) + base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltipContent) } onExited: base.hideTooltip() } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 25a5574a39..d367510ef6 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -76,7 +76,7 @@ Item { id: supportExtruderCombobox - height: UM.Theme.getSize("print_setup_support_extruder_selector").height + height: UM.Theme.getSize("print_setup_big_dropdown").height anchors { left: enableSupportCheckBox.right diff --git a/resources/qml/qmldir b/resources/qml/qmldir index c0a8bac0ae..4dc9a34894 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -15,4 +15,5 @@ ExpandableComponent 1.0 ExpandableComponent.qml PrinterTypeLabel 1.0 PrinterTypeLabel.qml ViewsSelector 1.0 ViewsSelector.qml ToolbarButton 1.0 ToolbarButton.qml -SettingView 1.0 SettingView.qml \ No newline at end of file +SettingView 1.0 SettingView.qml +ProfileMenu 1.0 ProfileMenu.qml \ No newline at end of file diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 5203cb0b0b..e6144bb6ec 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -38,6 +38,7 @@ QtObject } } + radius: UM.Theme.getSize("setting_control_radius").width border.width: Theme.getSize("default_lining").width border.color: { @@ -489,11 +490,12 @@ QtObject UM.RecolorImage { id: swatch - height: Math.round(UM.Theme.getSize("setting_control").height / 2) + height: Math.round(control.height / 2) width: height anchors.right: downArrow.left anchors.verticalCenter: parent.verticalCenter - anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) + anchors.rightMargin: UM.Theme.getSize("default_margin").width +// anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("extruder_button") diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index afe40007f4..2c5c7a360a 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -377,7 +377,8 @@ "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_tickmarks": [0.32, 0.32], - "print_setup_support_extruder_selector": [18.2, 2.5], + "print_setup_big_dropdown": [28, 2.5], + "print_setup_icon": [1.2, 1.2], "configuration_selector_mode_tabs": [0.0, 3.0], From f3af5a72ad7b29f3e27197cff85c43bcff0519fd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:13:26 +0100 Subject: [PATCH 399/558] Use ListModel.count instead of rowCount The .count property properly updates when the model is changed. Contributes to issue CURA-5876. --- cura/Settings/ExtrudersModel.py | 2 +- cura/Settings/MachineManager.py | 2 +- .../MachineSettingsAction.qml | 4 ++-- resources/qml/Dialogs/AddMachineDialog.qml | 2 +- .../ConfigurationMenu/ConfigurationMenu.qml | 2 +- resources/qml/Menus/ProfileMenu.qml | 8 +++---- resources/qml/Preferences/MachinesPage.qml | 8 ++++--- .../Preferences/Materials/MaterialsList.qml | 8 +++---- resources/qml/Preferences/ProfilesPage.qml | 24 ++++++++++++------- .../qml/Preferences/SettingVisibilityPage.qml | 2 +- .../qml/Settings/SettingOptionalExtruder.qml | 13 ++++++---- resources/qml/SidebarSimple.qml | 6 ++--- resources/qml/Toolbar.qml | 2 +- resources/qml/ViewsSelector.qml | 2 +- 14 files changed, 49 insertions(+), 36 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 955bd9dbb2..5f10ac99d4 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -165,7 +165,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): def __updateExtruders(self): extruders_changed = False - if self.rowCount() != 0: + if self.count != 0: extruders_changed = True items = [] diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index be4a4e2b4e..7e1a06f45c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1540,7 +1540,7 @@ class MachineManager(QObject): elif word.isdigit(): abbr_machine += word else: - stripped_word = ''.join(char for char in unicodedata.normalize('NFD', word.upper()) if unicodedata.category(char) != 'Mn') + stripped_word = "".join(char for char in unicodedata.normalize("NFD", word.upper()) if unicodedata.category(char) != "Mn") # - use only the first character if the word is too long (> 3 characters) # - use the whole word if it's not too long (<= 3 characters) if len(stripped_word) > 3: diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 004b4e3cfc..c88a721a84 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -23,7 +23,7 @@ Cura.MachineAction target: base.extrudersModel onModelChanged: { - var extruderCount = base.extrudersModel.rowCount(); + var extruderCount = base.extrudersModel.count; base.extruderTabsCount = extruderCount; } } diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index 8b2b9d1868..bcf5807949 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -170,7 +170,7 @@ UM.Dialog if (machineList.model.getItem(machineList.currentIndex).section != section) { // Find the first machine from this section - for(var i = 0; i < machineList.model.rowCount(); i++) + for(var i = 0; i < machineList.model.count; i++) { var item = machineList.model.getItem(i); if (item.section == section) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 202bc22ce0..9927ad1498 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -44,7 +44,7 @@ Cura.ExpandableComponent delegate: Item { height: parent.height - width: Math.round(ListView.view.width / extrudersModel.rowCount()) + width: Math.round(ListView.view.width / extrudersModel.count) // Extruder icon. Shows extruder index and has the same color as the active material. Cura.ExtruderIcon diff --git a/resources/qml/Menus/ProfileMenu.qml b/resources/qml/Menus/ProfileMenu.qml index ffd3c556b6..e09b7930a8 100644 --- a/resources/qml/Menus/ProfileMenu.qml +++ b/resources/qml/Menus/ProfileMenu.qml @@ -34,7 +34,7 @@ Menu MenuSeparator { id: customSeparator - visible: Cura.CustomQualityProfilesDropDownMenuModel.rowCount > 0 + visible: Cura.CustomQualityProfilesDropDownMenuModel.count > 0 } Instantiator @@ -45,7 +45,7 @@ Menu Connections { target: Cura.CustomQualityProfilesDropDownMenuModel - onModelReset: customSeparator.visible = Cura.CustomQualityProfilesDropDownMenuModel.rowCount() > 0 + onModelReset: customSeparator.visible = Cura.CustomQualityProfilesDropDownMenuModel.count > 0 } MenuItem @@ -59,12 +59,12 @@ Menu onObjectAdded: { - customSeparator.visible = model.rowCount() > 0; + customSeparator.visible = model.count > 0; menu.insertItem(index, object); } onObjectRemoved: { - customSeparator.visible = model.rowCount() > 0; + customSeparator.visible = model.count > 0; menu.removeItem(object); } } diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 4dc5465dc6..bc75b9bc72 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -21,8 +21,10 @@ UM.ManagementPage function activeMachineIndex() { - for(var i = 0; i < model.rowCount(); i++) { - if (model.getItem(i).id == Cura.MachineManager.activeMachineId) { + for(var i = 0; i < model.count; i++) + { + if (model.getItem(i).id == Cura.MachineManager.activeMachineId) + { return i; } } @@ -47,7 +49,7 @@ UM.ManagementPage { text: catalog.i18nc("@action:button", "Remove"); iconName: "list-remove"; - enabled: base.currentItem != null && model.rowCount() > 1 + enabled: base.currentItem != null && model.count > 1 onClicked: confirmDialog.open(); }, Button diff --git a/resources/qml/Preferences/Materials/MaterialsList.qml b/resources/qml/Preferences/Materials/MaterialsList.qml index 00bead9650..61f92db84c 100644 --- a/resources/qml/Preferences/Materials/MaterialsList.qml +++ b/resources/qml/Preferences/Materials/MaterialsList.qml @@ -57,7 +57,7 @@ Item var currentItemId = base.currentItem == null ? "" : base.currentItem.root_material_id search_root_id = currentItemId } - for (var material_idx = 0; material_idx < genericMaterialsModel.rowCount(); material_idx++) + for (var material_idx = 0; material_idx < genericMaterialsModel.count; material_idx++) { var material = genericMaterialsModel.getItem(material_idx) if (material.root_material_id == search_root_id) @@ -72,15 +72,15 @@ Item return true } } - for (var brand_idx = 0; brand_idx < materialsModel.rowCount(); brand_idx++) + for (var brand_idx = 0; brand_idx < materialsModel.count; brand_idx++) { var brand = materialsModel.getItem(brand_idx) var types_model = brand.material_types - for (var type_idx = 0; type_idx < types_model.rowCount(); type_idx++) + for (var type_idx = 0; type_idx < types_model.count; type_idx++) { var type = types_model.getItem(type_idx) var colors_model = type.colors - for (var material_idx = 0; material_idx < colors_model.rowCount(); material_idx++) + for (var material_idx = 0; material_idx < colors_model.count; material_idx++) { var material = colors_model.getItem(material_idx) if (material.root_material_id == search_root_id) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index ba0c2848a5..d7ffbb3152 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -188,21 +188,27 @@ Item Connections { target: qualitiesModel - onItemsChanged: { + onItemsChanged: + { var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name; - if (newQualityNameToSelect != "") { + if (newQualityNameToSelect != "") + { toSelectItemName = newQualityNameToSelect; } var newIdx = -1; // Default to nothing if nothing can be found - if (toSelectItemName != "") { + if (toSelectItemName != "") + { // Select the required quality name if given - for (var idx = 0; idx < qualitiesModel.rowCount(); ++idx) { + for (var idx = 0; idx < qualitiesModel.count; ++idx) + { var item = qualitiesModel.getItem(idx); - if (item.name == toSelectItemName) { + if (item.name == toSelectItemName) + { // Switch to the newly created profile if needed newIdx = idx; - if (base.toActivateNewQuality) { + if (base.toActivateNewQuality) + { // Activate this custom quality if required Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group); } @@ -382,9 +388,11 @@ Item var selectedItemName = Cura.MachineManager.activeQualityOrQualityChangesName; // Select the required quality name if given - for (var idx = 0; idx < qualitiesModel.rowCount(); idx++) { + for (var idx = 0; idx < qualitiesModel.count; idx++) + { var item = qualitiesModel.getItem(idx); - if (item.name == selectedItemName) { + if (item.name == selectedItemName) + { currentIndex = idx; break; } diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 8896d0611e..bb47301b69 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -54,7 +54,7 @@ UM.PreferencesPage { return Qt.Unchecked } - else if(definitionsModel.visibleCount == definitionsModel.rowCount(null)) + else if(definitionsModel.visibleCount == definitionsModel.count) { return Qt.Checked } diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml index a3c1422b30..5f0d8327f8 100644 --- a/resources/qml/Settings/SettingOptionalExtruder.qml +++ b/resources/qml/Settings/SettingOptionalExtruder.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2016 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// 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.0 @@ -31,12 +31,15 @@ SettingItem { forceActiveFocus(); propertyProvider.setPropertyValue("value", model.getItem(index).index); - } else + } + else { if (propertyProvider.properties.value == -1) { - control.currentIndex = model.rowCount() - 1; // we know the last item is "Not overriden" - } else { + control.currentIndex = model.count - 1; // we know the last item is "Not overriden" + } + else + { control.currentIndex = propertyProvider.properties.value; // revert to the old value } } diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 5e723a3d70..e07810691e 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -106,7 +106,7 @@ Item var availableMin = -1 var availableMax = -1 - for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) + for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.count; i++) { var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i) @@ -183,7 +183,7 @@ Item qualityModel.existingQualityProfile = 0 // check, the ticks count cannot be less than zero - qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.rowCount() - 1) + qualityModel.totalTicks = Math.max(0, Cura.QualityProfilesDropDownMenuModel.count - 1) } } @@ -1156,7 +1156,7 @@ Item function populateExtruderModel() { extruderModel.clear(); - for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) + for(var extruderNumber = 0; extruderNumber < extruders.count; extruderNumber++) { extruderModel.append({ text: extruders.getItem(extruderNumber).name, diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 0240aaab26..4e00bd7248 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -65,7 +65,7 @@ Item style: UM.Theme.styles.toolbar_button property bool isFirstElement: toolsModel.getItem(0).id == model.id - property bool isLastElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id + property bool isLastElement: toolsModel.getItem(toolsModel.count - 1).id == model.id onCheckedChanged: { diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index e9fdd57177..e239ea82a0 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -19,7 +19,7 @@ Cura.ExpandableComponent property var activeView: { - for (var i = 0; i < viewModel.rowCount(); i++) + for (var i = 0; i < viewModel.count; i++) { if (viewModel.items[i].active) { From 6012ea0b9edf78369bec7abc463869f226e26b23 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:15:11 +0100 Subject: [PATCH 400/558] Don't use QtQuick imports from Qt 5.11 Our build system uses 5.10. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 2 +- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index c40eb5b9e9..32be97f74e 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 9927ad1498..816ac27470 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.11 import UM 1.2 as UM import Cura 1.0 as Cura From af747ae09c254327dd5d85e90a2cea86cc5d5562 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:19:25 +0100 Subject: [PATCH 401/558] Don't hide tab bar when disabling all but one extruder And make sure the checkbox for enabling also disappears. We don't want to make this dependent on the number of enabled extruders, but on the total number of extruders. This way you can actually re-enable an extruder again because the tab bar shouldn't disappear. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index eae160b48a..7ff47ea16f 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -40,7 +40,7 @@ Item id: tabBar anchors.top: header.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - visible: Cura.MachineManager.numberExtrudersEnabled > 1 + visible: extrudersModel.count > 1 currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) @@ -138,6 +138,7 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth + visible: extrudersModel.count > 1 } OldControls.CheckBox @@ -146,6 +147,7 @@ Item enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox + visible: extrudersModel.count > 1 /* Use a MouseArea to process the click on this checkbox. This is necessary because actually clicking the checkbox From 39411222da20db6a39f1341e6d42c9610c88c85a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:37:22 +0100 Subject: [PATCH 402/558] Use normal font size for Auto slicing... message It should've been the normal font size anyway. This is not small! Contributes to issue CURA-5876. --- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index cae598fea6..dee099bc88 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -48,7 +48,7 @@ Column text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...") color: UM.Theme.getColor("text") - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering } From c8cb3a094a216eac21b139ba6577541ea53046d1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:52:10 +0100 Subject: [PATCH 403/558] Re-use SecondaryButton instead of setting colours ourselves It has a pre-defined theme. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/ConfigurationMenu.qml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 816ac27470..fc8b31f125 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -147,7 +147,7 @@ Cura.ExpandableComponent width: parent.width height: childrenRect.height - Cura.ActionButton + Cura.SecondaryButton { id: goToCustom visible: popupItem.configuration_method === "auto" @@ -159,18 +159,13 @@ Cura.ExpandableComponent top: parent.top } - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.getIcon("arrow_right") iconOnRightSide: true onClicked: popupItem.configuration_method = "custom" } - Cura.ActionButton + Cura.SecondaryButton { id: goToAuto visible: popupItem.configuration_method === "custom" @@ -182,11 +177,6 @@ Cura.ExpandableComponent top: parent.top } - color: UM.Theme.getColor("secondary") - hoverColor: UM.Theme.getColor("secondary") - textColor: UM.Theme.getColor("primary") - textHoverColor: UM.Theme.getColor("text") - iconSource: UM.Theme.getIcon("arrow_left") onClicked: popupItem.configuration_method = "auto" From 65d3aa44802c740d06c19ebbc58a2e9f2732ee80 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Dec 2018 11:59:03 +0100 Subject: [PATCH 404/558] Fix broken sizes due to merged theme entry Merge conflict went wrong, I think. Contributes to issue CURA-5876. --- resources/qml/ActionPanel/OutputProcessWidget.qml | 2 +- resources/qml/ActionPanel/SliceProcessWidget.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 3a85a13810..8ce5d13f17 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -111,7 +111,7 @@ Column { id: previewStageShortcut - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height text: catalog.i18nc("@button", "Preview") onClicked: UM.Controller.setActiveStage("PreviewStage") diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index dee099bc88..1143bb4c1a 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -101,7 +101,7 @@ Column // Disable the slice process when width: parent.width - height: UM.Theme.getSize("action_panel_button").height + height: UM.Theme.getSize("action_button").height visible: !autoSlice Cura.PrimaryButton { From 4c468831f06fcc33de6b657985aed22907c2796c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 13:58:13 +0100 Subject: [PATCH 405/558] Add tabs for select the extruder in the custom print setup. Align some elements beneath the tabs. Contributes to CURA-5941. --- .../Custom/CustomPrintSetup.qml | 63 +++++- .../Custom/GlobalProfileSelector.qml | 4 +- .../Recommended/RecommendedPrintSetup.qml | 9 + .../RecommendedSupportSelector.qml | 11 +- resources/qml/Settings/SettingView.qml | 186 +++++++++--------- resources/themes/cura-light/styles.qml | 2 +- resources/themes/cura-light/theme.json | 4 +- 7 files changed, 164 insertions(+), 115 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index e0f0827b17..ae31976a34 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -13,9 +13,15 @@ Item id: customPrintSetup // TODO: Hardcoded now but UX has to decide about the height of this item - height: 500 + height: 480 property real padding: UM.Theme.getSize("default_margin").width + property bool multipleExtruders: extrudersModel.count > 1 + + Cura.ExtrudersModel + { + id: extrudersModel + } // Profile selector row GlobalProfileSelector @@ -32,11 +38,64 @@ Item } } + UM.TabRow + { + id: tabBar + + visible: multipleExtruders // The tab row is only visible when there are more than 1 extruder + + anchors + { + top: globalProfileRow.bottom + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + } + + currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) + + Repeater + { + id: repeater + model: extrudersModel + delegate: UM.TabRowButton + { + contentItem: Item + { + Cura.ExtruderIcon + { + anchors.horizontalCenter: parent.horizontalCenter + materialColor: model.color + extruderEnabled: model.enabled + } + } + onClicked: + { + Cura.ExtruderManager.setActiveExtruderIndex(tabBar.currentIndex) + } + } + } + + // When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt. + // This causes the currentIndex of the tab to be in an invalid position which resets it to 0. + // Therefore we need to change it back to what it was: The active extruder index. + Connections + { + target: repeater.model + onModelChanged: + { + tabBar.currentIndex = Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) + } + } + } + Cura.SettingView { anchors { - top: globalProfileRow.bottom + top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom topMargin: UM.Theme.getSize("default_margin").height left: parent.left leftMargin: parent.padding diff --git a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml index 91525d0f9e..11b2d3608b 100644 --- a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml @@ -35,8 +35,8 @@ Item id: globalProfileSelection text: generateActiveQualityText() - width: UM.Theme.getSize("print_setup_big_dropdown").width - height: UM.Theme.getSize("print_setup_big_dropdown").height + width: UM.Theme.getSize("print_setup_big_item").width + height: UM.Theme.getSize("print_setup_big_item").height anchors { top: parent.top diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 194747271e..618c519d31 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -69,4 +69,13 @@ Item labelColumnWidth: parent.firstColumnWidth } } + + UM.SettingPropertyProvider + { + id: extrudersEnabledCount + containerStack: Cura.MachineManager.activeMachine + key: "extruders_enabled_count" + watchedProperties: [ "value" ] + storeIndex: 0 + } } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index d367510ef6..ce4aa6c195 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -76,7 +76,7 @@ Item { id: supportExtruderCombobox - height: UM.Theme.getSize("print_setup_big_dropdown").height + height: UM.Theme.getSize("print_setup_big_item").height anchors { left: enableSupportCheckBox.right @@ -171,15 +171,6 @@ Item storeIndex: 0 } - UM.SettingPropertyProvider - { - id: extrudersEnabledCount - containerStack: Cura.MachineManager.activeMachine - key: "extruders_enabled_count" - watchedProperties: [ "value" ] - storeIndex: 0 - } - UM.SettingPropertyProvider { id: supportExtruderNr diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 2c42d222ce..3250e847a3 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -19,70 +19,22 @@ Item property Action configureSettings property bool findingSettings - ToolButton - { - id: settingVisibilityMenu - - property var toolButtonIconColor: UM.Theme.getColor("setting_category_text") - - width: height - height: UM.Theme.getSize("setting_control").height - anchors - { - topMargin: UM.Theme.getSize("thick_margin").height - left: filterContainer.right - leftMargin: UM.Theme.getSize("default_margin").width - } - style: ButtonStyle - { - background: Item { - UM.RecolorImage { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(parent.width * 0.6) - height: Math.round(parent.height * 0.6) - sourceSize.width: width - sourceSize.height: width - color: settingVisibilityMenu.toolButtonIconColor - source: UM.Theme.getIcon("settings") - } - } - label: Label{} - } - menu: SettingVisibilityPresetsMenu - { - onShowAllSettings: - { - definitionsModel.setAllVisible(true); - filter.updateDefinitionModel(); - } - } - - MouseArea - { - anchors.fill: parent - hoverEnabled: true - acceptedButtons: Qt.RightButton - onEntered: settingVisibilityMenu.toolButtonIconColor = UM.Theme.getColor("setting_control_button_hover") - onExited: settingVisibilityMenu.toolButtonIconColor = UM.Theme.getColor("setting_category_text") - } - } - Rectangle { id: filterContainer visible: true + radius: UM.Theme.getSize("setting_control_radius").width border.width: Math.round(UM.Theme.getSize("default_lining").width) border.color: { - if(hoverMouseArea.containsMouse || clearFilterButton.containsMouse) + if (hoverMouseArea.containsMouse || clearFilterButton.containsMouse) { - return UM.Theme.getColor("setting_control_border_highlight"); + return UM.Theme.getColor("setting_control_border_highlight") } else { - return UM.Theme.getColor("setting_control_border"); + return UM.Theme.getColor("setting_control_border") } } @@ -90,13 +42,12 @@ Item anchors { - topMargin: UM.Theme.getSize("thick_margin").height + top: parent.top left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - right: scrollView.right - rightMargin: Math.floor(UM.Theme.getSize("wide_margin").width * 2) + right: settingVisibilityMenu.left + rightMargin: UM.Theme.getSize("default_margin").width } - height: UM.Theme.getSize("setting_control").height + height: UM.Theme.getSize("print_setup_big_item").height Timer { id: settingsSearchTimer @@ -108,7 +59,7 @@ Item TextField { - id: filter; + id: filter height: parent.height anchors.left: parent.left anchors.right: clearFilterButton.left @@ -118,9 +69,9 @@ Item style: TextFieldStyle { - textColor: UM.Theme.getColor("setting_control_text"); + textColor: UM.Theme.getColor("setting_control_text") placeholderTextColor: UM.Theme.getColor("setting_filter_field") - font: UM.Theme.getFont("default"); + font: UM.Theme.getFont("default_italic") background: Item {} } @@ -134,38 +85,38 @@ Item onEditingFinished: { - definitionsModel.filter = {"i18n_label": "*" + text}; - findingSettings = (text.length > 0); - if(findingSettings != lastFindingSettings) + definitionsModel.filter = {"i18n_label": "*" + text} + findingSettings = (text.length > 0) + if (findingSettings != lastFindingSettings) { - updateDefinitionModel(); - lastFindingSettings = findingSettings; + updateDefinitionModel() + lastFindingSettings = findingSettings } } Keys.onEscapePressed: { - filter.text = ""; + filter.text = "" } function updateDefinitionModel() { - if(findingSettings) + if (findingSettings) { - expandedCategories = definitionsModel.expanded.slice(); - definitionsModel.expanded = [""]; // keep categories closed while to prevent render while making settings visible one by one - definitionsModel.showAncestors = true; - definitionsModel.showAll = true; - definitionsModel.expanded = ["*"]; + expandedCategories = definitionsModel.expanded.slice() + definitionsModel.expanded = [""] // keep categories closed while to prevent render while making settings visible one by one + definitionsModel.showAncestors = true + definitionsModel.showAll = true + definitionsModel.expanded = ["*"] } else { - if(expandedCategories) + if (expandedCategories) { - definitionsModel.expanded = expandedCategories; + definitionsModel.expanded = expandedCategories } - definitionsModel.showAncestors = false; - definitionsModel.showAll = false; + definitionsModel.showAncestors = false + definitionsModel.showAll = false } } } @@ -197,8 +148,45 @@ Item onClicked: { - filter.text = ""; - filter.forceActiveFocus(); + filter.text = "" + filter.forceActiveFocus() + } + } + } + + ToolButton + { + id: settingVisibilityMenu + + anchors + { + top: filterContainer.top + bottom: filterContainer.bottom + right: parent.right + } + + style: ButtonStyle + { + background: Item { + UM.RecolorImage { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + sourceSize.height: height + color: control.enabled ? UM.Theme.getColor("setting_category_text") : UM.Theme.getColor("setting_category_disabled_text") + source: UM.Theme.getIcon("menu") + } + } + label: Label{} + } + menu: SettingVisibilityPresetsMenu + { + onShowAllSettings: + { + definitionsModel.setAllVisible(true) + filter.updateDefinitionModel() } } } @@ -206,33 +194,35 @@ Item ScrollView { id: scrollView - anchors.top: filterContainer.bottom; - anchors.bottom: parent.bottom; - anchors.right: parent.right; - anchors.left: parent.left; - anchors.topMargin: UM.Theme.getSize("thick_margin").height - anchors.rightMargin: UM.Theme.getSize("narrow_margin").height / 3 + anchors + { + top: filterContainer.bottom + topMargin: UM.Theme.getSize("default_margin").height + bottom: parent.bottom + right: parent.right + left: parent.left + } - style: UM.Theme.styles.scrollview; - flickableItem.flickableDirection: Flickable.VerticalFlick; - __wheelAreaScrollSpeed: 75; // Scroll three lines in one scroll event + style: UM.Theme.styles.scrollview + flickableItem.flickableDirection: Flickable.VerticalFlick + __wheelAreaScrollSpeed: 75 // Scroll three lines in one scroll event ListView { id: contents - spacing: Math.round(UM.Theme.getSize("default_lining").height); - cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item. + spacing: Math.round(UM.Theme.getSize("default_lining").height) + cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. model: UM.SettingDefinitionsModel { - id: definitionsModel; + id: definitionsModel containerId: Cura.MachineManager.activeDefinitionId visibilityHandler: UM.SettingPreferenceVisibilityHandler { } exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false. expanded: CuraApplication.expandedCategories onExpandedChanged: { - if(!findingSettings) + if (!findingSettings) { // Do not change expandedCategories preference while filtering settings // because all categories are expanded while filtering @@ -248,7 +238,7 @@ Item { id: delegate - width: Math.round(UM.Theme.getSize("print_setup_widget").width); + width: scrollView.width height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing Behavior on height { NumberAnimation { duration: 100 } } opacity: provider.properties.enabled == "True" ? 1 : 0 @@ -318,17 +308,17 @@ Item // machine gets changed. var activeMachineId = Cura.MachineManager.activeMachineId; - if(!model.settable_per_extruder) + if (!model.settable_per_extruder) { //Not settable per extruder or there only is global, so we must pick global. return activeMachineId; } - if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0) + if (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0) { //We have limit_to_extruder, so pick that stack. return Cura.ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)]; } - if(Cura.ExtruderManager.activeExtruderStackId) + if (Cura.ExtruderManager.activeExtruderStackId) { //We're on an extruder tab. Pick the current extruder. return Cura.ExtruderManager.activeExtruderStackId; @@ -390,14 +380,14 @@ Item } onSetActiveFocusToNextSetting: { - if(forward == undefined || forward) + if (forward == undefined || forward) { contents.currentIndex = contents.indexWithFocus + 1; while(contents.currentItem && contents.currentItem.height <= 0) { contents.currentIndex++; } - if(contents.currentItem) + if (contents.currentItem) { contents.currentItem.item.focusItem.forceActiveFocus(); } @@ -409,7 +399,7 @@ Item { contents.currentIndex--; } - if(contents.currentItem) + if (contents.currentItem) { contents.currentItem.item.focusItem.forceActiveFocus(); } diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index e6144bb6ec..ca95b6d373 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -495,7 +495,7 @@ QtObject anchors.right: downArrow.left anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: UM.Theme.getSize("default_margin").width -// anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) + sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("extruder_button") diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2c5c7a360a..5af77d59c3 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -377,7 +377,7 @@ "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_tickmarks": [0.32, 0.32], - "print_setup_big_dropdown": [28, 2.5], + "print_setup_big_item": [28, 2.5], "print_setup_icon": [1.2, 1.2], "configuration_selector_mode_tabs": [0.0, 3.0], @@ -425,7 +425,7 @@ "setting_text_maxwidth": [40.0, 0.0], "standard_list_lineheight": [1.5, 1.5], - "standard_arrow": [0.8, 0.8], + "standard_arrow": [1.0, 1.0], "button": [4, 4], "button_icon": [2.5, 2.5], From ce6a0676dd029a8e4b6ce7d5e2640c8114505fa5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 14:43:35 +0100 Subject: [PATCH 406/558] Add a rectangle surrounding the settings listview Contributes to CURA-5941. --- .../Custom/CustomPrintSetup.qml | 23 +++++++++++++++++-- resources/qml/Settings/SettingCategory.qml | 20 ++++++++-------- resources/qml/Settings/SettingItem.qml | 11 +++++---- resources/qml/Settings/SettingView.qml | 3 ++- resources/themes/cura-light/styles.qml | 4 ++-- resources/themes/cura-light/theme.json | 2 +- 6 files changed, 43 insertions(+), 20 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index ae31976a34..b524bb5926 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -91,17 +91,36 @@ Item } } - Cura.SettingView + Rectangle { anchors { top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom - topMargin: UM.Theme.getSize("default_margin").height left: parent.left leftMargin: parent.padding right: parent.right rightMargin: parent.padding bottom: parent.bottom + topMargin: -UM.Theme.getSize("default_lining").width + bottomMargin: -UM.Theme.getSize("default_lining").width + } + z: tabBar.z - 1 + // Don't show the border when only one extruder + border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent" + border.width: UM.Theme.getSize("default_lining").width + + Cura.SettingView + { + anchors + { + fill: parent + topMargin: UM.Theme.getSize("default_margin").height + leftMargin: UM.Theme.getSize("default_margin").width + // Small space for the scrollbar + rightMargin: UM.Theme.getSize("narrow_margin").width + // Compensate for the negative margin in the parent + bottomMargin: UM.Theme.getSize("default_lining").width + } } } } diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 4ec6294d61..9a061304d4 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -12,8 +12,8 @@ Button id: base anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 + // To avoid overlaping with the scrollBars + anchors.rightMargin: 2 * UM.Theme.getSize("thin_margin").width hoverEnabled: true background: Rectangle @@ -25,22 +25,24 @@ Button if (base.color) { return base.color - } else if (!base.enabled) + } + else if (!base.enabled) { return UM.Theme.getColor("setting_category_disabled") - } else if (base.hovered && base.checkable && base.checked) + } + else if (base.hovered && base.checkable && base.checked) { return UM.Theme.getColor("setting_category_active_hover") - } else if (base.pressed || (base.checkable && base.checked)) + } + else if (base.pressed || (base.checkable && base.checked)) { return UM.Theme.getColor("setting_category_active") - } else if (base.hovered) + } + else if (base.hovered) { return UM.Theme.getColor("setting_category_hover") - } else - { - return UM.Theme.getColor("setting_category") } + return UM.Theme.getColor("setting_category") } Behavior on color { ColorAnimation { duration: 50; } } Rectangle diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 036dcfeba4..df90cffdf3 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -10,8 +10,9 @@ import Cura 1.0 as Cura import "." -Item { - id: base; +Item +{ + id: base height: UM.Theme.getSize("section").height @@ -105,11 +106,11 @@ Item { Label { - id: label; + id: label - anchors.left: parent.left; + anchors.left: parent.left anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width / 1.2) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 - anchors.right: settingControls.left; + anchors.right: settingControls.left anchors.verticalCenter: parent.verticalCenter text: definition.label diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 3250e847a3..ff94c9168f 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -163,6 +163,7 @@ Item top: filterContainer.top bottom: filterContainer.bottom right: parent.right + rightMargin: UM.Theme.getSize("wide_margin").width } style: ButtonStyle @@ -210,7 +211,7 @@ Item ListView { id: contents - spacing: Math.round(UM.Theme.getSize("default_lining").height) + spacing: UM.Theme.getSize("default_lining").height cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. model: UM.SettingDefinitionsModel diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index ca95b6d373..eed5393a0b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -384,13 +384,13 @@ QtObject { implicitWidth: Theme.getSize("scrollbar").width radius: Math.round(implicitWidth / 2) - color: Theme.getColor("scrollbar_background"); + color: Theme.getColor("scrollbar_background") } handle: Rectangle { id: scrollViewHandle - implicitWidth: Theme.getSize("scrollbar").width; + implicitWidth: Theme.getSize("scrollbar").width radius: Math.round(implicitWidth / 2) color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle"); diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 5af77d59c3..dbe5e7196e 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -411,7 +411,7 @@ "extruder_icon": [2.33, 2.33], - "section": [0.0, 2.2], + "section": [0.0, 2], "section_icon": [1.6, 1.6], "section_icon_column": [2.8, 0.0], From 4e9c595bdd3dec5ac4f3688a4a25554fcf6f980d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 15:34:33 +0100 Subject: [PATCH 407/558] Restyle the settings list Be sure that the alignments and the margins are corrects according to the designs. Contributes to CURA-5941. --- resources/qml/Settings/SettingCategory.qml | 34 ++--- resources/qml/Settings/SettingItem.qml | 149 ++++++++++++--------- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 104 insertions(+), 81 deletions(-) diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 9a061304d4..9b78683e14 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -138,19 +138,20 @@ Button if (!base.enabled) { return UM.Theme.getColor("setting_category_disabled_text") - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) + } + else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) { return UM.Theme.getColor("setting_category_active_hover_text") - } else if (base.pressed || (base.checkable && base.checked)) + } + else if (base.pressed || (base.checkable && base.checked)) { return UM.Theme.getColor("setting_category_active_text") - } else if (base.hovered || base.activeFocus) + } + else if (base.hovered || base.activeFocus) { return UM.Theme.getColor("setting_category_hover_text") - } else - { - return UM.Theme.getColor("setting_category_text") } + return UM.Theme.getColor("setting_category_text") } source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } @@ -161,25 +162,26 @@ Button id: icon anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.leftMargin: UM.Theme.getSize("thin_margin").width color: { if (!base.enabled) { return UM.Theme.getColor("setting_category_disabled_text") - } else if((base.hovered || base.activeFocus) && base.checkable && base.checked) + } + else if((base.hovered || base.activeFocus) && base.checkable && base.checked) { return UM.Theme.getColor("setting_category_active_hover_text") - } else if(base.pressed || (base.checkable && base.checked)) + } + else if(base.pressed || (base.checkable && base.checked)) { return UM.Theme.getColor("setting_category_active_text") - } else if(base.hovered || base.activeFocus) + } + else if(base.hovered || base.activeFocus) { return UM.Theme.getColor("setting_category_hover_text") - } else - { - return UM.Theme.getColor("setting_category_text") } + return UM.Theme.getColor("setting_category_text") } source: UM.Theme.getIcon(definition.icon) width: UM.Theme.getSize("section_icon").width @@ -196,7 +198,9 @@ Button if (definition.expanded) { settingDefinitionsModel.collapse(definition.key) - } else { + } + else + { settingDefinitionsModel.expandRecursive(definition.key) } //Set focus so that tab navigation continues from this point on. @@ -205,7 +209,7 @@ Button } onActiveFocusChanged: { - if(activeFocus) + if (activeFocus) { base.focusReceived() } diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index df90cffdf3..4dd53f8663 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -15,6 +15,10 @@ Item id: base height: UM.Theme.getSize("section").height + anchors.left: parent.left + anchors.right: parent.right + // To avoid overlaping with the scrollBars + anchors.rightMargin: 2 * UM.Theme.getSize("thin_margin").width property alias contents: controlContainer.children property alias hovered: mouse.containsMouse @@ -44,25 +48,25 @@ Item var affected_by = settingDefinitionsModel.getRequires(definition.key, "value") var affected_by_list = "" - for(var i in affected_by) + for (var i in affected_by) { affected_by_list += "
  • %1
  • \n".arg(affected_by[i].label) } var affects_list = "" - for(var i in affects) + for (var i in affects) { affects_list += "
  • %1
  • \n".arg(affects[i].label) } var tooltip = "%1\n

    %2

    ".arg(definition.label).arg(definition.description) - if(affects_list != "") + if (affects_list != "") { tooltip += "
    %1\n
      \n%2
    ".arg(catalog.i18nc("@label Header for list of settings.", "Affects")).arg(affects_list) } - if(affected_by_list != "") + if (affected_by_list != "") { tooltip += "
    %1\n
      \n%2
    ".arg(catalog.i18nc("@label Header for list of settings.", "Affected By")).arg(affected_by_list) } @@ -72,35 +76,39 @@ Item MouseArea { - id: mouse; + id: mouse - anchors.fill: parent; + anchors.fill: parent - acceptedButtons: Qt.RightButton; + acceptedButtons: Qt.RightButton hoverEnabled: true; - onClicked: base.contextMenuRequested(); + onClicked: base.contextMenuRequested() - onEntered: { - hoverTimer.start(); + onEntered: + { + hoverTimer.start() } - onExited: { - if(controlContainer.item && controlContainer.item.hovered) { - return; + onExited: + { + if (controlContainer.item && controlContainer.item.hovered) + { + return } - hoverTimer.stop(); - base.hideTooltip(); + hoverTimer.stop() + base.hideTooltip() } - Timer { - id: hoverTimer; - interval: 500; - repeat: false; + Timer + { + id: hoverTimer + interval: 500 + repeat: false onTriggered: { - base.showTooltip(base.tooltipText); + base.showTooltip(base.tooltipText) } } @@ -109,16 +117,16 @@ Item id: label anchors.left: parent.left - anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width / 1.2) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 + anchors.leftMargin: doDepthIndentation ? Math.round(UM.Theme.getSize("thin_margin").width + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 anchors.right: settingControls.left anchors.verticalCenter: parent.verticalCenter text: definition.label - elide: Text.ElideMiddle; + elide: Text.ElideMiddle renderType: Text.NativeRendering textFormat: Text.PlainText - color: UM.Theme.getColor("setting_control_text"); + color: UM.Theme.getColor("setting_control_text") opacity: (definition.visible) ? 1 : 0.5 // emphasize the setting if it has a value in the user or quality profile font: base.doQualityUserSettingEmphasis && base.stackLevel != undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default") @@ -131,7 +139,8 @@ Item height: Math.round(parent.height / 2) spacing: Math.round(UM.Theme.getSize("thick_margin").height / 2) - anchors { + anchors + { right: controlContainer.left rightMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2) verticalCenter: parent.verticalCenter @@ -151,112 +160,123 @@ Item iconSource: UM.Theme.getIcon("link") - onEntered: { - hoverTimer.stop(); - var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders."); - if ((resolve != "None") && (stackLevel != 0)) { + onEntered: + { + hoverTimer.stop() + var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders.") + if ((resolve != "None") && (stackLevel != 0)) + { // We come here if a setting has a resolve and the setting is not manually edited. - tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "]."; + tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "]." } - base.showTooltip(tooltipText); + base.showTooltip(tooltipText) } - onExited: base.showTooltip(base.tooltipText); + onExited: base.showTooltip(base.tooltipText) } UM.SimpleButton { - id: revertButton; + id: revertButton visible: base.stackLevel == 0 && base.showRevertButton - height: parent.height; - width: height; + height: parent.height + width: height color: UM.Theme.getColor("setting_control_button") hoverColor: UM.Theme.getColor("setting_control_button_hover") iconSource: UM.Theme.getIcon("reset") - onClicked: { + onClicked: + { revertButton.focus = true - if (externalResetHandler) { + if (externalResetHandler) + { externalResetHandler(propertyProvider.key) - } else { + } + else + { Cura.MachineManager.clearUserSettingAllCurrentStacks(propertyProvider.key) } } - onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile.")) } - onExited: base.showTooltip(base.tooltipText); + onEntered: + { + hoverTimer.stop() + base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile.")) + } + onExited: base.showTooltip(base.tooltipText) } UM.SimpleButton { // This button shows when the setting has an inherited function, but is overriden by profile. - id: inheritButton; + id: inheritButton // Inherit button needs to be visible if; // - User made changes that override any loaded settings // - This setting item uses inherit button at all // - The type of the value of any deeper container is an "object" (eg; is a function) visible: { - if(!base.showInheritButton) + if (!base.showInheritButton) { - return false; + return false } - if(!propertyProvider.properties.enabled) + if (!propertyProvider.properties.enabled) { // Note: This is not strictly necessary since a disabled setting is hidden anyway. // But this will cause the binding to be re-evaluated when the enabled property changes. - return false; + return false } // There are no settings with any warning. - if(Cura.SettingInheritanceManager.settingsWithInheritanceWarning.length == 0) + if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.length == 0) { - return false; + return false } // This setting has a resolve value, so an inheritance warning doesn't do anything. - if(resolve != "None") + if (resolve != "None") { return false } // If the setting does not have a limit_to_extruder property (or is -1), use the active stack. - if(globalPropertyProvider.properties.limit_to_extruder == null || String(globalPropertyProvider.properties.limit_to_extruder) == "-1") + if (globalPropertyProvider.properties.limit_to_extruder == null || String(globalPropertyProvider.properties.limit_to_extruder) == "-1") { - return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0; + return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0 } // Setting does have a limit_to_extruder property, so use that one instead. if (definition.key === undefined) { // Observed when loading workspace, probably when SettingItems are removed. - return false; + return false } - return Cura.SettingInheritanceManager.getOverridesForExtruder(definition.key, String(globalPropertyProvider.properties.limit_to_extruder)).indexOf(definition.key) >= 0; + return Cura.SettingInheritanceManager.getOverridesForExtruder(definition.key, String(globalPropertyProvider.properties.limit_to_extruder)).indexOf(definition.key) >= 0 } - height: parent.height; - width: height; + height: parent.height + width: height - onClicked: { - focus = true; + onClicked: + { + focus = true // Get the most shallow function value (eg not a number) that we can find. var last_entry = propertyProvider.stackLevels[propertyProvider.stackLevels.length - 1] for (var i = 1; i < base.stackLevels.length; i++) { - var has_setting_function = typeof(propertyProvider.getPropertyValue("value", base.stackLevels[i])) == "object"; + var has_setting_function = typeof(propertyProvider.getPropertyValue("value", base.stackLevels[i])) == "object" if(has_setting_function) { last_entry = propertyProvider.stackLevels[i] - break; + break } } - if((last_entry == 4 || last_entry == 11) && base.stackLevel == 0 && base.stackLevels.length == 2) + if ((last_entry == 4 || last_entry == 11) && base.stackLevel == 0 && base.stackLevels.length == 2) { // Special case of the inherit reset. If only the definition (4th or 11th) container) and the first // entry (user container) are set, we can simply remove the container. @@ -277,23 +297,22 @@ Item color: UM.Theme.getColor("setting_control_button") hoverColor: UM.Theme.getColor("setting_control_button_hover") - iconSource: UM.Theme.getIcon("formula"); + iconSource: UM.Theme.getIcon("formula") onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value.")) } - onExited: base.showTooltip(base.tooltipText); + onExited: base.showTooltip(base.tooltipText) } } Item { - id: controlContainer; + id: controlContainer enabled: propertyProvider.isValueUsed - anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 - anchors.verticalCenter: parent.verticalCenter; - width: UM.Theme.getSize("setting_control").width; + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("setting_control").width height: UM.Theme.getSize("setting_control").height } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index dbe5e7196e..57532d91e5 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -416,7 +416,7 @@ "section_icon_column": [2.8, 0.0], "setting": [25.0, 1.8], - "setting_control": [10.0, 2.0], + "setting_control": [11.0, 2.0], "setting_control_radius": [0.15, 0.15], "setting_control_depth_margin": [1.4, 0.0], "setting_preferences_button_margin": [4, 0.0], From d3b5b2717d726ff99e22c372e1eaf2da48b2a73b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 15:56:21 +0100 Subject: [PATCH 408/558] Add rounded corners to the settings Contributes to CURA-5941 --- .../RecommendedSupportSelector.qml | 6 +-- resources/qml/Settings/SettingCheckBox.qml | 43 +++++++++++-------- resources/qml/Settings/SettingComboBox.qml | 1 + resources/qml/Settings/SettingExtruder.qml | 40 ++++++++--------- .../qml/Settings/SettingOptionalExtruder.qml | 29 ++++++------- resources/qml/Settings/SettingTextField.qml | 37 +++++++++------- 6 files changed, 81 insertions(+), 75 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index ce4aa6c195..da46f2a735 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -97,10 +97,10 @@ Item property string color_override: "" // for manually setting values property string color: // is evaluated automatically, but the first time is before extruderModel being filled { - var current_extruder = extruderModel.get(currentIndex); - color_override = ""; + var current_extruder = extruderModel.get(currentIndex) + color_override = "" if (current_extruder === undefined) return "" - return (current_extruder.color) ? current_extruder.color : ""; + return (current_extruder.color) ? current_extruder.color : "" } currentIndex: diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index d37754d27c..f53a696343 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -28,37 +28,40 @@ SettingItem // 3: material -> user changed material in materials page // 4: variant // 5: machine - var value; - if ((base.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) { + var value + if ((base.resolve != "None") && (stackLevel != 0) && (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; - } else { - value = propertyProvider.properties.value; + value = base.resolve + } + else + { + value = propertyProvider.properties.value } switch(value) { case "True": - return true; + return true case "False": - return false; + return false default: - return value; + return value } } Keys.onSpacePressed: { - forceActiveFocus(); - propertyProvider.setPropertyValue("value", !checked); + forceActiveFocus() + propertyProvider.setPropertyValue("value", !checked) } onClicked: { - forceActiveFocus(); - propertyProvider.setPropertyValue("value", !checked); + forceActiveFocus() + propertyProvider.setPropertyValue("value", !checked) } Keys.onTabPressed: @@ -72,9 +75,9 @@ SettingItem onActiveFocusChanged: { - if(activeFocus) + if (activeFocus) { - base.focusReceived(); + base.focusReceived() } } @@ -90,32 +93,34 @@ SettingItem color: { - if(!enabled) + if (!enabled) { return UM.Theme.getColor("setting_control_disabled") } - if(control.containsMouse || control.activeFocus) + if (control.containsMouse || 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) + if (!enabled) { return UM.Theme.getColor("setting_control_disabled_border") } - if(control.containsMouse || control.activeFocus) + if (control.containsMouse || control.activeFocus) { return UM.Theme.getColor("setting_control_border_highlight") } return UM.Theme.getColor("setting_control_border") } - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2.5) diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 76d458e427..13d2a0eb8f 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -35,6 +35,7 @@ SettingItem return UM.Theme.getColor("setting_control") } + radius: UM.Theme.getSize("setting_control_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: { diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index a9427f863a..e1fedd9274 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -19,8 +19,9 @@ SettingItem model: Cura.ExtrudersModel { - onModelChanged: { - control.color = getItem(control.currentIndex).color; + onModelChanged: + { + control.color = getItem(control.currentIndex).color } } @@ -113,14 +114,15 @@ SettingItem { if (!enabled) { - return UM.Theme.getColor("setting_control_disabled"); + return UM.Theme.getColor("setting_control_disabled") } if (control.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_control_highlight"); + return UM.Theme.getColor("setting_control_highlight") } - return UM.Theme.getColor("setting_control"); + return UM.Theme.getColor("setting_control") } + radius: UM.Theme.getSize("setting_control_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: { @@ -153,20 +155,18 @@ SettingItem elide: Text.ElideLeft verticalAlignment: Text.AlignVCenter - background: Rectangle + background: UM.RecolorImage { id: swatch - height: Math.round(UM.Theme.getSize("setting_control").height / 2) + height: Math.round(parent.height / 2) width: height - anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - radius: Math.round(width / 2) + anchors.rightMargin: UM.Theme.getSize("thin_margin").width + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") color: control.color } } @@ -219,20 +219,18 @@ SettingItem verticalAlignment: Text.AlignVCenter rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width - background: Rectangle + background: UM.RecolorImage { id: swatch - height: Math.round(UM.Theme.getSize("setting_control").height / 2) + height: Math.round(parent.height / 2) width: height - anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - radius: Math.round(width / 2) + anchors.rightMargin: UM.Theme.getSize("thin_margin").width + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") color: control.model.getItem(index).color } } diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml index a3c1422b30..53044b0f82 100644 --- a/resources/qml/Settings/SettingOptionalExtruder.qml +++ b/resources/qml/Settings/SettingOptionalExtruder.qml @@ -116,6 +116,7 @@ SettingItem } return UM.Theme.getColor("setting_control"); } + radius: UM.Theme.getSize("setting_control_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: { @@ -148,20 +149,18 @@ SettingItem elide: Text.ElideRight verticalAlignment: Text.AlignVCenter - background: Rectangle + background: UM.RecolorImage { id: swatch - height: Math.round(UM.Theme.getSize("setting_control").height / 2) + height: Math.round(parent.height / 2) width: height - anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - radius: Math.round(width / 2) + anchors.rightMargin: UM.Theme.getSize("thin_margin").width + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") color: control.color } } @@ -215,20 +214,18 @@ SettingItem verticalAlignment: Text.AlignVCenter rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width - background: Rectangle + background: UM.RecolorImage { id: swatch - height: Math.round(UM.Theme.getSize("setting_control").height / 2) + height: Math.round(parent.height / 2) width: height - anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - radius: Math.round(width / 2) + anchors.rightMargin: UM.Theme.getSize("thin_margin").width + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") color: control.model.getItem(index).color } } diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml index 9ec9338316..770ef53900 100644 --- a/resources/qml/Settings/SettingTextField.qml +++ b/resources/qml/Settings/SettingTextField.qml @@ -32,6 +32,7 @@ SettingItem anchors.fill: parent + radius: UM.Theme.getSize("setting_control_radius").width border.width: Math.round(UM.Theme.getSize("default_lining").width) border.color: { @@ -81,10 +82,10 @@ SettingItem Rectangle { - anchors.fill: parent; - anchors.margins: Math.round(UM.Theme.getSize("default_lining").width); + anchors.fill: parent + anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) color: UM.Theme.getColor("setting_control_highlight") - opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35; + opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35 } Label @@ -145,11 +146,11 @@ SettingItem } color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default"); + font: UM.Theme.getFont("default") - selectByMouse: true; + selectByMouse: true - maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10; + maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10 clip: true; //Hide any text that exceeds the width of the text box. validator: RegExpValidator { regExp: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : (definition.type == "float") ? /^-?[0-9]{0,9}[.,]?[0-9]{0,3}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry @@ -158,7 +159,8 @@ SettingItem { target: input property: "text" - value: { + value: + { // Stacklevels // 0: user -> unsaved change // 1: quality changes -> saved change @@ -167,13 +169,15 @@ SettingItem // 4: variant // 5: machine_changes // 6: machine - if ((base.resolve != "None" && base.resolve) && (stackLevel != 0) && (stackLevel != 1)) { + if ((base.resolve != "None" && base.resolve) && (stackLevel != 0) && (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). - return base.resolve; - } else { - return propertyProvider.properties.value; + return base.resolve + } + else { + return propertyProvider.properties.value } } when: !input.activeFocus @@ -182,16 +186,17 @@ SettingItem MouseArea { id: mouseArea - anchors.fill: parent; + anchors.fill: parent cursorShape: Qt.IBeamCursor onPressed: { - if(!input.activeFocus) { - base.focusGainedByClick = true; - input.forceActiveFocus(); + if (!input.activeFocus) + { + base.focusGainedByClick = true + input.forceActiveFocus() } - mouse.accepted = false; + mouse.accepted = false } } } From 15415dc3b98e70a2dd299c4d2cdef1a2065c1185 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 16:53:52 +0100 Subject: [PATCH 409/558] Fix position of the tooltips for the settings Contributes to CURA-5941 --- resources/qml/Settings/SettingView.qml | 2 +- resources/themes/cura-light/theme.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index ff94c9168f..867d662edc 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -360,7 +360,7 @@ Item contextMenu.provider = provider contextMenu.popup(); } - onShowTooltip: base.showTooltip(delegate, Qt.point(- UM.Theme.getSize("default_arrow").width, 0), text) + onShowTooltip: base.showTooltip(delegate, Qt.point(- settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) onHideTooltip: base.hideTooltip() onShowAllHiddenInheritedSettings: { diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 57532d91e5..3d0169dac9 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -35,7 +35,7 @@ "family": "Noto Sans" }, "default_italic": { - "size": 1.15, + "size": 1.0, "weight": 50, "italic": true, "family": "Noto Sans" From 004405e5f97337c5acfafda2da0c75bc4a9e7004 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 3 Dec 2018 17:25:07 +0100 Subject: [PATCH 410/558] Change the colors to match the designs. Contributes to CURA-5941. --- .../PrintSetupSelectorContents.qml | 6 +-- resources/qml/Settings/SettingCategory.qml | 26 ----------- resources/themes/cura-light/styles.qml | 2 +- resources/themes/cura-light/theme.json | 46 +++++++++---------- 4 files changed, 27 insertions(+), 53 deletions(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 77d1b59f4c..358cba8ad0 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -25,7 +25,7 @@ Item { id: header height: UM.Theme.getSize("print_setup_widget_header").height - color: UM.Theme.getColor("action_button_hovered") // TODO: It's not clear the color that we need to use here + color: UM.Theme.getColor("secondary") anchors { @@ -46,9 +46,9 @@ Item anchors { - topMargin: UM.Theme.getSize("sidebar_margin").height + topMargin: UM.Theme.getSize("default_margin").height left: parent.left - leftMargin: UM.Theme.getSize("narrow_margin").height + leftMargin: UM.Theme.getSize("default_margin").height } } diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 9b78683e14..be93f8ffab 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -45,32 +45,6 @@ Button return UM.Theme.getColor("setting_category") } Behavior on color { ColorAnimation { duration: 50; } } - Rectangle - { - id: backgroundLiningRectangle - height: UM.Theme.getSize("default_lining").height - width: parent.width - anchors.bottom: parent.bottom - color: - { - if (!base.enabled) - { - return UM.Theme.getColor("setting_category_disabled_border") - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) - { - return UM.Theme.getColor("setting_category_active_hover_border") - } else if (base.pressed || (base.checkable && base.checked)) - { - return UM.Theme.getColor("setting_category_active_border") - } else if (base.hovered || base.activeFocus) - { - return UM.Theme.getColor("setting_category_hover_border") - } else - { - return UM.Theme.getColor("setting_category_border") - } - } - } } signal showTooltip(string text) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index eed5393a0b..66c000af62 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -393,7 +393,7 @@ QtObject implicitWidth: Theme.getSize("scrollbar").width radius: Math.round(implicitWidth / 2) - color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle"); + color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle") Behavior on color { ColorAnimation { duration: 50; } } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 3d0169dac9..8e440757aa 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -86,7 +86,7 @@ "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], - "secondary": [240, 240, 240, 255], + "secondary": [245, 245, 245, 255], "secondary_shadow": [216, 216, 216, 255], "primary_button": [38, 113, 231, 255], @@ -183,25 +183,25 @@ "action_button_disabled_shadow": [228, 228, 228, 255], "scrollbar_background": [255, 255, 255, 255], - "scrollbar_handle": [31, 36, 39, 255], - "scrollbar_handle_hover": [12, 159, 227, 255], - "scrollbar_handle_down": [12, 159, 227, 255], + "scrollbar_handle": [10, 8, 80, 255], + "scrollbar_handle_hover": [50, 130, 255, 255], + "scrollbar_handle_down": [50, 130, 255, 255], "setting_category": [245, 245, 245, 255], "setting_category_disabled": [255, 255, 255, 255], - "setting_category_hover": [245, 245, 245, 255], + "setting_category_hover": [232, 242, 252, 255], "setting_category_active": [245, 245, 245, 255], - "setting_category_active_hover": [245, 245, 245, 255], - "setting_category_text": [31, 36, 39, 255], + "setting_category_active_hover": [232, 242, 252, 255], + "setting_category_text": [35, 35, 35, 255], "setting_category_disabled_text": [24, 41, 77, 101], - "setting_category_hover_text": [31, 36, 39, 255], - "setting_category_active_text": [31, 36, 39, 255], - "setting_category_active_hover_text": [31, 36, 39, 255], + "setting_category_hover_text": [35, 35, 35, 255], + "setting_category_active_text": [35, 35, 35, 255], + "setting_category_active_hover_text": [35, 35, 35, 255], "setting_category_border": [245, 245, 245, 255], "setting_category_disabled_border": [245, 245, 245, 255], - "setting_category_hover_border": [12, 159, 227, 255], - "setting_category_active_border": [245, 245, 245, 255], - "setting_category_active_hover_border": [12, 159, 227, 255], + "setting_category_hover_border": [50, 130, 255, 255], + "setting_category_active_border": [50, 130, 255, 255], + "setting_category_active_hover_border": [50, 130, 255, 255], "setting_control": [255, 255, 255, 255], "setting_control_selected": [31, 36, 39, 255], @@ -298,16 +298,16 @@ "xray_error": [255, 0, 0, 255], "layerview_ghost": [32, 32, 32, 96], - "layerview_none": [255, 255, 255, 255], - "layerview_inset_0": [255, 0, 0, 255], - "layerview_inset_x": [0, 255, 0, 255], - "layerview_skin": [255, 255, 0, 255], - "layerview_support": [0, 255, 255, 255], - "layerview_skirt": [0, 255, 255, 255], - "layerview_infill": [255, 192, 0, 255], - "layerview_support_infill": [0, 255, 255, 255], - "layerview_move_combing": [0, 0, 255, 255], - "layerview_move_retraction": [128, 128, 255, 255], + "layerview_none": [255, 255, 255, 255], + "layerview_inset_0": [255, 0, 0, 255], + "layerview_inset_x": [0, 255, 0, 255], + "layerview_skin": [255, 255, 0, 255], + "layerview_support": [0, 255, 255, 255], + "layerview_skirt": [0, 255, 255, 255], + "layerview_infill": [255, 192, 0, 255], + "layerview_support_infill": [0, 255, 255, 255], + "layerview_move_combing": [0, 0, 255, 255], + "layerview_move_retraction": [128, 128, 255, 255], "layerview_support_interface": [64, 192, 255, 255], "layerview_nozzle": [181, 166, 66, 50], From 9b8b91b6a41eef06b504f47474d213f54335a308 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 3 Dec 2018 17:34:08 +0100 Subject: [PATCH 411/558] More specific variable type for is_connected Contributes to issue CURA-5876. Co-Authored-By: Ghostkeeper --- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index fc8b31f125..79b7c9bf66 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -102,7 +102,7 @@ Cura.ExpandableComponent height: implicitHeight //Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up. spacing: UM.Theme.getSize("default_margin").height - property var is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible. + property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible. onVisibleChanged: { is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate. From 6af1e72ea330c009feb3a3834233481a442db2c7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 07:45:34 +0100 Subject: [PATCH 412/558] Show progress bar while autoslice is preparing Previously it would say 'preparing to slice'. Now it just says 'auto slicing' but with an indeterminate progress bar. Only the indeterminate progress bar just appears empty right now... Contributes to issue CURA-5997. --- resources/qml/ActionPanel/SliceProcessWidget.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 3329ac4b23..14e149dddb 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,7 +44,7 @@ Column { id: autoSlicingLabel width: parent.width - visible: prepareButtons.autoSlice && widget.backendState == UM.Backend.Processing + visible: prepareButtons.autoSlice && (widget.backendState == UM.Backend.Processing || widget.backendState == UM.Backend.NotStarted) text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...") color: UM.Theme.getColor("text") @@ -71,7 +71,8 @@ Column width: parent.width height: UM.Theme.getSize("progressbar").height value: progress - visible: widget.backendState == UM.Backend.Processing + indeterminate: widget.backendState == UM.Backend.NotStarted + visible: (widget.backendState == UM.Backend.Processing || (prepareButtons.autoSlice && widget.backendState == UM.Backend.NotStarted)) background: Rectangle { From 98ec6c66f2d486890b2d31c68bb8bd09e3bd911e Mon Sep 17 00:00:00 2001 From: THeijmans Date: Tue, 4 Dec 2018 08:25:05 +0100 Subject: [PATCH 413/558] CC06 profile fix removed line adding 10degrees to many profiles --- resources/variants/ultimaker_s5_cc06.inst.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/variants/ultimaker_s5_cc06.inst.cfg b/resources/variants/ultimaker_s5_cc06.inst.cfg index d41d08118a..7adf7ab7a0 100644 --- a/resources/variants/ultimaker_s5_cc06.inst.cfg +++ b/resources/variants/ultimaker_s5_cc06.inst.cfg @@ -13,7 +13,6 @@ brim_width = 7 machine_nozzle_cool_down_speed = 0.9 machine_nozzle_id = CC 0.6 machine_nozzle_size = 0.6 -material_print_temperature = =default_material_print_temperature + 10 raft_acceleration = =acceleration_print raft_airgap = 0.3 raft_base_thickness = =resolveOrValue('layer_height_0') * 1.2 From e9f8757fac1b5740f7daab3dea3288940f092400 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:12:57 +0100 Subject: [PATCH 414/558] Change the info button in the action panel according to the designs Adjust the padding in the preview shortcut. --- .../qml/ActionPanel/OutputProcessWidget.qml | 2 + .../ActionPanel/PrintInformationWidget.qml | 3 -- resources/themes/cura-light/icons/info.svg | 48 ------------------- 3 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 resources/themes/cura-light/icons/info.svg diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 45cb1fdb41..6ab8dc6fbb 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -112,6 +112,8 @@ Column id: previewStageShortcut height: UM.Theme.getSize("action_panel_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Preview") onClicked: UM.Controller.setActiveStage("PreviewStage") diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml index 82707576e0..25e380dea8 100644 --- a/resources/qml/ActionPanel/PrintInformationWidget.qml +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -11,9 +11,6 @@ UM.RecolorImage { id: widget - //implicitHeight: UM.Theme.getSize("section_icon").height - //implicitWidth: UM.Theme.getSize("section_icon").width - source: UM.Theme.getIcon("info") width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height diff --git a/resources/themes/cura-light/icons/info.svg b/resources/themes/cura-light/icons/info.svg deleted file mode 100644 index 97e4fc4f35..0000000000 --- a/resources/themes/cura-light/icons/info.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From c1f5c00a7e088fee409d7c7282607faf3976707f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:18:45 +0100 Subject: [PATCH 415/558] Forgot to add the icon --- resources/themes/cura-light/icons/info.svg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 resources/themes/cura-light/icons/info.svg diff --git a/resources/themes/cura-light/icons/info.svg b/resources/themes/cura-light/icons/info.svg new file mode 100644 index 0000000000..9896b3dac8 --- /dev/null +++ b/resources/themes/cura-light/icons/info.svg @@ -0,0 +1,13 @@ + + + + Icon/ info + Created with Sketch. + + + + + + + + \ No newline at end of file From 57a852a15ae0ff9e292e3eff574c067399a29777 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 09:19:08 +0100 Subject: [PATCH 416/558] Don't show the background if there are less than 2 extruders to show in the Toolbar It caused a very tiny rectangle if the printer has only 1 extruder. Contributes to CURA-5984. --- resources/qml/Toolbar.qml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 07522dd535..5fbddea9ac 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -115,6 +115,7 @@ Item } radius: UM.Theme.getSize("default_radius").width color: UM.Theme.getColor("lining") + visible: extrudersModel.items.length > 1 } Column @@ -131,8 +132,7 @@ Item id: extruders width: childrenRect.width height: childrenRect.height - property var _model: Cura.ExtrudersModel { id: extrudersModel } - model: _model.items.length > 1 ? _model : 0 + model: extrudersModel.items.length > 1 ? extrudersModel : 0 delegate: ExtruderButton { @@ -144,13 +144,18 @@ Item } } + Cura.ExtrudersModel + { + id: extrudersModel + } + UM.PointingRectangle { - id: panelBorder; + id: panelBorder - anchors.left: parent.right; - anchors.leftMargin: UM.Theme.getSize("default_margin").width; - anchors.top: base.top; + anchors.left: parent.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: base.top anchors.topMargin: base.activeY z: buttons.z - 1 @@ -161,14 +166,14 @@ Item { if (panel.item && panel.width > 0) { - return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width); + return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width) } else { return 0; } } - height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0; + height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0 opacity: panel.item && panel.width > 0 ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } @@ -186,11 +191,11 @@ Item { id: panel - x: UM.Theme.getSize("default_margin").width; - y: UM.Theme.getSize("default_margin").height; + x: UM.Theme.getSize("default_margin").width + y: UM.Theme.getSize("default_margin").height source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "" - enabled: UM.Controller.toolsEnabled; + enabled: UM.Controller.toolsEnabled } } From 692686597cf9204748a25c38fc11392712e74ae4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 12:07:31 +0100 Subject: [PATCH 417/558] Fix an issues that didn't calculate the correct height of the popup when the custom mode was selected from previous runs. Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 42 ++++++++-------- .../PrintSetupSelectorContents.qml | 49 ++++++++++--------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 82747d1c5b..df7604015e 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -25,10 +25,7 @@ Item property alias headerItem: headerItemLoader.sourceComponent // The popupItem holds the QML item that is shown when the "open" button is pressed - property var popupItem - - // The popupItem holds the QML item that is shown when the "open" button is pressed - property var componentItem + property alias popupItem: popup.contentItem property color popupBackgroundColor: UM.Theme.getColor("action_button") @@ -87,23 +84,6 @@ Item } } - onPopupItemChanged: - { - // Since we want the size of the popup to be set by the size of the content, - // we need to do it like this. - popup.width = popupItem.width + 2 * popup.padding - popup.height = popupItem.height + 2 * popup.padding - popup.contentItem = popupItem - } - - Connections - { - // Since it could be that the popup is dynamically populated, we should also take these changes into account. - target: popupItem - onWidthChanged: popup.width = popupItem.width + 2 * popup.padding - onHeightChanged: popup.height = popupItem.height + 2 * popup.padding - } - implicitHeight: 100 * screenScaleFactor implicitWidth: 400 * screenScaleFactor @@ -202,5 +182,25 @@ Item border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width } + + contentItem: Item { } + + onContentItemChanged: + { + // Since we want the size of the popup to be set by the size of the content, + // we need to do it like this. + popup.width = contentItem.width + 2 * popup.padding + popup.height = contentItem.height + 2 * popup.padding + } + } + + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the Popup item. + // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. + Connections + { + // Since it could be that the popup is dynamically populated, we should also take these changes into account. + target: popup.contentItem + onWidthChanged: popup.width = popup.contentItem.width + 2 * popup.padding + onHeightChanged: popup.height = popup.contentItem.height + 2 * popup.padding } } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 358cba8ad0..a2856e1fe5 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -17,9 +17,26 @@ Item width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height - property int currentModeIndex: -1 + enum Mode + { + Recommended = 0, + Custom = 1 + } + + // Set the current mode index to the value that is stored in the preferences or Recommended mode otherwise. + property int currentModeIndex: + { + var index = Math.round(UM.Preferences.getValue("cura/active_mode")) + + if(index != null && !isNaN(index)) + { + return index + } + return PrintSetupSelectorContents.Mode.Recommended + } onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + // Header of the popup Rectangle { @@ -93,7 +110,9 @@ Item Item { id: contents - height: currentModeIndex == 0 ? recommendedPrintSetup.height : customPrintSetup.height + // Use the visible property instead of checking the currentModeIndex. That creates a binding that + // evaluates the new height every time the visible property changes. + height: recommendedPrintSetup.visible ? recommendedPrintSetup.height : customPrintSetup.height anchors { @@ -111,7 +130,7 @@ Item right: parent.right top: parent.top } - visible: currentModeIndex == 0 + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended } CustomPrintSetup @@ -123,7 +142,7 @@ Item right: parent.right top: parent.top } - visible: currentModeIndex == 1 + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom } } @@ -160,8 +179,8 @@ Item rightPadding: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Recommended") iconSource: UM.Theme.getIcon("arrow_left") - visible: currentModeIndex == 1 - onClicked: currentModeIndex = 0 + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom + onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Recommended } Cura.SecondaryButton @@ -174,22 +193,8 @@ Item text: catalog.i18nc("@button", "Custom") iconSource: UM.Theme.getIcon("arrow_right") iconOnRightSide: true - visible: currentModeIndex == 0 - onClicked: currentModeIndex = 1 - } - } - - Component.onCompleted: - { - var index = Math.round(UM.Preferences.getValue("cura/active_mode")) - - if(index != null && !isNaN(index)) - { - currentModeIndex = index - } - else - { - currentModeIndex = 0 + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended + onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Custom } } } \ No newline at end of file From e159cbdb1a8124ceac8c897d39a96556ba35da5a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 13:14:12 +0100 Subject: [PATCH 418/558] Rename all the references from 'popup' to 'content' Contributes to CURA-5941. --- .../SimulationViewMenuComponent.qml | 2 +- resources/qml/ExpandableComponent.qml | 82 ++++++++++--------- .../QuickConfigurationSelector.qml | 2 +- .../PrintSetupSelector/PrintSetupSelector.qml | 8 +- .../qml/PrinterSelector/MachineSelector.qml | 6 +- resources/qml/ViewsSelector.qml | 6 +- 6 files changed, 57 insertions(+), 49 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 53b64afb47..a9eb157f48 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -45,7 +45,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter } - popupItem: Column + contentItem: Column { id: viewSettings diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index df7604015e..0b4076c04a 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -6,40 +6,48 @@ import Cura 1.0 as Cura import QtGraphicalEffects 1.0 // For the dropshadow -// The expandable component has 3 major sub components: +// The expandable component has 2 major sub components: // * The headerItem; Always visible and should hold some info about what happens if the component is expanded -// * The popupItem; The content that needs to be shown if the component is expanded. -// * The icon; An icon that is displayed on the right of the drawer. +// * The contentItem; The content that needs to be shown if the component is expanded. Item { id: base - // Enumeration with the different possible alignments of the popup with respect of the headerItem - enum PopupAlignment + // Enumeration with the different possible alignments of the content with respect of the headerItem + enum ContentAlignment { AlignLeft, AlignRight } + enum ContentType + { + Floating, + Fixed + } + // The headerItem holds the QML item that is always displayed. property alias headerItem: headerItemLoader.sourceComponent - // The popupItem holds the QML item that is shown when the "open" button is pressed - property alias popupItem: popup.contentItem + // The contentItem holds the QML item that is shown when the "open" button is pressed + property alias contentItem: content.contentItem - property color popupBackgroundColor: UM.Theme.getColor("action_button") + // Defines the type of the contents + property int contentType: ExpandableComponent.ContentType.Floating + + property color contentBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") - // Defines the alignment of the popup with respect of the headerItem, by default to the right - property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight + // Defines the alignment of the content with respect of the headerItem, by default to the right + property int contentAlignment: ExpandableComponent.ContentAlignment.AlignRight - // How much spacing is needed around the popupItem - property alias popupPadding: popup.padding + // How much spacing is needed around the contentItem + property alias contentPadding: content.padding - // How much spacing is needed for the popupItem by Y coordinate - property var popupSpacingY: 0 + // How much spacing is needed for the contentItem by Y coordinate + property var contentSpacingY: 0 // How much padding is needed around the header & button property alias headerPadding: background.padding @@ -53,7 +61,7 @@ Item property alias iconSize: collapseButton.height // Is the "drawer" open? - readonly property alias expanded: popup.visible + readonly property alias expanded: content.visible property alias expandedHighlightColor: expandedHighlight.color @@ -63,8 +71,8 @@ Item // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. property alias headerCornerSide: background.cornerSide - // Change the popupItem close behaviour - property alias popupClosePolicy : popup.closePolicy + // Change the contentItem close behaviour + property alias contentClosePolicy : content.closePolicy property alias headerShadowColor: shadow.color @@ -72,15 +80,15 @@ Item property int shadowOffset: 2 - function togglePopup() + function toggleContent() { - if (popup.visible) + if (content.visible) { - popup.close() + content.close() } else { - popup.open() + content.open() } } @@ -108,7 +116,7 @@ Item } } - // A highlight that is shown when the popup is expanded + // A highlight that is shown when the content is expanded Rectangle { id: expandedHighlight @@ -140,7 +148,7 @@ Item { id: mouseArea anchors.fill: parent - onClicked: togglePopup() + onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor onExited: background.color = headerBackgroundColor @@ -163,21 +171,21 @@ Item Popup { - id: popup + id: content - // Ensure that the popup is located directly below the headerItem - y: background.height + base.shadowOffset + popupSpacingY + // Ensure that the content is located directly below the headerItem + y: background.height + base.shadowOffset + base.contentSpacingY - // Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left. + // Make the content aligned with the rest, using the property contentAlignment to decide whether is right or left. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. - x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 + x: contentAlignment == ExpandableComponent.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent background: Cura.RoundedRectangle { cornerSide: Cura.RoundedRectangle.Direction.Down - color: popupBackgroundColor + color: contentBackgroundColor border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width @@ -187,20 +195,20 @@ Item onContentItemChanged: { - // Since we want the size of the popup to be set by the size of the content, + // Since we want the size of the content to be set by the size of the content, // we need to do it like this. - popup.width = contentItem.width + 2 * popup.padding - popup.height = contentItem.height + 2 * popup.padding + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding } } - // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the Popup item. + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections { - // Since it could be that the popup is dynamically populated, we should also take these changes into account. - target: popup.contentItem - onWidthChanged: popup.width = popup.contentItem.width + 2 * popup.padding - onHeightChanged: popup.height = popup.contentItem.height + 2 * popup.padding + // Since it could be that the content is dynamically populated, we should also take these changes into account. + target: content.contentItem + onWidthChanged: content.width = content.contentItem.width + 2 * content.padding + onHeightChanged: content.height = content.contentItem.height + 2 * content.padding } } diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index eb6800cb36..de92161bbb 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -93,7 +93,7 @@ Cura.ExpandableComponent } } - popupItem: Item + contentItem: Item { width: base.width - 2 * UM.Theme.getSize("default_margin").width height: 200 diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index f1b424f7f2..78bdbde542 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -15,10 +15,10 @@ Cura.ExpandableComponent property string disabledText: catalog.i18nc("@label:Should be short", "Off") iconSource: UM.Theme.getIcon("pencil") - popupPadding: UM.Theme.getSize("default_lining").width - popupSpacingY: UM.Theme.getSize("narrow_margin").width + contentPadding: UM.Theme.getSize("default_lining").width + contentSpacingY: UM.Theme.getSize("narrow_margin").width - popupClosePolicy: Popup.CloseOnEscape + contentClosePolicy: Popup.CloseOnEscape UM.I18nCatalog { @@ -36,5 +36,5 @@ Cura.ExpandableComponent id: extrudersModel } - popupItem: PrintSetupSelectorContents {} + contentItem: PrintSetupSelectorContents {} } \ No newline at end of file diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 15cd773c90..f742d0bef3 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -15,8 +15,8 @@ Cura.ExpandableComponent property bool isPrinterConnected: Cura.MachineManager.printerConnected property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - popupPadding: UM.Theme.getSize("default_lining").width - popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft + contentPadding: UM.Theme.getSize("default_lining").width + contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog @@ -80,7 +80,7 @@ Cura.ExpandableComponent } } - popupItem: Item + contentItem: Item { id: popup width: UM.Theme.getSize("machine_selector_widget_content").width diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index e9fdd57177..97de60689b 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -11,8 +11,8 @@ Cura.ExpandableComponent { id: viewSelector - popupPadding: UM.Theme.getSize("default_lining").width - popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft + contentPadding: UM.Theme.getSize("default_lining").width + contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") property var viewModel: UM.ViewModel { } @@ -70,7 +70,7 @@ Cura.ExpandableComponent } } - popupItem: Column + contentItem: Column { id: viewSelectorPopup width: viewSelector.width - 2 * viewSelector.popupPadding From 4dcce7616bb8286c265a392ed21d62fabd10e6a7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 13:21:26 +0100 Subject: [PATCH 419/558] Fix some leftover renamings Contributes to CURA-5941 --- resources/qml/Account/AccountDetails.qml | 4 ++-- resources/qml/ExpandableComponent.qml | 4 ++-- .../qml/PrintSetupSelector/PrintSetupSelectorContents.qml | 2 +- resources/qml/PrinterSelector/MachineSelector.qml | 4 ++-- resources/qml/PrinterSelector/MachineSelectorButton.qml | 2 +- resources/qml/ViewsSelector.qml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index a288426e0c..bfb23930c6 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -13,8 +13,8 @@ Column property var loggedIn: false property var profileImage: "" - padding: 2 * UM.Theme.getSize("default_margin").height - spacing: 2 * UM.Theme.getSize("default_margin").height + padding: UM.Theme.getSize("wide_margin").height + spacing: UM.Theme.getSize("wide_margin").height AvatarImage { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0b4076c04a..89f6cf9f25 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -139,8 +139,8 @@ Item sourceSize.width: width sourceSize.height: height visible: source != "" - width: height - height: Math.round(0.2 * base.height) + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height color: UM.Theme.getColor("text") } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index a2856e1fe5..0524a6de9e 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -93,7 +93,7 @@ Item background: Item {} - onClicked: togglePopup() // Will hide the popup item + onClicked: toggleContent() // Will hide the popup item } } diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index f742d0bef3..49b4f87267 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -134,7 +134,7 @@ Cura.ExpandableComponent text: catalog.i18nc("@button", "Add printer") onClicked: { - togglePopup() + toggleContent() Cura.Actions.addMachine.trigger() } } @@ -146,7 +146,7 @@ Cura.ExpandableComponent text: catalog.i18nc("@button", "Manage printers") onClicked: { - togglePopup() + toggleContent() Cura.Actions.configureMachines.trigger() } } diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 369e75cede..b88af35f82 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -83,7 +83,7 @@ Button onClicked: { - togglePopup() + toggleContent() Cura.MachineManager.setActiveMachine(model.id) } diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index 97de60689b..71a29e4949 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -120,7 +120,7 @@ Cura.ExpandableComponent onClicked: { - viewSelector.togglePopup() + toggleContent() UM.Controller.setActiveView(id) } } From 47ff95b1f3cfb793b2b4af6114aa1688e864d8a3 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 4 Dec 2018 13:53:11 +0100 Subject: [PATCH 420/558] Set contentType to the different expandable components. Also add a color for the active state when the contentType is 'Fixed'. Contributes to CURA-5941. --- .../SimulationViewMenuComponent.qml | 2 +- resources/qml/ExpandableComponent.qml | 28 +++++++++++-------- .../QuickConfigurationSelector.qml | 1 - .../PrintSetupSelector/PrintSetupSelector.qml | 2 +- .../qml/PrinterSelector/MachineSelector.qml | 1 - resources/qml/ViewsSelector.qml | 1 - 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index a9eb157f48..9dc3b67658 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -16,7 +16,7 @@ Cura.ExpandableComponent id: base width: UM.Theme.getSize("layerview_menu_size").width - iconSource: UM.Theme.getIcon("pencil") + contentType: Cura.ExpandableComponent.ContentType.Fixed Connections { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 89f6cf9f25..f6e340c4ea 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -30,7 +30,7 @@ Item property alias headerItem: headerItemLoader.sourceComponent // The contentItem holds the QML item that is shown when the "open" button is pressed - property alias contentItem: content.contentItem + property var contentItem: content.contentItem // Defines the type of the contents property int contentType: ExpandableComponent.ContentType.Floating @@ -38,6 +38,7 @@ Item property color contentBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") + property color headerActiveColor: UM.Theme.getColor("secondary") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") // Defines the alignment of the content with respect of the headerItem, by default to the right @@ -123,7 +124,7 @@ Item width: parent.width height: UM.Theme.getSize("thick_lining").height color: UM.Theme.getColor("primary") - visible: expanded + visible: contentType == ExpandableComponent.ContentType.Floating && expanded anchors.bottom: parent.bottom } @@ -138,6 +139,9 @@ Item } sourceSize.width: width sourceSize.height: height + source: contentType == ExpandableComponent.ContentType.Floating ? + (expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")) : + UM.Theme.getIcon("pencil") visible: source != "" width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height @@ -151,7 +155,8 @@ Item onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor - onExited: background.color = headerBackgroundColor + onExited: background.color = (contentType == ExpandableComponent.ContentType.Fixed && expanded) ? + headerActiveColor : headerBackgroundColor } } @@ -190,16 +195,15 @@ Item border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width } + } - contentItem: Item { } - - onContentItemChanged: - { - // Since we want the size of the content to be set by the size of the content, - // we need to do it like this. - content.width = contentItem.width + 2 * content.padding - content.height = contentItem.height + 2 * content.padding - } + onContentItemChanged: + { + // Since we want the size of the content to be set by the size of the content, + // we need to do it like this. + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding + content.contentItem = contentItem } // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index de92161bbb..ea82f4fe13 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -27,7 +27,6 @@ Cura.ExpandableComponent name: "cura" } - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") headerItem: Item { // Horizontal list that shows the extruders diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 78bdbde542..0eea697950 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -14,7 +14,7 @@ Cura.ExpandableComponent property string enabledText: catalog.i18nc("@label:Should be short", "On") property string disabledText: catalog.i18nc("@label:Should be short", "Off") - iconSource: UM.Theme.getIcon("pencil") + contentType: Cura.ExpandableComponent.ContentType.Fixed contentPadding: UM.Theme.getSize("default_lining").width contentSpacingY: UM.Theme.getSize("narrow_margin").width diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 49b4f87267..69a1ac899c 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -17,7 +17,6 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog { diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index 71a29e4949..d469202606 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -13,7 +13,6 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") property var viewModel: UM.ViewModel { } From 82d8410d184d0727612158bf50e45a8b13ae31a9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 13:58:54 +0100 Subject: [PATCH 421/558] Don't emit enabledChanged signal if it didn't change Contributes to issue CURA-5876. --- cura/Settings/ExtruderStack.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Settings/ExtruderStack.py b/cura/Settings/ExtruderStack.py index ed758db183..d626ef06da 100644 --- a/cura/Settings/ExtruderStack.py +++ b/cura/Settings/ExtruderStack.py @@ -52,6 +52,8 @@ class ExtruderStack(CuraContainerStack): return super().getNextStack() def setEnabled(self, enabled: bool) -> None: + if self.getMetaDataEntry("enabled", True) == enabled: #No change. + return #Don't emit a signal then. self.setMetaDataEntry("enabled", str(enabled)) self.enabledChanged.emit() From a1f579a5288a43dd48480f565ed8c2dd514f9b47 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:01:49 +0100 Subject: [PATCH 422/558] Improve wording of iconOnRightSide documentation Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index cd0a264766..116253ab7a 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -43,7 +43,7 @@ Button contentItem: Row { - //Icon if displayed on the left side. + //Left side icon. Only displayed if !iconOnRightSide. UM.RecolorImage { id: buttonIconLeft @@ -71,7 +71,7 @@ Button elide: Text.ElideRight } - //Icon if displayed on the right side. + //Right side icon. Only displayed if iconOnRightSide. UM.RecolorImage { id: buttonIconRight From 801701623eedd41681c4caf31251b2cd4bf33f84 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:04:07 +0100 Subject: [PATCH 423/558] Remove unnecessary top anchor in first subitem of item It already gets aligned to the top anyway. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index 8e86549e17..58b6bac089 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -22,7 +22,6 @@ Item anchors { - top: parent.top left: parent.left right: parent.right } From 759b5b58476c3d2be6c0faf5118fc052f1d6bec8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:23:41 +0100 Subject: [PATCH 424/558] Use anchors rather than a calculation with padding It's supposed to be slightly more efficient. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationItem.qml | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 3ea220c91e..7ba7202819 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -34,7 +34,13 @@ Button { id: extruderRow - width: parent.width - 2 * parent.padding + anchors + { + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + } height: childrenRect.height spacing: UM.Theme.getSize("default_margin").width @@ -58,7 +64,13 @@ Button id: separator visible: buildplateInformation.visible - width: parent.width - 2 * parent.padding + anchors + { + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + } height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 color: UM.Theme.getColor("text") } @@ -66,7 +78,14 @@ Button Item { id: buildplateInformation - width: parent.width - 2 * parent.padding + + anchors + { + left: parent.left + leftMargin: parent.padding + right: parent.right + rightMargin: parent.padding + } height: childrenRect.height visible: configuration.buildplateConfiguration != "" From 7cc1f021c1333fe962a2875167f6b1750bc238fb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:25:58 +0100 Subject: [PATCH 425/558] Fix right-alignment of configuration items in list The scrollbar will go on top of it now, but it looks nicer if you don't scroll. Maybe we have to make it adaptable? Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 32be97f74e..5a9f72260c 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -27,7 +27,7 @@ Column ScrollView { id: container - width: parent.width - parent.padding + width: parent.width height: Math.min(configurationList.contentHeight, 350 * screenScaleFactor) ButtonGroup @@ -58,7 +58,7 @@ Column delegate: ConfigurationItem { - width: parent.width - UM.Theme.getSize("default_margin").width + width: parent.width configuration: modelData } } From 347240410ad1885d3dc237dc7f0db1f9e249671b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:35:28 +0100 Subject: [PATCH 426/558] Use enumeration to check and switch state of configuration menu Instead of a string. This is a bit more restrictive. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationMenu.qml | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 79b7c9bf66..1b7dfe30e4 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -28,6 +28,12 @@ Cura.ExpandableComponent name: "cura" } + enum ConfigurationMethod + { + AUTO, + CUSTOM + } + iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") headerItem: Item { @@ -108,7 +114,7 @@ Cura.ExpandableComponent is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate. } - property var configuration_method: is_connected ? "auto" : "custom" //Auto if connected to a printer at start-up, or Custom if not. + property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.AUTO : ConfigurationMenu.ConfigurationMethod.CUSTOM //Auto if connected to a printer at start-up, or Custom if not. Item { @@ -117,13 +123,13 @@ Cura.ExpandableComponent AutoConfiguration { id: autoConfiguration - visible: popupItem.configuration_method === "auto" + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO } CustomConfiguration { id: customConfiguration - visible: popupItem.configuration_method === "custom" + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM } } @@ -150,7 +156,7 @@ Cura.ExpandableComponent Cura.SecondaryButton { id: goToCustom - visible: popupItem.configuration_method === "auto" + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO text: catalog.i18nc("@label", "Custom") anchors @@ -162,13 +168,13 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("arrow_right") iconOnRightSide: true - onClicked: popupItem.configuration_method = "custom" + onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.CUSTOM } Cura.SecondaryButton { id: goToAuto - visible: popupItem.configuration_method === "custom" + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM text: catalog.i18nc("@label", "Configurations") anchors @@ -179,7 +185,7 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("arrow_left") - onClicked: popupItem.configuration_method = "auto" + onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.AUTO } } } From 2dde2438b2a984e2dabf19edcb5164934e456050 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:38:13 +0100 Subject: [PATCH 427/558] Remove unnecessary anchors Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/ConfigurationMenu.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 1b7dfe30e4..a49fe5574f 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -159,11 +159,7 @@ Cura.ExpandableComponent visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO text: catalog.i18nc("@label", "Custom") - anchors - { - right: parent.right - top: parent.top - } + anchors.right: parent.right iconSource: UM.Theme.getIcon("arrow_right") iconOnRightSide: true @@ -177,12 +173,6 @@ Cura.ExpandableComponent visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM text: catalog.i18nc("@label", "Configurations") - anchors - { - left: parent.left - top: parent.top - } - iconSource: UM.Theme.getIcon("arrow_left") onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.AUTO From 023100f4c3690e564d26ddf4bd6ffece955d4c38 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Dec 2018 14:39:08 +0100 Subject: [PATCH 428/558] Changed valueError property to bool instead of var A bit more specific. Contributes to issue CURA-5876. Co-Authored-By: Ghostkeeper --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 7ff47ea16f..e28478e9e2 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -181,7 +181,7 @@ Item { id: materialSelection - property var valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true + property bool valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true property var valueWarning: !Cura.MachineManager.isActiveQualitySupported text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" @@ -232,4 +232,4 @@ Item } } } -} \ No newline at end of file +} From 8a257f018486a2d4cc22ae980ea4e8dd8e5ffc57 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Dec 2018 14:39:39 +0100 Subject: [PATCH 429/558] Change valueWarning property to bool instead of var A bit more specific. Contributes to issue CURA-5876. Co-Authored-By: Ghostkeeper --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index e28478e9e2..72b640e94a 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -182,7 +182,7 @@ Item id: materialSelection property bool valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true - property var valueWarning: !Cura.MachineManager.isActiveQualitySupported + property bool valueWarning: !Cura.MachineManager.isActiveQualitySupported text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" tooltip: text From ef29fb0cfaaf22ccd582ad238cbc3259894fb137 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:44:12 +0100 Subject: [PATCH 430/558] Remove unnecessary item wrapper Contributes to issue CURA-5876. --- .../ConfigurationMenu/PrintCoreConfiguration.qml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 8d2f0c0f7c..4064a961d5 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -16,16 +16,11 @@ Row spacing: UM.Theme.getSize("default_margin").width //Extruder icon. - Item + Cura.ExtruderIcon { - width: childrenRect.width - height: information.height - Cura.ExtruderIcon - { - materialColor: printCoreConfiguration.material.color - anchors.verticalCenter: parent.verticalCenter - extruderEnabled: printCoreConfiguration.material.name !== "" && printCoreConfiguration.hotendID !== "" - } + materialColor: printCoreConfiguration.material.color + anchors.verticalCenter: parent.verticalCenter + extruderEnabled: printCoreConfiguration.material.name !== "" && printCoreConfiguration.hotendID !== "" } Column From 2fdfdaa00b4cc7cea04e754a25ad58f056d3d684 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 14:47:34 +0100 Subject: [PATCH 431/558] Rename iconOnRightSide to isIconOnRightSide More accurately represents the type of value that's in this property. Contributes to issue CURA-5876. --- resources/qml/ActionButton.qml | 10 +++++----- .../qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 116253ab7a..2107264dff 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -12,7 +12,7 @@ Button { id: button property alias iconSource: buttonIconLeft.source - property var iconOnRightSide: false + property bool isIconOnRightSide: false property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text @@ -43,7 +43,7 @@ Button contentItem: Row { - //Left side icon. Only displayed if !iconOnRightSide. + //Left side icon. Only displayed if !isIconOnRightSide. UM.RecolorImage { id: buttonIconLeft @@ -53,7 +53,7 @@ Button sourceSize.width: width sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor - visible: source != "" && !button.iconOnRightSide + visible: source != "" && !button.isIconOnRightSide anchors.verticalCenter: parent.verticalCenter } @@ -71,7 +71,7 @@ Button elide: Text.ElideRight } - //Right side icon. Only displayed if iconOnRightSide. + //Right side icon. Only displayed if isIconOnRightSide. UM.RecolorImage { id: buttonIconRight @@ -81,7 +81,7 @@ Button sourceSize.width: width sourceSize.height: height color: buttonIconLeft.color - visible: source != "" && button.iconOnRightSide + visible: source != "" && button.isIconOnRightSide anchors.verticalCenter: buttonIconLeft.verticalCenter } } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index a49fe5574f..f81176ab1a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -162,7 +162,7 @@ Cura.ExpandableComponent anchors.right: parent.right iconSource: UM.Theme.getIcon("arrow_right") - iconOnRightSide: true + isIconOnRightSide: true onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.CUSTOM } From 5b4fad3c08fe089bf216f91ac2ce889c4cc16e83 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 4 Dec 2018 14:54:15 +0100 Subject: [PATCH 432/558] When toggling auto-slice, force a re-slice CURA-5997 --- resources/qml/ActionPanel/SliceProcessWidget.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 14e149dddb..03d91db530 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -137,6 +137,10 @@ Column { var autoSlice = UM.Preferences.getValue("general/auto_slice") prepareButtons.autoSlice = autoSlice + if(autoSlice) + { + CuraApplication.backend.forceSlice() + } } } From 4d87c464237c4c92c2aa5dfd0c4909a94f49bf92 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 15:04:51 +0100 Subject: [PATCH 433/558] Remove sourceSize.width: width from all RecolorImages It is now the default in Uranium. Contributes to issue CURA-5876. --- plugins/ModelChecker/ModelChecker.qml | 1 - .../PerObjectSettingsPanel.qml | 1 - .../PostProcessingPlugin/PostProcessingPlugin.qml | 4 ---- plugins/PrepareStage/PrepareMenu.qml | 1 - .../resources/qml/ToolboxDownloadsGridTile.qml | 1 - .../resources/qml/ToolboxDownloadsShowcaseTile.qml | 2 -- resources/qml/ActionButton.qml | 4 ---- .../qml/ActionPanel/PrintInformationWidget.qml | 3 --- resources/qml/Dialogs/AboutDialog.qml | 2 -- resources/qml/Dialogs/AddMachineDialog.qml | 3 +-- resources/qml/ExpandableComponent.qml | 2 -- resources/qml/ExtruderIcon.qml | 3 --- resources/qml/IconLabel.qml | 3 --- resources/qml/IconWithText.qml | 2 -- resources/qml/JobSpecs.qml | 1 - resources/qml/MainWindow/MainWindowHeader.qml | 3 --- .../Menus/ConfigurationMenu/ConfigurationItem.qml | 2 -- resources/qml/ObjectsList.qml | 3 +-- .../Preferences/Materials/MaterialsBrandSection.qml | 5 ++--- .../qml/Preferences/Materials/MaterialsSlot.qml | 2 -- .../Preferences/Materials/MaterialsTypeSection.qml | 2 -- resources/qml/PrinterSelector/MachineSelector.qml | 3 --- resources/qml/Settings/SettingCategory.qml | 13 ++++++++----- resources/qml/Settings/SettingCheckBox.qml | 4 ++-- resources/qml/Settings/SettingView.qml | 11 ++++++----- resources/qml/SidebarSimple.qml | 1 - resources/themes/cura-light/styles.qml | 5 ----- 27 files changed, 20 insertions(+), 67 deletions(-) diff --git a/plugins/ModelChecker/ModelChecker.qml b/plugins/ModelChecker/ModelChecker.qml index 5e41591d6b..437df29516 100644 --- a/plugins/ModelChecker/ModelChecker.qml +++ b/plugins/ModelChecker/ModelChecker.qml @@ -33,7 +33,6 @@ Button { width: UM.Theme.getSize("save_button_specs_icons").width; height: UM.Theme.getSize("save_button_specs_icons").height; - sourceSize.width: width; sourceSize.height: width; color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene"); source: "model_checker.svg" diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 5d4e17a102..0e2bd88619 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -265,7 +265,6 @@ Item { anchors.verticalCenter: parent.verticalCenter width: parent.width height: width - sourceSize.width: width sourceSize.height: width color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") source: UM.Theme.getIcon("minus") diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index bd4d361d35..3fa10c23b9 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -141,7 +141,6 @@ UM.Dialog anchors.horizontalCenter: parent.horizontalCenter width: Math.round(control.width / 2.7) height: Math.round(control.height / 2.7) - sourceSize.width: width sourceSize.height: width color: palette.text source: UM.Theme.getIcon("cross1") @@ -176,7 +175,6 @@ UM.Dialog anchors.horizontalCenter: parent.horizontalCenter width: Math.round(control.width / 2.5) height: Math.round(control.height / 2.5) - sourceSize.width: width sourceSize.height: width color: control.enabled ? palette.text : disabledPalette.text source: UM.Theme.getIcon("arrow_bottom") @@ -211,7 +209,6 @@ UM.Dialog anchors.horizontalCenter: parent.horizontalCenter width: Math.round(control.width / 2.5) height: Math.round(control.height / 2.5) - sourceSize.width: width sourceSize.height: width color: control.enabled ? palette.text : disabledPalette.text source: UM.Theme.getIcon("arrow_top") @@ -498,7 +495,6 @@ UM.Dialog anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2) height: Math.round(parent.height / 2) - sourceSize.width: width sourceSize.height: height color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : control.pressed ? UM.Theme.getColor("action_button_active_text") : diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index abfe3080c2..fa94bc88b2 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -107,7 +107,6 @@ Item height: UM.Theme.getSize("button_icon").height color: UM.Theme.getColor("toolbar_button_text") - sourceSize.width: width sourceSize.height: height } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index be44c0f374..61374f9d99 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -52,7 +52,6 @@ Item bottom: parent.bottom right: parent.right } - sourceSize.width: width sourceSize.height: height visible: installedPackages != 0 color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border") diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml index 4fb70541d2..8a2fdc8bc8 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml @@ -48,8 +48,6 @@ Rectangle right: parent.right bottomMargin: UM.Theme.getSize("default_lining").width } - sourceSize.width: width - sourceSize.height: height visible: installedPackages != 0 color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border") source: "../images/installed_check.svg" diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 2107264dff..54d77f7d59 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -50,8 +50,6 @@ Button source: "" height: buttonText.height width: visible ? height : 0 - sourceSize.width: width - sourceSize.height: height color: button.hovered ? button.textHoverColor : button.textColor visible: source != "" && !button.isIconOnRightSide anchors.verticalCenter: parent.verticalCenter @@ -78,8 +76,6 @@ Button source: buttonIconLeft.source height: buttonText.height width: visible ? height : 0 - sourceSize.width: width - sourceSize.height: height color: buttonIconLeft.color visible: source != "" && button.isIconOnRightSide anchors.verticalCenter: buttonIconLeft.verticalCenter diff --git a/resources/qml/ActionPanel/PrintInformationWidget.qml b/resources/qml/ActionPanel/PrintInformationWidget.qml index 82707576e0..436649c4e1 100644 --- a/resources/qml/ActionPanel/PrintInformationWidget.qml +++ b/resources/qml/ActionPanel/PrintInformationWidget.qml @@ -18,9 +18,6 @@ UM.RecolorImage width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - sourceSize.width: width - sourceSize.height: height - color: popup.opened ? UM.Theme.getColor("primary") : UM.Theme.getColor("text_medium") MouseArea diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 25c9bbf74b..94eca4e7c0 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -39,8 +39,6 @@ UM.Dialog source: UM.Theme.getImage("logo") - sourceSize.width: width - sourceSize.height: height anchors.top: parent.top anchors.topMargin: ((base.minimumWidth - width) / 2) | 0 anchors.horizontalCenter: parent.horizontalCenter diff --git a/resources/qml/Dialogs/AddMachineDialog.qml b/resources/qml/Dialogs/AddMachineDialog.qml index 918c717b94..f00359869c 100644 --- a/resources/qml/Dialogs/AddMachineDialog.qml +++ b/resources/qml/Dialogs/AddMachineDialog.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -156,7 +156,6 @@ UM.Dialog anchors.rightMargin: UM.Theme.getSize("default_margin").width width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width sourceSize.height: width color: palette.windowText source: base.activeCategory == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index b438f0398c..9bedaa940c 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -139,8 +139,6 @@ Item verticalCenter: parent.verticalCenter margins: background.padding } - sourceSize.width: width - sourceSize.height: height visible: source != "" width: height height: Math.round(0.2 * base.height) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 742c2a9dfe..49ad73a32e 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -22,8 +22,6 @@ Item id: mainIcon anchors.fill: parent - sourceSize.width: parent.width - sourceSize.height: parent.height source: UM.Theme.getIcon("extruder_button") color: extruderEnabled ? materialColor: "gray" } @@ -64,7 +62,6 @@ Item id: disabledIcon anchors.fill: parent anchors.margins: UM.Theme.getSize("thick_lining").width - sourceSize.width: width sourceSize.height: width source: UM.Theme.getIcon("cross1") visible: !extruderEnabled diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 386ed0ae01..f925b6eab5 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -31,9 +31,6 @@ Item width: UM.Theme.getSize("section_icon").width height: width - sourceSize.width: width - sourceSize.height: height - color: label.color visible: source != "" } diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index dcb3ef7851..22599b3aed 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -37,8 +37,6 @@ Item width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - sourceSize.width: width - sourceSize.height: height color: "black" anchors diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 717d6e925b..935cb723de 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -60,7 +60,6 @@ Item { { width: UM.Theme.getSize("save_button_specs_icons").width; height: UM.Theme.getSize("save_button_specs_icons").height; - sourceSize.width: width; sourceSize.height: width; color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene"); source: UM.Theme.getIcon("pencil"); diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 34936e9b5a..fa0594e2ae 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -54,9 +54,6 @@ Rectangle source: UM.Theme.getImage("logo") width: UM.Theme.getSize("logo").width height: UM.Theme.getSize("logo").height - - sourceSize.width: width - sourceSize.height: height } Row diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 7ba7202819..4a17e8eed8 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -95,8 +95,6 @@ Button anchors.left: parent.left width: UM.Theme.getSize("main_window_header_button_icon").width height: UM.Theme.getSize("main_window_header_button_icon").height - sourceSize.width: width - sourceSize.height: height source: UM.Theme.getIcon("buildplate") color: UM.Theme.getColor("text") } diff --git a/resources/qml/ObjectsList.qml b/resources/qml/ObjectsList.qml index 8c8eaa16ae..8f45b3744f 100644 --- a/resources/qml/ObjectsList.qml +++ b/resources/qml/ObjectsList.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -55,7 +55,6 @@ Rectangle { width: control.width height: control.height - sourceSize.width: width sourceSize.height: width color: UM.Theme.getColor("setting_control_text") source: collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index c8f391dfb0..a3a0e4708f 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -55,7 +55,8 @@ Rectangle text: "" implicitWidth: UM.Theme.getSize("favorites_button").width implicitHeight: UM.Theme.getSize("favorites_button").height - UM.RecolorImage { + UM.RecolorImage + { anchors { verticalCenter: parent.verticalCenter @@ -63,8 +64,6 @@ Rectangle } width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: height color: "black" source: brand_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index a5af17f47a..a706aaf2b9 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -95,8 +95,6 @@ Rectangle } width: UM.Theme.getSize("favorites_button_icon").width height: UM.Theme.getSize("favorites_button_icon").height - sourceSize.width: width - sourceSize.height: height color: { if (favorite_button.hovered) diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index f62fc4ee16..f98c19e0b3 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -74,8 +74,6 @@ Rectangle } width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: height color: "black" source: material_type_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 15cd773c90..91b5591cd8 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -59,9 +59,6 @@ Cura.ExpandableComponent width: UM.Theme.getSize("printer_status_icon").width height: UM.Theme.getSize("printer_status_icon").height - sourceSize.width: width - sourceSize.height: height - color: UM.Theme.getColor("primary") visible: isNetworkPrinter && isPrinterConnected diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index aafe36c546..196b2d6b97 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -129,23 +129,26 @@ Button anchors.rightMargin: UM.Theme.getSize("default_margin").width width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width sourceSize.height: width color: { if (!base.enabled) { return UM.Theme.getColor("setting_category_disabled_text") - } else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) + } + else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) { return UM.Theme.getColor("setting_category_active_hover_text") - } else if (base.pressed || (base.checkable && base.checked)) + } + else if (base.pressed || (base.checkable && base.checked)) { return UM.Theme.getColor("setting_category_active_text") - } else if (base.hovered || base.activeFocus) + } + else if (base.hovered || base.activeFocus) { return UM.Theme.getColor("setting_category_hover_text") - } else + } + else { return UM.Theme.getColor("setting_category_text") } diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index d37754d27c..fb2d5a2f4d 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -115,12 +115,12 @@ SettingItem return UM.Theme.getColor("setting_control_border") } - UM.RecolorImage { + 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.width: width sourceSize.height: width color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text"); source: UM.Theme.getIcon("check") diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index ef1f123953..bb624bcbde 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 1.1 @@ -129,13 +129,14 @@ Item } style: ButtonStyle { - background: Item { - UM.RecolorImage { + background: Item + { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width sourceSize.height: width color: control.enabled ? UM.Theme.getColor("setting_category_text") : UM.Theme.getColor("setting_category_disabled_text") source: UM.Theme.getIcon("menu") diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index e07810691e..fb4d52979d 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -731,7 +731,6 @@ Item { anchors.fill: parent anchors.margins: 2 * screenScaleFactor - sourceSize.width: width sourceSize.height: width source: UM.Theme.getIcon(model.icon) color: UM.Theme.getColor("quality_slider_unavailable") diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 90344d4644..aaa8ec18f1 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -73,7 +73,6 @@ QtObject anchors.rightMargin: Theme.getSize("default_margin").width width: Theme.getSize("standard_arrow").width height: Theme.getSize("standard_arrow").height - sourceSize.width: width sourceSize.height: width color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text") source: Theme.getIcon("arrow_bottom") @@ -257,7 +256,6 @@ QtObject anchors.bottomMargin: Theme.getSize("button").height - Math.round(Theme.getSize("button_icon").height / 4) width: Theme.getSize("standard_arrow").width height: Theme.getSize("standard_arrow").height - sourceSize.width: width sourceSize.height: width visible: control.menu != null; color: @@ -543,7 +541,6 @@ QtObject anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2.5) height: Math.round(parent.height / 2.5) - sourceSize.width: width sourceSize.height: width color: Theme.getColor("checkbox_mark") source: control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check") @@ -585,7 +582,6 @@ QtObject anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2.5) height: Math.round(parent.height / 2.5) - sourceSize.width: width sourceSize.height: width color: Theme.getColor("checkbox_mark") source: @@ -836,7 +832,6 @@ QtObject anchors.horizontalCenter: parent.horizontalCenter width: Math.floor(control.width / 2) height: Math.floor(control.height / 2) - sourceSize.width: width sourceSize.height: width color: { From de78c44461d89061a5110d30d3b93066dc07bfc1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 16:43:13 +0100 Subject: [PATCH 434/558] Fix configuration drop-down for dark theme This actually changes the secondary colour to be darker for the dark theme, to be more in line with the general theme then. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 1 + resources/themes/cura-dark/theme.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 72b640e94a..fe2bf34e35 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -90,6 +90,7 @@ Item radius: tabBar.visible ? UM.Theme.getSize("default_radius").width : 0 border.width: tabBar.visible ? UM.Theme.getSize("default_lining").width : 0 border.color: UM.Theme.getColor("lining") + color: UM.Theme.getColor("main_background") //Remove rounding and lining at the top. Rectangle diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 078f04db1a..d9ef74ebb9 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -15,7 +15,7 @@ "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 204], "border": [127, 127, 127, 255], - "secondary": [241, 242, 242, 255], + "secondary": [95, 95, 95, 255], "main_window_header_button_text_inactive": [128, 128, 128, 255], "main_window_header_button_text_hovered": [255, 255, 255, 255], From 1544ab6cf0b5b5a746e2084dffce2da7a3172067 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 17:07:59 +0100 Subject: [PATCH 435/558] Explicitly enable hover on ConfigurationItem Apparently the default for this depends on some system setting. In Nallath's computer that system setting makes it false by default for some reason. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 4a17e8eed8..af2712be44 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -12,6 +12,7 @@ Button id: configurationItem property var configuration: null + hoverEnabled: true height: childrenRect.height From 780e5e16917192e8f639142e1058f399a5e291f5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 4 Dec 2018 17:09:55 +0100 Subject: [PATCH 436/558] Fix binding loop in PrintCoreConfiguration Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 4064a961d5..885f02d740 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -12,7 +12,7 @@ Row id: extruderInfo property var printCoreConfiguration - height: childrenRect.height + height: information.height spacing: UM.Theme.getSize("default_margin").width //Extruder icon. From a62da4e5239b2f29d66d261d5405aa3e35f3f6d0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 09:13:48 +0100 Subject: [PATCH 437/558] Use setCurrentIndex instead of direct assignment This should prevent the binding from breaking and hopefully the segfault CURA-5876 --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index fe2bf34e35..2667c837ba 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -76,7 +76,7 @@ Item target: repeater.model onModelChanged: { - tabBar.currentIndex = Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) + tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex) } } } From cdb8020029bec6ee1c6c4224ff5cb02159dd810e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 5 Dec 2018 09:39:04 +0100 Subject: [PATCH 438/558] Add another expandable component Use one of them if the drop-panel has to act as a Popup and the other if it has to act as a standard component. Contributes to CURA-5941. --- .../SimulationViewMenuComponent.qml | 1 - resources/qml/ExpandableComponent.qml | 66 ++---- resources/qml/ExpandablePopup.qml | 204 ++++++++++++++++++ .../QuickConfigurationSelector.qml | 2 +- .../PrintSetupSelector/PrintSetupSelector.qml | 4 - .../qml/PrinterSelector/MachineSelector.qml | 4 +- resources/qml/ViewsSelector.qml | 8 +- 7 files changed, 227 insertions(+), 62 deletions(-) create mode 100644 resources/qml/ExpandablePopup.qml diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 9dc3b67658..76875a035d 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -16,7 +16,6 @@ Cura.ExpandableComponent id: base width: UM.Theme.getSize("layerview_menu_size").width - contentType: Cura.ExpandableComponent.ContentType.Fixed Connections { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index f6e340c4ea..4f4848ea8b 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -20,20 +20,11 @@ Item AlignRight } - enum ContentType - { - Floating, - Fixed - } - // The headerItem holds the QML item that is always displayed. property alias headerItem: headerItemLoader.sourceComponent // The contentItem holds the QML item that is shown when the "open" button is pressed - property var contentItem: content.contentItem - - // Defines the type of the contents - property int contentType: ExpandableComponent.ContentType.Floating + property alias contentItem: content.contentItem property color contentBackgroundColor: UM.Theme.getColor("action_button") @@ -48,7 +39,7 @@ Item property alias contentPadding: content.padding // How much spacing is needed for the contentItem by Y coordinate - property var contentSpacingY: 0 + property var contentSpacingY: UM.Theme.getSize("narrow_margin").width // How much padding is needed around the header & button property alias headerPadding: background.padding @@ -64,17 +55,12 @@ Item // Is the "drawer" open? readonly property alias expanded: content.visible - property alias expandedHighlightColor: expandedHighlight.color - // What should the radius of the header be. This is also influenced by the headerCornerSide property alias headerRadius: background.radius // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. property alias headerCornerSide: background.cornerSide - // Change the contentItem close behaviour - property alias contentClosePolicy : content.closePolicy - property alias headerShadowColor: shadow.color property alias enableHeaderShadow: shadow.visible @@ -83,14 +69,7 @@ Item function toggleContent() { - if (content.visible) - { - content.close() - } - else - { - content.open() - } + content.visible = !content.visible } implicitHeight: 100 * screenScaleFactor @@ -117,17 +96,6 @@ Item } } - // A highlight that is shown when the content is expanded - Rectangle - { - id: expandedHighlight - width: parent.width - height: UM.Theme.getSize("thick_lining").height - color: UM.Theme.getColor("primary") - visible: contentType == ExpandableComponent.ContentType.Floating && expanded - anchors.bottom: parent.bottom - } - UM.RecolorImage { id: collapseButton @@ -139,9 +107,7 @@ Item } sourceSize.width: width sourceSize.height: height - source: contentType == ExpandableComponent.ContentType.Floating ? - (expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")) : - UM.Theme.getIcon("pencil") + source: UM.Theme.getIcon("pencil") visible: source != "" width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height @@ -155,8 +121,7 @@ Item onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor - onExited: background.color = (contentType == ExpandableComponent.ContentType.Fixed && expanded) ? - headerActiveColor : headerBackgroundColor + onExited: background.color = expanded ? headerActiveColor : headerBackgroundColor } } @@ -174,9 +139,10 @@ Item z: background.z - 1 } - Popup + Control { id: content + visible: false // Ensure that the content is located directly below the headerItem y: background.height + base.shadowOffset + base.contentSpacingY @@ -185,7 +151,6 @@ Item // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. x: contentAlignment == ExpandableComponent.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 padding: UM.Theme.getSize("default_margin").width - closePolicy: Popup.CloseOnPressOutsideParent background: Cura.RoundedRectangle { @@ -195,15 +160,16 @@ Item border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width } - } - onContentItemChanged: - { - // Since we want the size of the content to be set by the size of the content, - // we need to do it like this. - content.width = contentItem.width + 2 * content.padding - content.height = contentItem.height + 2 * content.padding - content.contentItem = contentItem + contentItem: Item {} + + onContentItemChanged: + { + // Since we want the size of the content to be set by the size of the content, + // we need to do it like this. + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding + } } // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml new file mode 100644 index 0000000000..da79d9b77b --- /dev/null +++ b/resources/qml/ExpandablePopup.qml @@ -0,0 +1,204 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +import QtGraphicalEffects 1.0 // For the dropshadow + +// The expandable component has 2 major sub components: +// * The headerItem; Always visible and should hold some info about what happens if the component is expanded +// * The contentItem; The content that needs to be shown if the component is expanded. +Item +{ + id: base + + // Enumeration with the different possible alignments of the content with respect of the headerItem + enum ContentAlignment + { + AlignLeft, + AlignRight + } + + // The headerItem holds the QML item that is always displayed. + property alias headerItem: headerItemLoader.sourceComponent + + // The contentItem holds the QML item that is shown when the "open" button is pressed + property alias contentItem: content.contentItem + + property color contentBackgroundColor: UM.Theme.getColor("action_button") + + property color headerBackgroundColor: UM.Theme.getColor("action_button") + property color headerActiveColor: UM.Theme.getColor("secondary") + property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + + // Defines the alignment of the content with respect of the headerItem, by default to the right + property int contentAlignment: ExpandablePopup.ContentAlignment.AlignRight + + // How much spacing is needed around the contentItem + property alias contentPadding: content.padding + + // How much padding is needed around the header & button + property alias headerPadding: background.padding + + // What icon should be displayed on the right. + property alias iconSource: collapseButton.source + + property alias iconColor: collapseButton.color + + // The icon size (it's always drawn as a square) + property alias iconSize: collapseButton.height + + // Is the "drawer" open? + readonly property alias expanded: content.visible + + property alias expandedHighlightColor: expandedHighlight.color + + // What should the radius of the header be. This is also influenced by the headerCornerSide + property alias headerRadius: background.radius + + // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. + property alias headerCornerSide: background.cornerSide + + // Change the contentItem close behaviour + property alias contentClosePolicy : content.closePolicy + + property alias headerShadowColor: shadow.color + + property alias enableHeaderShadow: shadow.visible + + property int shadowOffset: 2 + + function toggleContent() + { + if (content.visible) + { + content.close() + } + else + { + content.open() + } + } + + implicitHeight: 100 * screenScaleFactor + implicitWidth: 400 * screenScaleFactor + + RoundedRectangle + { + id: background + property real padding: UM.Theme.getSize("default_margin").width + + color: headerBackgroundColor + anchors.fill: parent + + Loader + { + id: headerItemLoader + anchors + { + left: parent.left + right: collapseButton.visible ? collapseButton.left : parent.right + top: parent.top + bottom: parent.bottom + margins: background.padding + } + } + + // A highlight that is shown when the content is expanded + Rectangle + { + id: expandedHighlight + width: parent.width + height: UM.Theme.getSize("thick_lining").height + color: UM.Theme.getColor("primary") + visible: expanded + anchors.bottom: parent.bottom + } + + UM.RecolorImage + { + id: collapseButton + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + margins: background.padding + } + sourceSize.width: width + sourceSize.height: height + source: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") + visible: source != "" + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + color: UM.Theme.getColor("text") + } + + MouseArea + { + id: mouseArea + anchors.fill: parent + onClicked: toggleContent() + hoverEnabled: true + onEntered: background.color = headerHoverColor + onExited: background.color = headerBackgroundColor + } + } + + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: background + source: background + verticalOffset: base.shadowOffset + visible: true + color: UM.Theme.getColor("action_button_shadow") + // Should always be drawn behind the background. + z: background.z - 1 + } + + Popup + { + id: content + + // Ensure that the content is located directly below the headerItem + y: background.height + base.shadowOffset + + // Make the content aligned with the rest, using the property contentAlignment to decide whether is right or left. + // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. + x: contentAlignment == ExpandablePopup.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 + padding: UM.Theme.getSize("default_margin").width + closePolicy: Popup.CloseOnPressOutsideParent + + background: Cura.RoundedRectangle + { + cornerSide: Cura.RoundedRectangle.Direction.Down + color: contentBackgroundColor + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + radius: UM.Theme.getSize("default_radius").width + } + + contentItem: Item {} + + onContentItemChanged: + { + // Since we want the size of the content to be set by the size of the content, + // we need to do it like this. + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding + } + } + + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. + // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. + Connections + { + // Since it could be that the content is dynamically populated, we should also take these changes into account. + target: content.contentItem + onWidthChanged: content.width = content.contentItem.width + 2 * content.padding + onHeightChanged: content.height = content.contentItem.height + 2 * content.padding + } +} diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index ea82f4fe13..138a1d6669 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -12,7 +12,7 @@ import UM 1.2 as UM import Cura 1.0 as Cura -Cura.ExpandableComponent +Cura.ExpandablePopup { id: base diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 0eea697950..19c8067683 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -14,11 +14,7 @@ Cura.ExpandableComponent property string enabledText: catalog.i18nc("@label:Should be short", "On") property string disabledText: catalog.i18nc("@label:Should be short", "Off") - contentType: Cura.ExpandableComponent.ContentType.Fixed contentPadding: UM.Theme.getSize("default_lining").width - contentSpacingY: UM.Theme.getSize("narrow_margin").width - - contentClosePolicy: Popup.CloseOnEscape UM.I18nCatalog { diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 69a1ac899c..ef766b6030 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -7,7 +7,7 @@ import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura -Cura.ExpandableComponent +Cura.ExpandablePopup { id: machineSelector @@ -16,7 +16,7 @@ Cura.ExpandableComponent property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null contentPadding: UM.Theme.getSize("default_lining").width - contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft + contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft UM.I18nCatalog { diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index d469202606..18d1f66759 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -7,12 +7,12 @@ import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura -Cura.ExpandableComponent +Cura.ExpandablePopup { id: viewSelector contentPadding: UM.Theme.getSize("default_lining").width - contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft + contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft property var viewModel: UM.ViewModel { } @@ -72,13 +72,13 @@ Cura.ExpandableComponent contentItem: Column { id: viewSelectorPopup - width: viewSelector.width - 2 * viewSelector.popupPadding + width: viewSelector.width - 2 * viewSelector.contentPadding // For some reason the height/width of the column gets set to 0 if this is not set... Component.onCompleted: { height = implicitHeight - width = viewSelector.width - 2 * viewSelector.popupPadding + width = viewSelector.width - 2 * viewSelector.contentPadding } Repeater From 5d95d1143762a72e7cfe9c384c9d5752f6b888c2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 5 Dec 2018 09:52:43 +0100 Subject: [PATCH 439/558] Use setCurrentIndex to switch tabs at activeExtruderChanged This fixes a mysterious segfault. We still don't know why the segfault occurred though. All we know is that QML logs something about a binding loop on currentIndex, and Qt logs something about removing range [-1 through 0] from VisualItemModel. When the tab bar is then made visible, Cura crashes. It is a nondeterministic crash. After this change, we are not seeing it any more (but with any nondeterministic bug, it's hard to verify that it was actually fixed). Contributes to issue CURA-5876. --- .../ConfigurationMenu/CustomConfiguration.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 2667c837ba..18c2dabb0f 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -42,8 +42,6 @@ Item anchors.topMargin: UM.Theme.getSize("default_margin").height visible: extrudersModel.count > 1 - currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) - Repeater { id: repeater @@ -68,6 +66,18 @@ Item } } + //When active extruder changes for some other reason, switch tabs. + //Don't directly link currentIndex to Cura.ExtruderManager.activeExtruderIndex! + //This causes a segfault in Qt 5.11. Something with VisualItemModel removing index -1. We have to use setCurrentIndex instead. + Connections + { + target: Cura.ExtruderManager + onActiveExtruderChanged: + { + tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex); + } + } + //When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt. //This causes the currentIndex of the tab to be in an invalid position which resets it to 0. //Therefore we need to change it back to what it was: The active extruder index. From 700ae4bebb2218610fbf0095f57e7aabb81e52ba Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 10:48:06 +0100 Subject: [PATCH 440/558] Removed super spammy logging CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 562a964f01..2b78581deb 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -491,11 +491,8 @@ class Toolbox(QObject, Extension): def canUpdate(self, package_id: str) -> bool: local_package = self._package_manager.getInstalledPackageInfo(package_id) if local_package is None: - Logger.log("i", "Could not find package [%s] as installed in the package manager, fall back to check the old plugins", - package_id) local_package = self.getOldPluginPackageMetadata(package_id) if local_package is None: - Logger.log("i", "Could not find package [%s] in the old plugins", package_id) return False remote_package = self.getRemotePackage(package_id) From 978a01e4c89873b42909991ae5ecc49988beab33 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 10:51:05 +0100 Subject: [PATCH 441/558] Fix typing & codestyle CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 2b78581deb..1fe7c961ba 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -31,8 +31,8 @@ i18n_catalog = i18nCatalog("cura") ## The Toolbox class is responsible of communicating with the server through the API class Toolbox(QObject, Extension): - DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" #type: str - DEFAULT_CLOUD_API_VERSION = 1 #type: int + DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" # type: str + DEFAULT_CLOUD_API_VERSION = 1 # type: int def __init__(self, application: CuraApplication) -> None: super().__init__() @@ -192,9 +192,9 @@ class Toolbox(QObject, Extension): return self.DEFAULT_CLOUD_API_ROOT if not hasattr(cura.CuraVersion, "CuraCloudAPIRoot"): # type: ignore return self.DEFAULT_CLOUD_API_ROOT - if not cura.CuraVersion.CuraCloudAPIRoot: # type: ignore + if not cura.CuraVersion.CuraCloudAPIRoot: # type: ignore return self.DEFAULT_CLOUD_API_ROOT - return cura.CuraVersion.CuraCloudAPIRoot # type: ignore + return cura.CuraVersion.CuraCloudAPIRoot # type: ignore # Get the cloud API version from CuraVersion def _getCloudAPIVersion(self) -> int: @@ -202,9 +202,9 @@ class Toolbox(QObject, Extension): return self.DEFAULT_CLOUD_API_VERSION if not hasattr(cura.CuraVersion, "CuraCloudAPIVersion"): # type: ignore return self.DEFAULT_CLOUD_API_VERSION - if not cura.CuraVersion.CuraCloudAPIVersion: # type: ignore + if not cura.CuraVersion.CuraCloudAPIVersion: # type: ignore return self.DEFAULT_CLOUD_API_VERSION - return cura.CuraVersion.CuraCloudAPIVersion # type: ignore + return cura.CuraVersion.CuraCloudAPIVersion # type: ignore # Get the packages version depending on Cura version settings. def _getSDKVersion(self) -> Union[int, str]: @@ -231,12 +231,6 @@ class Toolbox(QObject, Extension): # Make remote requests: self._makeRequestByType("packages") self._makeRequestByType("authors") - # TODO: Uncomment in the future when the tag-filtered api calls work in the cloud server - # self._makeRequestByType("plugins_showcase") - # self._makeRequestByType("plugins_available") - # self._makeRequestByType("materials_showcase") - # self._makeRequestByType("materials_available") - # self._makeRequestByType("materials_generic") # Gather installed packages: self._updateInstalledModels() @@ -281,7 +275,7 @@ class Toolbox(QObject, Extension): "description": plugin_data["plugin"]["description"] } return formatted - except: + except KeyError: Logger.log("w", "Unable to convert plugin meta data %s", str(plugin_data)) return None From d9135ac72fa9aa4aa155179fb44e57cda2d1ad96 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 11:06:14 +0100 Subject: [PATCH 442/558] Fix more codestyle issues CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 62 +++++++++++++++------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 1fe7c961ba..b6cfafe40c 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -559,34 +559,30 @@ class Toolbox(QObject, Extension): # Check for plugins that were installed with the old plugin browser def isOldPlugin(self, plugin_id: str) -> bool: - if plugin_id in self._old_plugin_ids: - return True - return False + return plugin_id in self._old_plugin_ids def getOldPluginPackageMetadata(self, plugin_id: str) -> Optional[Dict[str, Any]]: return self._old_plugin_metadata.get(plugin_id) - def loadingComplete(self) -> bool: + def isLoadingComplete(self) -> bool: populated = 0 - for list in self._metadata.items(): - if len(list) > 0: + for metadata_list in self._metadata.items(): + if metadata_list: populated += 1 - if populated == len(self._metadata.items()): - return True - return False + return populated == len(self._metadata.items()) # Make API Calls # -------------------------------------------------------------------------- - def _makeRequestByType(self, type: str) -> None: - Logger.log("i", "Marketplace: Requesting %s metadata from server.", type) - request = QNetworkRequest(self._request_urls[type]) + def _makeRequestByType(self, request_type: str) -> None: + Logger.log("i", "Requesting %s metadata from server.", request_type) + request = QNetworkRequest(self._request_urls[request_type]) request.setRawHeader(*self._request_header) if self._network_manager: self._network_manager.get(request) @pyqtSlot(str) def startDownload(self, url: str) -> None: - Logger.log("i", "Marketplace: Attempting to download & install package from %s.", url) + Logger.log("i", "Attempting to download & install package from %s.", url) url = QUrl(url) self._download_request = QNetworkRequest(url) if hasattr(QNetworkRequest, "FollowRedirectsAttribute"): @@ -603,7 +599,7 @@ class Toolbox(QObject, Extension): @pyqtSlot() def cancelDownload(self) -> None: - Logger.log("i", "Marketplace: User cancelled the download of a package.") + Logger.log("i", "User cancelled the download of a package.") self.resetDownload() def resetDownload(self) -> None: @@ -647,10 +643,10 @@ class Toolbox(QObject, Extension): ] if reply.operation() == QNetworkAccessManager.GetOperation: - for type, url in self._request_urls.items(): + for response_type, url in self._request_urls.items(): # HACK: Do nothing because we'll handle these from the "packages" call - if type in do_not_handle: + if response_type in do_not_handle: continue if reply.url() == url: @@ -665,38 +661,35 @@ class Toolbox(QObject, Extension): return # Create model and apply metadata: - if not self._models[type]: - Logger.log("e", "Could not find the %s model.", type) + if not self._models[response_type]: + Logger.log("e", "Could not find the %s model.", response_type) break - self._metadata[type] = json_data["data"] - self._models[type].setMetadata(self._metadata[type]) + self._metadata[response_type] = json_data["data"] + self._models[response_type].setMetadata(self._metadata[response_type]) # Do some auto filtering # TODO: Make multiple API calls in the future to handle this - if type is "packages": - self._models[type].setFilter({"type": "plugin"}) + if response_type is "packages": + self._models[response_type].setFilter({"type": "plugin"}) self.buildMaterialsModels() self.buildPluginsModels() - if type is "authors": - self._models[type].setFilter({"package_types": "material"}) - if type is "materials_generic": - self._models[type].setFilter({"tags": "generic"}) + if response_type is "authors": + self._models[response_type].setFilter({"package_types": "material"}) + if response_type is "materials_generic": + self._models[response_type].setFilter({"tags": "generic"}) self.metadataChanged.emit() - if self.loadingComplete() is True: + if self.isLoadingComplete(): self.setViewPage("overview") - return except json.decoder.JSONDecodeError: - Logger.log("w", "Marketplace: Received invalid JSON for %s.", type) + Logger.log("w", "Received invalid JSON for %s.", response_type) break else: self.setViewPage("errored") self.resetDownload() - return - else: # Ignore any operation that is not a get operation pass @@ -717,10 +710,10 @@ class Toolbox(QObject, Extension): self._onDownloadComplete(file_path) def _onDownloadComplete(self, file_path: str) -> None: - Logger.log("i", "Marketplace: Download complete.") + Logger.log("i", "Download complete.") package_info = self._package_manager.getPackageInfo(file_path) if not package_info: - Logger.log("w", "Marketplace: Package file [%s] was not a valid CuraPackage.", file_path) + Logger.log("w", "Package file [%s] was not a valid CuraPackage.", file_path) return license_content = self._package_manager.getPackageLicense(file_path) @@ -729,7 +722,6 @@ class Toolbox(QObject, Extension): return self.install(file_path) - return # Getter & Setters for Properties: # -------------------------------------------------------------------------- @@ -847,7 +839,7 @@ class Toolbox(QObject, Extension): self._metadata["materials_available"] = [] self._metadata["materials_generic"] = [] - processed_authors = [] # type: List[str] + processed_authors = [] # type: List[str] for item in self._metadata["packages"]: if item["package_type"] == "material": From abcc621cc62120a0f9f1e5f32599f8356e607dc2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 11:29:44 +0100 Subject: [PATCH 443/558] Added missing typing --- plugins/Toolbox/src/AuthorsModel.py | 43 ++++++++++++++-------------- plugins/Toolbox/src/PackagesModel.py | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/plugins/Toolbox/src/AuthorsModel.py b/plugins/Toolbox/src/AuthorsModel.py index bea3893504..6f4b5bd280 100644 --- a/plugins/Toolbox/src/AuthorsModel.py +++ b/plugins/Toolbox/src/AuthorsModel.py @@ -2,18 +2,19 @@ # Cura is released under the terms of the LGPLv3 or higher. import re -from typing import Dict +from typing import Dict, List, Optional, Union from PyQt5.QtCore import Qt, pyqtProperty, pyqtSignal from UM.Qt.ListModel import ListModel + ## Model that holds cura packages. By setting the filter property the instances held by this model can be changed. class AuthorsModel(ListModel): - def __init__(self, parent = None): + def __init__(self, parent = None) -> None: super().__init__(parent) - self._metadata = None + self._metadata = None # type: Optional[List[Dict[str, Union[str, List[str], int]]]] self.addRoleName(Qt.UserRole + 1, "id") self.addRoleName(Qt.UserRole + 2, "name") @@ -25,39 +26,39 @@ class AuthorsModel(ListModel): self.addRoleName(Qt.UserRole + 8, "description") # List of filters for queries. The result is the union of the each list of results. - self._filter = {} # type: Dict[str,str] + self._filter = {} # type: Dict[str, str] - def setMetadata(self, data): + def setMetadata(self, data: List[Dict[str, Union[str, List[str], int]]]): self._metadata = data self._update() - def _update(self): - items = [] + def _update(self) -> None: + items = [] # type: List[Dict[str, Union[str, List[str], int, None]]] if not self._metadata: - self.setItems([]) + self.setItems(items) return for author in self._metadata: items.append({ - "id": author["author_id"], - "name": author["display_name"], - "email": author["email"] if "email" in author else None, - "website": author["website"], - "package_count": author["package_count"] if "package_count" in author else 0, - "package_types": author["package_types"] if "package_types" in author else [], - "icon_url": author["icon_url"] if "icon_url" in author else None, - "description": "Material and quality profiles from {author_name}".format(author_name = author["display_name"]) + "id": author.get("author_id"), + "name": author.get("display_name"), + "email": author.get("email"), + "website": author.get("website"), + "package_count": author.get("package_count", 0), + "package_types": author.get("package_types", []), + "icon_url": author.get("icon_url"), + "description": "Material and quality profiles from {author_name}".format(author_name = author.get("display_name", "")) }) # Filter on all the key-word arguments. for key, value in self._filter.items(): if key is "package_types": - key_filter = lambda item, value = value: value in item["package_types"] + key_filter = lambda item, value = value: value in item["package_types"] # type: ignore elif "*" in value: - key_filter = lambda item, key = key, value = value: self._matchRegExp(item, key, value) + key_filter = lambda item, key = key, value = value: self._matchRegExp(item, key, value) # type: ignore else: - key_filter = lambda item, key = key, value = value: self._matchString(item, key, value) - items = filter(key_filter, items) + key_filter = lambda item, key = key, value = value: self._matchString(item, key, value) # type: ignore + items = filter(key_filter, items) # type: ignore # Execute all filters. filtered_items = list(items) @@ -72,7 +73,7 @@ class AuthorsModel(ListModel): self._filter = filter_dict self._update() - @pyqtProperty("QVariantMap", fset = setFilter, constant = True) + @pyqtProperty("QStringMap", fset = setFilter, constant = True) def filter(self) -> Dict[str, str]: return self._filter diff --git a/plugins/Toolbox/src/PackagesModel.py b/plugins/Toolbox/src/PackagesModel.py index a31facf75a..2849a29c99 100644 --- a/plugins/Toolbox/src/PackagesModel.py +++ b/plugins/Toolbox/src/PackagesModel.py @@ -33,7 +33,7 @@ class PackagesModel(ListModel): self.addRoleName(Qt.UserRole + 12, "last_updated") self.addRoleName(Qt.UserRole + 13, "is_bundled") self.addRoleName(Qt.UserRole + 14, "is_active") - self.addRoleName(Qt.UserRole + 15, "is_installed") # Scheduled pkgs are included in the model but should not be marked as actually installed + self.addRoleName(Qt.UserRole + 15, "is_installed") # Scheduled pkgs are included in the model but should not be marked as actually installed self.addRoleName(Qt.UserRole + 16, "has_configs") self.addRoleName(Qt.UserRole + 17, "supported_configs") self.addRoleName(Qt.UserRole + 18, "download_count") From 034b1660f766211bd658127e28f0dd35809c2f6b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 5 Dec 2018 13:05:22 +0100 Subject: [PATCH 444/558] Adjust sizes in the custom print setup mode Contributes to CURA-5941. --- .../qml/PrintSetupSelector/Custom/CustomPrintSetup.qml | 9 +++------ .../PrintSetupSelector/PrintSetupSelectorContents.qml | 8 ++++---- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index b524bb5926..8b0f3524d7 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -11,9 +11,7 @@ import Cura 1.0 as Cura Item { id: customPrintSetup - - // TODO: Hardcoded now but UX has to decide about the height of this item - height: 480 + height: childrenRect.height + padding property real padding: UM.Theme.getSize("default_margin").width property bool multipleExtruders: extrudersModel.count > 1 @@ -93,16 +91,15 @@ Item Rectangle { + height: UM.Theme.getSize("print_setup_widget").height anchors { - top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom + top: tabBar.bottom left: parent.left leftMargin: parent.padding right: parent.right rightMargin: parent.padding - bottom: parent.bottom topMargin: -UM.Theme.getSize("default_lining").width - bottomMargin: -UM.Theme.getSize("default_lining").width } z: tabBar.z - 1 // Don't show the border when only one extruder diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 0524a6de9e..522b038423 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -28,7 +28,7 @@ Item { var index = Math.round(UM.Preferences.getValue("cura/active_mode")) - if(index != null && !isNaN(index)) + if (index != null && !isNaN(index)) { return index } @@ -150,7 +150,8 @@ Item { id: buttonsSeparator - anchors.top: contents.bottom + // The buttonsSeparator is inside the contents. This is to avoid a double line in the bottom + anchors.bottom: contents.bottom width: parent.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") @@ -162,10 +163,9 @@ Item property real padding: UM.Theme.getSize("default_margin").width height: childrenRect.height + 2 * padding - // The buttonsSeparator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. anchors { - top: buttonsSeparator.top + top: buttonsSeparator.bottom left: parent.left right: parent.right } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 8e440757aa..f383a570a2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -369,7 +369,7 @@ "account_button": [12, 3], - "print_setup_widget": [38.0, 42.0], + "print_setup_widget": [38.0, 30.0], "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], From b1440737e641a708683c06ea12c7874dd3fb8ab7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 13:21:17 +0100 Subject: [PATCH 445/558] Remove a whole bunch of unused code CURA-6006 --- plugins/Toolbox/src/AuthorsModel.py | 2 +- plugins/Toolbox/src/Toolbox.py | 70 +++++++++-------------------- 2 files changed, 22 insertions(+), 50 deletions(-) diff --git a/plugins/Toolbox/src/AuthorsModel.py b/plugins/Toolbox/src/AuthorsModel.py index 6f4b5bd280..8fafda54ec 100644 --- a/plugins/Toolbox/src/AuthorsModel.py +++ b/plugins/Toolbox/src/AuthorsModel.py @@ -73,7 +73,7 @@ class AuthorsModel(ListModel): self._filter = filter_dict self._update() - @pyqtProperty("QStringMap", fset = setFilter, constant = True) + @pyqtProperty("QVariantMap", fset = setFilter, constant = True) def filter(self) -> Dict[str, str]: return self._filter diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index b6cfafe40c..5db3dd934f 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -70,13 +70,6 @@ class Toolbox(QObject, Extension): self._metadata = { "authors": [], "packages": [], - "plugins_showcase": [], - "plugins_available": [], - "plugins_installed": [], - "materials_showcase": [], - "materials_available": [], - "materials_installed": [], - "materials_generic": [] } # type: Dict[str, List[Any]] # Models: @@ -178,12 +171,7 @@ class Toolbox(QObject, Extension): ) self._request_urls = { "authors": QUrl("{base_url}/authors".format(base_url = self._api_url)), - "packages": QUrl("{base_url}/packages".format(base_url = self._api_url)), - "plugins_showcase": QUrl("{base_url}/showcase".format(base_url = self._api_url)), - "plugins_available": QUrl("{base_url}/packages?package_type=plugin".format(base_url = self._api_url)), - "materials_showcase": QUrl("{base_url}/showcase".format(base_url = self._api_url)), - "materials_available": QUrl("{base_url}/packages?package_type=material".format(base_url = self._api_url)), - "materials_generic": QUrl("{base_url}/packages?package_type=material&tags=generic".format(base_url = self._api_url)) + "packages": QUrl("{base_url}/packages".format(base_url = self._api_url)) } # Get the API root for the packages API depending on Cura version settings. @@ -606,8 +594,8 @@ class Toolbox(QObject, Extension): if self._download_reply: try: self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) - except TypeError: #Raised when the method is not connected to the signal yet. - pass #Don't need to disconnect. + except TypeError: # Raised when the method is not connected to the signal yet. + pass # Don't need to disconnect. self._download_reply.abort() self._download_reply = None self._download_request = None @@ -633,22 +621,8 @@ class Toolbox(QObject, Extension): self.resetDownload() return - # HACK: These request are not handled independently at this moment, but together from the "packages" call - do_not_handle = [ - "materials_available", - "materials_showcase", - "materials_generic", - "plugins_available", - "plugins_showcase", - ] - if reply.operation() == QNetworkAccessManager.GetOperation: for response_type, url in self._request_urls.items(): - - # HACK: Do nothing because we'll handle these from the "packages" call - if response_type in do_not_handle: - continue - if reply.url() == url: if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: try: @@ -672,11 +646,10 @@ class Toolbox(QObject, Extension): # TODO: Make multiple API calls in the future to handle this if response_type is "packages": self._models[response_type].setFilter({"type": "plugin"}) - self.buildMaterialsModels() + self.reBuildMaterialsModels() self.buildPluginsModels() - if response_type is "authors": + elif response_type is "authors": self._models[response_type].setFilter({"package_types": "material"}) - if response_type is "materials_generic": self._models[response_type].setFilter({"tags": "generic"}) self.metadataChanged.emit() @@ -834,10 +807,10 @@ class Toolbox(QObject, Extension): # HACK(S): # -------------------------------------------------------------------------- - def buildMaterialsModels(self) -> None: - self._metadata["materials_showcase"] = [] - self._metadata["materials_available"] = [] - self._metadata["materials_generic"] = [] + def reBuildMaterialsModels(self) -> None: + materials_showcase_metadata = [] + materials_available_metadata = [] + materials_generic_metadata = [] processed_authors = [] # type: List[str] @@ -850,30 +823,29 @@ class Toolbox(QObject, Extension): # Generic materials to be in the same section if "generic" in item["tags"]: - self._metadata["materials_generic"].append(item) + materials_generic_metadata.append(item) else: if "showcase" in item["tags"]: - self._metadata["materials_showcase"].append(author) + materials_showcase_metadata.append(author) else: - self._metadata["materials_available"].append(author) + materials_available_metadata.append(author) processed_authors.append(author["author_id"]) - self._models["materials_showcase"].setMetadata(self._metadata["materials_showcase"]) - self._models["materials_available"].setMetadata(self._metadata["materials_available"]) - self._models["materials_generic"].setMetadata(self._metadata["materials_generic"]) + self._models["materials_showcase"].setMetadata(materials_showcase_metadata) + self._models["materials_available"].setMetadata(materials_available_metadata) + self._models["materials_generic"].setMetadata(materials_generic_metadata) def buildPluginsModels(self) -> None: - self._metadata["plugins_showcase"] = [] - self._metadata["plugins_available"] = [] + plugins_showcase_metadata = [] + plugins_available_metadata = [] for item in self._metadata["packages"]: if item["package_type"] == "plugin": - if "showcase" in item["tags"]: - self._metadata["plugins_showcase"].append(item) + plugins_showcase_metadata.append(item) else: - self._metadata["plugins_available"].append(item) + plugins_available_metadata.append(item) - self._models["plugins_showcase"].setMetadata(self._metadata["plugins_showcase"]) - self._models["plugins_available"].setMetadata(self._metadata["plugins_available"]) + self._models["plugins_showcase"].setMetadata(plugins_showcase_metadata) + self._models["plugins_available"].setMetadata(plugins_available_metadata) From 5b57e6bf307eb2060b6c386c054401ab0625a779 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 5 Dec 2018 13:24:34 +0100 Subject: [PATCH 446/558] Code style in JobSpecs --- resources/qml/JobSpecs.qml | 82 +++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 45111992c1..5f773f9b25 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -9,20 +9,27 @@ import QtQuick.Layouts 1.1 import UM 1.1 as UM import Cura 1.0 as Cura -Item { +Item +{ id: base property bool activity: CuraApplication.platformActivity property string fileBaseName: PrintInformation.baseName - UM.I18nCatalog { id: catalog; name: "cura"} + UM.I18nCatalog + { + id: catalog + name:"cura" + } height: childrenRect.height - onActivityChanged: { - if (activity == false) { + onActivityChanged: + { + if (!activity) + { //When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't set an empty string as a jobName (which is later used for saving the file) - PrintInformation.baseName = '' + PrintInformation.baseName = "" } } @@ -49,21 +56,22 @@ Item { onClicked: { - printJobTextfield.selectAll(); - printJobTextfield.focus = true; + printJobTextfield.selectAll() + printJobTextfield.focus = true } + style: ButtonStyle { background: Item { UM.RecolorImage { - width: UM.Theme.getSize("save_button_specs_icons").width; - height: UM.Theme.getSize("save_button_specs_icons").height; - sourceSize.width: width; - sourceSize.height: width; - color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene"); - source: UM.Theme.getIcon("pencil"); + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene") + source: UM.Theme.getIcon("pencil") } } } @@ -73,25 +81,31 @@ Item { { id: printJobTextfield anchors.right: printJobPencilIcon.left - anchors.rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) + anchors.rightMargin: UM.Theme.getSize("narrow_margin").width height: UM.Theme.getSize("jobspecs_line").height width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 property int unremovableSpacing: 5 text: PrintInformation.jobName horizontalAlignment: TextInput.AlignRight - onEditingFinished: { - var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text; - PrintInformation.setJobName(new_name, true); - printJobTextfield.focus = false; + + onEditingFinished: + { + var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text + PrintInformation.setJobName(new_name, true) + printJobTextfield.focus = false } + validator: RegExpValidator { regExp: /^[^\\\/\*\?\|\[\]]*$/ } - style: TextFieldStyle{ - textColor: UM.Theme.getColor("text_scene"); - font: UM.Theme.getFont("default_bold"); - background: Rectangle { + + style: TextFieldStyle + { + textColor: UM.Theme.getColor("text_scene") + font: UM.Theme.getFont("default_bold") + background: Rectangle + { opacity: 0 border.width: 0 } @@ -100,7 +114,8 @@ Item { } } - Row { + Row + { id: additionalComponentsRow anchors.top: jobNameRow.bottom anchors.right: parent.right @@ -117,10 +132,7 @@ Item { { return UM.Theme.getSize("default_margin").width } - else - { - return 0; - } + return 0 } height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter @@ -129,21 +141,25 @@ Item { text: CuraApplication.getSceneBoundingBoxString } - Component.onCompleted: { + Component.onCompleted: + { base.addAdditionalComponents("jobSpecsButton") } - Connections { + Connections + { target: CuraApplication onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton") } - function addAdditionalComponents (areaId) { - if(areaId == "jobSpecsButton") { - for (var component in CuraApplication.additionalComponents["jobSpecsButton"]) { + function addAdditionalComponents (areaId) + { + if (areaId == "jobSpecsButton") + { + for (var component in CuraApplication.additionalComponents["jobSpecsButton"]) + { CuraApplication.additionalComponents["jobSpecsButton"][component].parent = additionalComponentsRow } } } - } From 0e22f6b672a29c8b57309332a1f77355f151f870 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 5 Dec 2018 13:30:01 +0100 Subject: [PATCH 447/558] Fix an issue that caused a non-deterministic segfault Also add a topMargin only when there are tabs in the custom print setup. Contributes to CURA-5941. --- .../Custom/CustomPrintSetup.qml | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 8b0f3524d7..b28c9ceb46 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -52,8 +52,6 @@ Item rightMargin: parent.padding } - currentIndex: Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) - Repeater { id: repeater @@ -76,15 +74,27 @@ Item } } - // When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt. - // This causes the currentIndex of the tab to be in an invalid position which resets it to 0. - // Therefore we need to change it back to what it was: The active extruder index. + //When active extruder changes for some other reason, switch tabs. + //Don't directly link currentIndex to Cura.ExtruderManager.activeExtruderIndex! + //This causes a segfault in Qt 5.11. Something with VisualItemModel removing index -1. We have to use setCurrentIndex instead. + Connections + { + target: Cura.ExtruderManager + onActiveExtruderChanged: + { + tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex); + } + } + + //When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt. + //This causes the currentIndex of the tab to be in an invalid position which resets it to 0. + //Therefore we need to change it back to what it was: The active extruder index. Connections { target: repeater.model onModelChanged: { - tabBar.currentIndex = Math.max(Cura.ExtruderManager.activeExtruderIndex, 0) + tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex) } } } @@ -94,7 +104,7 @@ Item height: UM.Theme.getSize("print_setup_widget").height anchors { - top: tabBar.bottom + top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom left: parent.left leftMargin: parent.padding right: parent.right From 07d210483c91d77c3198548a386247fdc993df2f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 13:42:13 +0100 Subject: [PATCH 448/558] Greatly decrease the bloat / complexity of the toolbox There was a lot of stuff going on that didn't need to happen, so I cut those parts out in order to improve the overview. --- plugins/Toolbox/src/AuthorsModel.py | 5 +-- plugins/Toolbox/src/PackagesModel.py | 5 +-- plugins/Toolbox/src/Toolbox.py | 54 ++++++++++++++-------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/plugins/Toolbox/src/AuthorsModel.py b/plugins/Toolbox/src/AuthorsModel.py index 8fafda54ec..877f8256ee 100644 --- a/plugins/Toolbox/src/AuthorsModel.py +++ b/plugins/Toolbox/src/AuthorsModel.py @@ -29,8 +29,9 @@ class AuthorsModel(ListModel): self._filter = {} # type: Dict[str, str] def setMetadata(self, data: List[Dict[str, Union[str, List[str], int]]]): - self._metadata = data - self._update() + if self._metadata != data: + self._metadata = data + self._update() def _update(self) -> None: items = [] # type: List[Dict[str, Union[str, List[str], int, None]]] diff --git a/plugins/Toolbox/src/PackagesModel.py b/plugins/Toolbox/src/PackagesModel.py index 2849a29c99..f941804653 100644 --- a/plugins/Toolbox/src/PackagesModel.py +++ b/plugins/Toolbox/src/PackagesModel.py @@ -45,8 +45,9 @@ class PackagesModel(ListModel): self._filter = {} # type: Dict[str, str] def setMetadata(self, data): - self._metadata = data - self._update() + if self._metadata != data: + self._metadata = data + self._update() def _update(self): items = [] diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 5db3dd934f..7b1442ff3c 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -66,8 +66,8 @@ class Toolbox(QObject, Extension): self._old_plugin_ids = set() # type: Set[str] self._old_plugin_metadata = dict() # type: Dict[str, Dict[str, Any]] - # Data: - self._metadata = { + # The responses as given by the server parsed to a list. + self._server_response_data = { "authors": [], "packages": [], } # type: Dict[str, List[Any]] @@ -301,13 +301,13 @@ class Toolbox(QObject, Extension): if plugin_id not in all_plugin_package_ids) self._old_plugin_metadata = {k: v for k, v in self._old_plugin_metadata.items() if k in self._old_plugin_ids} - self._metadata["plugins_installed"] = all_packages["plugin"] + list(self._old_plugin_metadata.values()) - self._models["plugins_installed"].setMetadata(self._metadata["plugins_installed"]) + self._server_response_data["plugins_installed"] = all_packages["plugin"] + list(self._old_plugin_metadata.values()) + self._models["plugins_installed"].setMetadata(self._server_response_data["plugins_installed"]) self.metadataChanged.emit() if "material" in all_packages: - self._metadata["materials_installed"] = all_packages["material"] + self._server_response_data["materials_installed"] = all_packages["material"] # TODO: ADD MATERIALS HERE ONCE MATERIALS PORTION OF TOOLBOX IS LIVE - self._models["materials_installed"].setMetadata(self._metadata["materials_installed"]) + self._models["materials_installed"].setMetadata(self._server_response_data["materials_installed"]) self.metadataChanged.emit() @pyqtSlot(str) @@ -461,7 +461,7 @@ class Toolbox(QObject, Extension): def getRemotePackage(self, package_id: str) -> Optional[Dict]: # TODO: make the lookup in a dict, not a loop. canUpdate is called for every item. remote_package = None - for package in self._metadata["packages"]: + for package in self._server_response_data["packages"]: if package["package_id"] == package_id: remote_package = package break @@ -524,7 +524,7 @@ class Toolbox(QObject, Extension): @pyqtSlot(str, result = int) def getNumberOfInstalledPackagesByAuthor(self, author_id: str) -> int: count = 0 - for package in self._metadata["materials_installed"]: + for package in self._server_response_data["materials_installed"]: if package["author"]["author_id"] == author_id: count += 1 return count @@ -533,7 +533,7 @@ class Toolbox(QObject, Extension): @pyqtSlot(str, result = int) def getTotalNumberOfMaterialPackagesByAuthor(self, author_id: str) -> int: count = 0 - for package in self._metadata["packages"]: + for package in self._server_response_data["packages"]: if package["package_type"] == "material": if package["author"]["author_id"] == author_id: count += 1 @@ -554,10 +554,10 @@ class Toolbox(QObject, Extension): def isLoadingComplete(self) -> bool: populated = 0 - for metadata_list in self._metadata.items(): + for metadata_list in self._server_response_data.items(): if metadata_list: populated += 1 - return populated == len(self._metadata.items()) + return populated == len(self._server_response_data.items()) # Make API Calls # -------------------------------------------------------------------------- @@ -639,15 +639,13 @@ class Toolbox(QObject, Extension): Logger.log("e", "Could not find the %s model.", response_type) break - self._metadata[response_type] = json_data["data"] - self._models[response_type].setMetadata(self._metadata[response_type]) + self._server_response_data[response_type] = json_data["data"] + self._models[response_type].setMetadata(self._server_response_data[response_type]) - # Do some auto filtering - # TODO: Make multiple API calls in the future to handle this if response_type is "packages": self._models[response_type].setFilter({"type": "plugin"}) self.reBuildMaterialsModels() - self.buildPluginsModels() + self.reBuildPluginsModels() elif response_type is "authors": self._models[response_type].setFilter({"package_types": "material"}) self._models[response_type].setFilter({"tags": "generic"}) @@ -743,39 +741,39 @@ class Toolbox(QObject, Extension): # Exposed Models: # -------------------------------------------------------------------------- - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def authorsModel(self) -> AuthorsModel: return cast(AuthorsModel, self._models["authors"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def packagesModel(self) -> PackagesModel: return cast(PackagesModel, self._models["packages"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def pluginsShowcaseModel(self) -> PackagesModel: return cast(PackagesModel, self._models["plugins_showcase"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def pluginsAvailableModel(self) -> PackagesModel: return cast(PackagesModel, self._models["plugins_available"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def pluginsInstalledModel(self) -> PackagesModel: return cast(PackagesModel, self._models["plugins_installed"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def materialsShowcaseModel(self) -> AuthorsModel: return cast(AuthorsModel, self._models["materials_showcase"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def materialsAvailableModel(self) -> AuthorsModel: return cast(AuthorsModel, self._models["materials_available"]) - @pyqtProperty(QObject, notify = metadataChanged) + @pyqtProperty(QObject, constant=True) def materialsInstalledModel(self) -> PackagesModel: return cast(PackagesModel, self._models["materials_installed"]) - @pyqtProperty(QObject, notify=metadataChanged) + @pyqtProperty(QObject, constant=True) def materialsGenericModel(self) -> PackagesModel: return cast(PackagesModel, self._models["materials_generic"]) @@ -814,7 +812,7 @@ class Toolbox(QObject, Extension): processed_authors = [] # type: List[str] - for item in self._metadata["packages"]: + for item in self._server_response_data["packages"]: if item["package_type"] == "material": author = item["author"] @@ -836,11 +834,11 @@ class Toolbox(QObject, Extension): self._models["materials_available"].setMetadata(materials_available_metadata) self._models["materials_generic"].setMetadata(materials_generic_metadata) - def buildPluginsModels(self) -> None: + def reBuildPluginsModels(self) -> None: plugins_showcase_metadata = [] plugins_available_metadata = [] - for item in self._metadata["packages"]: + for item in self._server_response_data["packages"]: if item["package_type"] == "plugin": if "showcase" in item["tags"]: plugins_showcase_metadata.append(item) From a52f866f818324994b1a1b34f06805ffd3ed24d0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 14:03:32 +0100 Subject: [PATCH 449/558] Move most models out of dictionary CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 47 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 7b1442ff3c..ada81dbc07 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -70,21 +70,25 @@ class Toolbox(QObject, Extension): self._server_response_data = { "authors": [], "packages": [], + "plugins_installed": [], + "materials_installed": [] } # type: Dict[str, List[Any]] # Models: self._models = { "authors": AuthorsModel(self), "packages": PackagesModel(self), - "plugins_showcase": PackagesModel(self), - "plugins_available": PackagesModel(self), - "plugins_installed": PackagesModel(self), - "materials_showcase": AuthorsModel(self), - "materials_available": AuthorsModel(self), - "materials_installed": PackagesModel(self), - "materials_generic": PackagesModel(self) } # type: Dict[str, ListModel] + self._plugins_showcase_model = PackagesModel(self) + self._plugins_available_model = PackagesModel(self) + self._plugins_installed_model = PackagesModel(self) + + self._materials_showcase_model = AuthorsModel(self) + self._materials_available_model = AuthorsModel(self) + self._materials_installed_model = PackagesModel(self) + self._materials_generic_model = PackagesModel(self) + # These properties are for keeping track of the UI state: # ---------------------------------------------------------------------- # View category defines which filter to use, and therefore effectively @@ -302,12 +306,11 @@ class Toolbox(QObject, Extension): self._old_plugin_metadata = {k: v for k, v in self._old_plugin_metadata.items() if k in self._old_plugin_ids} self._server_response_data["plugins_installed"] = all_packages["plugin"] + list(self._old_plugin_metadata.values()) - self._models["plugins_installed"].setMetadata(self._server_response_data["plugins_installed"]) + self._plugins_installed_model.setMetadata(self._server_response_data["plugins_installed"]) self.metadataChanged.emit() if "material" in all_packages: self._server_response_data["materials_installed"] = all_packages["material"] - # TODO: ADD MATERIALS HERE ONCE MATERIALS PORTION OF TOOLBOX IS LIVE - self._models["materials_installed"].setMetadata(self._server_response_data["materials_installed"]) + self._materials_installed_model.setMetadata(all_packages["material"]) self.metadataChanged.emit() @pyqtSlot(str) @@ -751,31 +754,31 @@ class Toolbox(QObject, Extension): @pyqtProperty(QObject, constant=True) def pluginsShowcaseModel(self) -> PackagesModel: - return cast(PackagesModel, self._models["plugins_showcase"]) + return self._plugins_showcase_model @pyqtProperty(QObject, constant=True) def pluginsAvailableModel(self) -> PackagesModel: - return cast(PackagesModel, self._models["plugins_available"]) + return self._plugins_available_model @pyqtProperty(QObject, constant=True) def pluginsInstalledModel(self) -> PackagesModel: - return cast(PackagesModel, self._models["plugins_installed"]) + return self._plugins_installed_model @pyqtProperty(QObject, constant=True) def materialsShowcaseModel(self) -> AuthorsModel: - return cast(AuthorsModel, self._models["materials_showcase"]) + return self._materials_showcase_model @pyqtProperty(QObject, constant=True) def materialsAvailableModel(self) -> AuthorsModel: - return cast(AuthorsModel, self._models["materials_available"]) + return self._materials_available_model @pyqtProperty(QObject, constant=True) def materialsInstalledModel(self) -> PackagesModel: - return cast(PackagesModel, self._models["materials_installed"]) + return self._materials_installed_model @pyqtProperty(QObject, constant=True) def materialsGenericModel(self) -> PackagesModel: - return cast(PackagesModel, self._models["materials_generic"]) + return self._materials_generic_model # Filter Models: # -------------------------------------------------------------------------- @@ -830,9 +833,9 @@ class Toolbox(QObject, Extension): processed_authors.append(author["author_id"]) - self._models["materials_showcase"].setMetadata(materials_showcase_metadata) - self._models["materials_available"].setMetadata(materials_available_metadata) - self._models["materials_generic"].setMetadata(materials_generic_metadata) + self._materials_showcase_model.setMetadata(materials_showcase_metadata) + self._materials_available_model.setMetadata(materials_available_metadata) + self._materials_generic_model.setMetadata(materials_generic_metadata) def reBuildPluginsModels(self) -> None: plugins_showcase_metadata = [] @@ -845,5 +848,5 @@ class Toolbox(QObject, Extension): else: plugins_available_metadata.append(item) - self._models["plugins_showcase"].setMetadata(plugins_showcase_metadata) - self._models["plugins_available"].setMetadata(plugins_available_metadata) + self._plugins_showcase_model.setMetadata(plugins_showcase_metadata) + self._plugins_available_model.setMetadata(plugins_available_metadata) From d6630b68815781ba92edae3510aaf62cf77b4d0d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 14:09:55 +0100 Subject: [PATCH 450/558] Removed some more cases where data was duplicated and re-used for different purposes CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index ada81dbc07..f70543d5d7 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -69,16 +69,14 @@ class Toolbox(QObject, Extension): # The responses as given by the server parsed to a list. self._server_response_data = { "authors": [], - "packages": [], - "plugins_installed": [], - "materials_installed": [] + "packages": [] } # type: Dict[str, List[Any]] # Models: self._models = { "authors": AuthorsModel(self), "packages": PackagesModel(self), - } # type: Dict[str, ListModel] + } # type: Dict[str, Union[AuthorsModel, PackagesModel]] self._plugins_showcase_model = PackagesModel(self) self._plugins_available_model = PackagesModel(self) @@ -305,11 +303,9 @@ class Toolbox(QObject, Extension): if plugin_id not in all_plugin_package_ids) self._old_plugin_metadata = {k: v for k, v in self._old_plugin_metadata.items() if k in self._old_plugin_ids} - self._server_response_data["plugins_installed"] = all_packages["plugin"] + list(self._old_plugin_metadata.values()) - self._plugins_installed_model.setMetadata(self._server_response_data["plugins_installed"]) + self._plugins_installed_model.setMetadata(all_packages["plugin"] + list(self._old_plugin_metadata.values())) self.metadataChanged.emit() if "material" in all_packages: - self._server_response_data["materials_installed"] = all_packages["material"] self._materials_installed_model.setMetadata(all_packages["material"]) self.metadataChanged.emit() @@ -527,8 +523,8 @@ class Toolbox(QObject, Extension): @pyqtSlot(str, result = int) def getNumberOfInstalledPackagesByAuthor(self, author_id: str) -> int: count = 0 - for package in self._server_response_data["materials_installed"]: - if package["author"]["author_id"] == author_id: + for package in self._materials_installed_model.items: + if package["author_id"] == author_id: count += 1 return count From 5ba8820f185673f0486393187eafca826c657537 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 5 Dec 2018 14:10:51 +0100 Subject: [PATCH 451/558] Remove unnecessary setting height to 0 when invisible Turns out that it doesn't count for the childrenRect.height anyway when the item is invisible. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml | 2 +- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index 58b6bac089..a09d6d2ba4 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura Item { width: parent.width - height: visible ? childrenRect.height : 0 + height: childrenRect.height Label { diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 18c2dabb0f..19b7158929 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -17,7 +17,7 @@ Item } width: parent.width - height: visible ? childrenRect.height : 0 + height: childrenRect.height Label { From 218fa3aded7ed4e4fb77bd092ca7e798ca948dae Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 5 Dec 2018 14:22:04 +0100 Subject: [PATCH 452/558] Align the print info to the left --- resources/qml/Cura.qml | 26 ++++---- resources/qml/JobSpecs.qml | 126 +++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 81 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3578888886..6559fafa12 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -189,16 +189,6 @@ UM.MainWindow onHideTooltip: base.hideTooltip() } - JobSpecs - { - id: jobSpecs - anchors - { - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height - } - } - Toolbar { // The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by @@ -228,6 +218,19 @@ UM.MainWindow } } + JobSpecs + { + id: jobSpecs + visible: CuraApplication.platformActivity + anchors + { + left: parent.left + bottom: viewOrientationControls.top + margins: UM.Theme.getSize("wide_margin").width + bottomMargin: UM.Theme.getSize("default_margin").width + } + } + ViewOrientationControls { id: viewOrientationControls @@ -235,9 +238,8 @@ UM.MainWindow anchors { left: parent.left - margins: UM.Theme.getSize("default_margin").width - bottom: parent.bottom + margins: UM.Theme.getSize("wide_margin").width } } diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 19b5b3f2de..97e12e15a3 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -19,9 +19,10 @@ Item UM.I18nCatalog { id: catalog - name:"cura" + name: "cura" } + width: childrenRect.width height: childrenRect.height onActivityChanged: @@ -33,82 +34,75 @@ Item } } - Rectangle + Item { id: jobNameRow anchors.top: parent.top - anchors.right: parent.right + anchors.left: parent.left height: UM.Theme.getSize("jobspecs_line").height - visible: base.activity - Item + Button { - width: parent.width - height: parent.height + id: printJobPencilIcon + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height - Button + onClicked: { - id: printJobPencilIcon - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height + printJobTextfield.selectAll() + printJobTextfield.focus = true + } - onClicked: + style: ButtonStyle + { + background: Item { - printJobTextfield.selectAll() - printJobTextfield.focus = true - } - - style: ButtonStyle - { - background: Item + UM.RecolorImage { - UM.RecolorImage - { - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene") - source: UM.Theme.getIcon("pencil") - } + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene") + source: UM.Theme.getIcon("pencil") } } } + } - TextField + TextField + { + id: printJobTextfield + anchors.left: printJobPencilIcon.right + anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + height: UM.Theme.getSize("jobspecs_line").height + width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) + maximumLength: 120 + property int unremovableSpacing: 5 + text: PrintInformation.jobName + horizontalAlignment: TextInput.AlignLeft + + onEditingFinished: { - id: printJobTextfield - anchors.right: printJobPencilIcon.left - anchors.rightMargin: UM.Theme.getSize("narrow_margin").width - height: UM.Theme.getSize("jobspecs_line").height - width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) - maximumLength: 120 - property int unremovableSpacing: 5 - text: PrintInformation.jobName - horizontalAlignment: TextInput.AlignRight + var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text + PrintInformation.setJobName(new_name, true) + printJobTextfield.focus = false + } - onEditingFinished: + validator: RegExpValidator { + regExp: /^[^\\\/\*\?\|\[\]]*$/ + } + + style: TextFieldStyle + { + textColor: UM.Theme.getColor("text_scene") + font: UM.Theme.getFont("default_bold") + background: Rectangle { - var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text - PrintInformation.setJobName(new_name, true) - printJobTextfield.focus = false - } - - validator: RegExpValidator { - regExp: /^[^\\\/\*\?\|\[\]]*$/ - } - - style: TextFieldStyle - { - textColor: UM.Theme.getColor("text_scene") - font: UM.Theme.getFont("default_bold") - background: Rectangle - { - opacity: 0 - border.width: 0 - } + opacity: 0 + border.width: 0 } } } @@ -118,22 +112,16 @@ Item { id: additionalComponentsRow anchors.top: jobNameRow.bottom - anchors.right: parent.right + anchors.left: parent.left } Label { id: boundingSpec anchors.top: jobNameRow.bottom - anchors.right: additionalComponentsRow.left - anchors.rightMargin: - { - if (additionalComponentsRow.width > 0) - { - return UM.Theme.getSize("default_margin").width - } - return 0 - } + anchors.left: additionalComponentsRow.right + anchors.leftMargin: additionalComponentsRow.width > 0 ? UM.Theme.getSize("default_margin").width : 0 + height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter font: UM.Theme.getFont("default_bold") From 00e95e68eb974e19ac3f6960b86965dd9ada8fbf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 5 Dec 2018 14:26:47 +0100 Subject: [PATCH 453/558] Removed unneeded Marketplace tag in logging The logger does that all by itself already. CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index f70543d5d7..cd20d26eca 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -781,7 +781,7 @@ class Toolbox(QObject, Extension): @pyqtSlot(str, str, str) def filterModelByProp(self, model_type: str, filter_type: str, parameter: str) -> None: if not self._models[model_type]: - Logger.log("w", "Marketplace: Couldn't filter %s model because it doesn't exist.", model_type) + Logger.log("w", "Couldn't filter %s model because it doesn't exist.", model_type) return self._models[model_type].setFilter({filter_type: parameter}) self.filterChanged.emit() @@ -789,7 +789,7 @@ class Toolbox(QObject, Extension): @pyqtSlot(str, "QVariantMap") def setFilters(self, model_type: str, filter_dict: dict) -> None: if not self._models[model_type]: - Logger.log("w", "Marketplace: Couldn't filter %s model because it doesn't exist.", model_type) + Logger.log("w", "Couldn't filter %s model because it doesn't exist.", model_type) return self._models[model_type].setFilter(filter_dict) self.filterChanged.emit() @@ -797,7 +797,7 @@ class Toolbox(QObject, Extension): @pyqtSlot(str) def removeFilters(self, model_type: str) -> None: if not self._models[model_type]: - Logger.log("w", "Marketplace: Couldn't remove filters on %s model because it doesn't exist.", model_type) + Logger.log("w", "Couldn't remove filters on %s model because it doesn't exist.", model_type) return self._models[model_type].setFilter({}) self.filterChanged.emit() From c757bf128e9fae8895973956a671fc0bcc430b31 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 09:12:43 +0100 Subject: [PATCH 454/558] Adjust colors and alignments in the print info panel --- resources/qml/Cura.qml | 6 +++--- resources/qml/ExpandableComponent.qml | 2 +- resources/themes/cura-light/theme.json | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 6559fafa12..ba1230f37d 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -226,8 +226,8 @@ UM.MainWindow { left: parent.left bottom: viewOrientationControls.top - margins: UM.Theme.getSize("wide_margin").width - bottomMargin: UM.Theme.getSize("default_margin").width + margins: UM.Theme.getSize("default_margin").width + bottomMargin: UM.Theme.getSize("thin_margin").width } } @@ -239,7 +239,7 @@ UM.MainWindow { left: parent.left bottom: parent.bottom - margins: UM.Theme.getSize("wide_margin").width + margins: UM.Theme.getSize("default_margin").width } } diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 9bedaa940c..3991ed74ba 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -142,7 +142,7 @@ Item visible: source != "" width: height height: Math.round(0.2 * base.height) - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("small_button_text") } MouseArea diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 767b6eaccd..3cea54ac77 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -123,8 +123,8 @@ "text_subtext": [0, 0, 0, 255], "text_medium": [128, 128, 128, 255], "text_emphasis": [255, 255, 255, 255], - "text_scene": [31, 36, 39, 255], - "text_scene_hover": [70, 84, 113, 255], + "text_scene": [102, 102, 102, 255], + "text_scene_hover": [123, 123, 113, 255], "error": [255, 140, 0, 255], "warning": [255, 190, 35, 255], @@ -144,10 +144,10 @@ "button_text_active_hover": [255, 255, 255, 255], "small_button": [0, 0, 0, 0], - "small_button_hover": [10, 8, 80, 255], + "small_button_hover": [102, 102, 102, 255], "small_button_active": [10, 8, 80, 255], "small_button_active_hover": [10, 8, 80, 255], - "small_button_text": [171, 171, 191, 255], + "small_button_text": [102, 102, 102, 255], "small_button_text_hover": [255, 255, 255, 255], "small_button_text_active": [255, 255, 255, 255], "small_button_text_active_hover": [255, 255, 255, 255], From b0c3a4e17a558154807a7807218367cb1b158a64 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 09:25:31 +0100 Subject: [PATCH 455/558] Align the additional components to the right of the job specs The model checker now shows centered --- plugins/ModelChecker/ModelChecker.qml | 12 +++++++----- resources/qml/JobSpecs.qml | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/plugins/ModelChecker/ModelChecker.qml b/plugins/ModelChecker/ModelChecker.qml index 437df29516..ddeed063b1 100644 --- a/plugins/ModelChecker/ModelChecker.qml +++ b/plugins/ModelChecker/ModelChecker.qml @@ -4,19 +4,19 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.2 import UM 1.2 as UM -import Cura 1.0 as Cura Button { id: modelCheckerButton - UM.I18nCatalog{id: catalog; name: "cura"} + UM.I18nCatalog + { + id: catalog + name: "cura" + } visible: manager.hasWarnings tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.") @@ -25,6 +25,8 @@ Button width: UM.Theme.getSize("save_button_specs_icons").width height: UM.Theme.getSize("save_button_specs_icons").height + anchors.verticalCenter: parent ? parent.verticalCenter : undefined + style: ButtonStyle { background: Item diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 97e12e15a3..8b06ab06db 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -108,19 +108,11 @@ Item } } - Row - { - id: additionalComponentsRow - anchors.top: jobNameRow.bottom - anchors.left: parent.left - } - Label { id: boundingSpec anchors.top: jobNameRow.bottom - anchors.left: additionalComponentsRow.right - anchors.leftMargin: additionalComponentsRow.width > 0 ? UM.Theme.getSize("default_margin").width : 0 + anchors.left: parent.left height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter @@ -129,6 +121,15 @@ Item text: CuraApplication.getSceneBoundingBoxString } + Row + { + id: additionalComponentsRow + anchors.top: boundingSpec.top + anchors.bottom: boundingSpec.bottom + anchors.left: boundingSpec.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + } + Component.onCompleted: { base.addAdditionalComponents("jobSpecsButton") @@ -140,7 +141,7 @@ Item onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton") } - function addAdditionalComponents (areaId) + function addAdditionalComponents(areaId) { if (areaId == "jobSpecsButton") { From 838949dac74831e38e9f07fe7d628af7807320db Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 09:45:27 +0100 Subject: [PATCH 456/558] Moved qml pages of toolbox to a loader This dramatically improves the loading of the toolbox dialog CURA-6006 --- plugins/Toolbox/resources/qml/Toolbox.qml | 54 ++++++++++----------- plugins/Toolbox/src/Toolbox.py | 59 +++++++++++------------ 2 files changed, 52 insertions(+), 61 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 853cec399d..d3d980b0b3 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -44,36 +44,31 @@ Window top: header.bottom bottom: footer.top } - // TODO: This could be improved using viewFilter instead of viewCategory - ToolboxLoadingPage + + Loader { - id: viewLoading - visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "loading" - } - ToolboxErrorPage - { - id: viewErrored - visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "errored" - } - ToolboxDownloadsPage - { - id: viewDownloads - visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "overview" - } - ToolboxDetailPage - { - id: viewDetail - visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "detail" - } - ToolboxAuthorPage - { - id: viewAuthor - visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "author" - } - ToolboxInstalledPage - { - id: installedPluginList - visible: toolbox.viewCategory == "installed" + anchors.fill:parent + source: + { + if(toolbox.viewCategory == "installed") + { + return "ToolboxInstalledPage.qml" + } + + switch (toolbox.viewPage) + { + case "loading": + return "ToolboxLoadingPage.qml" + case "errored": + return "ToolboxErrorPage.qml" + case "overview": + return "ToolboxDownloadsPage.qml" + case "detail": + return "ToolboxDetailPage.qml" + case "author": + return "ToolboxAuthorPage.qml" + } + } } } @@ -95,6 +90,7 @@ Window licenseDialog.show(); } } + ToolboxLicenseDialog { id: licenseDialog diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index cd20d26eca..c8349827a9 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -622,44 +622,39 @@ class Toolbox(QObject, Extension): if reply.operation() == QNetworkAccessManager.GetOperation: for response_type, url in self._request_urls.items(): - if reply.url() == url: - if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: - try: - json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) + if reply.url() != url: + continue - # Check for errors: - if "errors" in json_data: - for error in json_data["errors"]: - Logger.log("e", "%s", error["title"]) - return + if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: + try: + json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) + except json.decoder.JSONDecodeError: + Logger.log("w", "Received invalid JSON for %s.", response_type) + break - # Create model and apply metadata: - if not self._models[response_type]: - Logger.log("e", "Could not find the %s model.", response_type) - break - - self._server_response_data[response_type] = json_data["data"] - self._models[response_type].setMetadata(self._server_response_data[response_type]) + # Check for errors: + if "errors" in json_data: + for error in json_data["errors"]: + Logger.log("e", "%s", error["title"]) + return - if response_type is "packages": - self._models[response_type].setFilter({"type": "plugin"}) - self.reBuildMaterialsModels() - self.reBuildPluginsModels() - elif response_type is "authors": - self._models[response_type].setFilter({"package_types": "material"}) - self._models[response_type].setFilter({"tags": "generic"}) + self._server_response_data[response_type] = json_data["data"] + self._models[response_type].setMetadata(json_data["data"]) - self.metadataChanged.emit() + if response_type is "packages": + self._models["packages"].setFilter({"type": "plugin"}) + self.reBuildMaterialsModels() + self.reBuildPluginsModels() + elif response_type is "authors": + self._models["authors"].setFilter({"tags": "generic"}) - if self.isLoadingComplete(): - self.setViewPage("overview") + self.metadataChanged.emit() - except json.decoder.JSONDecodeError: - Logger.log("w", "Received invalid JSON for %s.", response_type) - break - else: - self.setViewPage("errored") - self.resetDownload() + if self.isLoadingComplete(): + self.setViewPage("overview") + else: + self.setViewPage("errored") + self.resetDownload() else: # Ignore any operation that is not a get operation pass From 6a466c99b241035a6dc6d9cbbf174f39d51aad3d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 09:54:32 +0100 Subject: [PATCH 457/558] Make the progressButton use signals instead of functions Although the naming is still a bit off, it's much cleaner to use signals instead of functions. It's also more in line with how default QML components handle these kind of situations CURA-6006 --- plugins/Toolbox/resources/qml/Toolbox.qml | 2 +- .../qml/ToolboxDetailTileActions.qml | 23 ++++++++----------- .../qml/ToolboxInstalledTileActions.qml | 8 +++---- .../resources/qml/ToolboxProgressButton.qml | 12 +++++----- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index d3d980b0b3..b2bab4355a 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -90,7 +90,7 @@ Window licenseDialog.show(); } } - + ToolboxLicenseDialog { id: licenseDialog diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index cd1e4cdbda..72a9d14dcd 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -18,19 +18,15 @@ Column id: installButton active: toolbox.isDownloading && toolbox.activePackage == model complete: installed - readyAction: function() + onReadyAction: { toolbox.activePackage = model toolbox.startDownload(model.download_url) } - activeAction: function() - { - toolbox.cancelDownload() - } - completeAction: function() - { - toolbox.viewCategory = "installed" - } + onActiveAction: toolbox.cancelDownload() + + onCompleteAction: toolbox.viewCategory = "installed" + // Don't allow installing while another download is running enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model) opacity: enabled ? 1.0 : 0.5 @@ -44,20 +40,19 @@ Column readyLabel: catalog.i18nc("@action:button", "Update") activeLabel: catalog.i18nc("@action:button", "Updating") completeLabel: catalog.i18nc("@action:button", "Updated") - readyAction: function() + + onReadyAction: { toolbox.activePackage = model toolbox.update(model.id) } - activeAction: function() - { - toolbox.cancelDownload() - } + onActiveAction: toolbox.cancelDownload() // Don't allow installing while another download is running enabled: !(toolbox.isDownloading && toolbox.activePackage != model) opacity: enabled ? 1.0 : 0.5 visible: canUpdate } + Connections { target: toolbox diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml index 8fd88b1cfd..621ecd96ea 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -30,15 +30,13 @@ Column readyLabel: catalog.i18nc("@action:button", "Update") activeLabel: catalog.i18nc("@action:button", "Updating") completeLabel: catalog.i18nc("@action:button", "Updated") - readyAction: function() + onReadyAction: { toolbox.activePackage = model toolbox.update(model.id) } - activeAction: function() - { - toolbox.cancelDownload() - } + onActiveAction: toolbox.cancelDownload() + // Don't allow installing while another download is running enabled: !(toolbox.isDownloading && toolbox.activePackage != model) opacity: enabled ? 1.0 : 0.5 diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index 2744e40ec9..00b0b985f5 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -18,9 +18,9 @@ Item property var activeLabel: catalog.i18nc("@action:button", "Cancel") property var completeLabel: catalog.i18nc("@action:button", "Installed") - property var readyAction: null // Action when button is ready and clicked (likely install) - property var activeAction: null // Action when button is active and clicked (likely cancel) - property var completeAction: null // Action when button is complete and clicked (likely go to installed) + signal readyAction() // Action when button is ready and clicked (likely install) + signal activeAction() // Action when button is active and clicked (likely cancel) + signal completeAction() // Action when button is complete and clicked (likely go to installed) width: UM.Theme.getSize("toolbox_action_button").width height: UM.Theme.getSize("toolbox_action_button").height @@ -47,15 +47,15 @@ Item { if (complete) { - return completeAction() + completeAction() } else if (active) { - return activeAction() + activeAction() } else { - return readyAction() + readyAction() } } style: ButtonStyle From 2602d5bf02287745831d3d264bbc8e3dcda37541 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 10:46:19 +0100 Subject: [PATCH 458/558] Add changed checks to prevent unneeded signals from being fired CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index c8349827a9..68919cf987 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -546,7 +546,7 @@ class Toolbox(QObject, Extension): # Check for plugins that were installed with the old plugin browser def isOldPlugin(self, plugin_id: str) -> bool: - return plugin_id in self._old_plugin_ids + return plugin_id in self._old_plugin_ids def getOldPluginPackageMetadata(self, plugin_id: str) -> Optional[Dict[str, Any]]: return self._old_plugin_metadata.get(plugin_id) @@ -709,8 +709,9 @@ class Toolbox(QObject, Extension): return self._is_downloading def setActivePackage(self, package: Dict[str, Any]) -> None: - self._active_package = package - self.activePackageChanged.emit() + if self._active_package != package: + self._active_package = package + self.activePackageChanged.emit() ## The active package is the package that is currently being downloaded @pyqtProperty(QObject, fset = setActivePackage, notify = activePackageChanged) @@ -718,16 +719,18 @@ class Toolbox(QObject, Extension): return self._active_package def setViewCategory(self, category: str = "plugin") -> None: - self._view_category = category - self.viewChanged.emit() + if self._view_category != category: + self._view_category = category + self.viewChanged.emit() @pyqtProperty(str, fset = setViewCategory, notify = viewChanged) def viewCategory(self) -> str: return self._view_category def setViewPage(self, page: str = "overview") -> None: - self._view_page = page - self.viewChanged.emit() + if self._view_page != page: + self._view_page = page + self.viewChanged.emit() @pyqtProperty(str, fset = setViewPage, notify = viewChanged) def viewPage(self) -> str: From f7f3c96f81d82cead247c3ecd0d3925d79047a48 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Dec 2018 10:53:40 +0100 Subject: [PATCH 459/558] Fix typo CURA-5941 --- .../Recommended/RecommendedAdhesionSelector.qml | 2 +- .../Recommended/RecommendedInfillDensitySelector.qml | 2 +- .../Recommended/RecommendedPrintSetup.qml | 2 +- .../Recommended/RecommendedSupportSelector.qml | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml index 3092644d4e..a5f35f333b 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -50,7 +50,7 @@ Item //: Setting enable printing build-plate adhesion helper checkbox style: UM.Theme.styles.checkbox - enabled: recommendedPrintSettup.settingsEnabled + enabled: recommendedPrintSetup.settingsEnabled visible: platformAdhesionType.properties.enabled == "True" checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 7c026ac9de..2971415948 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -189,7 +189,7 @@ Item text: catalog.i18nc("@label", "Gradual infill") style: UM.Theme.styles.checkbox - enabled: recommendedPrintSettup.settingsEnabled + enabled: recommendedPrintSetup.settingsEnabled visible: infillSteps.properties.enabled == "True" checked: parseInt(infillSteps.properties.value) > 0 diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 618c519d31..6885f8c041 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura Item { - id: recommendedPrintSettup + id: recommendedPrintSetup height: childrenRect.height + 2 * padding diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index da46f2a735..57e0c8ce6b 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -50,7 +50,7 @@ Item property alias _hovered: enableSupportMouseArea.containsMouse style: UM.Theme.styles.checkbox - enabled: recommendedPrintSettup.settingsEnabled + enabled: recommendedPrintSetup.settingsEnabled visible: supportEnabled.properties.enabled == "True" checked: supportEnabled.properties.value == "True" @@ -87,7 +87,7 @@ Item } style: UM.Theme.styles.combobox_color - enabled: recommendedPrintSettup.settingsEnabled + enabled: recommendedPrintSetup.settingsEnabled visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started @@ -127,7 +127,7 @@ Item id: supportExtruderMouseArea anchors.fill: parent hoverEnabled: true - enabled: recommendedPrintSettup.settingsEnabled + enabled: recommendedPrintSetup.settingsEnabled acceptedButtons: Qt.NoButton onEntered: { From 48e15daf6410e19fd8eb658061a925c4e714ee1b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 11:16:42 +0100 Subject: [PATCH 460/558] Fix height of scroll view and make scrollable Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- .../qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index af2712be44..6ac1e6a2ad 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -14,7 +14,7 @@ Button property var configuration: null hoverEnabled: true - height: childrenRect.height + height: background.height background: Rectangle { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 5a9f72260c..d07337f9c5 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -28,7 +28,9 @@ Column { id: container width: parent.width - height: Math.min(configurationList.contentHeight, 350 * screenScaleFactor) + height: Math.round(Math.min(configurationList.height, 350 * screenScaleFactor)) + contentHeight: configurationList.height + clip: true ButtonGroup { @@ -41,6 +43,7 @@ Column spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) width: container.width contentHeight: childrenRect.height + height: childrenRect.height section.property: "modelData.printerType" section.criteria: ViewSection.FullString From f655e6c43ee115cdad81b7683cab1902cf930258 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 11:30:59 +0100 Subject: [PATCH 461/558] Add a pattern in the background of the header. Adjust some main colors to the ones in the designs. --- resources/qml/Cura.qml | 65 +- resources/qml/MainWindow/MainWindowHeader.qml | 27 +- .../cura-light/images/header_pattern.svg | 1903 ++++++++++++++++- resources/themes/cura-light/theme.json | 22 +- 4 files changed, 1940 insertions(+), 77 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3578888886..f16ae9a19b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -88,6 +88,30 @@ UM.MainWindow window: base } + Rectangle + { + id: headerBackground + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + height: stageMenu.source != "" ? Math.round(mainWindowHeader.height + stageMenu.height / 2) : mainWindowHeader.height + color: UM.Theme.getColor("main_window_header_background") + + // This is the new fancy pattern + Image + { + id: backgourndPattern + anchors.fill: parent + fillMode: Image.Tile + source: UM.Theme.getImage("header_pattern") + horizontalAlignment: Image.AlignLeft + verticalAlignment: Image.AlignTop + } + } + MainWindowHeader { id: mainWindowHeader @@ -144,44 +168,6 @@ UM.MainWindow } } - Rectangle - { - id: stageMenuBackground - anchors - { - left: parent.left - right: parent.right - top: parent.top - } - visible: stageMenu.source != "" - height: visible ? Math.round(UM.Theme.getSize("stage_menu").height / 2) : 0 - - LinearGradient - { - anchors.fill: parent - start: Qt.point(0, 0) - end: Qt.point(parent.width, 0) - gradient: Gradient - { - GradientStop - { - position: 0.0 - color: UM.Theme.getColor("main_window_header_background") - } - GradientStop - { - position: 0.5 - color: UM.Theme.getColor("main_window_header_background_gradient") - } - GradientStop - { - position: 1.0 - color: UM.Theme.getColor("main_window_header_background") - } - } - } - } - Connections { target: stageMenu.item @@ -257,7 +243,8 @@ UM.MainWindow anchors { - top: stageMenuBackground.bottom + // Align to the top of the stageMenu since the stageMenu may not exist + top: parent.top left: parent.left right: parent.right bottom: parent.bottom diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index fa0594e2ae..ae1c13d9c3 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -12,38 +12,13 @@ import QtGraphicalEffects 1.0 import "../Account" -Rectangle +Item { id: base implicitHeight: UM.Theme.getSize("main_window_header").height implicitWidth: UM.Theme.getSize("main_window_header").width - LinearGradient - { - anchors.fill: parent - start: Qt.point(0, 0) - end: Qt.point(parent.width, 0) - gradient: Gradient - { - GradientStop - { - position: 0.0 - color: UM.Theme.getColor("main_window_header_background") - } - GradientStop - { - position: 0.5 - color: UM.Theme.getColor("main_window_header_background_gradient") - } - GradientStop - { - position: 1.0 - color: UM.Theme.getColor("main_window_header_background") - } - } - } - Image { id: logo diff --git a/resources/themes/cura-light/images/header_pattern.svg b/resources/themes/cura-light/images/header_pattern.svg index 2a9de2f3e9..14ea9dc917 100644 --- a/resources/themes/cura-light/images/header_pattern.svg +++ b/resources/themes/cura-light/images/header_pattern.svg @@ -1 +1,1902 @@ -Pattern \ No newline at end of file + + + + Pattern_Cura_1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 767b6eaccd..a4ed45fb24 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -93,14 +93,14 @@ "secondary_button_hover": [228, 228, 228, 255], "secondary_button_text": [30, 102, 215, 255], - "main_window_header_background": [10, 8, 80, 255], + "main_window_header_background": [8, 7, 63, 255], "main_window_header_background_gradient": [25, 23, 91, 255], - "main_window_header_button_text_active": [10, 8, 80, 255], + "main_window_header_button_text_active": [8, 7, 63, 255], "main_window_header_button_text_inactive": [255, 255, 255, 255], "main_window_header_button_text_hovered": [255, 255, 255, 255], "main_window_header_button_background_active": [255, 255, 255, 255], "main_window_header_button_background_inactive": [255, 255, 255, 0], - "main_window_header_button_background_hovered": [255, 255, 255, 102], + "main_window_header_button_background_hovered": [117, 114, 159, 255], "account_widget_outline_active": [70, 66, 126, 255], @@ -113,7 +113,7 @@ "toolbar_background": [255, 255, 255, 255], - "printer_type_label_background": [171, 171, 191, 255], + "printer_type_label_background": [228, 228, 242, 255], "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], @@ -127,9 +127,9 @@ "text_scene_hover": [70, 84, 113, 255], "error": [255, 140, 0, 255], - "warning": [255, 190, 35, 255], + "warning": [245, 166, 35, 255], - "toolbar_button_text": [10, 8, 80, 255], + "toolbar_button_text": [8, 7, 63, 255], "toolbar_button_hover": [232, 242, 252, 255], "toolbar_button_active": [232, 242, 252, 255], "toolbar_button_active_hover": [232, 242, 252, 255], @@ -144,9 +144,9 @@ "button_text_active_hover": [255, 255, 255, 255], "small_button": [0, 0, 0, 0], - "small_button_hover": [10, 8, 80, 255], - "small_button_active": [10, 8, 80, 255], - "small_button_active_hover": [10, 8, 80, 255], + "small_button_hover": [8, 7, 63, 255], + "small_button_active": [8, 7, 63, 255], + "small_button_active_hover": [8, 7, 63, 255], "small_button_text": [171, 171, 191, 255], "small_button_text_hover": [255, 255, 255, 255], "small_button_text_active": [255, 255, 255, 255], @@ -222,8 +222,8 @@ "progressbar_control": [50, 130, 255, 255], "slider_groove": [223, 223, 223, 255], - "slider_groove_fill": [10, 8, 80, 255], - "slider_handle": [10, 8, 80, 255], + "slider_groove_fill": [8, 7, 63, 255], + "slider_handle": [8, 7, 63, 255], "slider_handle_active": [50, 130, 255, 255], "slider_text_background": [255, 255, 255, 255], From aab61ce8dac70c8a24ded4db31641ff67f0fb8c7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 11:35:33 +0100 Subject: [PATCH 462/558] Modify the header pattern to be have an empty space in the left and bottom, so when repeating the pattern it doesn't overlap. --- .../cura-light/images/header_pattern.svg | 3789 ++++++++--------- 1 file changed, 1894 insertions(+), 1895 deletions(-) diff --git a/resources/themes/cura-light/images/header_pattern.svg b/resources/themes/cura-light/images/header_pattern.svg index 14ea9dc917..eff5f01cfa 100644 --- a/resources/themes/cura-light/images/header_pattern.svg +++ b/resources/themes/cura-light/images/header_pattern.svg @@ -1,1902 +1,1901 @@ - + - Pattern_Cura_1 + Desktop HD Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 26a41c37265822414c3b79e58acce3fc2765a51a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 11:45:14 +0100 Subject: [PATCH 463/558] Adjust the color of the printer in the printer selector For that I needed to get rid of the IconLabel component, since in this case the color of the icon and the text is the same (and it makes sense) --- .../qml/PrinterSelector/MachineSelector.qml | 57 +++++++++++++------ resources/themes/cura-light/theme.json | 1 + 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 91b5591cd8..95abfd6644 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -25,29 +25,52 @@ Cura.ExpandableComponent name: "cura" } - headerItem: Cura.IconLabel + headerItem: Item { - text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName - source: - { - if (isNetworkPrinter) - { - if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1) - { - return UM.Theme.getIcon("printer_group") - } - return UM.Theme.getIcon("printer_single") - } - return "" - } - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - iconSize: UM.Theme.getSize("machine_selector_icon").width + implicitHeight: icon.height UM.RecolorImage { id: icon + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + source: + { + if (isNetworkPrinter) + { + if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1) + { + return UM.Theme.getIcon("printer_group") + } + return UM.Theme.getIcon("printer_single") + } + return "" + } + width: UM.Theme.getSize("machine_selector_icon").width + height: width + + color: UM.Theme.getColor("machine_selector_printer_icon") + visible: source != "" + } + + Label + { + id: label + anchors.left: icon.visible ? icon.right : parent.left + anchors.right: parent.right + anchors.leftMargin: UM.Theme.getSize("thin_margin").width + anchors.verticalCenter: icon.verticalCenter + text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName + elide: Text.ElideRight + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + + UM.RecolorImage + { anchors { bottom: parent.bottom diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a4ed45fb24..2d7e92be4d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -108,6 +108,7 @@ "machine_selector_active": [68, 72, 75, 255], "machine_selector_hover": [68, 72, 75, 255], "machine_selector_text_active": [255, 255, 255, 255], + "machine_selector_printer_icon": [8, 7, 63, 255], "action_panel_secondary": [27, 95, 202, 255], From 47626f603341dc8d71688e1722f2a498763707f6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 11:57:55 +0100 Subject: [PATCH 464/558] Fix the color and proportions of the cura logo in the about panel --- resources/qml/Dialogs/AboutDialog.qml | 4 +- .../themes/cura-light/images/logo_about.svg | 172 ++++++++++++++++++ 2 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 resources/themes/cura-light/images/logo_about.svg diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 94eca4e7c0..add84614e0 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -35,9 +35,9 @@ UM.Dialog { id: logo width: (base.minimumWidth * 0.85) | 0 - height: (width * (1/4.25)) | 0 + height: (width * (UM.Theme.getSize("logo").height / UM.Theme.getSize("logo").width)) | 0 - source: UM.Theme.getImage("logo") + source: UM.Theme.getImage("logo_about") anchors.top: parent.top anchors.topMargin: ((base.minimumWidth - width) / 2) | 0 diff --git a/resources/themes/cura-light/images/logo_about.svg b/resources/themes/cura-light/images/logo_about.svg new file mode 100644 index 0000000000..34301fd6c9 --- /dev/null +++ b/resources/themes/cura-light/images/logo_about.svg @@ -0,0 +1,172 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f1fec2f28082661e58b6fb0824521d69409bb4fb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 12:07:03 +0100 Subject: [PATCH 465/558] Theme the scroll bar We need to make this a reusable component at some point, I think. This is the first time we're using the QtQuick2 version of ScrollView. Contributes to issue CURA-5876. --- .../ConfigurationListView.qml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index d07337f9c5..e7936b69d2 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -28,10 +28,25 @@ Column { id: container width: parent.width - height: Math.round(Math.min(configurationList.height, 350 * screenScaleFactor)) + readonly property int maximumHeight: 350 * screenScaleFactor + height: Math.round(Math.min(configurationList.height, maximumHeight)) contentHeight: configurationList.height clip: true + ScrollBar.vertical.policy: (configurationList.height > maximumHeight) ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff //The AsNeeded policy also hides it when the cursor is away, and we don't want that. + ScrollBar.vertical.background: Rectangle + { + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: width / 2 + color: UM.Theme.getColor("scrollbar_background") + } + ScrollBar.vertical.contentItem: Rectangle + { + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: width / 2 + color: UM.Theme.getColor(parent.pressed ? "scrollbar_handle_down" : parent.hovered ? "scrollbar_handle_hover" : "scrollbar_handle") + } + ButtonGroup { buttons: configurationList.children @@ -41,7 +56,7 @@ Column { id: configurationList spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) - width: container.width + width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any. contentHeight: childrenRect.height height: childrenRect.height From 4b79770d58e4f3f608a1aa6b079f07b522262564 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 13:42:29 +0100 Subject: [PATCH 466/558] Align the buttons in the output process widget The menu in the output device selector has now a rounded corner. --- resources/qml/ActionButton.qml | 5 ++++- .../ActionPanel/OutputDevicesActionButton.qml | 2 ++ .../qml/ActionPanel/OutputProcessWidget.qml | 17 ++++++++++++++--- resources/themes/cura-light/styles.qml | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 54d77f7d59..fc4a1c05f4 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -7,6 +7,7 @@ import QtQuick.Controls 2.1 import QtGraphicalEffects 1.0 // For the dropshadow import UM 1.1 as UM +import Cura 1.0 as Cura Button { @@ -16,6 +17,7 @@ Button property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.text + property alias cornerSide: backgroundRect.cornerSide property color color: UM.Theme.getColor("primary") property color hoverColor: UM.Theme.getColor("primary_hover") @@ -82,9 +84,10 @@ Button } } - background: Rectangle + background: Cura.RoundedRectangle { id: backgroundRect + cornerSide: Cura.RoundedRectangle.Direction.All color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor radius: UM.Theme.getSize("action_button_radius").width border.width: UM.Theme.getSize("default_lining").width diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 12e4ac42fd..95750e6d11 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -17,6 +17,7 @@ Item id: saveToButton height: parent.height fixedWidthMode: true + cornerSide: deviceSelectionMenu.visible ? Cura.RoundedRectangle.Direction.Left : Cura.RoundedRectangle.Direction.All anchors { @@ -44,6 +45,7 @@ Item shadowEnabled: true shadowColor: UM.Theme.getColor("primary_shadow") + cornerSide: Cura.RoundedRectangle.Direction.Right anchors { diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index d1790b3791..1d1a1e44e1 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -101,16 +101,24 @@ Column } } - Row + Item { id: buttonRow - spacing: UM.Theme.getSize("default_margin").width - width: parent.width + anchors.right: parent.right + anchors.left: parent.left + height: UM.Theme.getSize("action_button").height Cura.SecondaryButton { id: previewStageShortcut + anchors + { + left: parent.left + right: outputDevicesButton.left + rightMargin: UM.Theme.getSize("default_margin").width + } + height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width @@ -125,6 +133,9 @@ Column Cura.OutputDevicesActionButton { + id: outputDevicesButton + + anchors.right: parent.right width: previewStageShortcut.visible ? UM.Theme.getSize("action_button").width : parent.width height: UM.Theme.getSize("action_button").height } diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index aaa8ec18f1..30cf42859a 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -145,7 +145,7 @@ QtObject text: control.text anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - font: UM.Theme.getFont("medium_bold") + font: UM.Theme.getFont("medium") color: { if (control.checked) From 76acb13f5962d9c185dd29aa8618f13db95c588a Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 13:50:58 +0100 Subject: [PATCH 467/558] Change the play/pause button colors --- plugins/SimulationView/SimulationViewMainComponent.qml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 16b9aeaae6..16b049c921 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -61,10 +61,9 @@ Item iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg" width: UM.Theme.getSize("small_button").width height: UM.Theme.getSize("small_button").height - hoverBackgroundColor: UM.Theme.getColor("small_button_hover") - hoverColor: UM.Theme.getColor("small_button_text_hover") - color: UM.Theme.getColor("small_button_text") - iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width + hoverColor: UM.Theme.getColor("slider_handle_active") + color: UM.Theme.getColor("slider_handle") + iconMargin: UM.Theme.getSize("thick_lining").width visible: !UM.SimulationView.compatibilityMode Connections From 1e699604642f69dda88185a382cae0f657580d93 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 13:52:57 +0100 Subject: [PATCH 468/558] Make it possible to disable ExpandableComponent It won't show the drop-down icon then, won't do hovers and won't allow you to click on it. This will not remove the contents of the ExpandableComponent menu bar item though, so that has to be done in ConfigurationMenu.qml. Contributes to issue CURA-5876. --- resources/qml/ExpandableComponent.qml | 4 +++- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 9bedaa940c..e42aa7e4a1 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -32,6 +32,8 @@ Item property color headerBackgroundColor: UM.Theme.getColor("action_button") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + property alias enabled: mouseArea.enabled + // Defines the alignment of the popup with respect of the headerItem, by default to the right property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight @@ -139,7 +141,7 @@ Item verticalCenter: parent.verticalCenter margins: background.padding } - visible: source != "" + visible: source != "" && base.enabled width: height height: Math.round(0.2 * base.height) color: UM.Theme.getColor("text") diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index f81176ab1a..c4671d3a3a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -45,6 +45,7 @@ Cura.ExpandableComponent orientation: ListView.Horizontal anchors.fill: parent model: extrudersModel + visible: base.enabled delegate: Item { From 298c68c93b6a5d98f7a3847849045003f001a154 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 13:56:06 +0100 Subject: [PATCH 469/558] Disable configuration menu if there are no configurations This then prevents you from dropping down into an empty menu. Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationMenu.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index c4671d3a3a..edb74d0251 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -102,6 +102,23 @@ Cura.ExpandableComponent } } + //Disable the menu if there are no materials, variants or build plates to change. + function updateEnabled() + { + var active_definition_id = Cura.MachineManager.activeMachine.definition.id; + var has_materials = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_materials"); + var has_variants = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variants"); + var has_buildplates = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variant_buildplates"); + base.enabled = has_materials || has_variants || has_buildplates; //Only let it drop down if there is any configuration that you could change. + } + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: base.updateEnabled(); + } + Component.onCompleted: updateEnabled(); + popupItem: Column { id: popupItem From 85f2a7e8f692e5202f4821e25ea9a9a7d79d7501 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Dec 2018 14:04:21 +0100 Subject: [PATCH 470/558] Move visible to Rows for extruder configs CURA-5941 So the whole row, such as "material", will be shown/hiden based on whether the machine has materials. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 19b7158929..ac40958a29 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -140,6 +140,7 @@ Item Row { height: UM.Theme.getSize("print_setup_item").height + visible: extrudersModel.count > 1 // If there is only one extruder, there is no point to enable/disable that. Label { @@ -149,7 +150,6 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: extrudersModel.count > 1 } OldControls.CheckBox @@ -158,7 +158,6 @@ Item enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox - visible: extrudersModel.count > 1 /* Use a MouseArea to process the click on this checkbox. This is necessary because actually clicking the checkbox @@ -177,6 +176,8 @@ Item Row { height: UM.Theme.getSize("print_setup_item").height + visible: Cura.MachineManager.hasMaterials + Label { text: catalog.i18nc("@label", "Material") @@ -185,7 +186,6 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: materialSelection.visible } OldControls.ToolButton @@ -197,7 +197,6 @@ Item text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" tooltip: text - visible: Cura.MachineManager.hasMaterials height: UM.Theme.getSize("setting_control").height width: selectors.controlWidth @@ -214,6 +213,7 @@ Item Row { height: UM.Theme.getSize("print_setup_item").height + visible: Cura.MachineManager.hasVariants Label { @@ -223,15 +223,13 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: variantSelection.visible } OldControls.ToolButton { id: variantSelection text: Cura.MachineManager.activeVariantName - tooltip: Cura.MachineManager.activeVariantName; - visible: Cura.MachineManager.hasVariants + tooltip: Cura.MachineManager.activeVariantName height: UM.Theme.getSize("setting_control").height width: selectors.controlWidth From 54def4edee6d743eaf43988a8b2568bebc8fee53 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 14:12:35 +0100 Subject: [PATCH 471/558] Revert "Moved qml pages of toolbox to a loader" This reverts commit 838949dac74831e38e9f07fe7d628af7807320db. --- plugins/Toolbox/resources/qml/Toolbox.qml | 55 +++++++++++---------- plugins/Toolbox/src/Toolbox.py | 59 ++++++++++++----------- 2 files changed, 62 insertions(+), 52 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index b2bab4355a..7cc5a730f2 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -44,31 +44,36 @@ Window top: header.bottom bottom: footer.top } - - Loader + // TODO: This could be improved using viewFilter instead of viewCategory + ToolboxLoadingPage { - anchors.fill:parent - source: - { - if(toolbox.viewCategory == "installed") - { - return "ToolboxInstalledPage.qml" - } - - switch (toolbox.viewPage) - { - case "loading": - return "ToolboxLoadingPage.qml" - case "errored": - return "ToolboxErrorPage.qml" - case "overview": - return "ToolboxDownloadsPage.qml" - case "detail": - return "ToolboxDetailPage.qml" - case "author": - return "ToolboxAuthorPage.qml" - } - } + id: viewLoading + visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "loading" + } + ToolboxErrorPage + { + id: viewErrored + visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "errored" + } + ToolboxDownloadsPage + { + id: viewDownloads + visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "overview" + } + ToolboxDetailPage + { + id: viewDetail + visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "detail" + } + ToolboxAuthorPage + { + id: viewAuthor + visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "author" + } + ToolboxInstalledPage + { + id: installedPluginList + visible: toolbox.viewCategory == "installed" } } @@ -90,7 +95,7 @@ Window licenseDialog.show(); } } - + ToolboxLicenseDialog { id: licenseDialog diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 68919cf987..ef67dc3c86 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -622,39 +622,44 @@ class Toolbox(QObject, Extension): if reply.operation() == QNetworkAccessManager.GetOperation: for response_type, url in self._request_urls.items(): - if reply.url() != url: - continue + if reply.url() == url: + if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: + try: + json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) - if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: - try: - json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) - except json.decoder.JSONDecodeError: - Logger.log("w", "Received invalid JSON for %s.", response_type) - break + # Check for errors: + if "errors" in json_data: + for error in json_data["errors"]: + Logger.log("e", "%s", error["title"]) + return - # Check for errors: - if "errors" in json_data: - for error in json_data["errors"]: - Logger.log("e", "%s", error["title"]) - return + # Create model and apply metadata: + if not self._models[response_type]: + Logger.log("e", "Could not find the %s model.", response_type) + break + + self._server_response_data[response_type] = json_data["data"] + self._models[response_type].setMetadata(self._server_response_data[response_type]) - self._server_response_data[response_type] = json_data["data"] - self._models[response_type].setMetadata(json_data["data"]) + if response_type is "packages": + self._models[response_type].setFilter({"type": "plugin"}) + self.reBuildMaterialsModels() + self.reBuildPluginsModels() + elif response_type is "authors": + self._models[response_type].setFilter({"package_types": "material"}) + self._models[response_type].setFilter({"tags": "generic"}) - if response_type is "packages": - self._models["packages"].setFilter({"type": "plugin"}) - self.reBuildMaterialsModels() - self.reBuildPluginsModels() - elif response_type is "authors": - self._models["authors"].setFilter({"tags": "generic"}) + self.metadataChanged.emit() - self.metadataChanged.emit() + if self.isLoadingComplete(): + self.setViewPage("overview") - if self.isLoadingComplete(): - self.setViewPage("overview") - else: - self.setViewPage("errored") - self.resetDownload() + except json.decoder.JSONDecodeError: + Logger.log("w", "Received invalid JSON for %s.", response_type) + break + else: + self.setViewPage("errored") + self.resetDownload() else: # Ignore any operation that is not a get operation pass From 05075c44ee31902bec6c9f9167acb7d00025c030 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 14:19:34 +0100 Subject: [PATCH 472/558] Add renderType to some labels in the Configuration panel Contributes to CURA-5876. --- resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml | 1 + resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 5 ++++- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index a09d6d2ba4..68c56c7c4b 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -19,6 +19,7 @@ Item font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") height: contentHeight + renderType: Text.NativeRendering anchors { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index edb74d0251..1d086acc67 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -71,6 +71,7 @@ Cura.ExpandableComponent elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_inactive") + renderType: Text.NativeRendering anchors { @@ -88,6 +89,7 @@ Cura.ExpandableComponent elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering anchors { @@ -155,8 +157,9 @@ Cura.ExpandableComponent { id: separator visible: buttonBar.visible + x: -popupPadding - width: parent.width + width: base.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 19b7158929..8d8f84155a 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -26,6 +26,7 @@ Item font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") height: contentHeight + renderType: Text.NativeRendering anchors { @@ -150,6 +151,7 @@ Item height: parent.height width: selectors.textWidth visible: extrudersModel.count > 1 + renderType: Text.NativeRendering } OldControls.CheckBox @@ -186,6 +188,7 @@ Item height: parent.height width: selectors.textWidth visible: materialSelection.visible + renderType: Text.NativeRendering } OldControls.ToolButton @@ -224,6 +227,7 @@ Item height: parent.height width: selectors.textWidth visible: variantSelection.visible + renderType: Text.NativeRendering } OldControls.ToolButton From 3c517d3fcce96c4f57f75bbbcf53a086d49f4055 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 6 Dec 2018 14:25:18 +0100 Subject: [PATCH 473/558] The top bar background overlaps settings bar --- 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 f16ae9a19b..a75ab44b99 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -93,7 +93,7 @@ UM.MainWindow id: headerBackground anchors { - top: parent.top + top: applicationMenu.bottom left: parent.left right: parent.right } From 3ca749cdcbbc9526586d979acfa9e8ab9489bedc Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 14:31:52 +0100 Subject: [PATCH 474/558] Add a bunch of renderTypes to labels in the DiscoverUM3Action. --- .../resources/qml/DiscoverUM3Action.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 967adfc029..bb710127fc 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -64,6 +64,7 @@ Cura.MachineAction width: parent.width text: catalog.i18nc("@title:window", "Connect to Networked Printer") wrapMode: Text.WordWrap + renderType: Text.NativeRendering font.pointSize: 18 } @@ -72,6 +73,7 @@ Cura.MachineAction id: pageDescription width: parent.width wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: catalog.i18nc("@label", "To print directly to your printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. If you don't connect Cura with your printer, you can still use a USB drive to transfer g-code files to your printer.\n\nSelect your printer from the list below:") } @@ -182,6 +184,7 @@ Cura.MachineAction text: listview.model[index].name color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text elide: Text.ElideRight + renderType: Text.NativeRendering } MouseArea @@ -204,6 +207,7 @@ Cura.MachineAction anchors.left: parent.left anchors.right: parent.right wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: catalog.i18nc("@label", "If your printer is not listed, read the network printing troubleshooting guide").arg("https://ultimaker.com/en/troubleshooting"); onLinkActivated: Qt.openUrlExternally(link) } @@ -221,6 +225,7 @@ Cura.MachineAction text: base.selectedDevice ? base.selectedDevice.name : "" font: UM.Theme.getFont("large") elide: Text.ElideRight + renderType: Text.NativeRendering } Grid { @@ -231,12 +236,14 @@ Cura.MachineAction { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: catalog.i18nc("@label", "Type") } Label { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: { if(base.selectedDevice) @@ -268,24 +275,28 @@ Cura.MachineAction { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: catalog.i18nc("@label", "Firmware version") } Label { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: base.selectedDevice ? base.selectedDevice.firmwareVersion : "" } Label { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: catalog.i18nc("@label", "Address") } Label { width: Math.round(parent.width * 0.5) wrapMode: Text.WordWrap + renderType: Text.NativeRendering text: base.selectedDevice ? base.selectedDevice.ipAddress : "" } } @@ -294,6 +305,7 @@ Cura.MachineAction { width: parent.width wrapMode: Text.WordWrap + renderType: Text.NativeRendering text:{ // The property cluster size does not exist for older UM3 devices. if(!base.selectedDevice || base.selectedDevice.clusterSize == null || base.selectedDevice.clusterSize == 1) @@ -315,6 +327,7 @@ Cura.MachineAction { width: parent.width wrapMode: Text.WordWrap + renderType: Text.NativeRendering visible: base.selectedDevice != null && !base.completeProperties text: catalog.i18nc("@label", "The printer at this address has not yet responded." ) } @@ -358,9 +371,10 @@ Cura.MachineAction Label { - text: catalog.i18nc("@alabel","Enter the IP address or hostname of your printer on the network.") + text: catalog.i18nc("@alabel", "Enter the IP address or hostname of your printer on the network.") width: parent.width wrapMode: Text.WordWrap + renderType: Text.NativeRendering } TextField From a77ad329993ae46799376689c4908de06292c801 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 14:35:07 +0100 Subject: [PATCH 475/558] Move all the seperate tiles into loaders instead of the entire page Otherwise the details selection didn't work anymore and I didn't want to add more hacks. CURA-6006 --- .../resources/qml/ToolboxDetailList.qml | 7 ++++++- .../resources/qml/ToolboxDownloadsGrid.qml | 10 ++++++---- .../qml/ToolboxDownloadsShowcase.qml | 19 +++++++++++-------- .../resources/qml/ToolboxInstalledPage.qml | 12 ++++++++++-- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml index 2e5eae098c..1700a58ebe 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml @@ -26,10 +26,15 @@ Item } height: childrenRect.height + 2 * UM.Theme.getSize("wide_margin").height spacing: UM.Theme.getSize("default_margin").height + Repeater { model: toolbox.packagesModel - delegate: ToolboxDetailTile {} + delegate: Loader + { + asynchronous: true + source: "ToolboxDetailTile.qml" + } } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml index c586828969..3e2643938b 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml @@ -24,7 +24,7 @@ Column color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") } - GridLayout + Grid { id: grid width: parent.width - 2 * parent.padding @@ -34,10 +34,12 @@ Column Repeater { model: gridArea.model - delegate: ToolboxDownloadsGridTile + delegate: Loader { - Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns - Layout.preferredHeight: UM.Theme.getSize("toolbox_thumbnail_small").height + asynchronous: true + width: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns + height: UM.Theme.getSize("toolbox_thumbnail_small").height + source: "ToolboxDownloadsGridTile.qml" } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml index 46f5debfdd..9851128076 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml @@ -30,23 +30,26 @@ Rectangle height: childrenRect.height spacing: UM.Theme.getSize("wide_margin").width columns: 3 - anchors - { - horizontalCenter: parent.horizontalCenter - } + anchors.horizontalCenter: parent.horizontalCenter + Repeater { - model: { - if ( toolbox.viewCategory == "plugin" ) + model: + { + if (toolbox.viewCategory == "plugin") { return toolbox.pluginsShowcaseModel } - if ( toolbox.viewCategory == "material" ) + if (toolbox.viewCategory == "material") { return toolbox.materialsShowcaseModel } } - delegate: ToolboxDownloadsShowcaseTile {} + delegate: Loader + { + asynchronous: true + source: "ToolboxDownloadsShowcaseTile.qml" + } } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index e683f89823..145e544b19 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -64,7 +64,11 @@ ScrollView { id: materialList model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile {} + delegate: Loader + { + asynchronous: true + source: "ToolboxInstalledTile.qml" + } } } } @@ -101,7 +105,11 @@ ScrollView { id: pluginList model: toolbox.materialsInstalledModel - delegate: ToolboxInstalledTile {} + delegate: Loader + { + asynchronous: true + source: "ToolboxInstalledTile.qml" + } } } } From 46c209a9936c1b2e52a83f743f1a3b8c58aeb2d7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 14:45:24 +0100 Subject: [PATCH 476/558] Add one pixel margin to the view selector. --- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- resources/qml/ViewsSelector.qml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 5ef04b7351..54d766a6e0 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -13,7 +13,7 @@ Column Label { - text: catalog.i18nc("@label", "Network connected printers") + text: catalog.i18nc("@label", "Connected printers") visible: networkedPrintersModel.items.length > 0 leftPadding: UM.Theme.getSize("default_margin").width height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index e239ea82a0..1e42a0b3ba 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -74,6 +74,8 @@ Cura.ExpandableComponent { id: viewSelectorPopup width: viewSelector.width - 2 * viewSelector.popupPadding + leftPadding: UM.Theme.getSize("default_lining").width + rightPadding: UM.Theme.getSize("default_lining").width // For some reason the height/width of the column gets set to 0 if this is not set... Component.onCompleted: @@ -91,7 +93,7 @@ Cura.ExpandableComponent { id: viewsSelectorButton text: model.name - width: parent.width + width: parent.width - viewSelectorPopup.leftPadding - viewSelectorPopup.rightPadding height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width From 62c53989335d4d955be4bcb1ac07df234bbb2896 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 14:58:28 +0100 Subject: [PATCH 477/558] Change buttons to use either secondary or primary CURA-6006 --- .../resources/qml/ToolboxInstalledPage.qml | 12 +-- .../qml/ToolboxInstalledTileActions.qml | 42 ++------- .../resources/qml/ToolboxProgressButton.qml | 93 +------------------ 3 files changed, 16 insertions(+), 131 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index 145e544b19..e683f89823 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -64,11 +64,7 @@ ScrollView { id: materialList model: toolbox.pluginsInstalledModel - delegate: Loader - { - asynchronous: true - source: "ToolboxInstalledTile.qml" - } + delegate: ToolboxInstalledTile {} } } } @@ -105,11 +101,7 @@ ScrollView { id: pluginList model: toolbox.materialsInstalledModel - delegate: Loader - { - asynchronous: true - source: "ToolboxInstalledTile.qml" - } + delegate: ToolboxInstalledTile {} } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml index 621ecd96ea..eb3a93f274 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -6,6 +6,8 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM +import Cura 1.0 as Cura + Column { property bool canUpdate: false @@ -43,44 +45,18 @@ Column visible: canUpdate } - Button + Cura.SecondaryButton { id: removeButton text: canDowngrade ? catalog.i18nc("@action:button", "Downgrade") : catalog.i18nc("@action:button", "Uninstall") visible: !model.is_bundled && model.is_installed enabled: !toolbox.isDownloading - style: ButtonStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: "transparent" - border - { - width: UM.Theme.getSize("default_lining").width - color: - { - if (control.hovered) - { - return UM.Theme.getColor("primary_hover") - } - else - { - return UM.Theme.getColor("lining") - } - } - } - } - label: Label - { - text: control.text - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font: UM.Theme.getFont("default") - } - } + + width: UM.Theme.getSize("toolbox_action_button").width + height: UM.Theme.getSize("toolbox_action_button").height + + fixedWidthMode: true + onClicked: toolbox.checkPackageUsageAndUninstall(model.id) Connections { diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index 00b0b985f5..0b574e8653 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -5,7 +5,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM - +import Cura 1.0 as Cura Item { @@ -25,9 +25,12 @@ Item width: UM.Theme.getSize("toolbox_action_button").width height: UM.Theme.getSize("toolbox_action_button").height - Button + Cura.PrimaryButton { id: button + width: UM.Theme.getSize("toolbox_action_button").width + height: UM.Theme.getSize("toolbox_action_button").height + fixedWidthMode: true text: { if (complete) @@ -58,92 +61,6 @@ Item readyAction() } } - style: ButtonStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: - { - if (base.complete) - { - return "transparent" - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("primary_hover") - } - else - { - return UM.Theme.getColor("primary") - } - } - } - border - { - width: - { - if (base.complete) - { - UM.Theme.getSize("default_lining").width - } - else - { - return 0 - } - } - color: - { - if (control.hovered) - { - return UM.Theme.getColor("primary_hover") - } - else - { - return UM.Theme.getColor("lining") - } - } - } - } - label: Label - { - text: control.text - color: - { - if (base.complete) - { - return UM.Theme.getColor("text") - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("button_text_hover") - } - else - { - return UM.Theme.getColor("button_text") - } - } - } - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font: - { - if (base.complete) - { - return UM.Theme.getFont("default") - } - else - { - return UM.Theme.getFont("default_bold") - } - } - } - } } AnimatedImage From b55ead8c89a331a2ce3902d2c7288587a1e675a7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 15:18:32 +0100 Subject: [PATCH 478/558] Fix typo Contributes to CURA-6010. --- 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 f16ae9a19b..6a8493ff06 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -103,7 +103,7 @@ UM.MainWindow // This is the new fancy pattern Image { - id: backgourndPattern + id: backgroundPattern anchors.fill: parent fillMode: Image.Tile source: UM.Theme.getImage("header_pattern") From 4b9e6e7708b862eb30c5ddad91de6421b75f80c2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 6 Dec 2018 16:06:22 +0100 Subject: [PATCH 479/558] Add the linear gradient back, that I removed in a previous commit Contributes to CURA-6010. --- resources/qml/Cura.qml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 6a8493ff06..93d8bddf1e 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -98,7 +98,31 @@ UM.MainWindow right: parent.right } height: stageMenu.source != "" ? Math.round(mainWindowHeader.height + stageMenu.height / 2) : mainWindowHeader.height - color: UM.Theme.getColor("main_window_header_background") + + LinearGradient + { + anchors.fill: parent + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) + gradient: Gradient + { + GradientStop + { + position: 0.0 + color: UM.Theme.getColor("main_window_header_background") + } + GradientStop + { + position: 0.5 + color: UM.Theme.getColor("main_window_header_background_gradient") + } + GradientStop + { + position: 1.0 + color: UM.Theme.getColor("main_window_header_background") + } + } + } // This is the new fancy pattern Image From c39674cd0cbbc3cb8e71bd9ece5a72d0c4eefcd0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 16:22:26 +0100 Subject: [PATCH 480/558] Use upper camel case for enum options Contributes to issue CURA-5876. --- .../ConfigurationMenu/ConfigurationMenu.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 1d086acc67..9bef2ca0be 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -30,8 +30,8 @@ Cura.ExpandableComponent enum ConfigurationMethod { - AUTO, - CUSTOM + Auto, + Custom } iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") @@ -134,7 +134,7 @@ Cura.ExpandableComponent is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate. } - property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.AUTO : ConfigurationMenu.ConfigurationMethod.CUSTOM //Auto if connected to a printer at start-up, or Custom if not. + property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not. Item { @@ -143,13 +143,13 @@ Cura.ExpandableComponent AutoConfiguration { id: autoConfiguration - visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.Auto } CustomConfiguration { id: customConfiguration - visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.Custom } } @@ -177,7 +177,7 @@ Cura.ExpandableComponent Cura.SecondaryButton { id: goToCustom - visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.Auto text: catalog.i18nc("@label", "Custom") anchors.right: parent.right @@ -185,18 +185,18 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("arrow_right") isIconOnRightSide: true - onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.CUSTOM + onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom } Cura.SecondaryButton { id: goToAuto - visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM + visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.Custom text: catalog.i18nc("@label", "Configurations") iconSource: UM.Theme.getIcon("arrow_left") - onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.AUTO + onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto } } } From 4e2ab163ed5dffec65a7328820e494434def97e5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 16:24:12 +0100 Subject: [PATCH 481/558] Add login fequired link to packages that have the login-required tag CURA-6006 --- .../qml/ToolboxDetailTileActions.qml | 22 ++++++++++++++++++- plugins/Toolbox/src/PackagesModel.py | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index 72a9d14dcd..8a11b402d2 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -5,11 +5,14 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM +import Cura 1.1 as Cura Column { property bool installed: toolbox.isInstalled(model.id) property bool canUpdate: toolbox.canUpdate(model.id) + property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn + width: UM.Theme.getSize("toolbox_action_button").width spacing: UM.Theme.getSize("narrow_margin").height @@ -28,11 +31,28 @@ Column onCompleteAction: toolbox.viewCategory = "installed" // Don't allow installing while another download is running - enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model) + enabled: installed || (!(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired) opacity: enabled ? 1.0 : 0.5 visible: !updateButton.visible // Don't show when the update button is visible } + + Label + { + wrapMode: Text.WordWrap + text:"Log in is required to install" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + linkColor: UM.Theme.getColor("text_link") + visible: loginRequired + width: installButton.width + MouseArea + { + anchors.fill: parent + onClicked:Cura.API.account.login() + } + } + ToolboxProgressButton { id: updateButton diff --git a/plugins/Toolbox/src/PackagesModel.py b/plugins/Toolbox/src/PackagesModel.py index f941804653..bcc02955a2 100644 --- a/plugins/Toolbox/src/PackagesModel.py +++ b/plugins/Toolbox/src/PackagesModel.py @@ -40,6 +40,7 @@ class PackagesModel(ListModel): self.addRoleName(Qt.UserRole + 19, "tags") self.addRoleName(Qt.UserRole + 20, "links") self.addRoleName(Qt.UserRole + 21, "website") + self.addRoleName(Qt.UserRole + 22, "login_required") # List of filters for queries. The result is the union of the each list of results. self._filter = {} # type: Dict[str, str] @@ -100,6 +101,7 @@ class PackagesModel(ListModel): "tags": package["tags"] if "tags" in package else [], "links": links_dict, "website": package["website"] if "website" in package else None, + "login_required": "login-required" in package.get("tags", []) }) # Filter on all the key-word arguments. From 05b32548f38b279da211279d753016ac19ef74dd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Dec 2018 16:27:56 +0100 Subject: [PATCH 482/558] Code style: Start comments with a space Contributes to issue CURA-5876. --- cura/Settings/ExtruderStack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ExtruderStack.py b/cura/Settings/ExtruderStack.py index d626ef06da..edb0e7d41f 100644 --- a/cura/Settings/ExtruderStack.py +++ b/cura/Settings/ExtruderStack.py @@ -52,8 +52,8 @@ class ExtruderStack(CuraContainerStack): return super().getNextStack() def setEnabled(self, enabled: bool) -> None: - if self.getMetaDataEntry("enabled", True) == enabled: #No change. - return #Don't emit a signal then. + if self.getMetaDataEntry("enabled", True) == enabled: # No change. + return # Don't emit a signal then. self.setMetaDataEntry("enabled", str(enabled)) self.enabledChanged.emit() From 4b8e3c32cbd46ef2f4ff63ca6a53654d2c22b0ec Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 16:37:47 +0100 Subject: [PATCH 483/558] Also show the login required if an update is needed CURA-6006 --- plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index 8a11b402d2..37d9bce4c5 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -40,7 +40,7 @@ Column Label { wrapMode: Text.WordWrap - text:"Log in is required to install" + text: catalog.i18nc("@label:The string between and is the highlighted link", "Log in is required to install or update") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") @@ -49,7 +49,7 @@ Column MouseArea { anchors.fill: parent - onClicked:Cura.API.account.login() + onClicked: Cura.API.account.login() } } @@ -68,7 +68,7 @@ Column } onActiveAction: toolbox.cancelDownload() // Don't allow installing while another download is running - enabled: !(toolbox.isDownloading && toolbox.activePackage != model) + enabled: !(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired opacity: enabled ? 1.0 : 0.5 visible: canUpdate } From 717fb260c15b2364e28d2de6ab4200d2c148a697 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 16:58:01 +0100 Subject: [PATCH 484/558] Change toolbox tabs to controls2 CURA-6006 --- .../resources/qml/ToolboxTabButton.qml | 75 +++++++++---------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml index b671d779f8..fa4f75d6fe 100644 --- a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml @@ -2,50 +2,49 @@ // Toolbox is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.0 import UM 1.1 as UM Button { + id: control property bool active: false - style: ButtonStyle + hoverEnabled: true + + background: Item { - background: Rectangle + implicitWidth: UM.Theme.getSize("toolbox_header_tab").width + implicitHeight: UM.Theme.getSize("toolbox_header_tab").height + Rectangle { - color: "transparent" - implicitWidth: UM.Theme.getSize("toolbox_header_tab").width - implicitHeight: UM.Theme.getSize("toolbox_header_tab").height - Rectangle - { - visible: control.active - color: UM.Theme.getColor("toolbox_header_highlight_hover") - anchors.bottom: parent.bottom - width: parent.width - height: UM.Theme.getSize("toolbox_header_highlight").height - } - } - label: Label - { - text: control.text - color: - { - if(control.hovered) - { - return UM.Theme.getColor("toolbox_header_button_text_hovered"); - } - if(control.active) - { - return UM.Theme.getColor("toolbox_header_button_text_active"); - } - else - { - return UM.Theme.getColor("toolbox_header_button_text_inactive"); - } - } - font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic") - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + visible: control.active + color: UM.Theme.getColor("primary") + anchors.bottom: parent.bottom + width: parent.width + height: UM.Theme.getSize("toolbox_header_highlight").height } } -} + contentItem: Label + { + id: label + text: control.text + color: + { + if(control.hovered) + { + return UM.Theme.getColor("toolbox_header_button_text_hovered"); + } + if(control.active) + { + return UM.Theme.getColor("toolbox_header_button_text_active"); + } + else + { + return UM.Theme.getColor("toolbox_header_button_text_inactive"); + } + } + font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } +} \ No newline at end of file From 2c9c9d8c962607311488a9a14526fb286de543a9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 17:23:02 +0100 Subject: [PATCH 485/558] Handle non-happy path for downloading CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index ef67dc3c86..ab975548ce 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -671,6 +671,11 @@ class Toolbox(QObject, Extension): if bytes_sent == bytes_total: self.setIsDownloading(False) cast(QNetworkReply, self._download_reply).downloadProgress.disconnect(self._onDownloadProgress) + + # Check if the download was sucessfull + if self._download_reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200: + Logger.log("w", "Failed to download package. The following error was returned: %s", json.loads(bytes(self._download_reply.readAll()).decode("utf-8"))) + return # Must not delete the temporary file on Windows self._temp_plugin_file = tempfile.NamedTemporaryFile(mode = "w+b", suffix = ".curapackage", delete = False) file_path = self._temp_plugin_file.name From d4a255c9e5779c8131ebb9743a5adf472530f99f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 17:35:58 +0100 Subject: [PATCH 486/558] Also add the login required label at the installed plugin list CURA-6006 --- .../qml/ToolboxDetailTileActions.qml | 1 - .../qml/ToolboxInstalledTileActions.qml | 21 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index 37d9bce4c5..cc32ff032d 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -36,7 +36,6 @@ Column visible: !updateButton.visible // Don't show when the update button is visible } - Label { wrapMode: Text.WordWrap diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml index eb3a93f274..39528f6437 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -6,12 +6,13 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM -import Cura 1.0 as Cura +import Cura 1.1 as Cura Column { property bool canUpdate: false property bool canDowngrade: false + property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn width: UM.Theme.getSize("toolbox_action_button").width spacing: UM.Theme.getSize("narrow_margin").height @@ -40,11 +41,27 @@ Column onActiveAction: toolbox.cancelDownload() // Don't allow installing while another download is running - enabled: !(toolbox.isDownloading && toolbox.activePackage != model) + enabled: !(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired opacity: enabled ? 1.0 : 0.5 visible: canUpdate } + Label + { + wrapMode: Text.WordWrap + text: catalog.i18nc("@label:The string between and is the highlighted link", "Log in is required to update") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + linkColor: UM.Theme.getColor("text_link") + visible: loginRequired + width: updateButton.width + MouseArea + { + anchors.fill: parent + onClicked: Cura.API.account.login() + } + } + Cura.SecondaryButton { id: removeButton From eddf4e7f3d96296576e8124fcfd3a86e01adf7e3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 6 Dec 2018 19:38:12 +0100 Subject: [PATCH 487/558] Simplify QML --- .../resources/qml/ToolboxInstalledPage.qml | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index e683f89823..738cdde323 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -21,44 +21,39 @@ ScrollView Column { spacing: UM.Theme.getSize("default_margin").height + visible: toolbox.pluginsInstalledModel.items.length > 0 + height: childrenRect.height + 4 * UM.Theme.getSize("default_margin").height + anchors { right: parent.right left: parent.left - leftMargin: UM.Theme.getSize("wide_margin").width - topMargin: UM.Theme.getSize("wide_margin").height - bottomMargin: UM.Theme.getSize("wide_margin").height + margins: UM.Theme.getSize("default_margin").width top: parent.top } - height: childrenRect.height + 4 * UM.Theme.getSize("default_margin").height + Label { - visible: toolbox.pluginsInstalledModel.items.length > 0 - width: parent.width + width: page.width text: catalog.i18nc("@title:tab", "Plugins") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") } Rectangle { - visible: toolbox.pluginsInstalledModel.items.length > 0 color: "transparent" width: parent.width - height: childrenRect.height + 1 * UM.Theme.getSize("default_lining").width + height: childrenRect.height + UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width Column { - height: childrenRect.height anchors { top: parent.top right: parent.right left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin: UM.Theme.getSize("default_margin").width - topMargin: UM.Theme.getSize("default_lining").width - bottomMargin: UM.Theme.getSize("default_lining").width + margins: UM.Theme.getSize("default_margin").width } Repeater { @@ -70,32 +65,26 @@ ScrollView } Label { - visible: toolbox.materialsInstalledModel.items.length > 0 - width: page.width text: catalog.i18nc("@title:tab", "Materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") } + Rectangle { - visible: toolbox.materialsInstalledModel.items.length > 0 color: "transparent" width: parent.width - height: childrenRect.height + 1 * UM.Theme.getSize("default_lining").width + height: childrenRect.height + UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width Column { - height: Math.max( UM.Theme.getSize("wide_margin").height, childrenRect.height) anchors { top: parent.top right: parent.right left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin: UM.Theme.getSize("default_margin").width - topMargin: UM.Theme.getSize("default_lining").width - bottomMargin: UM.Theme.getSize("default_lining").width + margins: UM.Theme.getSize("default_margin").width } Repeater { From b33ce7a50f891165fe71e964815804e2a9427f6a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 7 Dec 2018 09:35:08 +0100 Subject: [PATCH 488/558] Fix alignment of download grid tile CURA-6006 --- plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index 887140bbfa..d6eedbcde5 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -63,6 +63,8 @@ Item { width: parent.width - thumbnail.width - parent.spacing spacing: Math.floor(UM.Theme.getSize("narrow_margin").width) + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height Label { id: name From 2a0954f24683066f28698b03b261721fc02847b0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 7 Dec 2018 09:35:53 +0100 Subject: [PATCH 489/558] Gracefully handle the conectionError when logging in --- cura/OAuth2/AuthorizationHelpers.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cura/OAuth2/AuthorizationHelpers.py b/cura/OAuth2/AuthorizationHelpers.py index f75ad9c9f9..762d0db069 100644 --- a/cura/OAuth2/AuthorizationHelpers.py +++ b/cura/OAuth2/AuthorizationHelpers.py @@ -81,9 +81,14 @@ class AuthorizationHelpers: # \param access_token: The encoded JWT token. # \return: Dict containing some profile data. def parseJWT(self, access_token: str) -> Optional["UserProfile"]: - token_request = requests.get("{}/check-token".format(self._settings.OAUTH_SERVER_URL), headers = { - "Authorization": "Bearer {}".format(access_token) - }) + try: + token_request = requests.get("{}/check-token".format(self._settings.OAUTH_SERVER_URL), headers = { + "Authorization": "Bearer {}".format(access_token) + }) + except ConnectionError: + # Connection was suddenly dropped. Nothing we can do about that. + Logger.logException("e", "Something failed while attempting to parse the JWT token") + return None if token_request.status_code not in (200, 201): Logger.log("w", "Could not retrieve token data from auth server: %s", token_request.text) return None From 9eb09132d66d989120d7002b212bbcd4f5816fa3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 7 Dec 2018 09:38:02 +0100 Subject: [PATCH 490/558] Fix minor layout issue installed page CURA-6006 --- plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index 738cdde323..3d5cd1c8d4 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -43,7 +43,7 @@ ScrollView { color: "transparent" width: parent.width - height: childrenRect.height + UM.Theme.getSize("default_lining").width + height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width Column @@ -74,7 +74,7 @@ ScrollView { color: "transparent" width: parent.width - height: childrenRect.height + UM.Theme.getSize("default_lining").width + height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width Column From eaf413997d0c5ca4b317a0d65b5aef5c44131627 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 7 Dec 2018 09:44:09 +0100 Subject: [PATCH 491/558] Changed the installed button to be a secondary button CURA-6006 --- .../qml/ToolboxDetailTileActions.qml | 40 ++++++++++++------- .../resources/qml/ToolboxProgressButton.qml | 1 + 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index cc32ff032d..848acfbf4f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -16,24 +16,36 @@ Column width: UM.Theme.getSize("toolbox_action_button").width spacing: UM.Theme.getSize("narrow_margin").height - ToolboxProgressButton + Item { - id: installButton - active: toolbox.isDownloading && toolbox.activePackage == model - complete: installed - onReadyAction: + width: installButton.width + height: installButton.height + ToolboxProgressButton { - toolbox.activePackage = model - toolbox.startDownload(model.download_url) + id: installButton + active: toolbox.isDownloading && toolbox.activePackage == model + onReadyAction: + { + toolbox.activePackage = model + toolbox.startDownload(model.download_url) + } + onActiveAction: toolbox.cancelDownload() + + // Don't allow installing while another download is running + enabled: installed || (!(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired) + opacity: enabled ? 1.0 : 0.5 + visible: !updateButton.visible && !installed// Don't show when the update button is visible } - onActiveAction: toolbox.cancelDownload() - onCompleteAction: toolbox.viewCategory = "installed" - - // Don't allow installing while another download is running - enabled: installed || (!(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired) - opacity: enabled ? 1.0 : 0.5 - visible: !updateButton.visible // Don't show when the update button is visible + Cura.SecondaryButton + { + visible: installed + onClicked: toolbox.viewCategory = "installed" + text: catalog.i18nc("@action:button", "Installed") + fixedWidthMode: true + width: installButton.width + height: installButton.height + } } Label diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index 0b574e8653..3ca18a52ed 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -7,6 +7,7 @@ import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM import Cura 1.0 as Cura +// TODO; This is in quite some need for refactoring. Item { id: base From 677edd51eea2ba87392851b2a5d01402e133e459 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 7 Dec 2018 10:55:20 +0100 Subject: [PATCH 492/558] Remove unnecessary visibles CURA-5941 Because the parent Rows already have it set. --- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index eb8c81f228..ec9c5d0e38 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -151,7 +151,6 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: extrudersModel.count > 1 renderType: Text.NativeRendering } @@ -189,7 +188,6 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: materialSelection.visible renderType: Text.NativeRendering } @@ -228,7 +226,6 @@ Item color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - visible: variantSelection.visible renderType: Text.NativeRendering } From da052fbe81eb8fc5c03049e867d0d8417146aff9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Dec 2018 11:21:25 +0100 Subject: [PATCH 493/558] Not show a tooltip in the output device selector when the popup shows up --- resources/qml/ActionPanel/OutputDevicesActionButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 95750e6d11..9a6c97bcff 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -55,7 +55,7 @@ Item leftPadding: UM.Theme.getSize("narrow_margin").width //Need more space than usual here for wide text. rightPadding: UM.Theme.getSize("narrow_margin").width - tooltip: catalog.i18nc("@info:tooltip", "Select the active output device") + tooltip: popup.opened ? "" : catalog.i18nc("@info:tooltip", "Select the active output device") iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom") color: UM.Theme.getColor("action_panel_secondary") visible: (devicesModel.deviceCount > 1) From 898fd25ddb456a3dcfba6900e2ff03d5843fb5f9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Dec 2018 11:43:41 +0100 Subject: [PATCH 494/558] Remove the component IconLabel since we have a similar one in IconWithText Contributes to CURA-5941. --- .../qml/ActionPanel/OutputProcessWidget.qml | 5 +- .../qml/ActionPanel/SliceProcessWidget.qml | 3 +- resources/qml/IconLabel.qml | 50 ------------------- resources/qml/IconWithText.qml | 6 ++- .../PrintSetupSelectorHeader.qml | 1 - resources/qml/qmldir | 1 - 6 files changed, 7 insertions(+), 59 deletions(-) delete mode 100644 resources/qml/IconLabel.qml diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 1d1a1e44e1..3f53abf28f 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -44,7 +44,7 @@ Column rightMargin: UM.Theme.getSize("thin_margin").height } - Cura.IconLabel + Cura.IconWithText { id: estimatedTime width: parent.width @@ -54,7 +54,7 @@ Column font: UM.Theme.getFont("default_bold") } - Cura.IconLabel + Cura.IconWithText { id: estimatedCosts width: parent.width @@ -84,7 +84,6 @@ Column return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } source: UM.Theme.getIcon("spool") - font: UM.Theme.getFont("default") } } diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 8f6608e15c..18caeafb40 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -52,7 +52,7 @@ Column renderType: Text.NativeRendering } - Cura.IconLabel + Cura.IconWithText { id: unableToSliceMessage width: parent.width @@ -61,7 +61,6 @@ Column text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") source: UM.Theme.getIcon("warning") color: UM.Theme.getColor("warning") - font: UM.Theme.getFont("default") } // Progress bar, only visible when the backend is in the process of slice the printjob diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml deleted file mode 100644 index ed41fba499..0000000000 --- a/resources/qml/IconLabel.qml +++ /dev/null @@ -1,50 +0,0 @@ -// 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.3 - -import UM 1.1 as UM - -// This item will show a label with a squared icon in the left -Item -{ - id: container - - property alias text: label.text - property alias source: icon.source - property alias color: label.color - property alias font: label.font - property alias iconSize: icon.width - - implicitHeight: icon.height - - UM.RecolorImage - { - id: icon - - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - - source: "" - width: UM.Theme.getSize("section_icon").width - height: width - - color: label.color - visible: source != "" - } - - Label - { - id: label - anchors.left: icon.visible ? icon.right : parent.left - anchors.right: parent.right - anchors.leftMargin: UM.Theme.getSize("thin_margin").width - anchors.verticalCenter: icon.verticalCenter - text: "Empty label" - elide: Text.ElideRight - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - } -} \ No newline at end of file diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index 22599b3aed..5530740040 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -13,9 +13,11 @@ import Cura 1.0 as Cura // It sets the icon size + half of the content as its minium width (in which case it will elide the text) Item { - property alias iconColor: icon.color property alias source: icon.source + property alias iconSize: icon.width + property alias color: label.color property alias text: label.text + property alias font: label.font property real margin: UM.Theme.getSize("narrow_margin").width @@ -37,7 +39,7 @@ Item width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - color: "black" + color: label.color anchors { diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index d4057289f6..518f3d49eb 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -43,7 +43,6 @@ RowLayout source: UM.Theme.getIcon("category_support") text: supportEnabled.properties.value == "True" ? enabledText : disabledText - UM.SettingPropertyProvider { id: supportEnabled diff --git a/resources/qml/qmldir b/resources/qml/qmldir index c19b982318..1dc21150ce 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -7,7 +7,6 @@ ActionButton 1.0 ActionButton.qml MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml ActionPanelWidget 1.0 ActionPanelWidget.qml -IconLabel 1.0 IconLabel.qml IconWithText 1.0 IconWithText.qml OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml ExpandableComponent 1.0 ExpandableComponent.qml From 1d33fe081fd30e257d9b0f5443288ad069b5f73c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Dec 2018 12:07:41 +0100 Subject: [PATCH 495/558] Clean up the code Remove all the references to the sidebar and use the term print_setup instead. Contributes to CURA-5941. --- .../PostProcessingPlugin.qml | 2 +- .../resources/qml/UM3InfoComponents.qml | 4 +- resources/qml/Cura.qml | 2 +- .../ConfigurationMenu/CustomConfiguration.qml | 4 +- resources/qml/MonitorButton.qml | 4 +- resources/qml/MonitorSidebar.qml | 2 +- resources/qml/ObjectsList.qml | 4 +- resources/qml/PrintMonitor.qml | 2 +- .../Custom/GlobalProfileSelector.qml | 2 +- ...debarTooltip.qml => PrintSetupTooltip.qml} | 0 resources/qml/SidebarContents.qml | 43 ------------------- resources/themes/cura-light/styles.qml | 6 +-- 12 files changed, 16 insertions(+), 59 deletions(-) rename resources/qml/{SidebarTooltip.qml => PrintSetupTooltip.qml} (100%) delete mode 100644 resources/qml/SidebarContents.qml diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 3fa10c23b9..b962f4d53b 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -412,7 +412,7 @@ UM.Dialog } } - Cura.SidebarTooltip + Cura.PrintSetupTooltip { id: tooltip } diff --git a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml index 105143c851..643c8164a7 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml @@ -29,7 +29,7 @@ Item { Button { height: UM.Theme.getSize("save_button_save_to_button").height; onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication(); - style: UM.Theme.styles.sidebar_action_button; + style: UM.Theme.styles.print_setup_action_button; text: catalog.i18nc("@action:button", "Request Access"); tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer"); visible: printerConnected && !printerAcceptsCommands && !authenticationRequested; @@ -38,7 +38,7 @@ Item { Button { height: UM.Theme.getSize("save_button_save_to_button").height; onClicked: connectActionDialog.show(); - style: UM.Theme.styles.sidebar_action_button; + style: UM.Theme.styles.print_setup_action_button; text: catalog.i18nc("@action:button", "Connect"); tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer"); visible: !printerConnected; diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 4e609ccbed..2df79d63c9 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -309,7 +309,7 @@ UM.MainWindow } } - SidebarTooltip + PrintSetupTooltip { id: tooltip } diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index ec9c5d0e38..78f6864c97 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -204,7 +204,7 @@ Item height: UM.Theme.getSize("setting_control").height width: selectors.controlWidth - style: UM.Theme.styles.sidebar_header_button + style: UM.Theme.styles.print_setup_header_button activeFocusOnPress: true menu: Cura.MaterialMenu { @@ -237,7 +237,7 @@ Item height: UM.Theme.getSize("setting_control").height width: selectors.controlWidth - style: UM.Theme.styles.sidebar_header_button + style: UM.Theme.styles.print_setup_header_button activeFocusOnPress: true; menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index eef76bcb09..fd7d2287c4 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -309,7 +309,7 @@ Item } } - style: UM.Theme.styles.sidebar_action_button + style: UM.Theme.styles.print_setup_action_button } Button @@ -325,7 +325,7 @@ Item text: catalog.i18nc("@label", "Abort Print") onClicked: confirmationDialog.visible = true - style: UM.Theme.styles.sidebar_action_button + style: UM.Theme.styles.print_setup_action_button } MessageDialog diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index 50416e34ab..669bdbfb8f 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -173,7 +173,7 @@ Rectangle anchors.bottom: parent.bottom } - SidebarTooltip + PrintSetupTooltip { id: tooltip } diff --git a/resources/qml/ObjectsList.qml b/resources/qml/ObjectsList.qml index 8f45b3744f..fd5175fce2 100644 --- a/resources/qml/ObjectsList.qml +++ b/resources/qml/ObjectsList.qml @@ -224,7 +224,7 @@ Rectangle { id: arrangeAllBuildPlatesButton; text: catalog.i18nc("@action:button","Arrange to all build plates"); - style: UM.Theme.styles.sidebar_action_button + style: UM.Theme.styles.print_setup_action_button height: UM.Theme.getSize("objects_menu_button").height; tooltip: ''; anchors @@ -244,7 +244,7 @@ Rectangle { id: arrangeBuildPlateButton; text: catalog.i18nc("@action:button","Arrange current build plate"); - style: UM.Theme.styles.sidebar_action_button + style: UM.Theme.styles.print_setup_action_button height: UM.Theme.getSize("objects_menu_button").height; tooltip: ''; anchors diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 3cc161cbe7..4ed8daa55c 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -49,7 +49,7 @@ Rectangle property var activePrinter: connectedDevice != null ? connectedDevice.activePrinter : null property var activePrintJob: activePrinter != null ? activePrinter.activePrintJob: null - SidebarTooltip + PrintSetupTooltip { id: tooltip } diff --git a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml index 11b2d3608b..8baaf9a7ae 100644 --- a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml @@ -43,7 +43,7 @@ Item right: parent.right } tooltip: Cura.MachineManager.activeQualityOrQualityChangesName - style: UM.Theme.styles.sidebar_header_button + style: UM.Theme.styles.print_setup_header_button activeFocusOnPress: true menu: Cura.ProfileMenu { } diff --git a/resources/qml/SidebarTooltip.qml b/resources/qml/PrintSetupTooltip.qml similarity index 100% rename from resources/qml/SidebarTooltip.qml rename to resources/qml/PrintSetupTooltip.qml diff --git a/resources/qml/SidebarContents.qml b/resources/qml/SidebarContents.qml deleted file mode 100644 index 0b19bfe3c1..0000000000 --- a/resources/qml/SidebarContents.qml +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -StackView -{ - id: sidebarContents - - delegate: StackViewDelegate - { - function transitionFinished(properties) - { - properties.exitItem.opacity = 1 - } - - pushTransition: StackViewTransition - { - PropertyAnimation - { - target: enterItem - property: "opacity" - from: 0 - to: 1 - duration: 100 - } - PropertyAnimation - { - target: exitItem - property: "opacity" - from: 1 - to: 0 - duration: 100 - } - } - } -} \ No newline at end of file diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 18fce7f319..bcc754f4ca 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -9,7 +9,7 @@ import UM 1.1 as UM QtObject { - property Component sidebar_header_button: Component + property Component print_setup_header_button: Component { ButtonStyle { @@ -80,7 +80,7 @@ QtObject } Label { - id: sidebarComboBoxLabel + id: printSetupComboBoxLabel color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text") text: control.text; elide: Text.ElideRight; @@ -644,7 +644,7 @@ QtObject } } - property Component sidebar_action_button: Component + property Component print_setup_action_button: Component { ButtonStyle { From dfe55b8f23b90fcdac812fc97a62e22bfcf6eea9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 12:59:51 +0100 Subject: [PATCH 496/558] Fix height of expandable component adapting to contents Since the children don't adjust their height based on if they are visible (which would cause a binding loop) we just need to adjust the height of the total menu based on which children are visible. Easy enough. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/ConfigurationMenu.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 9bef2ca0be..5780649423 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -139,7 +139,19 @@ Cura.ExpandableComponent Item { width: parent.width - height: childrenRect.height + height: + { + var height = 0; + if(autoConfiguration.visible) + { + height += autoConfiguration.height; + } + if(customConfiguration.visible) + { + height += customConfiguration.height; + } + return height; + } AutoConfiguration { id: autoConfiguration From 6a696a57f25e0ac41091320a9abb64a3ccce37c6 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 7 Dec 2018 13:01:49 +0100 Subject: [PATCH 497/558] Removed unused property --- resources/qml/JobSpecs.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 8b06ab06db..c7f82b8876 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -80,7 +80,6 @@ Item height: UM.Theme.getSize("jobspecs_line").height width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 - property int unremovableSpacing: 5 text: PrintInformation.jobName horizontalAlignment: TextInput.AlignLeft From 26be65e405f42ea806c10501a8c09793fe58a896 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Dec 2018 13:29:16 +0100 Subject: [PATCH 498/558] Fix some other merge conflicts Contributes to CURA-6008. --- resources/qml/ExpandableComponent.qml | 3 +- resources/qml/ExpandablePopup.qml | 2 +- resources/qml/JobSpecs.qml | 1 - resources/themes/cura-light/theme.json | 81 ++++++++++++++------------ 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3f30f8f386..3a03740251 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -109,10 +109,9 @@ Item } source: UM.Theme.getIcon("pencil") visible: source != "" && base.enabled -// color: UM.Theme.getColor("small_button_text") width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("small_button_text") } MouseArea diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index a1e2fb0fea..c15310f803 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -131,7 +131,7 @@ Item visible: source != "" && base.enabled width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("small_button_text") } MouseArea diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 8b06ab06db..c7f82b8876 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -80,7 +80,6 @@ Item height: UM.Theme.getSize("jobspecs_line").height width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 - property int unremovableSpacing: 5 text: PrintInformation.jobName horizontalAlignment: TextInput.AlignLeft diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f96a785f11..16d13b9652 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -35,7 +35,7 @@ "family": "Noto Sans" }, "default_italic": { - "size": 1.15, + "size": 1.0, "weight": 50, "italic": true, "family": "Noto Sans" @@ -80,7 +80,7 @@ "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], - "secondary": [240, 240, 240, 255], + "secondary": [245, 245, 245, 255], "secondary_shadow": [216, 216, 216, 255], "primary_button": [38, 113, 231, 255], @@ -178,34 +178,34 @@ "action_button_disabled_shadow": [228, 228, 228, 255], "scrollbar_background": [255, 255, 255, 255], - "scrollbar_handle": [31, 36, 39, 255], - "scrollbar_handle_hover": [12, 159, 227, 255], - "scrollbar_handle_down": [12, 159, 227, 255], + "scrollbar_handle": [10, 8, 80, 255], + "scrollbar_handle_hover": [50, 130, 255, 255], + "scrollbar_handle_down": [50, 130, 255, 255], "setting_category": [245, 245, 245, 255], "setting_category_disabled": [255, 255, 255, 255], - "setting_category_hover": [245, 245, 245, 255], + "setting_category_hover": [232, 242, 252, 255], "setting_category_active": [245, 245, 245, 255], - "setting_category_active_hover": [245, 245, 245, 255], - "setting_category_text": [31, 36, 39, 255], + "setting_category_active_hover": [232, 242, 252, 255], + "setting_category_text": [35, 35, 35, 255], "setting_category_disabled_text": [24, 41, 77, 101], - "setting_category_hover_text": [31, 36, 39, 255], - "setting_category_active_text": [31, 36, 39, 255], - "setting_category_active_hover_text": [31, 36, 39, 255], + "setting_category_hover_text": [35, 35, 35, 255], + "setting_category_active_text": [35, 35, 35, 255], + "setting_category_active_hover_text": [35, 35, 35, 255], "setting_category_border": [245, 245, 245, 255], "setting_category_disabled_border": [245, 245, 245, 255], - "setting_category_hover_border": [12, 159, 227, 255], - "setting_category_active_border": [245, 245, 245, 255], - "setting_category_active_hover_border": [12, 159, 227, 255], + "setting_category_hover_border": [50, 130, 255, 255], + "setting_category_active_border": [50, 130, 255, 255], + "setting_category_active_hover_border": [50, 130, 255, 255], "setting_control": [255, 255, 255, 255], "setting_control_selected": [31, 36, 39, 255], "setting_control_highlight": [255, 255, 255, 255], - "setting_control_border": [127, 127, 127, 255], + "setting_control_border": [199, 199, 199, 255], "setting_control_border_highlight": [50, 130, 255, 255], - "setting_control_text": [27, 27, 27, 255], - "setting_control_depth_line": [127, 127, 127, 255], - "setting_control_button": [127, 127, 127, 255], + "setting_control_text": [35, 35, 35, 255], + "setting_control_depth_line": [199, 199, 199, 255], + "setting_control_button": [199, 199, 199, 255], "setting_control_button_hover": [70, 84, 113, 255], "setting_control_disabled": [245, 245, 245, 255], "setting_control_disabled_text": [127, 127, 127, 255], @@ -216,6 +216,7 @@ "setting_validation_warning_background": [255, 145, 62, 255], "setting_validation_warning": [127, 127, 127, 255], "setting_validation_ok": [255, 255, 255, 255], + "setting_filter_field" : [153, 153, 153, 255], "material_compatibility_warning": [0, 0, 0, 255], @@ -233,11 +234,11 @@ "checkbox": [255, 255, 255, 255], "checkbox_hover": [255, 255, 255, 255], - "checkbox_border": [64, 69, 72, 255], + "checkbox_border": [199, 199, 199, 255], "checkbox_border_hover": [50, 130, 255, 255], - "checkbox_mark": [119, 122, 124, 255], + "checkbox_mark": [50, 130, 255, 255], "checkbox_disabled": [223, 223, 223, 255], - "checkbox_text": [27, 27, 27, 255], + "checkbox_text": [35, 35, 35, 255], "tooltip": [68, 192, 255, 255], "tooltip_text": [255, 255, 255, 255], @@ -293,16 +294,16 @@ "xray_error": [255, 0, 0, 255], "layerview_ghost": [32, 32, 32, 96], - "layerview_none": [255, 255, 255, 255], - "layerview_inset_0": [255, 0, 0, 255], - "layerview_inset_x": [0, 255, 0, 255], - "layerview_skin": [255, 255, 0, 255], - "layerview_support": [0, 255, 255, 255], - "layerview_skirt": [0, 255, 255, 255], - "layerview_infill": [255, 192, 0, 255], - "layerview_support_infill": [0, 255, 255, 255], - "layerview_move_combing": [0, 0, 255, 255], - "layerview_move_retraction": [128, 128, 255, 255], + "layerview_none": [255, 255, 255, 255], + "layerview_inset_0": [255, 0, 0, 255], + "layerview_inset_x": [0, 255, 0, 255], + "layerview_skin": [255, 255, 0, 255], + "layerview_support": [0, 255, 255, 255], + "layerview_skirt": [0, 255, 255, 255], + "layerview_infill": [255, 192, 0, 255], + "layerview_support_infill": [0, 255, 255, 255], + "layerview_move_combing": [0, 0, 255, 255], + "layerview_move_retraction": [128, 128, 255, 255], "layerview_support_interface": [64, 192, 255, 255], "layerview_nozzle": [181, 166, 66, 50], @@ -356,10 +357,16 @@ "account_button": [12, 3], - "print_setup_widget": [30.0, 42.0], + "print_setup_widget": [38.0, 30.0], "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], + "print_setup_widget_header": [0.0, 3.0], + "print_setup_slider_groove": [0.16, 0.16], + "print_setup_slider_handle": [1.0, 1.0], + "print_setup_slider_tickmarks": [0.32, 0.32], + "print_setup_big_item": [28, 2.5], + "print_setup_icon": [1.2, 1.2], "configuration_selector_mode_tabs": [0.0, 3.0], @@ -391,12 +398,13 @@ "extruder_icon": [2.33, 2.33], - "section": [0.0, 2.2], + "section": [0.0, 2], "section_icon": [1.6, 1.6], "section_icon_column": [2.8, 0.0], "setting": [25.0, 1.8], - "setting_control": [10.0, 2.0], + "setting_control": [11.0, 2.0], + "setting_control_radius": [0.15, 0.15], "setting_control_depth_margin": [1.4, 0.0], "setting_preferences_button_margin": [4, 0.0], "setting_control_margin": [0.0, 0.0], @@ -404,7 +412,7 @@ "setting_text_maxwidth": [40.0, 0.0], "standard_list_lineheight": [1.5, 1.5], - "standard_arrow": [0.8, 0.8], + "standard_arrow": [1.0, 1.0], "button": [4, 4], "button_icon": [2.5, 2.5], @@ -444,7 +452,8 @@ "layerview_row": [11.0, 1.5], "layerview_row_spacing": [0.0, 0.5], - "checkbox": [2.0, 2.0], + "checkbox": [1.5, 1.5], + "checkbox_radius": [0.08, 0.08], "tooltip": [20.0, 10.0], "tooltip_margins": [1.0, 1.0], From e74258c26bd1917d87e5fd4bbb1f77719eb947f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 13:39:42 +0100 Subject: [PATCH 499/558] Don't show materials if printer has no materials But if the printer does have other configurations to change, do show a placeholder text to indicate that the configuration can be selected here. This also simplifies a bit of code where it would need to call an updateEnabled() function, since it turns out that these properties in Cura.MachineManager have proper signals (contrary to what was previously used, the metadata entry stuff). Contributes to issue UCRA-5876. --- .../ConfigurationMenu/ConfigurationMenu.qml | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index c282975cd3..33a317b42b 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -34,9 +34,11 @@ Cura.ExpandablePopup Custom } + enabled: Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants || Cura.MachineManager.hasVariantBuildplates; //Only let it drop down if there is any configuration that you could change. + headerItem: Item { - // Horizontal list that shows the extruders + // Horizontal list that shows the extruders and their materials ListView { id: extrudersList @@ -44,7 +46,7 @@ Cura.ExpandablePopup orientation: ListView.Horizontal anchors.fill: parent model: extrudersModel - visible: base.enabled + visible: Cura.MachineManager.hasMaterials delegate: Item { @@ -101,24 +103,26 @@ Cura.ExpandablePopup } } } - } - //Disable the menu if there are no materials, variants or build plates to change. - function updateEnabled() - { - var active_definition_id = Cura.MachineManager.activeMachine.definition.id; - var has_materials = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_materials"); - var has_variants = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variants"); - var has_buildplates = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variant_buildplates"); - base.enabled = has_materials || has_variants || has_buildplates; //Only let it drop down if there is any configuration that you could change. - } + //Placeholder text if there is a configuration to select but no materials (so we can't show the materials per extruder). + Label + { + text: catalog.i18nc("@label", "Select configuration") + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering - Connections - { - target: Cura.MachineManager - onGlobalContainerChanged: base.updateEnabled(); + visible: !Cura.MachineManager.hasMaterials && (Cura.MachineManager.hasVariants || Cura.MachineManager.hasVariantBuildplates) + + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + } } - Component.onCompleted: updateEnabled(); contentItem: Column { From 15f81da95b40e1cb27a73b9f13562bc6f525f296 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Dec 2018 13:47:58 +0100 Subject: [PATCH 500/558] Do not show the layer height in the header panel when the profile is not supported --- cura/Settings/MachineManager.py | 4 ++++ .../PrintSetupSelectorHeader.qml | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index a472cc7f09..c375ce01d1 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1536,6 +1536,10 @@ class MachineManager(QObject): name = self._current_quality_group.name return name + @pyqtProperty(bool, notify = activeQualityGroupChanged) + def hasNotSupportedQuality(self) -> bool: + return self._current_quality_group is None and self._current_quality_changes_group is None + def _updateUponMaterialMetadataChange(self) -> None: if self._global_container_stack is None: return diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index 518f3d49eb..d4287045b8 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -13,7 +13,19 @@ RowLayout Cura.IconWithText { source: UM.Theme.getIcon("category_layer_height") - text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : "" + text: + { + if (Cura.MachineManager.activeStack) + { + var text = Cura.MachineManager.activeQualityOrQualityChangesName + if (!Cura.MachineManager.hasNotSupportedQuality) + { + text += " " + layerHeight.properties.value + "mm" + } + return text + } + return "" + } UM.SettingPropertyProvider { From 43a06fdc3d85e618534297d967c560cdc9783c08 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 13:49:17 +0100 Subject: [PATCH 501/558] Add more margin above printer type labels A bit of Gestalt. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index e7936b69d2..53969a0370 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -64,11 +64,12 @@ Column section.criteria: ViewSection.FullString section.delegate: Item { - height: printerTypeLabel.height + UM.Theme.getSize("default_margin").height + height: printerTypeLabel.height + UM.Theme.getSize("default_margin").height * 2 //Causes a default margin above the label and a default margin below the label. Cura.PrinterTypeLabel { id: printerTypeLabel text: Cura.MachineManager.getAbbreviatedMachineName(section) + anchors.verticalCenter: parent.verticalCenter //One default margin above and one below. } } From 8e2c130416ecdf1adf21bc8d5388588442f6f6c7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 14:31:06 +0100 Subject: [PATCH 502/558] Use default lining style as separator for buildplate Normal colour, normal thickness. Contributes to issue CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 6ac1e6a2ad..05cac16e29 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -72,8 +72,8 @@ Button right: parent.right rightMargin: parent.padding } - height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0 - color: UM.Theme.getColor("text") + height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0 + color: UM.Theme.getColor("lining") } Item From c663681e66a42b63b1e831a1dbf967e6043f563b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 14:39:43 +0100 Subject: [PATCH 503/558] Simplify buildplate icon Removed all unnecessary crap added by Sketch. Contributes to issue CURA-5876. --- .../themes/cura-light/icons/buildplate.svg | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/resources/themes/cura-light/icons/buildplate.svg b/resources/themes/cura-light/icons/buildplate.svg index 9e61296958..d844b91a28 100644 --- a/resources/themes/cura-light/icons/buildplate.svg +++ b/resources/themes/cura-light/icons/buildplate.svg @@ -1,17 +1,9 @@ - - - icn_buildplate - Created with Sketch. - - - - - - - - - - + + + + + + \ No newline at end of file From 78df27369f1cc423fc3e369d22da6115fba43560 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 14:41:30 +0100 Subject: [PATCH 504/558] Fill buildplate icon This is according to our newest designs. Contributes to issue CURA-5876. --- resources/themes/cura-light/icons/buildplate.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/icons/buildplate.svg b/resources/themes/cura-light/icons/buildplate.svg index d844b91a28..7505c8204e 100644 --- a/resources/themes/cura-light/icons/buildplate.svg +++ b/resources/themes/cura-light/icons/buildplate.svg @@ -4,6 +4,6 @@ - + \ No newline at end of file From ffcac04f9e1bb595bc30a33ba0d9aeb327b7c45d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 15:21:53 +0100 Subject: [PATCH 505/558] Add printer type selector if connected to cluster If there are 2 or more printer types in your connected cluster, you can switch the printer type here. Contributes to issue CURA-5876. --- .../ConfigurationMenu/CustomConfiguration.qml | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 78f6864c97..8429e2c093 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -36,10 +36,57 @@ Item } } + //Printer type selector. + Item + { + id: printerTypeSelectorRow + visible: + { + return Cura.MachineManager.printerOutputDevices.length >= 1 //If connected... + && Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount != null //...and we have configuration information... + && Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount.length > 1; //...and there is more than one type of printer in the configuration list. + } + height: visible ? childrenRect.height : 0 + + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + top: header.bottom + topMargin: visible ? UM.Theme.getSize("default_margin").height : 0 + } + + Label + { + text: catalog.i18nc("@label", "Printer") + width: Math.round(parent.width * 0.3) - UM.Theme.getSize("default_margin").width + height: contentHeight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + anchors.verticalCenter: printerTypeSelector.verticalCenter + anchors.left: parent.left + } + + OldControls.ToolButton + { + id: printerTypeSelector + text: Cura.MachineManager.activeMachineDefinitionName + tooltip: Cura.MachineManager.activeMachineDefinitionName + height: UM.Theme.getSize("setting_control").height + width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width + anchors.right: parent.right + style: UM.Theme.styles.print_setup_header_button + + menu: Cura.PrinterTypeMenu { } + } + } + UM.TabRow { id: tabBar - anchors.top: header.bottom + anchors.top: printerTypeSelectorRow.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height visible: extrudersModel.count > 1 From 6a7bbe5bdb46c3f6db301097d30e472f3b45702e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 15:31:12 +0100 Subject: [PATCH 506/558] Fix hiding materials if material is empty Because the loaded material profile has the name 'Empty' then. Contributes to issue CURA-5876. --- .../qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 885f02d740..a344e31d4f 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -20,7 +20,7 @@ Row { materialColor: printCoreConfiguration.material.color anchors.verticalCenter: parent.verticalCenter - extruderEnabled: printCoreConfiguration.material.name !== "" && printCoreConfiguration.hotendID !== "" + extruderEnabled: printCoreConfiguration.material.brand !== "" && printCoreConfiguration.hotendID !== "" } Column @@ -36,7 +36,7 @@ Row } Label { - text: printCoreConfiguration.material.name ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct. + text: printCoreConfiguration.material.brand ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct. renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("default") From b565b111c873dd3804f2ce50193c5836850c7fe9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 15:38:08 +0100 Subject: [PATCH 507/558] Adjust disabled extruder colour This also introduces a more global 'disabled' colour as defined by the style guide. I hope that we can gradually transition to this one, but we'll have to adjust some colours here and there. Contributes to issue CURA-5876. --- resources/qml/ExtruderIcon.qml | 2 +- resources/themes/cura-dark/theme.json | 1 + resources/themes/cura-light/theme.json | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 49ad73a32e..bb0b347b7e 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -23,7 +23,7 @@ Item anchors.fill: parent source: UM.Theme.getIcon("extruder_button") - color: extruderEnabled ? materialColor: "gray" + color: extruderEnabled ? materialColor: UM.Theme.getColor("disabled") } Rectangle diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index d9ef74ebb9..8540abf61a 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -35,6 +35,7 @@ "text_scene_hover": [255, 255, 255, 204], "error": [212, 31, 53, 255], + "disabled": [32, 32, 32, 255], "button": [39, 44, 48, 255], "button_hover": [39, 44, 48, 255], diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 16d13b9652..d4fb59b7a1 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -129,6 +129,7 @@ "error": [255, 140, 0, 255], "warning": [245, 166, 35, 255], + "disabled": [229, 229, 229, 255], "toolbar_button_text": [8, 7, 63, 255], "toolbar_button_hover": [232, 242, 252, 255], From 9dc8450db0aa3ba21b969f787a29a6fe775058f2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 7 Dec 2018 17:37:10 +0100 Subject: [PATCH 508/558] Fix typo --- .../Recommended/RecommendedQualityProfileSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 4963f10792..15d40f545a 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -350,7 +350,7 @@ Item enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated onEntered: { - var tooltipContent = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") + var tooltipContent = catalog.i18nc("@tooltip", "This quality profile is not available for your current material and nozzle configuration. Please change these to enable this quality profile") base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), tooltipContent) } onExited: base.hideTooltip() From 9e7a52e28bd783876ae8255fc3648f4dbb7fcc4e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 09:43:50 +0100 Subject: [PATCH 509/558] Update the background color for the expandable component when using the close button. Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3a03740251..4170a0942e 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -71,7 +71,15 @@ Item function toggleContent() { - content.visible = !content.visible + content.visible = !expanded + } + + // Add this binding since the background color is not updated otherwise + Binding + { + target: background + property: "color" + value: expanded ? headerActiveColor : headerBackgroundColor } implicitHeight: 100 * screenScaleFactor @@ -82,7 +90,7 @@ Item id: background property real padding: UM.Theme.getSize("default_margin").width - color: headerBackgroundColor + color: expanded ? headerActiveColor : headerBackgroundColor anchors.fill: parent Loader From 8cfb9350bc2931224d4be597c3650c0b808e4e2c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 10:36:55 +0100 Subject: [PATCH 510/558] Add a mouse area to gather the scroll events in the settings panel Contributes to CURA-5941. --- resources/qml/Settings/SettingView.qml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 3f84296307..9904770281 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -168,8 +168,10 @@ Item style: ButtonStyle { - background: Item { - UM.RecolorImage { + background: Item + { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: UM.Theme.getSize("standard_arrow").width @@ -180,8 +182,9 @@ Item source: UM.Theme.getIcon("menu") } } - label: Label{} + label: Label {} } + menu: SettingVisibilityPresetsMenu { onShowAllSettings: @@ -192,6 +195,14 @@ Item } } + // Mouse area that gathers the scroll events to not propagate it to the main view. + MouseArea + { + anchors.fill: scrollView + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true + } + ScrollView { id: scrollView From 12522c929372c06ec55731ec381fed3f84bd2f8d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 11:19:44 +0100 Subject: [PATCH 511/558] Change hover colors of the small buttons. Contributes to CURA-5941 --- .../PrintSetupSelectorContents.qml | 4 ++-- resources/qml/Settings/SettingView.qml | 2 +- resources/qml/ViewOrientationButton.qml | 1 - resources/themes/cura-light/theme.json | 14 +++++++------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 47d25edd54..7cd03ff74a 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -74,6 +74,7 @@ Item id: closeButton width: UM.Theme.getSize("message_close").width height: UM.Theme.getSize("message_close").height + hoverEnabled: true anchors { @@ -86,8 +87,7 @@ Item { anchors.fill: parent sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("message_text") + color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") source: UM.Theme.getIcon("cross1") } diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 9904770281..c1b4b28d1d 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -178,7 +178,7 @@ Item height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: height - color: control.enabled ? UM.Theme.getColor("setting_category_text") : UM.Theme.getColor("setting_category_disabled_text") + color: control.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") source: UM.Theme.getIcon("menu") } } diff --git a/resources/qml/ViewOrientationButton.qml b/resources/qml/ViewOrientationButton.qml index 682fd71b4e..5371f8549b 100644 --- a/resources/qml/ViewOrientationButton.qml +++ b/resources/qml/ViewOrientationButton.qml @@ -9,7 +9,6 @@ UM.SimpleButton { width: UM.Theme.getSize("small_button").width height: UM.Theme.getSize("small_button").height - hoverBackgroundColor: UM.Theme.getColor("small_button_hover") hoverColor: UM.Theme.getColor("small_button_text_hover") color: UM.Theme.getColor("small_button_text") iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d4fb59b7a1..0ef6c24bfb 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -80,7 +80,7 @@ "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], "border": [127, 127, 127, 255], - "secondary": [245, 245, 245, 255], + "secondary": [240, 240, 240, 255], "secondary_shadow": [216, 216, 216, 255], "primary_button": [38, 113, 231, 255], @@ -150,7 +150,7 @@ "small_button_active": [10, 8, 80, 255], "small_button_active_hover": [10, 8, 80, 255], "small_button_text": [102, 102, 102, 255], - "small_button_text_hover": [255, 255, 255, 255], + "small_button_text_hover": [8, 7, 63, 255], "small_button_text_active": [255, 255, 255, 255], "small_button_text_active_hover": [255, 255, 255, 255], @@ -183,18 +183,18 @@ "scrollbar_handle_hover": [50, 130, 255, 255], "scrollbar_handle_down": [50, 130, 255, 255], - "setting_category": [245, 245, 245, 255], + "setting_category": [240, 240, 240, 255], "setting_category_disabled": [255, 255, 255, 255], "setting_category_hover": [232, 242, 252, 255], - "setting_category_active": [245, 245, 245, 255], + "setting_category_active": [240, 240, 240, 255], "setting_category_active_hover": [232, 242, 252, 255], "setting_category_text": [35, 35, 35, 255], "setting_category_disabled_text": [24, 41, 77, 101], "setting_category_hover_text": [35, 35, 35, 255], "setting_category_active_text": [35, 35, 35, 255], "setting_category_active_hover_text": [35, 35, 35, 255], - "setting_category_border": [245, 245, 245, 255], - "setting_category_disabled_border": [245, 245, 245, 255], + "setting_category_border": [240, 240, 240, 255], + "setting_category_disabled_border": [240, 240, 240, 255], "setting_category_hover_border": [50, 130, 255, 255], "setting_category_active_border": [50, 130, 255, 255], "setting_category_active_hover_border": [50, 130, 255, 255], @@ -274,7 +274,7 @@ "z_axis": [0, 255, 0, 255], "all_axis": [255, 255, 255, 255], - "viewport_background": [245, 245, 245, 255], + "viewport_background": [250, 250, 250, 255], "volume_outline": [50, 130, 255, 255], "buildplate": [244, 244, 244, 255], "buildplate_grid": [129, 131, 134, 255], From 021c44862752905999fdd0aaf9fac3130cb3e5b2 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 11:31:18 +0100 Subject: [PATCH 512/558] Remove depreciated monitor tab stuff Contributes to CL-1152 --- .../resources/qml/PrintCoreConfiguration.qml | 121 ----- .../resources/qml/PrintJobInfoBlock.qml | 505 ------------------ .../resources/qml/PrintJobPreview.qml | 75 --- .../resources/qml/PrintJobTitle.qml | 59 -- .../resources/qml/PrinterCard.qml | 241 --------- .../resources/qml/PrinterCardDetails.qml | 75 --- .../resources/qml/PrinterCardProgressBar.qml | 108 ---- .../resources/qml/PrinterFamilyPill.qml | 32 -- .../resources/qml/PrinterInfoBlock.qml | 83 --- 9 files changed, 1299 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml deleted file mode 100644 index 7bcd9ce6e4..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import UM 1.2 as UM - -Item { - id: extruderInfo; - property var printCoreConfiguration: null; - height: childrenRect.height; - width: Math.round(parent.width / 2); - - // Extruder circle - Item { - id: extruderCircle; - height: UM.Theme.getSize("monitor_extruder_circle").height; - width: UM.Theme.getSize("monitor_extruder_circle").width; - - // Loading skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill"); - radius: Math.round(width / 2); - visible: !printCoreConfiguration; - } - - // Actual content - Rectangle { - anchors.fill: parent; - border.width: UM.Theme.getSize("monitor_thick_lining").width; - border.color: UM.Theme.getColor("monitor_lining_heavy"); - color: "transparent"; - opacity: { - if (printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null) { - return 0.5; - } - return 1; - } - radius: Math.round(width / 2); - visible: printCoreConfiguration; - - Label { - anchors.centerIn: parent; - color: UM.Theme.getColor("text"); - font: UM.Theme.getFont("default_bold"); - text: printCoreConfiguration ? printCoreConfiguration.position + 1 : 0; - } - } - } - - // Print core and material labels - Item { - id: materialLabel - anchors { - left: extruderCircle.right; - leftMargin: UM.Theme.getSize("default_margin").width; - right: parent.right; - top: parent.top; - } - height: UM.Theme.getSize("monitor_text_line").height; - - // Loading skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill"); - visible: !extruderInfo.printCoreConfiguration; - } - - // Actual content - Label { - anchors.fill: parent; - elide: Text.ElideRight; - color: UM.Theme.getColor("text"); - font: UM.Theme.getFont("default"); - text: { - if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) { - return printCoreConfiguration.activeMaterial.name; - } - return ""; - } - visible: extruderInfo.printCoreConfiguration; - } - } - - Item { - id: printCoreLabel; - anchors { - left: extruderCircle.right; - leftMargin: UM.Theme.getSize("default_margin").width; - right: parent.right; - top: materialLabel.bottom; - topMargin: Math.floor(UM.Theme.getSize("default_margin").height/4); - } - height: UM.Theme.getSize("monitor_text_line").height; - - // Loading skeleton - Rectangle { - color: UM.Theme.getColor("monitor_skeleton_fill"); - height: parent.height; - visible: !extruderInfo.printCoreConfiguration; - width: Math.round(parent.width / 3); - } - - // Actual content - Label { - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default"); - opacity: 0.6; - text: { - if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) { - return printCoreConfiguration.hotendID; - } - return ""; - } - visible: extruderInfo.printCoreConfiguration; - } - } -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml deleted file mode 100644 index a611cb4ff6..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import UM 1.3 as UM - -Item { - id: root; - property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width; - property var shadowOffset: 2 * screenScaleFactor; - property var debug: false; - property var printJob: null; - width: parent.width; // Bubbles downward - height: childrenRect.height + shadowRadius * 2; // Bubbles upward - - UM.I18nCatalog { - id: catalog; - name: "cura"; - } - - // The actual card (white block) - Rectangle { - // 5px margin, but shifted 2px vertically because of the shadow - anchors { - bottomMargin: root.shadowRadius + root.shadowOffset; - leftMargin: root.shadowRadius; - rightMargin: root.shadowRadius; - topMargin: root.shadowRadius - root.shadowOffset; - } - color: UM.Theme.getColor("monitor_card_background"); - height: childrenRect.height; - layer.enabled: true - layer.effect: DropShadow { - radius: root.shadowRadius - verticalOffset: 2 * screenScaleFactor - color: "#3F000000" // 25% shadow - } - width: parent.width - shadowRadius * 2; - - Column { - height: childrenRect.height; - width: parent.width; - - // Main content - Item { - id: mainContent; - height: 200 * screenScaleFactor; // TODO: Theme! - width: parent.width; - - // Left content - Item { - anchors { - bottom: parent.bottom; - left: parent.left; - margins: UM.Theme.getSize("wide_margin").width; - right: parent.horizontalCenter; - top: parent.top; - } - - Item { - id: printJobName; - width: parent.width; - height: UM.Theme.getSize("monitor_text_line").height; - - Rectangle { - color: UM.Theme.getColor("monitor_skeleton_fill"); - height: parent.height; - visible: !printJob; - width: Math.round(parent.width / 3); - } - Label { - anchors.fill: parent; - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default_bold"); - text: printJob && printJob.name ? printJob.name : ""; // Supress QML warnings - visible: printJob; - } - } - - Item { - id: printJobOwnerName; - anchors { - top: printJobName.bottom; - topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2); - } - height: UM.Theme.getSize("monitor_text_line").height; - width: parent.width; - - Rectangle { - color: UM.Theme.getColor("monitor_skeleton_fill"); - height: parent.height; - visible: !printJob; - width: Math.round(parent.width / 2); - } - Label { - anchors.fill: parent; - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default"); - text: printJob ? printJob.owner : ""; // Supress QML warnings - visible: printJob; - } - } - - Item { - id: printJobPreview; - property var useUltibot: false; - anchors { - bottom: parent.bottom; - horizontalCenter: parent.horizontalCenter; - top: printJobOwnerName.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - } - width: height; - - // Skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill"); - radius: UM.Theme.getSize("default_margin").width; - visible: !printJob; - } - - // Actual content - Image { - id: previewImage; - anchors.fill: parent; - opacity: printJob && printJob.state == "error" ? 0.5 : 1.0; - source: printJob ? printJob.previewImageUrl : ""; - visible: printJob; - } - - UM.RecolorImage { - id: ultiBotImage; - - anchors.centerIn: printJobPreview; - color: UM.Theme.getColor("monitor_placeholder_image"); - height: printJobPreview.height; - source: "../svg/ultibot.svg"; - sourceSize { - height: height; - width: width; - } - /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or - not in order to determine if we show the placeholder (ultibot) image instead. */ - visible: printJob && previewImage.status == Image.Error; - width: printJobPreview.width; - } - - UM.RecolorImage { - id: statusImage; - anchors.centerIn: printJobPreview; - color: UM.Theme.getColor("monitor_image_overlay"); - height: 0.5 * printJobPreview.height; - source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : ""; - sourceSize { - height: height; - width: width; - } - visible: source != ""; - width: 0.5 * printJobPreview.width; - } - } - - Label { - id: totalTimeLabel; - anchors { - bottom: parent.bottom; - right: parent.right; - } - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default"); - text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : ""; - } - } - - // Divider - Rectangle { - anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; - } - color: !printJob ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_lining_light"); - height: parent.height - 2 * UM.Theme.getSize("default_margin").height; - width: UM.Theme.getSize("default_lining").width; - } - - // Right content - Item { - anchors { - bottom: parent.bottom; - left: parent.horizontalCenter; - margins: UM.Theme.getSize("wide_margin").width; - right: parent.right; - top: parent.top; - } - - Item { - id: targetPrinterLabel; - height: UM.Theme.getSize("monitor_text_line").height; - width: parent.width; - - Rectangle { - visible: !printJob; - color: UM.Theme.getColor("monitor_skeleton_fill"); - anchors.fill: parent; - } - - Label { - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default_bold"); - text: { - if (printJob !== null) { - if (printJob.assignedPrinter == null) { - if (printJob.state == "error") { - return catalog.i18nc("@label", "Waiting for: Unavailable printer"); - } - return catalog.i18nc("@label", "Waiting for: First available"); - } else { - return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name; - } - } - return ""; - } - visible: printJob; - } - } - - PrinterInfoBlock { - anchors.bottom: parent.bottom; - printer: root.printJon && root.printJob.assignedPrinter; - printJob: root.printJob; - } - } - - PrintJobContextMenu { - id: contextButton; - anchors { - right: mainContent.right; - rightMargin: UM.Theme.getSize("default_margin").width * 3 + root.shadowRadius; - top: mainContent.top; - topMargin: UM.Theme.getSize("default_margin").height; - } - printJob: root.printJob; - visible: root.printJob; - } - } - - Item { - id: configChangesBox; - height: childrenRect.height; - visible: printJob && printJob.configurationChanges.length !== 0; - width: parent.width; - - // Config change toggle - Rectangle { - id: configChangeToggle; - color: { - if (configChangeToggleArea.containsMouse) { - return UM.Theme.getColor("viewport_background"); // TODO: Theme! - } else { - return "transparent"; - } - } - width: parent.width; - height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme! - anchors { - left: parent.left; - right: parent.right; - top: parent.top; - } - - Rectangle { - color: !printJob ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_lining_light"); - height: UM.Theme.getSize("default_lining").height; - width: parent.width; - } - - UM.RecolorImage { - anchors { - right: configChangeToggleLabel.left; - rightMargin: UM.Theme.getSize("default_margin").width; - verticalCenter: parent.verticalCenter; - } - color: UM.Theme.getColor("text"); - height: 23 * screenScaleFactor; // TODO: Theme! - source: "../svg/warning-icon.svg"; - sourceSize { - height: height; - width: width; - } - width: 23 * screenScaleFactor; // TODO: Theme! - } - - Label { - id: configChangeToggleLabel; - anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; - } - color: UM.Theme.getColor("text"); - font: UM.Theme.getFont("default"); - text: catalog.i18nc("@label", "Configuration change"); - } - - UM.RecolorImage { - anchors { - left: configChangeToggleLabel.right; - leftMargin: UM.Theme.getSize("default_margin").width; - verticalCenter: parent.verticalCenter; - } - color: UM.Theme.getColor("text"); - height: 15 * screenScaleFactor; // TODO: Theme! - source: { - if (configChangeDetails.visible) { - return UM.Theme.getIcon("arrow_top"); - } else { - return UM.Theme.getIcon("arrow_bottom"); - } - } - sourceSize { - width: width; - height: height; - } - width: 15 * screenScaleFactor; // TODO: Theme! - } - - MouseArea { - id: configChangeToggleArea; - anchors.fill: parent; - hoverEnabled: true; - onClicked: { - configChangeDetails.visible = !configChangeDetails.visible; - } - } - } - - // Config change details - Item { - id: configChangeDetails; - anchors.top: configChangeToggle.bottom; - Behavior on height { NumberAnimation { duration: 100 } } - // In case of really massive multi-line configuration changes - height: visible ? Math.max(UM.Theme.getSize("monitor_config_override_box").height, childrenRect.height) : 0; - visible: false; - width: parent.width; - - Item { - anchors { - bottomMargin: UM.Theme.getSize("wide_margin").height; - fill: parent; - leftMargin: UM.Theme.getSize("wide_margin").height * 4; - rightMargin: UM.Theme.getSize("wide_margin").height * 4; - topMargin: UM.Theme.getSize("wide_margin").height; - } - clip: true; - - Label { - anchors.fill: parent; - elide: Text.ElideRight; - color: UM.Theme.getColor("text"); - font: UM.Theme.getFont("default"); - text: { - if (!printJob || printJob.configurationChanges.length === 0) { - return ""; - } - var topLine; - if (materialsAreKnown(printJob)) { - topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name); - } else { - topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name); - } - var result = "

    " + topLine +"

    "; - for (var i = 0; i < printJob.configurationChanges.length; i++) { - var change = printJob.configurationChanges[i]; - var text; - switch (change.typeOfChange) { - case "material_change": - text = catalog.i18nc("@label", "Change material %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName); - break; - case "material_insert": - text = catalog.i18nc("@label", "Load %3 as material %1 (This cannot be overridden).").arg(change.index + 1).arg(change.targetName); - break; - case "print_core_change": - text = catalog.i18nc("@label", "Change print core %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName); - break; - case "buildplate_change": - text = catalog.i18nc("@label", "Change build plate to %1 (This cannot be overridden).").arg(formatBuildPlateType(change.target_name)); - break; - default: - text = ""; - } - result += "

    " + text + "

    "; - } - return result; - } - wrapMode: Text.WordWrap; - } - - Button { - anchors { - bottom: parent.bottom; - left: parent.left; - } - background: Rectangle { - border { - color: UM.Theme.getColor("monitor_lining_heavy"); - width: UM.Theme.getSize("default_lining").width; - } - color: parent.hovered ? UM.Theme.getColor("monitor_card_background_inactive") : UM.Theme.getColor("monitor_card_background"); - implicitHeight: UM.Theme.getSize("default_margin").height * 3; - implicitWidth: UM.Theme.getSize("default_margin").height * 8; - } - contentItem: Label { - color: UM.Theme.getColor("text"); - font: UM.Theme.getFont("medium"); - horizontalAlignment: Text.AlignHCenter; - text: parent.text; - verticalAlignment: Text.AlignVCenter; - } - onClicked: { - overrideConfirmationDialog.visible = true; - } - text: catalog.i18nc("@label", "Override"); - visible: { - if (printJob && printJob.configurationChanges) { - var length = printJob.configurationChanges.length; - for (var i = 0; i < length; i++) { - var typeOfChange = printJob.configurationChanges[i].typeOfChange; - if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") { - return false; - } - } - } - return true; - } - } - } - } - - MessageDialog { - id: overrideConfirmationDialog; - Component.onCompleted: visible = false; - icon: StandardIcon.Warning; - onYes: OutputDevice.forceSendJob(printJob.key); - standardButtons: StandardButton.Yes | StandardButton.No; - text: { - if (!printJob) { - return ""; - } - var printJobName = formatPrintJobName(printJob.name); - var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName); - return confirmText; - } - title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); - } - } - } - } - // Utils - function formatPrintJobName(name) { - var extensions = [ ".gz", ".gcode", ".ufp" ]; - for (var i = 0; i < extensions.length; i++) { - var extension = extensions[i]; - if (name.slice(-extension.length) === extension) { - name = name.substring(0, name.length - extension.length); - } - } - return name; - } - function materialsAreKnown(job) { - var conf0 = job.configuration[0]; - if (conf0 && !conf0.material.material) { - return false; - } - var conf1 = job.configuration[1]; - if (conf1 && !conf1.material.material) { - return false; - } - return true; - } - function formatBuildPlateType(buildPlateType) { - var translationText = ""; - switch (buildPlateType) { - case "glass": - translationText = catalog.i18nc("@label", "Glass"); - break; - case "aluminum": - translationText = catalog.i18nc("@label", "Aluminum"); - break; - default: - translationText = null; - } - return translationText; - } -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml deleted file mode 100644 index b1a73255f4..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.3 -import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.4 as LegacyControls -import UM 1.3 as UM - -// Includes print job name, owner, and preview - -Item { - property var job: null; - property var useUltibot: false; - height: 100 * screenScaleFactor; - width: height; - - // Skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill"); - radius: UM.Theme.getSize("default_margin").width; - visible: !job; - } - - // Actual content - Image { - id: previewImage; - visible: job; - source: job ? job.previewImageUrl : ""; - opacity: { - if (job == null) { - return 1.0; - } - var states = ["wait_cleanup", "wait_user_action", "error", "paused"]; - if (states.indexOf(job.state) !== -1) { - return 0.5; - } - return 1.0; - } - anchors.fill: parent; - } - - UM.RecolorImage { - id: ultibotImage; - anchors.centerIn: parent; - color: UM.Theme.getColor("monitor_placeholder_image"); // TODO: Theme! - height: parent.height; - source: "../svg/ultibot.svg"; - sourceSize { - height: height; - width: width; - } - /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or - not in order to determine if we show the placeholder (ultibot) image instead. */ - visible: job && previewImage.status == Image.Error; - width: parent.width; - } - - UM.RecolorImage { - id: statusImage; - anchors.centerIn: parent; - color: "black"; // TODO: Theme! - height: Math.round(0.5 * parent.height); - source: job && job.state == "error" ? "../svg/aborted-icon.svg" : ""; - sourceSize { - height: height; - width: width; - } - visible: source != ""; - width: Math.round(0.5 * parent.width); - } -} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml deleted file mode 100644 index f9f7b5ae87..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Controls 2.0 -import UM 1.3 as UM - -Column { - property var job: null; - height: childrenRect.height; - spacing: Math.floor( UM.Theme.getSize("default_margin").height / 2); // TODO: Use explicit theme size - width: parent.width; - - Item { - id: jobName; - height: UM.Theme.getSize("monitor_text_line").height; - width: parent.width; - - // Skeleton loading - Rectangle { - color: UM.Theme.getColor("monitor_skeleton_fill"); - height: parent.height; - visible: !job; - width: Math.round(parent.width / 3); - } - - Label { - anchors.fill: parent; - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default_bold"); - text: job && job.name ? job.name : ""; - visible: job; - } - } - - Item { - id: ownerName; - height: UM.Theme.getSize("monitor_text_line").height; - width: parent.width; - - // Skeleton loading - Rectangle { - color: UM.Theme.getColor("monitor_skeleton_fill"); - height: parent.height; - visible: !job; - width: Math.round(parent.width / 2); - } - - Label { - anchors.fill: parent; - color: UM.Theme.getColor("text") - elide: Text.ElideRight; - font: UM.Theme.getFont("default"); - text: job ? job.owner : ""; - visible: job; - } - } -} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml deleted file mode 100644 index 24beaf70fe..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.3 -import QtGraphicalEffects 1.0 -import UM 1.3 as UM - -Item { - id: root; - property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width; - property var shadowOffset: UM.Theme.getSize("monitor_shadow_offset").width; - property var printer: null; - property var collapsed: true; - height: childrenRect.height + shadowRadius * 2; // Bubbles upward - width: parent.width; // Bubbles downward - - // The actual card (white block) - Rectangle { - // 5px margin, but shifted 2px vertically because of the shadow - anchors { - bottomMargin: root.shadowRadius + root.shadowOffset; - leftMargin: root.shadowRadius; - rightMargin: root.shadowRadius; - topMargin: root.shadowRadius - root.shadowOffset; - } - color: { - if (!printer) { - return UM.Theme.getColor("monitor_card_background_inactive"); - } - if (printer.state == "disabled") { - return UM.Theme.getColor("monitor_card_background_inactive"); - } else { - return UM.Theme.getColor("monitor_card_background"); - } - } - height: childrenRect.height; - layer.effect: DropShadow { - radius: root.shadowRadius; - verticalOffset: root.shadowOffset; - color: "#3F000000"; // 25% shadow - } - layer.enabled: true - width: parent.width - 2 * shadowRadius; - - Column { - id: cardContents; - height: childrenRect.height; - width: parent.width; - - // Main card - Item { - id: mainCard; - anchors { - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").width; - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - } - height: 60 * screenScaleFactor + 2 * UM.Theme.getSize("default_margin").height; - width: parent.width; - - // Machine icon - Item { - id: machineIcon; - anchors.verticalCenter: parent.verticalCenter; - height: parent.height - 2 * UM.Theme.getSize("default_margin").width; - width: height; - - // Skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill_dark"); - radius: UM.Theme.getSize("default_margin").width; - visible: !printer; - } - - // Content - UM.RecolorImage { - anchors.centerIn: parent; - color: { - if (printer && printer.activePrintJob != undefined) { - return UM.Theme.getColor("monitor_printer_icon"); - } - return UM.Theme.getColor("monitor_printer_icon_inactive"); - } - height: sourceSize.height; - source: { - if (!printer) { - return ""; - } - switch(printer.type) { - case "Ultimaker 3": - return "../svg/UM3-icon.svg"; - case "Ultimaker 3 Extended": - return "../svg/UM3x-icon.svg"; - case "Ultimaker S5": - return "../svg/UMs5-icon.svg"; - } - } - visible: printer; - width: sourceSize.width; - } - } - - // Printer info - Item { - id: printerInfo; - anchors { - left: machineIcon.right; - leftMargin: UM.Theme.getSize("wide_margin").width; - right: collapseIcon.left; - verticalCenter: machineIcon.verticalCenter; - } - height: childrenRect.height; - - // Machine name - Item { - id: machineNameLabel; - height: UM.Theme.getSize("monitor_text_line").height; - width: { - var percent = printer ? 0.75 : 0.3; - return Math.round(parent.width * percent); - } - - // Skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill_dark"); - visible: !printer; - } - - // Actual content - Label { - anchors.fill: parent; - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default_bold"); - text: printer ? printer.name : ""; - visible: printer; - width: parent.width; - } - } - - // Job name - Item { - id: activeJobLabel; - anchors { - top: machineNameLabel.bottom; - topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2); - } - height: UM.Theme.getSize("monitor_text_line").height; - width: Math.round(parent.width * 0.75); - - // Skeleton - Rectangle { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_skeleton_fill_dark"); - visible: !printer; - } - - // Actual content - Label { - anchors.fill: parent; - color: UM.Theme.getColor("monitor_text_inactive"); - elide: Text.ElideRight; - font: UM.Theme.getFont("default"); - text: { - if (!printer) { - return ""; - } - if (printer.state == "disabled") { - return catalog.i18nc("@label", "Not available"); - } else if (printer.state == "unreachable") { - return catalog.i18nc("@label", "Unreachable"); - } - if (printer.activePrintJob != null && printer.activePrintJob.name) { - return printer.activePrintJob.name; - } - return catalog.i18nc("@label", "Available"); - } - visible: printer; - } - } - } - - // Collapse icon - UM.RecolorImage { - id: collapseIcon; - anchors { - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - verticalCenter: parent.verticalCenter; - } - color: UM.Theme.getColor("text"); - height: 15 * screenScaleFactor; // TODO: Theme! - source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom"); - sourceSize { - height: height; - width: width; - } - visible: printer; - width: 15 * screenScaleFactor; // TODO: Theme! - } - - MouseArea { - anchors.fill: parent; - enabled: printer; - onClicked: { - if (model && root.collapsed) { - printerList.currentIndex = model.index; - } else { - printerList.currentIndex = -1; - } - } - } - - Connections { - target: printerList; - onCurrentIndexChanged: { - root.collapsed = printerList.currentIndex != model.index; - } - } - } - // Detailed card - PrinterCardDetails { - collapsed: root.collapsed; - printer: root.printer; - visible: root.printer; - } - - // Progress bar - PrinterCardProgressBar { - visible: printer && printer.activePrintJob != null; - width: parent.width; - } - } - } -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml deleted file mode 100644 index 31da388b00..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.3 -import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.4 as LegacyControls -import UM 1.3 as UM - -Item { - id: root; - property var printer: null; - property var printJob: printer ? printer.activePrintJob : null; - property var collapsed: true; - Behavior on height { NumberAnimation { duration: 100 } } - Behavior on opacity { NumberAnimation { duration: 100 } } - height: collapsed ? 0 : childrenRect.height; - opacity: collapsed ? 0 : 1; - width: parent.width; - - Column { - id: contentColumn; - anchors { - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").width; - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - } - height: childrenRect.height + UM.Theme.getSize("default_margin").height; - spacing: UM.Theme.getSize("default_margin").height; - width: parent.width; - - HorizontalLine {} - - PrinterInfoBlock { - printer: root.printer; - printJob: root.printer ? root.printer.activePrintJob : null; - } - - HorizontalLine {} - - Row { - height: childrenRect.height; - visible: root.printJob; - width: parent.width; - - PrintJobTitle { - job: root.printer ? root.printer.activePrintJob : null; - } - PrintJobContextMenu { - id: contextButton; - anchors { - right: parent.right; - rightMargin: UM.Theme.getSize("wide_margin").width; - } - printJob: root.printer ? root.printer.activePrintJob : null; - visible: printJob; - } - } - - PrintJobPreview { - anchors.horizontalCenter: parent.horizontalCenter; - job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null; - visible: root.printJob; - } - - CameraButton { - id: showCameraButton; - iconSource: "../svg/camera-icon.svg"; - visible: root.printer; - } - } -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml deleted file mode 100644 index e86c959b8c..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Controls.Styles 1.3 -import QtQuick.Controls 1.4 -import UM 1.3 as UM - -ProgressBar { - property var progress: { - if (!printer || printer.activePrintJob == null) { - return 0; - } - var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal; - if (result > 1.0) { - result = 1.0; - } - return result; - } - style: ProgressBarStyle { - property var remainingTime: { - if (!printer || printer.activePrintJob == null) { - return 0; - } - /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining - time from ever being less than 0. Negative durations cause strange behavior such - as displaying "-1h -1m". */ - return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0); - } - property var progressText: { - if (printer === null ) { - return ""; - } - switch (printer.activePrintJob.state) { - case "wait_cleanup": - if (printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) { - return catalog.i18nc("@label:status", "Aborted"); - } - return catalog.i18nc("@label:status", "Finished"); - case "pre_print": - case "sent_to_printer": - return catalog.i18nc("@label:status", "Preparing"); - case "aborted": - return catalog.i18nc("@label:status", "Aborted"); - case "wait_user_action": - return catalog.i18nc("@label:status", "Aborted"); - case "pausing": - return catalog.i18nc("@label:status", "Pausing"); - case "paused": - return OutputDevice.formatDuration( remainingTime ); - case "resuming": - return catalog.i18nc("@label:status", "Resuming"); - case "queued": - return catalog.i18nc("@label:status", "Action required"); - default: - return OutputDevice.formatDuration( remainingTime ); - } - } - background: Rectangle { - color: UM.Theme.getColor("monitor_progress_background"); - implicitHeight: visible ? 24 : 0; - implicitWidth: 100; - } - progress: Rectangle { - id: progressItem; - color: { - if (! printer || !printer.activePrintJob) { - return "black"; - } - var state = printer.activePrintJob.state - var inactiveStates = [ - "pausing", - "paused", - "resuming", - "wait_cleanup" - ]; - if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) { - return UM.Theme.getColor("monitor_progress_fill_inactive"); - } else { - return UM.Theme.getColor("monitor_progress_fill"); - } - } - - Label { - id: progressLabel; - anchors { - left: parent.left; - leftMargin: getTextOffset(); - } - text: progressText; - anchors.verticalCenter: parent.verticalCenter; - color: progressItem.width + progressLabel.width < control.width ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_progress_fill_text"); - width: contentWidth; - font: UM.Theme.getFont("default"); - } - - function getTextOffset() { - if (progressItem.width + progressLabel.width + 16 < control.width) { - return progressItem.width + UM.Theme.getSize("default_margin").width; - } else { - return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width; - } - } - } - } - value: progress; - width: parent.width; -} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml deleted file mode 100644 index 0a88b053a8..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2018 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.2 as UM - -Item { - property alias text: familyNameLabel.text; - property var padding: 3 * screenScaleFactor; // TODO: Theme! - implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom. - implicitWidth: Math.max(48 * screenScaleFactor, familyNameLabel.contentWidth + implicitHeight); // The extra height is added to ensure the radius doesn't cut something off. - - Rectangle { - id: background; - anchors { - horizontalCenter: parent.horizontalCenter; - right: parent.right; - } - color: familyNameLabel.text.length < 1 ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_pill_background"); - height: parent.height; - radius: 0.5 * height; - width: parent.width; - } - - Label { - id: familyNameLabel; - anchors.centerIn: parent; - color: UM.Theme.getColor("text"); - text: ""; - } -} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml deleted file mode 100644 index 92a8f1dcb3..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.3 -import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.4 as LegacyControls -import UM 1.3 as UM - -// Includes printer type pill and extuder configurations - -Item { - id: root; - property var printer: null; - property var printJob: null; - width: parent.width; - height: childrenRect.height; - - // Printer family pills - Row { - id: printerFamilyPills; - anchors { - left: parent.left; - right: parent.right; - } - height: childrenRect.height; - spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width); - width: parent.width; - - Repeater { - id: compatiblePills; - delegate: PrinterFamilyPill { - text: modelData; - } - model: printJob ? printJob.compatibleMachineFamilies : []; - visible: printJob; - - } - - PrinterFamilyPill { - text: printer ? printer.type : ""; - visible: !compatiblePills.visible && printer; - } - } - - // Extruder info - Row { - id: extrudersInfo; - anchors { - left: parent.left; - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").width; - top: printerFamilyPills.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - } - height: childrenRect.height; - spacing: UM.Theme.getSize("default_margin").width; - width: parent.width; - - PrintCoreConfiguration { - width: Math.round(parent.width / 2) * screenScaleFactor; - printCoreConfiguration: getExtruderConfig(0); - } - - PrintCoreConfiguration { - width: Math.round(parent.width / 2) * screenScaleFactor; - printCoreConfiguration: getExtruderConfig(1); - } - } - - function getExtruderConfig( i ) { - if (root.printJob) { - // Use more-specific print job if possible - return root.printJob.configuration.extruderConfigurations[i]; - } - if (root.printer) { - return root.printer.printerConfiguration.extruderConfigurations[i]; - } - return null; - } -} \ No newline at end of file From 0d55d023a193c651a28e69cae667d5daa0ae2548 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 11:36:03 +0100 Subject: [PATCH 513/558] Align the message colors with the ones in the designs. Contributes to CURA-6018. --- resources/themes/cura-light/theme.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 0ef6c24bfb..738f3e5c3f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -248,11 +248,13 @@ "message_background": [255, 255, 255, 255], "message_shadow": [0, 0, 0, 120], - "message_border": [127, 127, 127, 255], + "message_border": [192, 193, 194, 255], "message_text": [0, 0, 0, 255], - "message_button": [50, 130, 255, 255], - "message_button_hover": [50, 130, 255, 255], - "message_button_active": [50, 130, 255, 255], + "message_close": [102, 102, 102, 255], + "message_close_hover": [8, 7, 63, 255], + "message_button": [38, 113, 231, 255], + "message_button_hover": [81, 145, 247, 255], + "message_button_active": [38, 113, 231, 255], "message_button_text": [255, 255, 255, 255], "message_button_text_hover": [255, 255, 255, 255], "message_button_text_active": [255, 255, 255, 255], @@ -478,6 +480,8 @@ "message_shadow": [0, 0], "message_margin": [0, 1.0], "message_inner_margin": [1.5, 1.5], + "message_radius": [0.25, 0.25], + "message_button_radius": [0.15, 0.15], "infill_button_margin": [0.5, 0.5], From ad7dcf6fc0700ebfdb424644fbeb8569a2f9f446 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 11:36:12 +0100 Subject: [PATCH 514/558] Delete ClusterControlItem.qml Contributes to CL-1152 --- .../resources/qml/ClusterControlItem.qml | 110 ------------------ 1 file changed, 110 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml deleted file mode 100644 index 94e75a6de0..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.3 -import UM 1.3 as UM -import Cura 1.0 as Cura - -Component { - Rectangle { - id: base; - property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width; - property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width; - anchors.fill: parent; - color: UM.Theme.getColor("main_background"); - visible: OutputDevice != null; - - UM.I18nCatalog { - id: catalog; - name: "cura"; - } - - Label { - id: printingLabel; - anchors { - left: parent.left; - leftMargin: 4 * UM.Theme.getSize("default_margin").width; - margins: 2 * UM.Theme.getSize("default_margin").width; - right: parent.right; - top: parent.top; - } - color: UM.Theme.getColor("text"); - elide: Text.ElideRight; - font: UM.Theme.getFont("large"); - text: catalog.i18nc("@label", "Printing"); - } - - Label { - id: managePrintersLabel; - anchors { - bottom: printingLabel.bottom; - right: printerScrollView.right; - rightMargin: 4 * UM.Theme.getSize("default_margin").width; - } - color: UM.Theme.getColor("primary"); // "Cura Blue" - font: UM.Theme.getFont("default"); - linkColor: UM.Theme.getColor("primary"); // "Cura Blue" - text: catalog.i18nc("@label link to connect manager", "Manage printers"); - } - - MouseArea { - anchors.fill: managePrintersLabel; - hoverEnabled: true; - onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel(); - onEntered: managePrintersLabel.font.underline = true; - onExited: managePrintersLabel.font.underline = false; - } - - // Skeleton loading - Column { - id: skeletonLoader; - anchors { - left: parent.left; - leftMargin: UM.Theme.getSize("wide_margin").width; - right: parent.right; - rightMargin: UM.Theme.getSize("wide_margin").width; - top: printingLabel.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - } - spacing: UM.Theme.getSize("default_margin").height - 10; - visible: printerList.count === 0; - - PrinterCard { - printer: null; - } - PrinterCard { - printer: null; - } - } - - // Actual content - ScrollView { - id: printerScrollView; - anchors { - bottom: parent.bottom; - left: parent.left; - right: parent.right; - top: printingLabel.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - } - style: UM.Theme.styles.scrollview; - - ListView { - id: printerList; - property var currentIndex: -1; - anchors { - fill: parent; - leftMargin: UM.Theme.getSize("wide_margin").width; - rightMargin: UM.Theme.getSize("wide_margin").width; - } - delegate: PrinterCard { - printer: modelData; - } - model: OutputDevice.printers; - spacing: UM.Theme.getSize("default_margin").height - 10; - } - } - } -} From 8a856f13d26c44668cb086729b22534b438d9a2b Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 11:36:51 +0100 Subject: [PATCH 515/558] Re-add config changes in monitor tab Contributes to CL-1152 --- .../resources/qml/ClusterMonitorItem.qml | 2 +- .../resources/qml/DiscoverUM3Action.qml | 2 +- .../resources/qml/HorizontalLine.qml | 12 -- .../qml/MonitorConfigOverrideDialog.qml | 131 ++++++++++++++++++ .../resources/qml/MonitorPrintJobCard.qml | 1 + .../resources/qml/MonitorPrintJobPreview.qml | 7 +- .../qml/MonitorPrintJobProgressBar.qml | 2 + .../resources/qml/MonitorPrinterCard.qml | 75 +++++++++- .../src/ClusterUM3OutputDevice.py | 10 -- 9 files changed, 210 insertions(+), 32 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml create mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml index adf5ea5e1c..31b3f4d4f5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml @@ -130,7 +130,7 @@ Component verticalCenter: externalLinkIcon.verticalCenter } color: UM.Theme.getColor("primary") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("default") // 12pt, regular linkColor: UM.Theme.getColor("primary") text: catalog.i18nc("@label link to connect manager", "Manage queue in Cura Connect") } diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index bb710127fc..e5f668c70d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -57,7 +57,7 @@ Cura.MachineAction spacing: UM.Theme.getSize("default_margin").height SystemPalette { id: palette } - UM.I18nCatalog { id: catalog; name: "cura" } + UM.I18nCatalog { id: catalog; name:"cura" } Label { id: pageTitle diff --git a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml deleted file mode 100644 index aeb92697ad..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Controls 2.0 -import UM 1.3 as UM - -Rectangle { - color: UM.Theme.getColor("monitor_lining_light"); // TODO: Maybe theme separately? Maybe not. - height: UM.Theme.getSize("default_lining").height; - width: parent.width; -} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml new file mode 100644 index 0000000000..aa62afa083 --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -0,0 +1,131 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.3 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 +import QtQuick.Dialogs 1.2 +import UM 1.3 as UM + +UM.Dialog +{ + id: overrideConfirmationDialog + + property var printer: null + + minimumWidth: screenScaleFactor * 640; + minimumHeight: screenScaleFactor * 320; + width: minimumWidth + height: minimumHeight + title: catalog.i18nc("@title:window", "Configuration Changes") + rightButtons: + [ + Button + { + id: overrideButton + anchors.margins: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@action:button", "Override") + onClicked: + { + OutputDevice.forceSendJob(printer.activePrintJob.key) + overrideConfirmationDialog.close() + } + }, + Button + { + id: cancelButton + anchors.margins: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@action:button", "Cancel") + onClicked: + { + overrideConfirmationDialog.reject() + } + } + ] + + Label + { + anchors + { + fill: parent + leftMargin: 60 + rightMargin: 60 + topMargin: 18 + bottomMargin: 56 + } + wrapMode: Text.WordWrap + text: + { + var topLine + if (materialsAreKnown(printer.activePrintJob)) + { + topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printer.name) + } + else + { + topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printer.name) + } + var result = "

    " + topLine +"

    " + for (var i = 0; i < printer.activePrintJob.configurationChanges.length; i++) + { + var change = printer.activePrintJob.configurationChanges[i] + var text + switch (change.typeOfChange) + { + case "material_change": + text = catalog.i18nc("@label", "Change material %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName) + break + case "material_insert": + text = catalog.i18nc("@label", "Load %3 as material %1 (This cannot be overridden).").arg(change.index + 1).arg(change.targetName) + break + case "print_core_change": + text = catalog.i18nc("@label", "Change print core %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName) + break + case "buildplate_change": + text = catalog.i18nc("@label", "Change build plate to %1 (This cannot be overridden).").arg(formatBuildPlateType(change.target_name)) + break + default: + text = "unknown" + } + result += "

    " + text + "

    " + } + return result + } + } + // Utils + function formatPrintJobName(name) { + var extensions = [ ".gz", ".gcode", ".ufp" ]; + for (var i = 0; i < extensions.length; i++) { + var extension = extensions[i]; + if (name.slice(-extension.length) === extension) { + name = name.substring(0, name.length - extension.length); + } + } + return name; + } + function materialsAreKnown(job) { + var conf0 = job.configuration[0]; + if (conf0 && !conf0.material.material) { + return false; + } + var conf1 = job.configuration[1]; + if (conf1 && !conf1.material.material) { + return false; + } + return true; + } + function formatBuildPlateType(buildPlateType) { + var translationText = ""; + switch (buildPlateType) { + case "glass": + translationText = catalog.i18nc("@label", "Glass"); + break; + case "aluminum": + translationText = catalog.i18nc("@label", "Aluminum"); + break; + default: + translationText = null; + } + return translationText; + } +} \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 8231870c21..5eaeff2e84 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -26,6 +26,7 @@ Item ExpandableCard { + borderColor: printJob.configurationChanges.length !== 0 ? "#f5a623" : "#EAEAEC" // TODO: Theme! headerItem: Row { height: 48 * screenScaleFactor // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index ec26bbe568..5acd350abb 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -23,7 +23,7 @@ Item anchors.fill: parent opacity: { - if (printJob && (printJob.state == "error" || !printJob.isActive)) + if (printJob && (printJob.state == "error" || printJob.configurationChanges.length > 0 || !printJob.isActive)) { return 0.5 } @@ -60,6 +60,10 @@ Item height: 0.5 * printJobPreview.height source: { + if (printJob.configurationChanges.length > 0) + { + return "../svg/warning-icon.svg" + } switch(printJob.state) { case "error": @@ -75,6 +79,7 @@ Item default: return "" } + return "" } sourceSize { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 88418516ed..e646172a6c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -88,6 +88,8 @@ Item return catalog.i18nc("@label:status", "Aborted") } return catalog.i18nc("@label:status", "Finished") + case "finished": + return catalog.i18nc("@label:status", "Finished") case "sent_to_printer": return catalog.i18nc("@label:status", "Preparing...") case "pre_print": diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 567fff8489..1676c51edf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -3,6 +3,7 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 +import QtQuick.Dialogs 1.1 import UM 1.3 as UM /** @@ -66,7 +67,7 @@ Item { verticalCenter: parent.verticalCenter } - width: 216 * screenScaleFactor // TODO: Theme! + width: 180 * screenScaleFactor // TODO: Theme! height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme! Label @@ -150,7 +151,7 @@ Item } border { - color: "#EAEAEC" // TODO: Theme! + color: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? "#f5a623" : "#EAEAEC" // TODO: Theme! width: borderSize // TODO: Remove once themed } color: "white" // TODO: Theme! @@ -185,14 +186,15 @@ Item } if (printer && printer.state == "unreachable") { - return catalog.i18nc("@label:status", "Unreachable") + return catalog.i18nc("@label:status", "Unavailable") } - if (printer && printer.state == "idle") + if (printer && !printer.activePrintJob && printer.state == "idle") { return catalog.i18nc("@label:status", "Idle") } return "" } + visible: text !== "" } Item @@ -218,7 +220,7 @@ Item { verticalCenter: parent.verticalCenter } - width: 216 * screenScaleFactor // TODO: Theme! + width: 180 * screenScaleFactor // TODO: Theme! height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme! visible: printer.activePrintJob @@ -247,7 +249,7 @@ Item } color: printer.activePrintJob && printer.activePrintJob.isActive ? "#53657d" : "#babac1" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("very_small") // 12pt, regular + font: UM.Theme.getFont("default") // 12pt, regular text: printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N width: parent.width @@ -264,8 +266,67 @@ Item verticalCenter: parent.verticalCenter } printJob: printer.activePrintJob - visible: printer.activePrintJob + visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length === 0 + } + + Label + { + anchors + { + verticalCenter: parent.verticalCenter + } + font: UM.Theme.getFont("default") + text: "Requires configuration changes" + visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 + + // FIXED-LINE-HEIGHT: + height: 18 * screenScaleFactor // TODO: Theme! + verticalAlignment: Text.AlignVCenter } } + + Button + { + id: detailsButton + anchors + { + verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: 18 * screenScaleFactor // TODO: Theme! + } + background: Rectangle + { + color: "#d8d8d8" // TODO: Theme! + radius: 2 * screenScaleFactor // Todo: Theme! + Rectangle + { + anchors.fill: parent + anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! + color: detailsButton.hovered ? "#e4e4e4" : "#f0f0f0" // TODO: Theme! + radius: 2 * screenScaleFactor // Todo: Theme! + } + } + contentItem: Label + { + anchors.fill: parent + anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! + color: "#1e66d7" // TODO: Theme! + font: UM.Theme.getFont("medium") // 14pt, regular + text: "Details" // TODO: I18NC! + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + height: 18 * screenScaleFactor // TODO: Theme! + } + implicitHeight: 32 * screenScaleFactor // TODO: Theme! + implicitWidth: 96 * screenScaleFactor // TODO: Theme! + visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 + onClicked: overrideConfirmationDialog.open() + } + } + + MonitorConfigOverrideDialog + { + id: overrideConfirmationDialog + printer: base.printer } } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index e31229680c..292011929d 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -608,16 +608,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel": material_manager = CuraApplication.getInstance().getMaterialManager() material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"]) - # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the - # material is unknown to Cura, so we should return an "empty" or "unknown" material model. - if material_group_list is None: - material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown" - return MaterialOutputModel(guid = material_data["guid"], - type = material_data.get("type", ""), - color = material_data.get("color", ""), - brand = material_data.get("brand", ""), - name = material_data.get("name", material_name) - ) # Sort the material groups by "is_read_only = True" first, and then the name alphabetically. read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list)) From dff364ee30870822158de7beaeb1faf7722f3d37 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 12:03:29 +0100 Subject: [PATCH 516/558] Change the panel to have also rounded rectangle in the top part Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 2 +- .../qml/PrintSetupSelector/PrintSetupSelectorContents.qml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 4170a0942e..04793653fe 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -162,7 +162,7 @@ Item background: Cura.RoundedRectangle { - cornerSide: Cura.RoundedRectangle.Direction.Down + cornerSide: Cura.RoundedRectangle.Direction.All color: contentBackgroundColor border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 7cd03ff74a..313bf0830c 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -38,11 +38,13 @@ Item // Header of the popup - Rectangle + Cura.RoundedRectangle { id: header height: UM.Theme.getSize("print_setup_widget_header").height color: UM.Theme.getColor("secondary") + cornerSide: Cura.RoundedRectangle.Direction.Up + radius: UM.Theme.getSize("default_radius").width anchors { From df4e5c40df403f76dfede9b74d358a075ff951c0 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 12:19:52 +0100 Subject: [PATCH 517/558] Rename ClusterMonitorItem Contributes to CL-1152 --- .../resources/qml/{ClusterMonitorItem.qml => MonitorStage.qml} | 1 + plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename plugins/UM3NetworkPrinting/resources/qml/{ClusterMonitorItem.qml => MonitorStage.qml} (99%) diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml similarity index 99% rename from plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml rename to plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 31b3f4d4f5..4d59e0eb6b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -8,6 +8,7 @@ import UM 1.3 as UM import Cura 1.0 as Cura import QtGraphicalEffects 1.0 +// Root component for the monitor tab (stage) Component { Item diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 292011929d..08592df603 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -64,7 +64,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): self._print_jobs = [] # type: List[UM3PrintJobOutputModel] self._received_print_jobs = False # type: bool - self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterMonitorItem.qml") + self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/MonitorStage.qml") # See comments about this hack with the clusterPrintersChanged signal self.printersChanged.connect(self.clusterPrintersChanged) From 1487af167b616a190e320e6d05c94fad3a3ff95b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 10 Dec 2018 13:20:36 +0100 Subject: [PATCH 518/558] Disable async loading for ToolboxDetailTile CURA-6006 --- plugins/Toolbox/resources/qml/ToolboxDetailList.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml index 1700a58ebe..4e44ea7d0b 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailList.qml @@ -32,7 +32,11 @@ Item model: toolbox.packagesModel delegate: Loader { - asynchronous: true + // FIXME: When using asynchronous loading, on Mac and Windows, the tile may fail to load complete, + // leaving an empty space below the title part. We turn it off for now to make it work on Mac and + // Windows. + // Can be related to this QT bug: https://bugreports.qt.io/browse/QTBUG-50992 + asynchronous: false source: "ToolboxDetailTile.qml" } } From b745755a7d1a0b7b482add455cb20535bc265247 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 10 Dec 2018 13:22:28 +0100 Subject: [PATCH 519/558] Remove TODO in ToolboxProgressButton CURA-6006 This file has been refactored. --- plugins/Toolbox/resources/qml/ToolboxProgressButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index 3ca18a52ed..933e3a5900 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM import Cura 1.0 as Cura -// TODO; This is in quite some need for refactoring. + Item { id: base From af37f51cf8aa9acd121d02d4b891d72444556350 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 13:36:06 +0100 Subject: [PATCH 520/558] Make the expandable content header to be a common header for every expandable component. Contributes to CURA-5941. --- .../SimulationViewMenuComponent.qml | 1 + resources/qml/ExpandableComponent.qml | 68 +++++++++++----- resources/qml/ExpandablePopup.qml | 3 + .../PrintSetupSelector/PrintSetupSelector.qml | 10 +-- .../PrintSetupSelectorContents.qml | 77 +------------------ .../PrintSetupSelectorHeader.qml | 3 + resources/themes/cura-light/theme.json | 3 +- 7 files changed, 64 insertions(+), 101 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 76875a035d..58b2bfe520 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -16,6 +16,7 @@ Cura.ExpandableComponent id: base width: UM.Theme.getSize("layerview_menu_size").width + contentHeaderTitle: catalog.i18nc("@label", "Color scheme") Connections { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 04793653fe..3c898caeb8 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -1,3 +1,6 @@ +// 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.3 @@ -40,6 +43,9 @@ Item // How much spacing is needed around the contentItem property alias contentPadding: content.padding + // Adds a title to the content item + property alias contentHeaderTitle: contentHeader.headerTitle + // How much spacing is needed for the contentItem by Y coordinate property var contentSpacingY: UM.Theme.getSize("narrow_margin").width @@ -55,7 +61,7 @@ Item property alias iconSize: collapseButton.height // Is the "drawer" open? - readonly property alias expanded: content.visible + readonly property alias expanded: contentContainer.visible // What should the radius of the header be. This is also influenced by the headerCornerSide property alias headerRadius: background.radius @@ -71,7 +77,7 @@ Item function toggleContent() { - content.visible = !expanded + contentContainer.visible = !expanded } // Add this binding since the background color is not updated otherwise @@ -147,10 +153,13 @@ Item z: background.z - 1 } - Control + Cura.RoundedRectangle { - id: content + id: contentContainer + visible: false + width: childrenRect.width + height: childrenRect.height // Ensure that the content is located directly below the headerItem y: background.height + base.shadowOffset + base.contentSpacingY @@ -158,25 +167,42 @@ Item // Make the content aligned with the rest, using the property contentAlignment to decide whether is right or left. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text. x: contentAlignment == ExpandableComponent.ContentAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 - padding: UM.Theme.getSize("default_margin").width - background: Cura.RoundedRectangle + cornerSide: Cura.RoundedRectangle.Direction.All + color: contentBackgroundColor + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + radius: UM.Theme.getSize("default_radius").width + + ExpandableComponentHeader { - cornerSide: Cura.RoundedRectangle.Direction.All - color: contentBackgroundColor - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - radius: UM.Theme.getSize("default_radius").width + id: contentHeader + headerTitle: "" + anchors + { + top: parent.top + right: parent.right + left: parent.left + } + } - contentItem: Item {} - - onContentItemChanged: + Control { - // Since we want the size of the content to be set by the size of the content, - // we need to do it like this. - content.width = contentItem.width + 2 * content.padding - content.height = contentItem.height + 2 * content.padding + id: content + + anchors.top: contentHeader.bottom + padding: UM.Theme.getSize("default_margin").width + + contentItem: Item {} + + onContentItemChanged: + { + // Since we want the size of the content to be set by the size of the content, + // we need to do it like this. + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding + } } } @@ -187,6 +213,10 @@ Item // Since it could be that the content is dynamically populated, we should also take these changes into account. target: content.contentItem onWidthChanged: content.width = content.contentItem.width + 2 * content.padding - onHeightChanged: content.height = content.contentItem.height + 2 * content.padding + onHeightChanged: + { + content.height = content.contentItem.height + 2 * content.padding + contentContainer.height = contentHeader.height + content.height + } } } diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index c15310f803..475f7f9f59 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -1,3 +1,6 @@ +// 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.3 diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 19c8067683..01886a5ea5 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -11,10 +11,11 @@ Cura.ExpandableComponent { id: printSetupSelector - property string enabledText: catalog.i18nc("@label:Should be short", "On") - property string disabledText: catalog.i18nc("@label:Should be short", "Off") + property bool preSlicedData: PrintInformation.preSliced contentPadding: UM.Theme.getSize("default_lining").width + contentHeaderTitle: catalog.i18nc("@label", "Print settings") + enabled: !preSlicedData UM.I18nCatalog { @@ -22,10 +23,7 @@ Cura.ExpandableComponent name: "cura" } - headerItem: PrintSetupSelectorHeader - { - anchors.fill: parent - } + headerItem: PrintSetupSelectorHeader {} Cura.ExtrudersModel { diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 313bf0830c..6c678f7ce5 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -12,7 +12,7 @@ import "Custom" Item { - id: popup + id: content width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height @@ -36,79 +36,6 @@ Item } onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) - - // Header of the popup - Cura.RoundedRectangle - { - id: header - height: UM.Theme.getSize("print_setup_widget_header").height - color: UM.Theme.getColor("secondary") - cornerSide: Cura.RoundedRectangle.Direction.Up - radius: UM.Theme.getSize("default_radius").width - - anchors - { - top: parent.top - right: parent.right - left: parent.left - } - - Label - { - id: headerLabel - text: catalog.i18nc("@label", "Print settings") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") - height: parent.height - - anchors - { - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").height - } - } - - Button - { - id: closeButton - width: UM.Theme.getSize("message_close").width - height: UM.Theme.getSize("message_close").height - hoverEnabled: true - - anchors - { - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - verticalCenter: parent.verticalCenter - } - - contentItem: UM.RecolorImage - { - anchors.fill: parent - sourceSize.width: width - color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") - source: UM.Theme.getIcon("cross1") - } - - background: Item {} - - onClicked: toggleContent() // Will hide the popup item - } - } - - Rectangle - { - id: topSeparator - - anchors.bottom: header.bottom - width: parent.width - height: UM.Theme.getSize("default_lining").height - color: UM.Theme.getColor("lining") - } - Item { id: contents @@ -118,7 +45,7 @@ Item anchors { - top: header.bottom + top: parent.top left: parent.left right: parent.right } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index d4287045b8..94da5bdd6f 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -10,6 +10,9 @@ import Cura 1.0 as Cura RowLayout { + property string enabledText: catalog.i18nc("@label:Should be short", "On") + property string disabledText: catalog.i18nc("@label:Should be short", "Off") + Cura.IconWithText { source: UM.Theme.getIcon("category_layer_height") diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 0ef6c24bfb..54b41fe348 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -362,13 +362,14 @@ "print_setup_mode_toggle": [0.0, 2.0], "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], - "print_setup_widget_header": [0.0, 3.0], "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_tickmarks": [0.32, 0.32], "print_setup_big_item": [28, 2.5], "print_setup_icon": [1.2, 1.2], + "expandable_component_content_header": [0.0, 3.0], + "configuration_selector_mode_tabs": [0.0, 3.0], "action_panel_widget": [25.0, 0.0], From 154c6c1ff226a820e7737dc09952043701f42069 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 13:42:33 +0100 Subject: [PATCH 521/558] Change the color of the setting control button to be the same as for the small buttons Contributes to CURA-5941. --- resources/themes/cura-light/theme.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 54b41fe348..5bad1cf7ae 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -205,9 +205,8 @@ "setting_control_border": [199, 199, 199, 255], "setting_control_border_highlight": [50, 130, 255, 255], "setting_control_text": [35, 35, 35, 255], - "setting_control_depth_line": [199, 199, 199, 255], - "setting_control_button": [199, 199, 199, 255], - "setting_control_button_hover": [70, 84, 113, 255], + "setting_control_button": [102, 102, 102, 255], + "setting_control_button_hover": [8, 7, 63, 255], "setting_control_disabled": [245, 245, 245, 255], "setting_control_disabled_text": [127, 127, 127, 255], "setting_control_disabled_border": [127, 127, 127, 255], From 90f822f6835471890a753dff0b5e4614d2d6e06b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 13:44:50 +0100 Subject: [PATCH 522/558] Add the component header that I miss in a previous commit Contributes to CURA-5941. --- resources/qml/ExpandableComponentHeader.qml | 68 +++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 resources/qml/ExpandableComponentHeader.qml diff --git a/resources/qml/ExpandableComponentHeader.qml b/resources/qml/ExpandableComponentHeader.qml new file mode 100644 index 0000000000..b1fd49cd1b --- /dev/null +++ b/resources/qml/ExpandableComponentHeader.qml @@ -0,0 +1,68 @@ +// 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.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +// Header of the popup +Cura.RoundedRectangle +{ + id: header + + property alias headerTitle: headerLabel.text + + height: UM.Theme.getSize("expandable_component_content_header").height + color: UM.Theme.getColor("secondary") + cornerSide: Cura.RoundedRectangle.Direction.Up + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + radius: UM.Theme.getSize("default_radius").width + + Label + { + id: headerLabel + text: "Title" + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("small_button_text") + height: parent.height + + anchors + { + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").height + } + } + + Button + { + id: closeButton + width: UM.Theme.getSize("message_close").width + height: UM.Theme.getSize("message_close").height + hoverEnabled: true + + anchors + { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + + contentItem: UM.RecolorImage + { + anchors.fill: parent + sourceSize.width: width + color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") + source: UM.Theme.getIcon("cross1") + } + + background: Item {} + + onClicked: toggleContent() // Will hide the popup item + } +} \ No newline at end of file From 3f97f83c473dd015353e7ca82003042cd2d11308 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 14:17:56 +0100 Subject: [PATCH 523/558] Add a disabled state to the expandable components In this case, when the component is disabled, there is an optional message that will show. It works for instance when loading a gcode and the print setup panel has to be disabled. Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 70 +++++++++----- resources/qml/ExpandablePopup.qml | 96 ++++++++++++------- .../PrintSetupSelector/PrintSetupSelector.qml | 1 + 3 files changed, 110 insertions(+), 57 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3c898caeb8..55271d99c3 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -37,6 +37,9 @@ Item property alias enabled: mouseArea.enabled + // Text to show when this component is disabled + property alias disabledText: disabledLabel.text + // Defines the alignment of the content with respect of the headerItem, by default to the right property int contentAlignment: ExpandableComponent.ContentAlignment.AlignRight @@ -85,7 +88,7 @@ Item { target: background property: "color" - value: expanded ? headerActiveColor : headerBackgroundColor + value: enabled ? (expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") } implicitHeight: 100 * screenScaleFactor @@ -96,36 +99,55 @@ Item id: background property real padding: UM.Theme.getSize("default_margin").width - color: expanded ? headerActiveColor : headerBackgroundColor + color: base.enabled ? (base.expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") anchors.fill: parent - Loader + Label { - id: headerItemLoader - anchors - { - left: parent.left - right: collapseButton.visible ? collapseButton.left : parent.right - top: parent.top - bottom: parent.bottom - margins: background.padding - } + id: disabledLabel + visible: !base.enabled + leftPadding: background.padding + text: "This component is disabled" + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + height: parent.height } - UM.RecolorImage + Item { - id: collapseButton - anchors + anchors.fill: parent + visible: base.enabled + + Loader { - right: parent.right - verticalCenter: parent.verticalCenter - margins: background.padding + id: headerItemLoader + anchors + { + left: parent.left + right: collapseButton.visible ? collapseButton.left : parent.right + top: parent.top + bottom: parent.bottom + margins: background.padding + } + } + + UM.RecolorImage + { + id: collapseButton + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + margins: background.padding + } + source: UM.Theme.getIcon("pencil") + visible: source != "" + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + color: UM.Theme.getColor("small_button_text") } - source: UM.Theme.getIcon("pencil") - visible: source != "" && base.enabled - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - color: UM.Theme.getColor("small_button_text") } MouseArea @@ -135,7 +157,7 @@ Item onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor - onExited: background.color = expanded ? headerActiveColor : headerBackgroundColor + onExited: background.color = base.enabled ? (base.expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") } } diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 475f7f9f59..75f718abf5 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -37,6 +37,9 @@ Item property alias enabled: mouseArea.enabled + // Text to show when this component is disabled + property alias disabledText: disabledLabel.text + // Defines the alignment of the content with respect of the headerItem, by default to the right property int contentAlignment: ExpandablePopup.ContentAlignment.AlignRight @@ -86,6 +89,14 @@ Item } } + // Add this binding since the background color is not updated otherwise + Binding + { + target: background + property: "color" + value: enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") + } + implicitHeight: 100 * screenScaleFactor implicitWidth: 400 * screenScaleFactor @@ -94,47 +105,66 @@ Item id: background property real padding: UM.Theme.getSize("default_margin").width - color: headerBackgroundColor + color: base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") anchors.fill: parent - Loader + Label { - id: headerItemLoader - anchors - { - left: parent.left - right: collapseButton.visible ? collapseButton.left : parent.right - top: parent.top - bottom: parent.bottom - margins: background.padding - } + id: disabledLabel + visible: !base.enabled + leftPadding: background.padding + text: "This component is disabled" + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + height: parent.height } - // A highlight that is shown when the content is expanded - Rectangle + Item { - id: expandedHighlight - width: parent.width - height: UM.Theme.getSize("thick_lining").height - color: UM.Theme.getColor("primary") - visible: expanded - anchors.bottom: parent.bottom - } + anchors.fill: parent + visible: base.enabled - UM.RecolorImage - { - id: collapseButton - anchors + Loader { - right: parent.right - verticalCenter: parent.verticalCenter - margins: background.padding + id: headerItemLoader + anchors + { + left: parent.left + right: collapseButton.visible ? collapseButton.left : parent.right + top: parent.top + bottom: parent.bottom + margins: background.padding + } + } + + // A highlight that is shown when the content is expanded + Rectangle + { + id: expandedHighlight + width: parent.width + height: UM.Theme.getSize("thick_lining").height + color: UM.Theme.getColor("primary") + visible: expanded + anchors.bottom: parent.bottom + } + + UM.RecolorImage + { + id: collapseButton + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + margins: background.padding + } + source: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") + visible: source != "" + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + color: UM.Theme.getColor("small_button_text") } - source: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") - visible: source != "" && base.enabled - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - color: UM.Theme.getColor("small_button_text") } MouseArea @@ -144,7 +174,7 @@ Item onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor - onExited: background.color = headerBackgroundColor + onExited: background.color = base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") } } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 01886a5ea5..fe642bd3c1 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -16,6 +16,7 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentHeaderTitle: catalog.i18nc("@label", "Print settings") enabled: !preSlicedData + disabledText: catalog.i18nc("@label shown when we load a Gcode file", "Print setup disabled. G code file can not be modified." UM.I18nCatalog { From 437ba3848db12db4f024911c1bc6b761134f0bb0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 14:26:20 +0100 Subject: [PATCH 524/558] Fix typo. Missing parenthesis Contributes to CURA-5941. --- resources/qml/PrintSetupSelector/PrintSetupSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index fe642bd3c1..599eac957e 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -16,7 +16,7 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentHeaderTitle: catalog.i18nc("@label", "Print settings") enabled: !preSlicedData - disabledText: catalog.i18nc("@label shown when we load a Gcode file", "Print setup disabled. G code file can not be modified." + disabledText: catalog.i18nc("@label shown when we load a Gcode file", "Print setup disabled. G code file can not be modified.") UM.I18nCatalog { From 315bcf50c746ee6a25aed8ae95c6245d898b7525 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 14:31:49 +0100 Subject: [PATCH 525/558] Get some personal space up in this personal space Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index aa62afa083..14bdd07313 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -48,10 +48,7 @@ UM.Dialog anchors { fill: parent - leftMargin: 60 - rightMargin: 60 - topMargin: 18 - bottomMargin: 56 + margins: 60 * screenScaleFactor // TODO: Theme! } wrapMode: Text.WordWrap text: From 861deaa9f74f4e3bc32db5f6c8e0628406c5e2e1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 10 Dec 2018 14:20:19 +0100 Subject: [PATCH 526/558] Add renderType native for toolbox QML Labels CURA-6006 --- plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml | 8 +++++++- plugins/Toolbox/resources/qml/ToolboxBackColumn.qml | 3 ++- .../resources/qml/ToolboxCompatibilityChart.qml | 8 +++++++- .../qml/ToolboxConfirmUninstallResetDialog.qml | 3 ++- plugins/Toolbox/resources/qml/ToolboxDetailPage.qml | 11 ++++++++++- plugins/Toolbox/resources/qml/ToolboxDetailTile.qml | 4 +++- .../resources/qml/ToolboxDetailTileActions.qml | 4 +++- .../Toolbox/resources/qml/ToolboxDownloadsGrid.qml | 3 ++- .../resources/qml/ToolboxDownloadsGridTile.qml | 4 +++- .../resources/qml/ToolboxDownloadsShowcase.qml | 3 ++- .../resources/qml/ToolboxDownloadsShowcaseTile.qml | 3 ++- plugins/Toolbox/resources/qml/ToolboxErrorPage.qml | 3 ++- plugins/Toolbox/resources/qml/ToolboxFooter.qml | 5 +++-- .../Toolbox/resources/qml/ToolboxInstalledPage.qml | 4 +++- .../Toolbox/resources/qml/ToolboxInstalledTile.qml | 6 +++++- .../resources/qml/ToolboxInstalledTileActions.qml | 5 ++++- .../Toolbox/resources/qml/ToolboxLicenseDialog.qml | 3 ++- plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml | 3 ++- plugins/Toolbox/resources/qml/ToolboxTabButton.qml | 5 +++-- 19 files changed, 67 insertions(+), 21 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml index 9c1df0c49e..7b026566c3 100644 --- a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.3 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -59,6 +59,7 @@ Item wrapMode: Text.WordWrap width: parent.width height: UM.Theme.getSize("toolbox_property_label").height + renderType: Text.NativeRendering } Label { @@ -70,6 +71,7 @@ Item left: title.left topMargin: UM.Theme.getSize("default_margin").height } + renderType: Text.NativeRendering } Column { @@ -88,12 +90,14 @@ Item text: catalog.i18nc("@label", "Website") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } Label { text: catalog.i18nc("@label", "Email") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } } Column @@ -122,6 +126,7 @@ Item color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) + renderType: Text.NativeRendering } Label @@ -138,6 +143,7 @@ Item color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) + renderType: Text.NativeRendering } } Rectangle diff --git a/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml b/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml index 8524b7d1e5..edb1967fee 100644 --- a/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml +++ b/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -64,6 +64,7 @@ Item font: UM.Theme.getFont("default_bold") horizontalAlignment: Text.AlignRight width: control.width + renderType: Text.NativeRendering } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml index d4c0ae14eb..db4e8c628f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -67,6 +67,7 @@ Item wrapMode: Text.WordWrap color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } TableView @@ -99,6 +100,7 @@ Item text: styleData.value || "" color: UM.Theme.getColor("text") font: UM.Theme.getFont("default_bold") + renderType: Text.NativeRendering } Rectangle { @@ -118,6 +120,7 @@ Item text: styleData.value || "" color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } } itemDelegate: Item @@ -130,6 +133,7 @@ Item text: styleData.value || "" color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } } @@ -144,6 +148,7 @@ Item elide: Text.ElideRight color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } } @@ -232,5 +237,6 @@ Item color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) + renderType: Text.NativeRendering } } diff --git a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml b/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml index 2c5d08aa72..e238132680 100644 --- a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml +++ b/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.10 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 @@ -66,6 +66,7 @@ UM.Dialog anchors.right: parent.right font: UM.Theme.getFont("default") wrapMode: Text.WordWrap + renderType: Text.NativeRendering } // Buttons diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index 9e2e178b71..7983be8aef 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.3 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -65,6 +65,7 @@ Item wrapMode: Text.WordWrap width: parent.width height: UM.Theme.getSize("toolbox_property_label").height + renderType: Text.NativeRendering } Column @@ -84,24 +85,28 @@ Item text: catalog.i18nc("@label", "Version") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } Label { text: catalog.i18nc("@label", "Last updated") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } Label { text: catalog.i18nc("@label", "Author") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } Label { text: catalog.i18nc("@label", "Downloads") + ":" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") + renderType: Text.NativeRendering } } Column @@ -121,6 +126,7 @@ Item text: details === null ? "" : (details.version || catalog.i18nc("@label", "Unknown")) font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering } Label { @@ -135,6 +141,7 @@ Item } font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering } Label { @@ -153,12 +160,14 @@ Item color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) + renderType: Text.NativeRendering } Label { text: details === null ? "" : (details.download_count || catalog.i18nc("@label", "Unknown")) font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + renderType: Text.NativeRendering } } Rectangle diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml index 1d701543ce..43f97baf3f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -31,6 +31,7 @@ Item wrapMode: Text.WordWrap color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering } Label { @@ -42,6 +43,7 @@ Item wrapMode: Text.WordWrap color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml index 848acfbf4f..7160dafa2d 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -57,6 +57,8 @@ Column linkColor: UM.Theme.getColor("text_link") visible: loginRequired width: installButton.width + renderType: Text.NativeRendering + MouseArea { anchors.fill: parent diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml index 3e2643938b..8e15882ae1 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 @@ -23,6 +23,7 @@ Column width: parent.width color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } Grid { diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index cee3f0fd20..357e9e9a72 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.3 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 @@ -72,6 +72,7 @@ Item wrapMode: Text.WordWrap color: UM.Theme.getColor("text") font: UM.Theme.getFont("default_bold") + renderType: Text.NativeRendering } Label { @@ -83,6 +84,7 @@ Item wrapMode: Text.WordWrap color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("default") + renderType: Text.NativeRendering } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml index 9851128076..820b74554a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -24,6 +24,7 @@ Rectangle width: parent.width color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } Grid { diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml index 8a2fdc8bc8..d1130cf63f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 @@ -79,6 +79,7 @@ Rectangle wrapMode: Text.WordWrap color: UM.Theme.getColor("button_text") font: UM.Theme.getFont("medium_bold") + renderType: Text.NativeRendering } } MouseArea diff --git a/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml b/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml index 600ae2b39f..e57e63dbb9 100644 --- a/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 @@ -18,5 +18,6 @@ Rectangle { centerIn: parent } + renderType: Text.NativeRendering } } diff --git a/plugins/Toolbox/resources/qml/ToolboxFooter.qml b/plugins/Toolbox/resources/qml/ToolboxFooter.qml index 5c2a6577ad..2d42ca7269 100644 --- a/plugins/Toolbox/resources/qml/ToolboxFooter.qml +++ b/plugins/Toolbox/resources/qml/ToolboxFooter.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -26,7 +26,7 @@ Item right: restartButton.right rightMargin: UM.Theme.getSize("default_margin").width } - + renderType: Text.NativeRendering } Button { @@ -56,6 +56,7 @@ Item text: control.text verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + renderType: Text.NativeRendering } } } diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index 3d5cd1c8d4..e1d01db59a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 @@ -38,6 +38,7 @@ ScrollView text: catalog.i18nc("@title:tab", "Plugins") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } Rectangle { @@ -68,6 +69,7 @@ ScrollView text: catalog.i18nc("@title:tab", "Materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering } Rectangle diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml index b16564fdd2..593e024309 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -51,6 +51,7 @@ Item wrapMode: Text.WordWrap font: UM.Theme.getFont("default_bold") color: pluginInfo.color + renderType: Text.NativeRendering } Label { @@ -60,6 +61,7 @@ Item width: parent.width wrapMode: Text.WordWrap color: pluginInfo.color + renderType: Text.NativeRendering } } Column @@ -88,6 +90,7 @@ Item onLinkActivated: Qt.openUrlExternally("mailto:" + model.author_email + "?Subject=Cura: " + model.name + " Plugin") color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("lining") linkColor: UM.Theme.getColor("text_link") + renderType: Text.NativeRendering } Label @@ -98,6 +101,7 @@ Item color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft + renderType: Text.NativeRendering } } ToolboxInstalledTileActions diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml index 39528f6437..61af84fbe5 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM @@ -24,6 +24,7 @@ Column font: UM.Theme.getFont("default") wrapMode: Text.WordWrap width: parent.width + renderType: Text.NativeRendering } ToolboxProgressButton @@ -55,6 +56,8 @@ Column linkColor: UM.Theme.getColor("text_link") visible: loginRequired width: updateButton.width + renderType: Text.NativeRendering + MouseArea { anchors.fill: parent diff --git a/plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml b/plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml index b8baf7bc83..40b22c268d 100644 --- a/plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml +++ b/plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.10 import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 @@ -32,6 +32,7 @@ UM.Dialog anchors.right: parent.right text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?") wrapMode: Text.Wrap + renderType: Text.NativeRendering } TextArea { diff --git a/plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml b/plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml index 1ba271dcab..025239bd43 100644 --- a/plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml @@ -1,7 +1,7 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 @@ -18,5 +18,6 @@ Rectangle { centerIn: parent } + renderType: Text.NativeRendering } } diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml index fa4f75d6fe..5e1aeaa636 100644 --- a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml @@ -1,8 +1,8 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 -import QtQuick.Controls 2.0 +import QtQuick 2.10 +import QtQuick.Controls 2.3 import UM 1.1 as UM Button @@ -46,5 +46,6 @@ Button font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic") verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + renderType: Text.NativeRendering } } \ No newline at end of file From 69744282e6208ef959035c7237a9685d9d85b819 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 10 Dec 2018 14:37:44 +0100 Subject: [PATCH 527/558] Fix rounding issue in toolbox QML widget size CURA-6006 --- plugins/Toolbox/resources/qml/Toolbox.qml | 4 ++-- plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 7cc5a730f2..9ede2a6bda 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -14,8 +14,8 @@ Window modality: Qt.ApplicationModal flags: Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint - width: 720 * screenScaleFactor - height: 640 * screenScaleFactor + width: Math.floor(720 * screenScaleFactor) + height: Math.floor(640 * screenScaleFactor) minimumWidth: width maximumWidth: minimumWidth minimumHeight: height diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml index 8e15882ae1..85f0ff8be4 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml @@ -38,7 +38,7 @@ Column delegate: Loader { asynchronous: true - width: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns + width: Math.round((grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns) height: UM.Theme.getSize("toolbox_thumbnail_small").height source: "ToolboxDownloadsGridTile.qml" } From df0ae20ddedf42040dee95243a5a236a0a65afea Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 14:39:15 +0100 Subject: [PATCH 528/558] Let's just get stepped up in here and get some personal space Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 14bdd07313..a283824bcf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -48,7 +48,8 @@ UM.Dialog anchors { fill: parent - margins: 60 * screenScaleFactor // TODO: Theme! + margins: 36 * screenScaleFactor // TODO: Theme! + bottomMargin: 56 * screenScaleFactor // TODO: Theme! } wrapMode: Text.WordWrap text: @@ -62,7 +63,7 @@ UM.Dialog { topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printer.name) } - var result = "

    " + topLine +"

    " + var result = "

    " + topLine +"

    \n\n" for (var i = 0; i < printer.activePrintJob.configurationChanges.length; i++) { var change = printer.activePrintJob.configurationChanges[i] From 590e8f5eb19cff433d1d5e1926dd4bcb89f4ea76 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 14:41:15 +0100 Subject: [PATCH 529/558] Wrap the disabled text in case it's too long. Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 55271d99c3..74adec5bc6 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -106,13 +106,15 @@ Item { id: disabledLabel visible: !base.enabled + anchors.fill: parent leftPadding: background.padding + rightPadding: background.padding text: "This component is disabled" font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter color: UM.Theme.getColor("text") - height: parent.height + wrapMode: Text.WordWrap } Item From aa376e60da409e87f49150900570cb957dbfd610 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 14:45:11 +0100 Subject: [PATCH 530/558] Make the disabled text translatable Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 2 +- resources/qml/ExpandableComponentHeader.qml | 2 +- resources/qml/ExpandablePopup.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 74adec5bc6..c2b9d715d5 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -109,7 +109,7 @@ Item anchors.fill: parent leftPadding: background.padding rightPadding: background.padding - text: "This component is disabled" + text: catalog.i18nc("@label default disabled text", "This component is disabled") font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/ExpandableComponentHeader.qml b/resources/qml/ExpandableComponentHeader.qml index b1fd49cd1b..09ea262c82 100644 --- a/resources/qml/ExpandableComponentHeader.qml +++ b/resources/qml/ExpandableComponentHeader.qml @@ -24,7 +24,7 @@ Cura.RoundedRectangle Label { id: headerLabel - text: "Title" + text: "" font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 75f718abf5..2d34b134e0 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -113,7 +113,7 @@ Item id: disabledLabel visible: !base.enabled leftPadding: background.padding - text: "This component is disabled" + text: catalog.i18nc("@label default disabled text", "This component is disabled") font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter From 2db5d2b23128be682e97ff34f5bbcf67aef1ccca Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 14:54:45 +0100 Subject: [PATCH 531/558] Add support for translation plurals Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index a283824bcf..127078d460 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -57,7 +57,7 @@ UM.Dialog var topLine if (materialsAreKnown(printer.activePrintJob)) { - topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printer.name) + topLine = catalog.i18ncp("@label", "The assigned printer, %1, requires the following configuration change:", "The assigned printer, %1, requires the following configuration changes:").arg(printer.name) } else { From 32f2b7ec1f293c4dde0b6575aa469e3d1c40aa8c Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 15:05:01 +0100 Subject: [PATCH 532/558] Fix some warnings Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 4 ++++ .../resources/qml/MonitorPrintJobPreview.qml | 4 ++++ .../resources/qml/MonitorPrintJobProgressBar.qml | 2 +- .../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 127078d460..cf8326a504 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -54,6 +54,10 @@ UM.Dialog wrapMode: Text.WordWrap text: { + if (!printer.activePrintJob) + { + return "" + } var topLine if (materialsAreKnown(printer.activePrintJob)) { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 5acd350abb..2f17db0c65 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -60,6 +60,10 @@ Item height: 0.5 * printJobPreview.height source: { + if (!printJob) + { + return "" + } if (printJob.configurationChanges.length > 0) { return "../svg/warning-icon.svg" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index e646172a6c..cfb7aba84d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -55,7 +55,7 @@ Item left: progressBar.right leftMargin: 18 * screenScaleFactor // TODO: Theme! } - text: Math.round(printJob.progress * 100) + "%" + text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%" color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme! width: contentWidth font: UM.Theme.getFont("medium") // 14pt, regular diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 02a8e7ae69..1edbf9f6a2 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -182,7 +182,7 @@ Item { abortConfirmationDialog.visible = true; popup.close(); } - text: printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort"); + text: printJob && printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort"); visible: { if (!printJob) { return false; From 028d993babdff046b9404a84271b07b00e426fef Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 15:27:51 +0100 Subject: [PATCH 533/558] Format .gcode.gz files too Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index cf8326a504..df3c99e0a1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -96,7 +96,7 @@ UM.Dialog } // Utils function formatPrintJobName(name) { - var extensions = [ ".gz", ".gcode", ".ufp" ]; + var extensions = [ ".gz", ".gcode", ".gcode.gz", ".ufp" ]; for (var i = 0; i < extensions.length; i++) { var extension = extensions[i]; if (name.slice(-extension.length) === extension) { From d495ec18bb7ab42de07bfb3617c00e7598a20e9e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 10 Dec 2018 15:28:20 +0100 Subject: [PATCH 534/558] Filter a bit more intelligently on when to check for errors CURA-6016 --- cura/Machines/MachineErrorChecker.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cura/Machines/MachineErrorChecker.py b/cura/Machines/MachineErrorChecker.py index 06f064315b..fb11123af6 100644 --- a/cura/Machines/MachineErrorChecker.py +++ b/cura/Machines/MachineErrorChecker.py @@ -64,21 +64,21 @@ class MachineErrorChecker(QObject): def _onMachineChanged(self) -> None: if self._global_stack: - self._global_stack.propertyChanged.disconnect(self.startErrorCheck) + self._global_stack.propertyChanged.disconnect(self.startErrorCheckPropertyChanged) self._global_stack.containersChanged.disconnect(self.startErrorCheck) for extruder in self._global_stack.extruders.values(): - extruder.propertyChanged.disconnect(self.startErrorCheck) + extruder.propertyChanged.disconnect(self.startErrorCheckPropertyChanged) extruder.containersChanged.disconnect(self.startErrorCheck) self._global_stack = self._machine_manager.activeMachine if self._global_stack: - self._global_stack.propertyChanged.connect(self.startErrorCheck) + self._global_stack.propertyChanged.connect(self.startErrorCheckPropertyChanged) self._global_stack.containersChanged.connect(self.startErrorCheck) for extruder in self._global_stack.extruders.values(): - extruder.propertyChanged.connect(self.startErrorCheck) + extruder.propertyChanged.connect(self.startErrorCheckPropertyChanged) extruder.containersChanged.connect(self.startErrorCheck) hasErrorUpdated = pyqtSignal() @@ -93,6 +93,13 @@ class MachineErrorChecker(QObject): def needToWaitForResult(self) -> bool: return self._need_to_check or self._check_in_progress + # Start the error check for property changed + # this is seperate from the startErrorCheck because it ignores a number property types + def startErrorCheckPropertyChanged(self, key, property_name): + if property_name != "value": + return + self.startErrorCheck() + # Starts the error check timer to schedule a new error check. def startErrorCheck(self, *args) -> None: if not self._check_in_progress: From 04af8fbd5018d7bfdf488ddd98b1d4ccabab1bfb Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 15:33:16 +0100 Subject: [PATCH 535/558] Update MonitorConfigOverrideDialog.qml Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index df3c99e0a1..7f7dc24350 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -96,7 +96,7 @@ UM.Dialog } // Utils function formatPrintJobName(name) { - var extensions = [ ".gz", ".gcode", ".gcode.gz", ".ufp" ]; + var extensions = [ ".gcode.gz", ".gz", ".gcode", ".ufp" ]; for (var i = 0; i < extensions.length; i++) { var extension = extensions[i]; if (name.slice(-extension.length) === extension) { From 1cd0d26db420af72d92c5b2538caa93a44495dcb Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 15:34:48 +0100 Subject: [PATCH 536/558] Change margins Instead of using multiplications and divisions, just use the corresponding margins. Contributes to CURA-5876. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- .../qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 05cac16e29..728a0cbe9a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -29,7 +29,7 @@ Button id: contentColumn width: parent.width padding: UM.Theme.getSize("wide_margin").width - spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) + spacing: UM.Theme.getSize("narrow_margin").height Row { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 53969a0370..3cc0754284 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -12,7 +12,7 @@ Column id: base property var outputDevice: null height: childrenRect.height + 2 * padding - spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) + spacing: UM.Theme.getSize("narrow_margin").height function forceModelUpdate() { @@ -55,7 +55,7 @@ Column ListView { id: configurationList - spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) + spacing: UM.Theme.getSize("narrow_margin").height width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any. contentHeight: childrenRect.height height: childrenRect.height @@ -64,7 +64,7 @@ Column section.criteria: ViewSection.FullString section.delegate: Item { - height: printerTypeLabel.height + UM.Theme.getSize("default_margin").height * 2 //Causes a default margin above the label and a default margin below the label. + height: printerTypeLabel.height + UM.Theme.getSize("wide_margin").height //Causes a default margin above the label and a default margin below the label. Cura.PrinterTypeLabel { id: printerTypeLabel From 11d8831d7a9a15e3e916d5d9762bfe1f755042e5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 15:40:18 +0100 Subject: [PATCH 537/558] Use the capitalized version of the buildplate name --- cura/PrinterOutput/ConfigurationModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutput/ConfigurationModel.py b/cura/PrinterOutput/ConfigurationModel.py index 89e609c913..6f55aa3b1f 100644 --- a/cura/PrinterOutput/ConfigurationModel.py +++ b/cura/PrinterOutput/ConfigurationModel.py @@ -44,7 +44,7 @@ class ConfigurationModel(QObject): @pyqtProperty(str, fset = setBuildplateConfiguration, notify = configurationChanged) def buildplateConfiguration(self) -> str: - return self._buildplate_configuration + return self._buildplate_configuration.capitalize() ## This method is intended to indicate whether the configuration is valid or not. # The method checks if the mandatory fields are or not set From 0e19fa731f8bc391c3b17ab33db0197410633ef0 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 10 Dec 2018 15:47:45 +0100 Subject: [PATCH 538/558] Codestyle Contributes to CL-1152 --- .../qml/MonitorConfigOverrideDialog.qml | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 7f7dc24350..1b9a03ea99 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -95,39 +95,46 @@ UM.Dialog } } // Utils - function formatPrintJobName(name) { - var extensions = [ ".gcode.gz", ".gz", ".gcode", ".ufp" ]; - for (var i = 0; i < extensions.length; i++) { - var extension = extensions[i]; - if (name.slice(-extension.length) === extension) { - name = name.substring(0, name.length - extension.length); + function formatPrintJobName(name) + { + var extensions = [ ".gcode.gz", ".gz", ".gcode", ".ufp" ] + for (var i = 0; i < extensions.length; i++) + { + var extension = extensions[i] + if (name.slice(-extension.length) === extension) + { + name = name.substring(0, name.length - extension.length) } } return name; } - function materialsAreKnown(job) { - var conf0 = job.configuration[0]; - if (conf0 && !conf0.material.material) { - return false; + function materialsAreKnown(job) + { + var conf0 = job.configuration[0] + if (conf0 && !conf0.material.material) + { + return false } - var conf1 = job.configuration[1]; - if (conf1 && !conf1.material.material) { - return false; + var conf1 = job.configuration[1] + if (conf1 && !conf1.material.material) + { + return false } - return true; + return true } - function formatBuildPlateType(buildPlateType) { - var translationText = ""; + function formatBuildPlateType(buildPlateType) + { + var translationText = "" switch (buildPlateType) { case "glass": - translationText = catalog.i18nc("@label", "Glass"); - break; + translationText = catalog.i18nc("@label", "Glass") + break case "aluminum": - translationText = catalog.i18nc("@label", "Aluminum"); - break; + translationText = catalog.i18nc("@label", "Aluminum") + break default: - translationText = null; + translationText = null } - return translationText; + return translationText } } \ No newline at end of file From 4fc4aecf17e33da689463c0d899f36a564fe2f83 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 15:48:59 +0100 Subject: [PATCH 539/558] Avoid the overlapping of text when the name is too long Normally I happens in other languages other than English. --- resources/qml/ViewsSelector.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index ed0b694aed..f2906f9d4c 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -60,6 +60,7 @@ Cura.ExpandablePopup { left: title.right leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right } height: parent.height elide: Text.ElideRight From 1436301d780572e976ed0c62edbebee42a404729 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 10 Dec 2018 16:20:00 +0100 Subject: [PATCH 540/558] Ensure setActiveExtruderIndex only gets called once when switching machines CURA-6016 --- cura/Settings/ExtruderManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index b0bcf3b100..8fa0172305 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -83,8 +83,9 @@ class ExtruderManager(QObject): # \param index The index of the new active extruder. @pyqtSlot(int) def setActiveExtruderIndex(self, index: int) -> None: - self._active_extruder_index = index - self.activeExtruderChanged.emit() + if self._active_extruder_index != index: + self._active_extruder_index = index + self.activeExtruderChanged.emit() @pyqtProperty(int, notify = activeExtruderChanged) def activeExtruderIndex(self) -> int: @@ -344,6 +345,7 @@ class ExtruderManager(QObject): if extruders_changed: self.extrudersChanged.emit(global_stack_id) self.setActiveExtruderIndex(0) + self.activeExtruderChanged.emit() # After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing # "fdmextruder". We need to check a machine here so its extruder definition is correct according to this. From 3132b1f689ad6f83479db5bd19a071e6d47bf74e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 10 Dec 2018 16:56:44 +0100 Subject: [PATCH 541/558] Update the extruder Model a whole lot less CURA-6016 --- cura/Settings/ExtrudersModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 5f10ac99d4..e19617c8ef 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -224,6 +224,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): "definition": "" } items.append(item) - - self.setItems(items) - self.modelChanged.emit() + if self._items != items: + self.setItems(items) + self.modelChanged.emit() From 716fedc7820c6a406d3ba431d99284e264cc5541 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 17:06:51 +0100 Subject: [PATCH 542/558] Use no text by default for the disabled state of the panels Contributes to CURA-5941. --- resources/qml/ExpandableComponent.qml | 2 +- resources/qml/ExpandablePopup.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index c2b9d715d5..2b07aa7d37 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -109,7 +109,7 @@ Item anchors.fill: parent leftPadding: background.padding rightPadding: background.padding - text: catalog.i18nc("@label default disabled text", "This component is disabled") + text: "" font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 2d34b134e0..4bf1684f18 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -113,7 +113,7 @@ Item id: disabledLabel visible: !base.enabled leftPadding: background.padding - text: catalog.i18nc("@label default disabled text", "This component is disabled") + text: "" font: UM.Theme.getFont("default") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter From 909f36d28ede29c0c9fc5f69db7f8941fc5a8429 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Dec 2018 09:24:22 +0100 Subject: [PATCH 543/558] Let the settingsMenu use the extruders of the active machine instead of the extruderModel The extruder model gets updated way to much (for all material changes) but we only need the number and names of the extruders, since the other menu's do this by themselves --- cura/Settings/GlobalStack.py | 16 +++++++++++++--- resources/qml/Menus/SettingsMenu.qml | 5 +++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index da1ec61254..44ceee9511 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -3,8 +3,8 @@ from collections import defaultdict import threading -from typing import Any, Dict, Optional, Set, TYPE_CHECKING -from PyQt5.QtCore import pyqtProperty, pyqtSlot +from typing import Any, Dict, Optional, Set, TYPE_CHECKING, List +from PyQt5.QtCore import pyqtProperty, pyqtSlot, pyqtSignal from UM.Decorators import override from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase @@ -42,13 +42,23 @@ class GlobalStack(CuraContainerStack): # Per thread we have our own resolving_settings, or strange things sometimes occur. self._resolving_settings = defaultdict(set) #type: Dict[str, Set[str]] # keys are thread names + extrudersChanged = pyqtSignal() + ## Get the list of extruders of this stack. # # \return The extruders registered with this stack. - @pyqtProperty("QVariantMap") + @pyqtProperty("QVariantMap", notify = extrudersChanged) def extruders(self) -> Dict[str, "ExtruderStack"]: return self._extruders + @pyqtProperty("QVariantList", notify = extrudersChanged) + def extruderList(self) -> List["ExtruderStack"]: + result_tuple_list = sorted(list(self.extruders.items()), key=lambda x: int(x[0])) + result_list = [item[1] for item in result_tuple_list] + + machine_extruder_count = self.getProperty("machine_extruder_count", "value") + return result_list[:machine_extruder_count] + @classmethod def getLoadingPriority(cls) -> int: return 2 diff --git a/resources/qml/Menus/SettingsMenu.qml b/resources/qml/Menus/SettingsMenu.qml index 79f8c5b7bf..4ea3a4d71a 100644 --- a/resources/qml/Menus/SettingsMenu.qml +++ b/resources/qml/Menus/SettingsMenu.qml @@ -16,10 +16,11 @@ Menu Instantiator { - model: Cura.ExtrudersModel { simpleNames: true } + model: Cura.MachineManager.activeMachine.extruderList + Menu { - title: model.name + title: modelData.name NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } From bb1950525a5e67ae9ee0e7163d720e0d14b72f16 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Dec 2018 09:42:34 +0100 Subject: [PATCH 544/558] Limit the amount of times the buildplate rebuild is done CURA-6016 --- cura/BuildVolume.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index f837f5cef7..aa1f170707 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -83,7 +83,14 @@ class BuildVolume(SceneNode): " with printed models."), title = catalog.i18nc("@info:title", "Build Volume")) self._global_container_stack = None + + self._stack_change_timer = QTimer() + self._stack_change_timer.setInterval(100) + self._stack_change_timer.setSingleShot(True) + self._stack_change_timer.timeout.connect(self._onStackChangeTimerFinished) + self._application.globalContainerStackChanged.connect(self._onStackChanged) + self._onStackChanged() self._engine_ready = False @@ -105,6 +112,8 @@ class BuildVolume(SceneNode): self._setting_change_timer.setSingleShot(True) self._setting_change_timer.timeout.connect(self._onSettingChangeTimerFinished) + + # Must be after setting _build_volume_message, apparently that is used in getMachineManager. # activeQualityChanged is always emitted after setActiveVariant, setActiveMaterial and setActiveQuality. # Therefore this works. @@ -526,8 +535,11 @@ class BuildVolume(SceneNode): if extra_z != self._extra_z_clearance: self._extra_z_clearance = extra_z - ## Update the build volume visualization def _onStackChanged(self): + self._stack_change_timer.start() + + ## Update the build volume visualization + def _onStackChangeTimerFinished(self): if self._global_container_stack: self._global_container_stack.propertyChanged.disconnect(self._onSettingPropertyChanged) extruders = ExtruderManager.getInstance().getActiveExtruderStacks() From 77703e1fb8f2a0c60a56126b9ccc90d5aba8f8a3 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 09:58:23 +0100 Subject: [PATCH 545/558] Catch an exception from numpy that happens when loading some models --- cura/Scene/ConvexHullDecorator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index 0c03ae615b..661106dec7 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -187,7 +187,10 @@ class ConvexHullDecorator(SceneNodeDecorator): for child in self._node.getChildren(): child_hull = child.callDecoration("_compute2DConvexHull") if child_hull: - points = numpy.append(points, child_hull.getPoints(), axis = 0) + try: + points = numpy.append(points, child_hull.getPoints(), axis = 0) + except ValueError: + pass if points.size < 3: return None From 4dab33d41babdb0d961d3d1bcb54479b5e8c3691 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 10:44:30 +0100 Subject: [PATCH 546/558] Remove the fancy snowflakes pattern --- resources/qml/Cura.qml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3e019cdcd5..a4faa27b67 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -123,17 +123,6 @@ UM.MainWindow } } } - - // This is the new fancy pattern - Image - { - id: backgroundPattern - anchors.fill: parent - fillMode: Image.Tile - source: UM.Theme.getImage("header_pattern") - horizontalAlignment: Image.AlignLeft - verticalAlignment: Image.AlignTop - } } MainWindowHeader From 0f357e1078b6a30a5b3ddda88bbc9fcd736f0bb4 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 11 Dec 2018 10:51:05 +0100 Subject: [PATCH 547/558] Replace fix for 'None' materials This was fixed in 4.0 and accidentally got reverted when merging another branch in. Contributes to CL-1160 --- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 08592df603..60474156a8 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -609,6 +609,17 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): material_manager = CuraApplication.getInstance().getMaterialManager() material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"]) + # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the + # material is unknown to Cura, so we should return an "empty" or "unknown" material model. + if material_group_list is None: + material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown" + return MaterialOutputModel(guid = material_data["guid"], + type = material_data.get("type", ""), + color = material_data.get("color", ""), + brand = material_data.get("brand", ""), + name = material_data.get("name", material_name) + ) + # Sort the material groups by "is_read_only = True" first, and then the name alphabetically. read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list)) non_read_only_material_group_list = list(filter(lambda x: not x.is_read_only, material_group_list)) From f67ac8d7c4f937a323f8b1a520abfaecad5b438a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Dec 2018 10:59:17 +0100 Subject: [PATCH 548/558] Update far less agressively for the material models CURA-6016 --- cura/Machines/Models/BaseMaterialsModel.py | 14 ++++++++++---- cura/Machines/Models/FavoriteMaterialsModel.py | 5 +---- cura/Machines/Models/GenericMaterialsModel.py | 3 --- cura/Machines/Models/MaterialBrandsModel.py | 4 ---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py index ef2e760330..3cd92bb6b4 100644 --- a/cura/Machines/Models/BaseMaterialsModel.py +++ b/cura/Machines/Models/BaseMaterialsModel.py @@ -1,5 +1,6 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from typing import Optional, Dict, Set from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty from UM.Qt.ListModel import ListModel @@ -9,6 +10,9 @@ from UM.Qt.ListModel import ListModel # Those 2 models are used by the material drop down menu to show generic materials and branded materials separately. # The extruder position defined here is being used to bound a menu to the correct extruder. This is used in the top # bar menu "Settings" -> "Extruder nr" -> "Material" -> this menu +from cura.Machines.MaterialNode import MaterialNode + + class BaseMaterialsModel(ListModel): extruderPositionChanged = pyqtSignal() @@ -54,8 +58,8 @@ class BaseMaterialsModel(ListModel): self._extruder_position = 0 self._extruder_stack = None - self._available_materials = None - self._favorite_ids = None + self._available_materials = None # type: Optional[Dict[str, MaterialNode]] + self._favorite_ids = set() # type: Set(str) def _updateExtruderStack(self): global_stack = self._machine_manager.activeMachine @@ -102,8 +106,10 @@ class BaseMaterialsModel(ListModel): return False extruder_stack = global_stack.extruders[extruder_position] - - self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) + available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) + if available_materials == self._available_materials: + return False + self._available_materials = available_materials if self._available_materials is None: return False diff --git a/cura/Machines/Models/FavoriteMaterialsModel.py b/cura/Machines/Models/FavoriteMaterialsModel.py index 18fe310c44..cc273e55ce 100644 --- a/cura/Machines/Models/FavoriteMaterialsModel.py +++ b/cura/Machines/Models/FavoriteMaterialsModel.py @@ -4,17 +4,14 @@ from UM.Logger import Logger from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel -class FavoriteMaterialsModel(BaseMaterialsModel): +class FavoriteMaterialsModel(BaseMaterialsModel): def __init__(self, parent = None): super().__init__(parent) self._update() def _update(self): - - # Perform standard check and reset if the check fails if not self._canUpdate(): - self.setItems([]) return # Get updated list of favorites diff --git a/cura/Machines/Models/GenericMaterialsModel.py b/cura/Machines/Models/GenericMaterialsModel.py index c276b865bf..8f41dd6a70 100644 --- a/cura/Machines/Models/GenericMaterialsModel.py +++ b/cura/Machines/Models/GenericMaterialsModel.py @@ -11,10 +11,7 @@ class GenericMaterialsModel(BaseMaterialsModel): self._update() def _update(self): - - # Perform standard check and reset if the check fails if not self._canUpdate(): - self.setItems([]) return # Get updated list of favorites diff --git a/cura/Machines/Models/MaterialBrandsModel.py b/cura/Machines/Models/MaterialBrandsModel.py index 458e4d9b47..ac82cf6670 100644 --- a/cura/Machines/Models/MaterialBrandsModel.py +++ b/cura/Machines/Models/MaterialBrandsModel.py @@ -28,12 +28,8 @@ class MaterialBrandsModel(BaseMaterialsModel): self._update() def _update(self): - - # Perform standard check and reset if the check fails if not self._canUpdate(): - self.setItems([]) return - # Get updated list of favorites self._favorite_ids = self._material_manager.getFavorites() From 4b6f4af44eeef9b0d39c3161d7e577d66d57388c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 11:10:45 +0100 Subject: [PATCH 549/558] Close the expandable panel when it becomes disabled It happens when it's open and the user loads a GCode. Contributes to CURA-5941 --- resources/qml/ExpandableComponent.qml | 18 +++++++++++++++++- resources/qml/ExpandablePopup.qml | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 2b07aa7d37..afe15bcb1d 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -88,7 +88,23 @@ Item { target: background property: "color" - value: enabled ? (expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") + value: + { + return base.enabled ? (expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") + } + } + + // The panel needs to close when it becomes disabled + Connections + { + target: base + onEnabledChanged: + { + if (!base.enabled && expanded) + { + toggleContent() + } + } } implicitHeight: 100 * screenScaleFactor diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 4bf1684f18..2d2665373e 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -94,7 +94,20 @@ Item { target: background property: "color" - value: enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") + value: base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") + } + + // The panel needs to close when it becomes disabled + Connections + { + target: base + onEnabledChanged: + { + if (!base.enabled && expanded) + { + toggleContent() + } + } } implicitHeight: 100 * screenScaleFactor From 2b2e8ebb31ffaacdcd6cac3851585de94af556c4 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 11:37:01 +0100 Subject: [PATCH 550/558] Add some safety checks when checking for the guid of the material Don't crash if the guid doesn't exist. Contributes to CL-1160. --- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 60474156a8..d39cf6e41c 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -607,13 +607,18 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel": material_manager = CuraApplication.getInstance().getMaterialManager() - material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"]) + material_group_list = None + + # Avoid crashing if there is no "guid" field in the metadata + material_guid = material_data.get("guid") + if material_guid: + material_group_list = material_manager.getMaterialGroupListByGUID(material_guid) # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the # material is unknown to Cura, so we should return an "empty" or "unknown" material model. if material_group_list is None: - material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown" - return MaterialOutputModel(guid = material_data["guid"], + material_name = "Empty" if len(material_data.get("guid", "") == 0 else "Unknown" + return MaterialOutputModel(guid = material_data.get("guid", ""), type = material_data.get("type", ""), color = material_data.get("color", ""), brand = material_data.get("brand", ""), From 1c373b720541691f4bd8d9e20a93b5596de04c32 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 11 Dec 2018 11:51:13 +0100 Subject: [PATCH 551/558] Improve config override text Contributes to CL-1152 --- .../resources/qml/MonitorConfigOverrideDialog.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 1b9a03ea99..6a32310dd5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -61,7 +61,7 @@ UM.Dialog var topLine if (materialsAreKnown(printer.activePrintJob)) { - topLine = catalog.i18ncp("@label", "The assigned printer, %1, requires the following configuration change:", "The assigned printer, %1, requires the following configuration changes:").arg(printer.name) + topLine = catalog.i18ncp("@label", "The assigned printer, %1, requires the following configuration change:", "The assigned printer, %1, requires the following configuration changes:", printer.activePrintJob.configurationChanges.length).arg(printer.name) } else { @@ -89,8 +89,10 @@ UM.Dialog default: text = "unknown" } - result += "

    " + text + "

    " + result += "

    " + text + "

    \n\n" } + var bottomLine = catalog.i18nc("@label", "Override will use the specified settings with the existing printer configuration. This may result in a failed print.") + result += "

    " + bottomLine + "

    \n\n" return result } } From 70b0d16fa4827f74632e8b57e3c01db0ed3aabdf Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 11:53:26 +0100 Subject: [PATCH 552/558] Fix typo Missing parenthesis. Contributes to CL-1160. --- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index d39cf6e41c..275087447e 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -617,7 +617,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the # material is unknown to Cura, so we should return an "empty" or "unknown" material model. if material_group_list is None: - material_name = "Empty" if len(material_data.get("guid", "") == 0 else "Unknown" + material_name = "Empty" if len(material_data.get("guid", "")) == 0 else "Unknown" return MaterialOutputModel(guid = material_data.get("guid", ""), type = material_data.get("type", ""), color = material_data.get("color", ""), From 4949f39c34e6ffee888fb9eed49181879c02b9d1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 12:10:32 +0100 Subject: [PATCH 553/558] Add translatable strings to empty and unknown material Contributes to CL-1160. --- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 275087447e..ef890fc4ed 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -617,7 +617,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): # This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the # material is unknown to Cura, so we should return an "empty" or "unknown" material model. if material_group_list is None: - material_name = "Empty" if len(material_data.get("guid", "")) == 0 else "Unknown" + material_name = i18n_catalog.i18nc("@label:material", "Empty") if len(material_data.get("guid", "")) == 0 \ + else i18n_catalog.i18nc("@label:material", "Unknown") return MaterialOutputModel(guid = material_data.get("guid", ""), type = material_data.get("type", ""), color = material_data.get("color", ""), @@ -649,9 +650,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): color = material_data["color"] brand = material_data["brand"] material_type = material_data["material"] - name = "Empty" if material_data["material"] == "empty" else "Unknown" - return MaterialOutputModel(guid=material_data["guid"], type=material_type, - brand=brand, color=color, name=name) + name = i18n_catalog.i18nc("@label:material", "Empty") if material_data["material"] == "empty" \ + else i18n_catalog.i18nc("@label:material", "Unknown") + return MaterialOutputModel(guid = material_data["guid"], type = material_type, + brand = brand, color = color, name = name) def _updatePrinter(self, printer: PrinterOutputModel, data: Dict[str, Any]) -> None: # For some unknown reason the cluster wants UUID for everything, except for sending a job directly to a printer. From 6c70543d11bdc37ab658e53686882bcd5a6e4452 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Dec 2018 12:46:11 +0100 Subject: [PATCH 554/558] Only set the containerID when the dialog is visible This prevents unneeded updates CURA-6016 --- resources/qml/Dialogs/WorkspaceSummaryDialog.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml index 1b3a7aac55..35630bd19b 100644 --- a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml +++ b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml @@ -11,6 +11,7 @@ import Cura 1.0 as Cura UM.Dialog { + id: base title: catalog.i18nc("@title:window", "Save Project") minimumWidth: 500 * screenScaleFactor @@ -49,7 +50,7 @@ UM.Dialog UM.SettingDefinitionsModel { id: definitionsModel - containerId: Cura.MachineManager.activeDefinitionId + containerId: base.visible ? Cura.MachineManager.activeDefinitionId: "" showAll: true exclude: ["command_line_settings"] showAncestors: true From 75ff03f3c8e55c2d2a651da0f36b3d0ee6c0fb8f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 11 Dec 2018 13:13:20 +0100 Subject: [PATCH 555/558] Use setState instead of emitting the backend state CURA-6016 --- .../CuraEngineBackend/CuraEngineBackend.py | 38 +++++++++---------- plugins/CuraEngineBackend/StartSliceJob.py | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 58bc74f3f1..7ede6b6736 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -203,7 +203,7 @@ class CuraEngineBackend(QObject, Backend): @pyqtSlot() def stopSlicing(self) -> None: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) if self._slicing: # We were already slicing. Stop the old job. self._terminate() self._createSocket() @@ -322,7 +322,7 @@ class CuraEngineBackend(QObject, Backend): self._start_slice_job = None if job.isCancelled() or job.getError() or job.getResult() == StartJobResult.Error: - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) return @@ -331,10 +331,10 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current material as it is incompatible with the selected machine or configuration."), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) else: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) return if job.getResult() == StartJobResult.SettingError: @@ -362,10 +362,10 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}").format(", ".join(error_labels)), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) else: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) return elif job.getResult() == StartJobResult.ObjectSettingError: @@ -386,7 +386,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice due to some per-model settings. The following settings have errors on one or more models: {error_labels}").format(error_labels = ", ".join(errors.values())), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) return @@ -395,16 +395,16 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) else: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) if job.getResult() == StartJobResult.ObjectsWithDisabledExtruder: self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because there are objects associated with disabled Extruder %s." % job.getMessage()), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) return @@ -413,10 +413,10 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() - self.backendStateChange.emit(BackendState.Error) + self.setState(BackendState.Error) self.backendError.emit(job) else: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) self._invokeSlice() return @@ -424,7 +424,7 @@ class CuraEngineBackend(QObject, Backend): self._socket.sendMessage(job.getSliceMessage()) # Notify the user that it's now up to the backend to do it's job - self.backendStateChange.emit(BackendState.Processing) + self.setState(BackendState.Processing) if self._slice_start_time: Logger.log("d", "Sending slice message took %s seconds", time() - self._slice_start_time ) @@ -442,7 +442,7 @@ class CuraEngineBackend(QObject, Backend): for node in DepthFirstIterator(self._scene.getRoot()): #type: ignore #Ignore type error because iter() should get called automatically by Python syntax. if node.callDecoration("isBlockSlicing"): enable_timer = False - self.backendStateChange.emit(BackendState.Disabled) + self.setState(BackendState.Disabled) self._is_disabled = True gcode_list = node.callDecoration("getGCodeList") if gcode_list is not None: @@ -451,7 +451,7 @@ class CuraEngineBackend(QObject, Backend): if self._use_timer == enable_timer: return self._use_timer if enable_timer: - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) self.enableTimer() return True else: @@ -518,7 +518,7 @@ class CuraEngineBackend(QObject, Backend): self._build_plates_to_be_sliced.append(build_plate_number) self.printDurationMessage.emit(source_build_plate_number, {}, []) self.processingProgress.emit(0.0) - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) # if not self._use_timer: # With manually having to slice, we want to clear the old invalid layer data. self._clearLayerData(build_plate_changed) @@ -567,7 +567,7 @@ class CuraEngineBackend(QObject, Backend): self.stopSlicing() self.markSliceAll() self.processingProgress.emit(0.0) - self.backendStateChange.emit(BackendState.NotStarted) + self.setState(BackendState.NotStarted) if not self._use_timer: # With manually having to slice, we want to clear the old invalid layer data. self._clearLayerData() @@ -613,7 +613,7 @@ class CuraEngineBackend(QObject, Backend): # \param message The protobuf message containing the slicing progress. def _onProgressMessage(self, message: Arcus.PythonMessage) -> None: self.processingProgress.emit(message.amount) - self.backendStateChange.emit(BackendState.Processing) + self.setState(BackendState.Processing) def _invokeSlice(self) -> None: if self._use_timer: @@ -632,7 +632,7 @@ class CuraEngineBackend(QObject, Backend): # # \param message The protobuf message signalling that slicing is finished. def _onSlicingFinishedMessage(self, message: Arcus.PythonMessage) -> None: - self.backendStateChange.emit(BackendState.Done) + self.setState(BackendState.Done) self.processingProgress.emit(1.0) gcode_list = self._scene.gcode_dict[self._start_slice_job_build_plate] #type: ignore #Because we generate this attribute dynamically. diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 9679360ad5..d3882a1209 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -323,7 +323,7 @@ class StartSliceJob(Job): value = stack.getProperty(key, "value") result[key] = value Job.yieldThread() - + result["print_bed_temperature"] = result["material_bed_temperature"] # Renamed settings. result["print_temperature"] = result["material_print_temperature"] result["time"] = time.strftime("%H:%M:%S") #Some extra settings. From b413b4cdb69fd3f6c46f93c3797c92bd9abc53b8 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 11 Dec 2018 17:21:14 +0100 Subject: [PATCH 556/558] Correct a typo in typing. [CURA-6016] --- cura/Machines/Models/BaseMaterialsModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py index 3cd92bb6b4..629e5c2b48 100644 --- a/cura/Machines/Models/BaseMaterialsModel.py +++ b/cura/Machines/Models/BaseMaterialsModel.py @@ -59,7 +59,7 @@ class BaseMaterialsModel(ListModel): self._extruder_stack = None self._available_materials = None # type: Optional[Dict[str, MaterialNode]] - self._favorite_ids = set() # type: Set(str) + self._favorite_ids = set() # type: Set[str] def _updateExtruderStack(self): global_stack = self._machine_manager.activeMachine From 31331e36d2fa6468973f1f1d26ae7df3d8c0d6a9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 12 Dec 2018 09:19:43 +0100 Subject: [PATCH 557/558] Revert "Use the capitalized version of the buildplate name" This reverts commit 11d8831d7a9a15e3e916d5d9762bfe1f755042e5. Contributes to CURA-6021. --- cura/PrinterOutput/ConfigurationModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutput/ConfigurationModel.py b/cura/PrinterOutput/ConfigurationModel.py index 6f55aa3b1f..89e609c913 100644 --- a/cura/PrinterOutput/ConfigurationModel.py +++ b/cura/PrinterOutput/ConfigurationModel.py @@ -44,7 +44,7 @@ class ConfigurationModel(QObject): @pyqtProperty(str, fset = setBuildplateConfiguration, notify = configurationChanged) def buildplateConfiguration(self) -> str: - return self._buildplate_configuration.capitalize() + return self._buildplate_configuration ## This method is intended to indicate whether the configuration is valid or not. # The method checks if the mandatory fields are or not set From f302a76d3aedf38e051e692f59246d406a1295d9 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 12 Dec 2018 10:47:15 +0100 Subject: [PATCH 558/558] Fix typing issue in Toolbox CURA-6006 --- plugins/Toolbox/src/Toolbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index ab975548ce..d957b7aae1 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -670,7 +670,8 @@ class Toolbox(QObject, Extension): self.setDownloadProgress(new_progress) if bytes_sent == bytes_total: self.setIsDownloading(False) - cast(QNetworkReply, self._download_reply).downloadProgress.disconnect(self._onDownloadProgress) + self._download_reply = cast(QNetworkReply, self._download_reply) + self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) # Check if the download was sucessfull if self._download_reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200: