From 2bf641efcfef28bbdae869ab3bfb6d8d4f70d8de Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 09:09:58 +0100 Subject: [PATCH 01/31] Add a Cura Tooltip to show in some buttons Contributes to CURA-6004. --- resources/qml/ActionButton.qml | 8 ++-- .../ActionPanel/OutputDevicesActionButton.qml | 1 - .../qml/ActionPanel/SliceProcessWidget.qml | 1 + resources/qml/PrintSetupTooltip.qml | 5 +-- resources/qml/ToolTip.qml | 43 +++++++++++++++++++ resources/qml/ToolbarButton.qml | 7 +++ resources/qml/qmldir | 3 +- resources/themes/cura-light/theme.json | 2 +- 8 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 resources/qml/ToolTip.qml diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 7177120f35..aa4d3f21c0 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -16,7 +16,7 @@ Button property alias iconSource: buttonIconLeft.source property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius - property alias tooltip: tooltip.text + property alias tooltip: tooltip.tooltipText property alias cornerSide: backgroundRect.cornerSide property color color: UM.Theme.getColor("primary") @@ -109,11 +109,9 @@ Button z: backgroundRect.z - 1 } - ToolTip + Cura.ToolTip { id: tooltip - text: "" - delay: 500 - visible: text != "" && button.hovered + show: button.hovered } } \ No newline at end of file diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 9a6c97bcff..2858bc267c 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -55,7 +55,6 @@ 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: 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) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 18caeafb40..2d377abcd8 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -109,6 +109,7 @@ Column fixedWidthMode: true anchors.fill: parent text: catalog.i18nc("@button", "Slice") + tooltip: "Start slicing process" enabled: widget.backendState != UM.Backend.Error visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error onClicked: sliceOrStopSlicing() diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 4fa4ef9dd7..693b703813 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -2,9 +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.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.3 import UM 1.0 as UM @@ -57,5 +55,6 @@ UM.PointingRectangle { textFormat: Text.RichText font: UM.Theme.getFont("default"); color: UM.Theme.getColor("tooltip_text"); + renderType: Text.NativeRendering } } diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml new file mode 100644 index 0000000000..ed71d3983b --- /dev/null +++ b/resources/qml/ToolTip.qml @@ -0,0 +1,43 @@ +// 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.0 as UM + +ToolTip +{ + // This property indicates when the tooltip has to show, for instance when a button is hovered + property bool show: false + + property alias tooltipText: tooltip.text + property var targetPoint: Qt.point(0, 0) + + id: tooltip + text: "" + delay: 500 + visible: text != "" && show + font: UM.Theme.getFont("default") + + background: UM.PointingRectangle + { + id: backgroundRect + color: UM.Theme.getColor("tooltip") + + target: Qt.point(targetPoint.x - tooltip.x, targetPoint.y - tooltip.y) + + arrowSize: UM.Theme.getSize("default_arrow").width + } + + contentItem: Label + { + id: label + text: tooltip.text + font: tooltip.font + wrapMode: Text.Wrap + textFormat: Text.RichText + color: UM.Theme.getColor("tooltip_text") + renderType: Text.NativeRendering + } +} \ No newline at end of file diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index adff73fb7c..307d49302c 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -96,4 +96,11 @@ Button height: UM.Theme.getSize("button_icon").height } } + + Cura.ToolTip + { + id: tooltip + tooltipText: base.text + show: base.hovered + } } diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 1dc21150ce..80e0f8be46 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -14,4 +14,5 @@ PrinterTypeLabel 1.0 PrinterTypeLabel.qml ViewsSelector 1.0 ViewsSelector.qml ToolbarButton 1.0 ToolbarButton.qml SettingView 1.0 SettingView.qml -ProfileMenu 1.0 ProfileMenu.qml \ No newline at end of file +ProfileMenu 1.0 ProfileMenu.qml +ToolTip 1.0 ToolTip.qml \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 16d13b9652..86201db809 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -240,7 +240,7 @@ "checkbox_disabled": [223, 223, 223, 255], "checkbox_text": [35, 35, 35, 255], - "tooltip": [68, 192, 255, 255], + "tooltip": [19, 19, 19, 255], "tooltip_text": [255, 255, 255, 255], "tool_button_border": [255, 255, 255, 0], From 9f52a52ea3ee9e497c8b7dc220a9077ad7c64c59 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Dec 2018 09:32:11 +0100 Subject: [PATCH 02/31] Fix ExtruderModel reference in machine settings dialog --- .../MachineSettingsAction.qml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index d8efe6f8b8..a9900070a8 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -14,20 +14,9 @@ Cura.MachineAction { id: base property var extrudersModel: CuraApplication.getExtrudersModel() - property int extruderTabsCount: 0 property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" - Connections - { - target: base.extrudersModel - onModelChanged: - { - var extruderCount = base.extrudersModel.count; - base.extruderTabsCount = extruderCount; - } - } - Connections { target: dialog ? dialog : null @@ -357,11 +346,11 @@ Cura.MachineAction Repeater { id: extruderTabsRepeater - model: base.extruderTabsCount + model: base.extrudersModel Tab { - title: base.extrudersModel.getItem(index).name + title: model.name anchors.margins: UM.Theme.getSize("default_margin").width Column From 1ac5403c21a6b55f372f19329328ef618ecf03fb Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 15:52:26 +0100 Subject: [PATCH 03/31] Remove extruder tabs from tabView CURA-6036 --- .../MachineSettingsAction/MachineSettingsAction.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index a9900070a8..60dd31dcae 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -348,6 +348,17 @@ Cura.MachineAction id: extruderTabsRepeater model: base.extrudersModel + + onItemAdded: + { + settingsTabs.addTab(index + 1, item) + } + + onItemRemoved: + { + settingsTabs.removeTab(index + 1) + } + Tab { title: model.name From 7cf1df74354022c5cceba84ae8ab304ad0d16b1e Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 16:19:21 +0100 Subject: [PATCH 04/31] Remove back Cura.ExtrudersModel{}, because if retrieve the model from backend the tabs cannot be removed after model update. The QML bug CURA-6036 --- .../MachineSettingsAction.qml | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 60dd31dcae..ef8fda224a 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -13,10 +13,22 @@ import Cura 1.0 as Cura Cura.MachineAction { id: base - property var extrudersModel: CuraApplication.getExtrudersModel() + property var extrudersModel: Cura.ExtrudersModel{} // Do not retrieve the Model from a backend. Otherwise the tabs + // in tabView will not removed/updated. Probably QML bug + property int extruderTabsCount: 0 property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" + Connections + { + target: base.extrudersModel + onModelChanged: + { + var extruderCount = base.extrudersModel.count; + base.extruderTabsCount = extruderCount; + } + } + Connections { target: dialog ? dialog : null @@ -346,22 +358,11 @@ Cura.MachineAction Repeater { id: extruderTabsRepeater - model: base.extrudersModel - - - onItemAdded: - { - settingsTabs.addTab(index + 1, item) - } - - onItemRemoved: - { - settingsTabs.removeTab(index + 1) - } + model: base.extruderTabsCount Tab { - title: model.name + title: base.extrudersModel.getItem(index).name anchors.margins: UM.Theme.getSize("default_margin").width Column From f1c28498a67aa73f93ada591bfdcb01c7ec14e59 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 11:00:00 +0100 Subject: [PATCH 05/31] Display 0 if there are no measurements for minimum values Don't display max float then. --- plugins/SimulationView/SimulationView.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 6a0ffc1666..ae01b7cdb0 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -342,12 +342,16 @@ class SimulationView(CuraView): return self._extruder_count def getMinFeedrate(self) -> float: + if abs(self._min_feedrate - sys.float_info.max) < 10: # Some lenience due to floating point rounding. + return 0.0 # If it's still max-float, there are no measurements. Use 0 then. return self._min_feedrate def getMaxFeedrate(self) -> float: return self._max_feedrate def getMinThickness(self) -> float: + if abs(self._min_thickness - sys.float_info.max) < 10: # Some lenience due to floating point rounding. + return 0.0 # If it's still max-float, there are no measurements. Use 0 then. return self._min_thickness def getMaxThickness(self) -> float: From 142ac56d78e2bcb91eff8fffb0341be736d3461f Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 19 Dec 2018 11:26:38 +0100 Subject: [PATCH 06/31] Add keyboard navigation for printer carousel --- .../UM3NetworkPrinting/resources/qml/MonitorCarousel.qml | 4 ++++ .../UM3NetworkPrinting/resources/qml/MonitorStage.qml | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml index a3e2517b45..eccd93c578 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml @@ -18,6 +18,10 @@ Item height: centerSection.height width: maximumWidth + + // Enable keyboard navigation + Keys.onLeftPressed: navigateTo(currentIndex - 1) + Keys.onRightPressed: navigateTo(currentIndex + 1) Item { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index b80c6a3661..8b1a11cb4d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -24,6 +24,11 @@ Component } } width: maximumWidth + + // Enable keyboard navigation. NOTE: This is done here so that we can also potentially + // forward to the queue items in the future. (Deleting selected print job, etc.) + Keys.forwardTo: carousel + Component.onCompleted: forceActiveFocus() UM.I18nCatalog { @@ -59,7 +64,9 @@ Component } width: parent.width height: 264 * screenScaleFactor // TODO: Theme! - MonitorCarousel {} + MonitorCarousel { + id: carousel + } } MonitorQueue From 56d0a52faccb3cc0cd5ecd8701b342a530395ed3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 11:51:46 +0100 Subject: [PATCH 07/31] Documentation and code style --- plugins/SimulationView/SimulationViewMenuComponent.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index eec254c0dd..fe32fe9eb1 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -358,7 +358,7 @@ Cura.ExpandableComponent width: parent.width height: UM.Theme.getSize("layerview_row").height - Label + Label //Minimum value. { text: { @@ -383,9 +383,10 @@ Cura.ExpandableComponent renderType: Text.NativeRendering } - Label + Label //Unit in the middle. { - text: { + text: + { if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) { // Feedrate selected @@ -407,7 +408,7 @@ Cura.ExpandableComponent font: UM.Theme.getFont("default") } - Label + Label //Maximum value. { text: { if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) From 9acaf9abd772643de75a51d4a8c47878c8ee2079 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 19 Dec 2018 13:30:25 +0100 Subject: [PATCH 08/31] Disable dropping of files into cura when monitor stage is active. CURA-6038 --- plugins/MonitorStage/MonitorMain.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 8f113735ee..34cf4ad801 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -16,12 +16,20 @@ Item color: UM.Theme.getColor("viewport_overlay") anchors.fill: parent + + // This mouse area is to prevent mouse clicks to be passed onto the scene. MouseArea { anchors.fill: parent acceptedButtons: Qt.AllButtons onWheel: wheel.accepted = true } + + // Disable dropping files into Cura when the monitor page is active + DropArea + { + anchors.fill: parent + } } Loader From 9e867f8077e95bec3fe15567983813433e42e5ef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 19 Dec 2018 13:53:34 +0100 Subject: [PATCH 09/31] Fix the codestyle and cleanup the QML a bit CURA-6043 --- .../PostProcessingPlugin.qml | 103 +++++++++++------- 1 file changed, 63 insertions(+), 40 deletions(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index b962f4d53b..5862259be5 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -25,7 +25,7 @@ UM.Dialog { if(!visible) //Whenever the window is closed (either via the "Close" button or the X on the window frame), we want to update it in the stack. { - manager.writeScriptsToStack(); + manager.writeScriptsToStack() } } @@ -67,12 +67,17 @@ UM.Dialog ListView { id: activeScriptsList - anchors.top: activeScriptsHeader.bottom - anchors.topMargin: base.textMargin - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - anchors.rightMargin: base.textMargin + + anchors + { + top: activeScriptsHeader.bottom + left: parent.left + right: parent.right + rightMargin: base.textMargin + topMargin: base.textMargin + leftMargin: UM.Theme.getSize("default_margin").width + } + height: childrenRect.height model: manager.scriptList delegate: Item @@ -84,8 +89,12 @@ UM.Dialog id: activeScriptButton text: manager.getScriptLabelByKey(modelData.toString()) exclusiveGroup: selectedScriptGroup + width: parent.width + height: UM.Theme.getSize("setting").height checkable: true - checked: { + + checked: + { if (manager.selectedScriptIndex == index) { base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) @@ -102,8 +111,7 @@ UM.Dialog manager.setSelectedScriptIndex(index) base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) } - width: parent.width - height: UM.Theme.getSize("setting").height + style: ButtonStyle { background: Rectangle @@ -121,6 +129,7 @@ UM.Dialog } } } + Button { id: removeButton @@ -249,8 +258,8 @@ UM.Dialog onTriggered: manager.addScriptToList(modelData.toString()) } - onObjectAdded: scriptsMenu.insertItem(index, object); - onObjectRemoved: scriptsMenu.removeItem(object); + onObjectAdded: scriptsMenu.insertItem(index, object) + onObjectRemoved: scriptsMenu.removeItem(object) } } } @@ -268,12 +277,16 @@ UM.Dialog { id: scriptSpecsHeader text: manager.selectedScriptIndex == -1 ? catalog.i18nc("@label", "Settings") : base.activeScriptName - anchors.top: parent.top - anchors.topMargin: base.textMargin - anchors.left: parent.left - anchors.leftMargin: base.textMargin - anchors.right: parent.right - anchors.rightMargin: base.textMargin + anchors + { + top: parent.top + topMargin: base.textMargin + left: parent.left + leftMargin: base.textMargin + right: parent.right + rightMargin: base.textMargin + } + elide: Text.ElideRight height: 20 * screenScaleFactor font: UM.Theme.getFont("large") @@ -283,11 +296,15 @@ UM.Dialog ScrollView { id: scrollView - anchors.top: scriptSpecsHeader.bottom - anchors.topMargin: settingsPanel.textMargin - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom + anchors + { + top: scriptSpecsHeader.bottom + topMargin: settingsPanel.textMargin + left: parent.left + right: parent.right + bottom: parent.bottom + } + visible: manager.selectedScriptDefinitionId != "" style: UM.Theme.styles.scrollview; @@ -297,7 +314,7 @@ UM.Dialog spacing: UM.Theme.getSize("default_lining").height model: UM.SettingDefinitionsModel { - id: definitionsModel; + id: definitionsModel containerId: manager.selectedScriptDefinitionId showAll: true } @@ -327,8 +344,10 @@ UM.Dialog } Behavior on height { NumberAnimation { duration: 100 } } opacity: provider.properties.enabled == "True" ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } enabled: opacity > 0 + property var definition: model property var settingDefinitionsModel: definitionsModel property var propertyProvider: provider @@ -339,7 +358,8 @@ UM.Dialog //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. asynchronous: model.type != "enum" && model.type != "extruder" - onLoaded: { + onLoaded: + { settingLoader.item.showRevertButton = false settingLoader.item.showInheritButton = false settingLoader.item.showLinkedSettingIcon = false @@ -395,18 +415,14 @@ UM.Dialog onShowTooltip: { - tooltip.text = text; - var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0); - tooltip.show(position); + tooltip.text = text + var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0) + tooltip.show(position) tooltip.target.x = position.x + 1 } - onHideTooltip: - { - tooltip.hide(); - } + onHideTooltip: tooltip.hide() } - } } } @@ -459,6 +475,7 @@ UM.Dialog Cura.SettingUnknown { } } } + rightButtons: Button { text: catalog.i18nc("@action:button", "Close") @@ -466,7 +483,8 @@ UM.Dialog onClicked: dialog.accept() } - Button { + Button + { objectName: "postProcessingSaveAreaButton" visible: activeScriptsList.count > 0 height: UM.Theme.getSize("save_button_save_to_button").height @@ -474,8 +492,10 @@ UM.Dialog tooltip: catalog.i18nc("@info:tooltip", "Change active post-processing scripts") onClicked: dialog.show() - style: ButtonStyle { - background: Rectangle { + style: ButtonStyle + { + background: Rectangle + { id: deviceSelectionIcon border.width: UM.Theme.getSize("default_lining").width border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : @@ -485,12 +505,15 @@ UM.Dialog control.pressed ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") Behavior on color { ColorAnimation { duration: 50; } } + anchors.left: parent.left - anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2); + anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2) + width: parent.height height: parent.height - UM.RecolorImage { + UM.RecolorImage + { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 2) @@ -498,11 +521,11 @@ UM.Dialog sourceSize.height: height color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : control.pressed ? UM.Theme.getColor("action_button_active_text") : - control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text"); + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text") source: "postprocessing.svg" } } - label: Label{ } + label: Label { } } } } \ No newline at end of file From a5134001e98934576969eb1815b228ed92f885f9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 13:03:59 +0100 Subject: [PATCH 10/31] Sort unique printer types So that they appear in a consistent order everywhere. --- cura/PrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 3102d73bb0..aeeb0381b2 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -230,7 +230,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Returns the unique configurations of the printers within this output device @pyqtProperty("QStringList", notify = uniqueConfigurationsChanged) def uniquePrinterTypes(self) -> List[str]: - return list(set([configuration.printerType for configuration in self._unique_configurations])) + return list(sorted(set([configuration.printerType for configuration in self._unique_configurations]))) def _onPrintersChanged(self) -> None: for printer in self._printers: From c0835f3a2fa8541de9b74fe715882e5e2993076f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 13:04:37 +0100 Subject: [PATCH 11/31] Code style Just something I boyscouted while working on something else. --- resources/qml/Menus/NetworkPrinterMenu.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml index 07a22202e4..166e45f3b9 100644 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ b/resources/qml/Menus/NetworkPrinterMenu.qml @@ -7,11 +7,14 @@ import QtQuick.Controls 1.4 import UM 1.2 as UM import Cura 1.0 as Cura -Instantiator { - model: UM.ContainerStacksModel { +Instantiator +{ + model: UM.ContainerStacksModel + { filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} } - MenuItem { + MenuItem + { // TODO: Use printer_group icon when it's a cluster. Not use it for now since it doesn't look as expected // iconSource: UM.Theme.getIcon("printer_single") text: model.metadata["connect_group_name"] From f2719ef582093f857e171678052507409f8958c0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 19 Dec 2018 14:09:07 +0100 Subject: [PATCH 12/31] Fix identation for postProcessing plugin settings CURA-6043 --- .../PostProcessingPlugin/PostProcessingPlugin.qml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 5862259be5..09fda8d454 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -301,6 +301,7 @@ UM.Dialog top: scriptSpecsHeader.bottom topMargin: settingsPanel.textMargin left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width right: parent.right bottom: parent.bottom } @@ -318,7 +319,8 @@ UM.Dialog containerId: manager.selectedScriptDefinitionId showAll: true } - delegate:Loader + + delegate: Loader { id: settingLoader @@ -329,18 +331,17 @@ UM.Dialog { if(model.type != undefined) { - return UM.Theme.getSize("section").height; + return UM.Theme.getSize("section").height } else { - return 0; + return 0 } } else { - return 0; + return 0 } - } Behavior on height { NumberAnimation { duration: 100 } } opacity: provider.properties.enabled == "True" ? 1 : 0 @@ -363,7 +364,7 @@ UM.Dialog settingLoader.item.showRevertButton = false settingLoader.item.showInheritButton = false settingLoader.item.showLinkedSettingIcon = false - settingLoader.item.doDepthIndentation = true + settingLoader.item.doDepthIndentation = false settingLoader.item.doQualityUserSettingEmphasis = false } From 3953c7bb3a4400f7e49fe3ee53052e317b341f62 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 19 Dec 2018 14:24:02 +0100 Subject: [PATCH 13/31] Added Tooltip alignment CURA-6004 --- resources/qml/ActionButton.qml | 2 ++ .../qml/ActionPanel/OutputProcessWidget.qml | 2 ++ resources/qml/ToolTip.qml | 29 +++++++++++++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 675cbb588e..9ceade6a57 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -31,6 +31,8 @@ Button property alias shadowColor: shadow.color property alias shadowEnabled: shadow.visible + property alias toolTipContentAlignment: tooltip.contentAlignment + // 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. diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index eb6dc5b417..03fa00d504 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -123,6 +123,8 @@ Column tooltip: text fixedWidthMode: true + toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignLeft + onClicked: UM.Controller.setActiveStage("PreviewStage") visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage" diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml index ed71d3983b..5e7d436d70 100644 --- a/resources/qml/ToolTip.qml +++ b/resources/qml/ToolTip.qml @@ -5,14 +5,26 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 import UM 1.0 as UM +import Cura 1.0 as Cura ToolTip { + + enum ContentAlignment + { + AlignLeft, + AlignRight + } + // This property indicates when the tooltip has to show, for instance when a button is hovered property bool show: false + // Defines the alignment of the content, by default to the left + property int contentAlignment: Cura.ToolTip.ContentAlignment.AlignRight + property alias tooltipText: tooltip.text - property var targetPoint: Qt.point(0, 0) + property var targetPoint: Qt.point(parent.x, y + Math.round(height/2)) + id: tooltip text: "" @@ -20,13 +32,24 @@ ToolTip visible: text != "" && show font: UM.Theme.getFont("default") + x: + { + if (contentAlignment == Cura.ToolTip.ContentAlignment.AlignLeft) + { + return (label.width + Math.round(UM.Theme.getSize("default_arrow").width * 1.2) + padding * 2) * -1 + } + return parent.width + Math.round(UM.Theme.getSize("default_arrow").width * 1.2 + padding) + } + + y: Math.round(parent.height / 2 - label.height / 2 ) - padding + + padding: 2 + background: UM.PointingRectangle { id: backgroundRect color: UM.Theme.getColor("tooltip") - target: Qt.point(targetPoint.x - tooltip.x, targetPoint.y - tooltip.y) - arrowSize: UM.Theme.getSize("default_arrow").width } From d891d30ab8df3b528902102b12dba6de7298eacc Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 19 Dec 2018 15:51:32 +0100 Subject: [PATCH 14/31] The Cura logo in left top corner is not displayed properly. CURA-6044 --- 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 eecf2a1e73..971b275bd8 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -29,6 +29,8 @@ Item source: UM.Theme.getImage("logo") width: UM.Theme.getSize("logo").width height: UM.Theme.getSize("logo").height + + mipmap: true } Row From 8bff0d17e8b2b15e67d5da8f02bda41ea0fe3576 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 09:43:01 +0100 Subject: [PATCH 15/31] Prevent the backend attempting to reslice everytime a preference changed --- plugins/CuraEngineBackend/CuraEngineBackend.py | 1 + resources/qml/ActionPanel/SliceProcessWidget.qml | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 7ede6b6736..1830a30b30 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -229,6 +229,7 @@ class CuraEngineBackend(QObject, Backend): if not self._build_plates_to_be_sliced: self.processingProgress.emit(1.0) Logger.log("w", "Slice unnecessary, nothing has changed that needs reslicing.") + self.setState(BackendState.Done) return if self._process_layers_job: diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 3756d0d452..b80c24e7b7 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -134,10 +134,14 @@ Column onPreferenceChanged: { var autoSlice = UM.Preferences.getValue("general/auto_slice") - prepareButtons.autoSlice = autoSlice - if(autoSlice) + print(prepareButtons.autoSlice, autoSlice) + if(prepareButtons.autoSlice != autoSlice) { - CuraApplication.backend.forceSlice() + prepareButtons.autoSlice = autoSlice + if(autoSlice) + { + CuraApplication.backend.forceSlice() + } } } } From a9f4b70b5cf35be3b8dec8f99178a73d12ebd571 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 20 Dec 2018 09:53:58 +0100 Subject: [PATCH 16/31] Emit 'number of extruders changed' signal after add machine. [CURA-6045] --- cura/Settings/MachineManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index cd8ca09447..2185bbce9d 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -299,6 +299,7 @@ class MachineManager(QObject): self.activeMaterialChanged.emit() self.rootMaterialChanged.emit() + self.numberExtrudersEnabledChanged.emit() def _onContainersChanged(self, container: ContainerInterface) -> None: self._instance_container_timer.start() From dc473dc78d63c15a62dfd5a197162f43b0780b8f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 11:09:02 +0100 Subject: [PATCH 17/31] Add missing typing for setting visibility preset model --- .../Models/SettingVisibilityPresetsModel.py | 35 +++++++++++++------ .../qml/ActionPanel/SliceProcessWidget.qml | 1 - 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/cura/Machines/Models/SettingVisibilityPresetsModel.py b/cura/Machines/Models/SettingVisibilityPresetsModel.py index 79131521f2..baa8e3ed29 100644 --- a/cura/Machines/Models/SettingVisibilityPresetsModel.py +++ b/cura/Machines/Models/SettingVisibilityPresetsModel.py @@ -6,6 +6,7 @@ from typing import Optional, List from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject from UM.Logger import Logger +from UM.Preferences import Preferences from UM.Resources import Resources from UM.i18n import i18nCatalog @@ -18,14 +19,20 @@ class SettingVisibilityPresetsModel(QObject): onItemsChanged = pyqtSignal() activePresetChanged = pyqtSignal() - def __init__(self, preferences, parent = None): + def __init__(self, preferences: Preferences, parent = None) -> None: super().__init__(parent) self._items = [] # type: List[SettingVisibilityPreset] + self._custom_preset = SettingVisibilityPreset(preset_id = "custom", name = "Custom selection", weight = -100) + self._populate() basic_item = self.getVisibilityPresetById("basic") - basic_visibile_settings = ";".join(basic_item.settings) + if basic_item is not None: + basic_visibile_settings = ";".join(basic_item.settings) + else: + Logger.log("w", "Unable to find the basic visiblity preset.") + basic_visibile_settings = "" self._preferences = preferences @@ -42,7 +49,8 @@ class SettingVisibilityPresetsModel(QObject): visible_settings = self._preferences.getValue("general/visible_settings") if not visible_settings: - self._preferences.setValue("general/visible_settings", ";".join(self._active_preset_item.settings)) + new_visible_settings = self._active_preset_item.settings if self._active_preset_item is not None else [] + self._preferences.setValue("general/visible_settings", ";".join(new_visible_settings)) else: self._onPreferencesChanged("general/visible_settings") @@ -59,9 +67,7 @@ class SettingVisibilityPresetsModel(QObject): def _populate(self) -> None: from cura.CuraApplication import CuraApplication items = [] # type: List[SettingVisibilityPreset] - - custom_preset = SettingVisibilityPreset(preset_id="custom", name ="Custom selection", weight = -100) - items.append(custom_preset) + items.append(self._custom_preset) for file_path in Resources.getAllResourcesOfType(CuraApplication.ResourceTypes.SettingVisibilityPreset): setting_visibility_preset = SettingVisibilityPreset() try: @@ -77,7 +83,7 @@ class SettingVisibilityPresetsModel(QObject): self.setItems(items) @pyqtProperty("QVariantList", notify = onItemsChanged) - def items(self): + def items(self) -> List[SettingVisibilityPreset]: return self._items def setItems(self, items: List[SettingVisibilityPreset]) -> None: @@ -87,7 +93,7 @@ class SettingVisibilityPresetsModel(QObject): @pyqtSlot(str) def setActivePreset(self, preset_id: str) -> None: - if preset_id == self._active_preset_item.presetId: + if self._active_preset_item is not None and preset_id == self._active_preset_item.presetId: Logger.log("d", "Same setting visibility preset [%s] selected, do nothing.", preset_id) return @@ -96,7 +102,7 @@ class SettingVisibilityPresetsModel(QObject): Logger.log("w", "Tried to set active preset to unknown id [%s]", preset_id) return - need_to_save_to_custom = self._active_preset_item.presetId == "custom" and preset_id != "custom" + need_to_save_to_custom = self._active_preset_item is None or (self._active_preset_item.presetId == "custom" and preset_id != "custom") if need_to_save_to_custom: # Save the current visibility settings to custom current_visibility_string = self._preferences.getValue("general/visible_settings") @@ -117,7 +123,9 @@ class SettingVisibilityPresetsModel(QObject): @pyqtProperty(str, notify = activePresetChanged) def activePreset(self) -> str: - return self._active_preset_item.presetId + if self._active_preset_item is not None: + return self._active_preset_item.presetId + return "" def _onPreferencesChanged(self, name: str) -> None: if name != "general/visible_settings": @@ -149,7 +157,12 @@ class SettingVisibilityPresetsModel(QObject): else: item_to_set = matching_preset_item + # If we didn't find a matching preset, fallback to custom. + if item_to_set is None: + item_to_set = self._custom_preset + if self._active_preset_item is None or self._active_preset_item.presetId != item_to_set.presetId: self._active_preset_item = item_to_set - self._preferences.setValue("cura/active_setting_visibility_preset", self._active_preset_item.presetId) + if self._active_preset_item is not None: + self._preferences.setValue("cura/active_setting_visibility_preset", self._active_preset_item.presetId) self.activePresetChanged.emit() diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index b80c24e7b7..462d685fd4 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -134,7 +134,6 @@ Column onPreferenceChanged: { var autoSlice = UM.Preferences.getValue("general/auto_slice") - print(prepareButtons.autoSlice, autoSlice) if(prepareButtons.autoSlice != autoSlice) { prepareButtons.autoSlice = autoSlice From 36efa171c68dd7b0beb5771b1f29be1680127a99 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 11:31:01 +0100 Subject: [PATCH 18/31] Add a bit more logging to the authorization service --- cura/OAuth2/AuthorizationService.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index 4355891139..a055254891 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -83,9 +83,11 @@ class AuthorizationService: if not self.getUserProfile(): # We check if we can get the user profile. # If we can't get it, that means the access token (JWT) was invalid or expired. + Logger.log("w", "Unable to get the user profile.") return None if self._auth_data is None: + Logger.log("d", "No auth data to retrieve the access_token from") return None return self._auth_data.access_token From 9ffc03925469aaaebceebd7d7931ab377e2f5d95 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 14:01:12 +0100 Subject: [PATCH 19/31] Fix logo aliasing CURA-6044 --- plugins/VersionUpgrade/VersionUpgrade32to33/__init__.py | 2 +- resources/qml/MainWindow/MainWindowHeader.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade32to33/__init__.py b/plugins/VersionUpgrade/VersionUpgrade32to33/__init__.py index 006b21bc48..b55ea5ebaf 100644 --- a/plugins/VersionUpgrade/VersionUpgrade32to33/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade32to33/__init__.py @@ -47,7 +47,7 @@ def getMetaData() -> Dict[str, Any]: }, "user": { "get_version": upgrade.getCfgVersion, - "location": {"./user"} + "location": {"./user", "./materials/*"} }, "variant": { "get_version": upgrade.getCfgVersion, diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 971b275bd8..e3b7e199fa 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -30,7 +30,8 @@ Item width: UM.Theme.getSize("logo").width height: UM.Theme.getSize("logo").height - mipmap: true + sourceSize.width: width + sourceSize.height: height } Row From f3a0b44d5ebfb7a69d54cf1610a50eeec0285941 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 20 Dec 2018 14:24:00 +0100 Subject: [PATCH 20/31] Simplify is_favorite condition No stupid ternary operators necessary. Contributes to issue CURA-6032. --- resources/qml/Preferences/Materials/MaterialsSlot.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index fb3cb9607d..7c891dc65f 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -15,7 +15,7 @@ Rectangle id: materialSlot property var material: null property var hovered: false - property var is_favorite: material != null ? material.is_favorite : false + property var is_favorite: material != null && material.is_favorite height: UM.Theme.getSize("favorites_row").height width: parent.width From 5bf260f5247f1367d0bf100514d596f4b8d4cfee Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 20 Dec 2018 14:25:52 +0100 Subject: [PATCH 21/31] Don't break binding of is_favorite upon clicking star We shouldn't override it here because doing that causes the binding to break. Just remove the favourite and let the model update itself, thus removing the star. Contributes to issue CURA-6032. --- resources/qml/Preferences/Materials/MaterialsSlot.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index 7c891dc65f..2f4847103b 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -73,11 +73,9 @@ Rectangle if (materialSlot.is_favorite) { base.materialManager.removeFavorite(material.root_material_id) - materialSlot.is_favorite = false return } base.materialManager.addFavorite(material.root_material_id) - materialSlot.is_favorite = true return } style: ButtonStyle From 3f599bd06f817ad39aaeb9d50b6939760e5505ea Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 16:31:57 +0100 Subject: [PATCH 22/31] Ensure that the tooltip text is translated CURA-6004 --- 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 ab5e224c90..79c0186443 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -109,7 +109,7 @@ Column fixedWidthMode: true anchors.fill: parent text: catalog.i18nc("@button", "Slice") - tooltip: "Start slicing process" + tooltip: catalog.i18nc("@label", "Start the slicing process") enabled: widget.backendState != UM.Backend.Error visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error onClicked: sliceOrStopSlicing() From 0965d909c09bdc27acb6c04084f35a7d5fac6ed5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 16:41:26 +0100 Subject: [PATCH 23/31] Remove the show property from the tooltip This was a bit of a weird setup, so i removed it. This way the tooltip can be used in the same way as the regular tooltip (by simply setting the visibility) CURA-6004 --- resources/qml/ActionButton.qml | 2 +- resources/qml/ToolTip.qml | 11 ++++------- resources/qml/ToolbarButton.qml | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 9ceade6a57..6cab04e5ec 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -115,6 +115,6 @@ Button Cura.ToolTip { id: tooltip - show: button.hovered + visible: button.hovered } } \ No newline at end of file diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml index 5e7d436d70..87586f76d8 100644 --- a/resources/qml/ToolTip.qml +++ b/resources/qml/ToolTip.qml @@ -9,28 +9,25 @@ import Cura 1.0 as Cura ToolTip { - enum ContentAlignment { AlignLeft, AlignRight } - // This property indicates when the tooltip has to show, for instance when a button is hovered - property bool show: false - // Defines the alignment of the content, by default to the left property int contentAlignment: Cura.ToolTip.ContentAlignment.AlignRight property alias tooltipText: tooltip.text property var targetPoint: Qt.point(parent.x, y + Math.round(height/2)) - id: tooltip text: "" delay: 500 - visible: text != "" && show font: UM.Theme.getFont("default") + + // If the text is not set, just set the height to 0 to prevent it from showing + height: text != "" ? label.contentHeight + 2 * UM.Theme.getSize("thin_margin").width: 0 x: { @@ -43,7 +40,7 @@ ToolTip y: Math.round(parent.height / 2 - label.height / 2 ) - padding - padding: 2 + padding: UM.Theme.getSize("thin_margin").width background: UM.PointingRectangle { diff --git a/resources/qml/ToolbarButton.qml b/resources/qml/ToolbarButton.qml index 307d49302c..b3f84bba1d 100644 --- a/resources/qml/ToolbarButton.qml +++ b/resources/qml/ToolbarButton.qml @@ -101,6 +101,6 @@ Button { id: tooltip tooltipText: base.text - show: base.hovered + visible: base.hovered } } From 75fbdf2c94a5e0f004dbecaba71447cb491a87e0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 10:40:37 +0100 Subject: [PATCH 24/31] Expand error message for cases when extruders are disabled It is also unable to slice models that are on extruders that are disabled. --- plugins/CuraEngineBackend/CuraEngineBackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 1830a30b30..cf00035e3b 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -411,7 +411,7 @@ class CuraEngineBackend(QObject, Backend): if job.getResult() == StartJobResult.NothingToSlice: if self._application.platformActivity: - 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."), + self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume or are assigned to a disabled extruder. Please scale or rotate models to fit, or enable an extruder."), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.setState(BackendState.Error) From 81e356ea1b3ce7e19b0ec211f337e75038369d53 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 11:20:09 +0100 Subject: [PATCH 25/31] Switch out the containersModel for the more specific printersModel --- resources/qml/Menus/LocalPrinterMenu.qml | 20 +++++++++++--------- resources/qml/Menus/NetworkPrinterMenu.qml | 14 +++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/resources/qml/Menus/LocalPrinterMenu.qml b/resources/qml/Menus/LocalPrinterMenu.qml index 0bdd4f33b9..e7c5037814 100644 --- a/resources/qml/Menus/LocalPrinterMenu.qml +++ b/resources/qml/Menus/LocalPrinterMenu.qml @@ -7,16 +7,18 @@ import QtQuick.Controls 1.4 import UM 1.2 as UM import Cura 1.0 as Cura -Instantiator { - model: UM.ContainerStacksModel { - filter: {"type": "machine", "um_network_key": null} - } - MenuItem { - text: model.name; - checkable: true; +Instantiator +{ + model: Cura.PrintersModel {} + + MenuItem + { + text: model.name + checkable: true checked: Cura.MachineManager.activeMachineId == model.id - exclusiveGroup: group; - onTriggered: Cura.MachineManager.setActiveMachine(model.id); + exclusiveGroup: group + visible: !model.hasRemoteConnection + onTriggered: Cura.MachineManager.setActiveMachine(model.id) } onObjectAdded: menu.insertItem(index, object) onObjectRemoved: menu.removeItem(object) diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml index 166e45f3b9..8c607bc5ae 100644 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ b/resources/qml/Menus/NetworkPrinterMenu.qml @@ -9,19 +9,15 @@ import Cura 1.0 as Cura Instantiator { - model: UM.ContainerStacksModel - { - filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} - } + model: Cura.PrintersModel {} MenuItem { - // TODO: Use printer_group icon when it's a cluster. Not use it for now since it doesn't look as expected -// iconSource: UM.Theme.getIcon("printer_single") text: model.metadata["connect_group_name"] - checkable: true; + checkable: true + visible: model.hasRemoteConnection checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] - exclusiveGroup: group; - onTriggered: Cura.MachineManager.setActiveMachine(model.id); + exclusiveGroup: group + onTriggered: Cura.MachineManager.setActiveMachine(model.id) } onObjectAdded: menu.insertItem(index, object) onObjectRemoved: menu.removeItem(object) From a5500b028f9d5f43688822d1ba8427868baeb833 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 11:50:30 +0100 Subject: [PATCH 26/31] Use HTTPS for Help links The Ultimaker website doesn't even accept anything else any more. --- cura/CuraActions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 49f7e740a9..ebb1523f13 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -36,12 +36,12 @@ class CuraActions(QObject): # Starting a web browser from a signal handler connected to a menu will crash on windows. # So instead, defer the call to the next run of the event loop, since that does work. # Note that weirdly enough, only signal handlers that open a web browser fail like that. - event = CallFunctionEvent(self._openUrl, [QUrl("http://ultimaker.com/en/support/software")], {}) + event = CallFunctionEvent(self._openUrl, [QUrl("https://ultimaker.com/en/support/software")], {}) cura.CuraApplication.CuraApplication.getInstance().functionEvent(event) @pyqtSlot() def openBugReportPage(self) -> None: - event = CallFunctionEvent(self._openUrl, [QUrl("http://github.com/Ultimaker/Cura/issues")], {}) + event = CallFunctionEvent(self._openUrl, [QUrl("https://github.com/Ultimaker/Cura/issues")], {}) cura.CuraApplication.CuraApplication.getInstance().functionEvent(event) ## Reset camera position and direction to default From 7269065cca3bcd16bb4689095d2d6e54dbe80544 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 11:54:11 +0100 Subject: [PATCH 27/31] Only clear the stored optimized layer data if the slice started --- plugins/CuraEngineBackend/CuraEngineBackend.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index cf00035e3b..f12a5b1222 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -86,8 +86,8 @@ class CuraEngineBackend(QObject, Backend): self._layer_view_active = False #type: bool self._onActiveViewChanged() - self._stored_layer_data = [] #type: List[Arcus.PythonMessage] - self._stored_optimized_layer_data = {} #type: Dict[int, List[Arcus.PythonMessage]] # key is build plate number, then arrays are stored until they go to the ProcessSlicesLayersJob + self._stored_layer_data = [] # type: List[Arcus.PythonMessage] + self._stored_optimized_layer_data = {} # type: Dict[int, List[Arcus.PythonMessage]] # key is build plate number, then arrays are stored until they go to the ProcessSlicesLayersJob self._scene = self._application.getController().getScene() #type: Scene self._scene.sceneChanged.connect(self._onSceneChanged) @@ -246,7 +246,7 @@ class CuraEngineBackend(QObject, Backend): num_objects = self._numObjectsPerBuildPlate() self._stored_layer_data = [] - self._stored_optimized_layer_data[build_plate_to_be_sliced] = [] + if build_plate_to_be_sliced not in num_objects or num_objects[build_plate_to_be_sliced] == 0: self._scene.gcode_dict[build_plate_to_be_sliced] = [] #type: ignore #Because we created this attribute above. @@ -254,7 +254,7 @@ class CuraEngineBackend(QObject, Backend): if self._build_plates_to_be_sliced: self.slice() return - + self._stored_optimized_layer_data[build_plate_to_be_sliced] = [] if self._application.getPrintInformation() and build_plate_to_be_sliced == active_build_plate: self._application.getPrintInformation().setToZeroPrintInformation(build_plate_to_be_sliced) From 07f0433751ad9f97e4169c60b46ce57f6010d671 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 11:58:57 +0100 Subject: [PATCH 28/31] Correct link to manual They changed this on the website, breaking all previous releases of Cura in the process. --- cura/CuraActions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index ebb1523f13..91e0966fed 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -36,7 +36,7 @@ class CuraActions(QObject): # Starting a web browser from a signal handler connected to a menu will crash on windows. # So instead, defer the call to the next run of the event loop, since that does work. # Note that weirdly enough, only signal handlers that open a web browser fail like that. - event = CallFunctionEvent(self._openUrl, [QUrl("https://ultimaker.com/en/support/software")], {}) + event = CallFunctionEvent(self._openUrl, [QUrl("https://ultimaker.com/en/resources/manuals/software")], {}) cura.CuraApplication.CuraApplication.getInstance().functionEvent(event) @pyqtSlot() From 766fc2293e1e5e635fdf0d5b2b5fbb75071df816 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 14:35:41 +0100 Subject: [PATCH 29/31] Fix visibility for machine icon in dark theme --- resources/themes/cura-dark/theme.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 537fccbc5c..6b29073475 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -28,6 +28,7 @@ "machine_selector_bar": [39, 44, 48, 255], "machine_selector_active": [39, 44, 48, 255], + "machine_selector_printer_icon": [204, 204, 204, 255], "text": [255, 255, 255, 204], "text_detail": [255, 255, 255, 172], From f627560751761f25b75733412b91a14cd2357e1e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 17:12:07 +0100 Subject: [PATCH 30/31] Add timer to QualityProfilesDropdownMenuModel to prevent unneeded updates It's the same old trick we've pulled off quite often, so this should be pretty safe --- .../Models/QualityProfilesDropDownMenuModel.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py index 747882b041..7ccc886bfe 100644 --- a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py +++ b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QTimer from UM.Application import Application from UM.Logger import Logger @@ -39,15 +39,23 @@ class QualityProfilesDropDownMenuModel(ListModel): self._machine_manager = self._application.getMachineManager() self._quality_manager = Application.getInstance().getQualityManager() - self._application.globalContainerStackChanged.connect(self._update) - self._machine_manager.activeQualityGroupChanged.connect(self._update) - self._machine_manager.extruderChanged.connect(self._update) - self._quality_manager.qualitiesUpdated.connect(self._update) + self._application.globalContainerStackChanged.connect(self._onChange) + self._machine_manager.activeQualityGroupChanged.connect(self._onChange) + self._machine_manager.extruderChanged.connect(self._onChange) + self._quality_manager.qualitiesUpdated.connect(self._onChange) self._layer_height_unit = "" # This is cached + self._update_timer = QTimer() # type: QTimer + self._update_timer.setInterval(100) + self._update_timer.setSingleShot(True) + self._update_timer.timeout.connect(self._update) + self._update() + def _onChange(self) -> None: + self._update_timer.start() + def _update(self): Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__)) From abe684c1bda37bb1ca7c7f82dd07b6720a5d22c1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 27 Dec 2018 13:08:25 +0100 Subject: [PATCH 31/31] Use Item instead of rectangle without defined colour Item should be faster to render. Contributes to issue CURA-6056. --- resources/qml/Preferences/Materials/MaterialsBrandSection.qml | 2 +- resources/qml/Preferences/Materials/MaterialsTypeSection.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index c40693e343..c976233805 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -10,7 +10,7 @@ import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura -Rectangle +Item { id: brand_section diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index f98c19e0b3..8f34217cce 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -10,7 +10,7 @@ import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura -Rectangle +Item { id: material_type_section property var materialType