From 5be8b2810dbcde6274513f71abaadf9e792b5fa6 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 22 Nov 2018 22:10:54 +0100 Subject: [PATCH 001/120] Fix: if load a model and scale it up to 0.1mm and then load another model then Cura will crash. It happens because the model 1 does not have any points for arranging it on the build plate CURA-5867 --- cura/Arranging/Arrange.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cura/Arranging/Arrange.py b/cura/Arranging/Arrange.py index 5657ee991a..32796005c8 100644 --- a/cura/Arranging/Arrange.py +++ b/cura/Arranging/Arrange.py @@ -66,6 +66,11 @@ class Arrange: continue vertices = vertices.getMinkowskiHull(Polygon.approximatedCircle(min_offset)) points = copy.deepcopy(vertices._points) + + # After scaling (like up to 0.1 mm) the node might not have points + if len(points) == 0: + continue + shape_arr = ShapeArray.fromPolygon(points, scale = scale) arranger.place(0, 0, shape_arr) From 2bf641efcfef28bbdae869ab3bfb6d8d4f70d8de Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 10 Dec 2018 09:09:58 +0100 Subject: [PATCH 002/120] 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 77ede1ae6bbd6c1a53b6682640fb754f186eee42 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 12 Dec 2018 17:50:21 +0100 Subject: [PATCH 003/120] Unify the fonts to only have 8 instead of 13. Contributes to CURA-6025. --- .../PostProcessingPlugin.qml | 4 +- .../resources/qml/ToolboxAuthorPage.qml | 2 +- .../resources/qml/ToolboxDetailPage.qml | 2 +- .../resources/qml/DiscoverUM3Action.qml | 2 +- .../resources/qml/MonitorPrinterCard.qml | 6 +-- .../resources/qml/MonitorStage.qml | 2 +- resources/qml/Account/AccountDetails.qml | 2 +- resources/qml/ActionButton.qml | 2 +- resources/qml/Dialogs/AboutDialog.qml | 2 +- resources/qml/ExtruderIcon.qml | 2 +- .../ConfigurationMenu/AutoConfiguration.qml | 2 +- .../ConfigurationMenu/CustomConfiguration.qml | 2 +- resources/qml/MonitorButton.qml | 4 +- resources/qml/Preferences/MachinesPage.qml | 2 +- .../Materials/MaterialsDetailsPanel.qml | 2 +- resources/qml/Preferences/ProfilesPage.qml | 2 +- resources/qml/PrinterOutput/ExtruderBox.qml | 4 +- resources/qml/PrinterOutput/HeatedBedBox.qml | 4 +- .../qml/PrinterOutput/MonitorSection.qml | 2 +- .../qml/PrinterOutput/OutputDeviceHeader.qml | 2 +- .../PrinterSelector/MachineSelectorButton.qml | 2 +- resources/qml/Settings/SettingCategory.qml | 2 +- resources/qml/ViewsSelector.qml | 2 +- resources/themes/cura-light/styles.qml | 6 +-- resources/themes/cura-light/theme.json | 38 +++++-------------- 25 files changed, 41 insertions(+), 61 deletions(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index b962f4d53b..580bb8c878 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -61,7 +61,7 @@ UM.Dialog anchors.leftMargin: base.textMargin anchors.right: parent.right anchors.rightMargin: base.textMargin - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") elide: Text.ElideRight } ListView @@ -276,7 +276,7 @@ UM.Dialog anchors.rightMargin: base.textMargin elide: Text.ElideRight height: 20 * screenScaleFactor - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") } diff --git a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml index 7b026566c3..b653f1a73b 100644 --- a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml @@ -55,7 +55,7 @@ Item bottomMargin: UM.Theme.getSize("default_margin").height } text: details.name || "" - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") wrapMode: Text.WordWrap width: parent.width height: UM.Theme.getSize("toolbox_property_label").height diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index 7983be8aef..fa91fa4884 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -60,7 +60,7 @@ Item bottomMargin: UM.Theme.getSize("default_margin").height } text: details === null ? "" : (details.name || "") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") wrapMode: Text.WordWrap width: parent.width diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index e5f668c70d..65fe859772 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -223,7 +223,7 @@ Cura.MachineAction width: parent.width wrapMode: Text.WordWrap text: base.selectedDevice ? base.selectedDevice.name : "" - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") elide: Text.ElideRight renderType: Text.NativeRendering } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 1676c51edf..67a8af727a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -76,7 +76,7 @@ Item text: printer && printer.name ? printer.name : "" color: "#414054" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("large") // 16pt, bold + font: UM.Theme.getFont("large_bold") // 16pt, bold width: parent.width // FIXED-LINE-HEIGHT: @@ -178,7 +178,7 @@ Item verticalCenter: parent.verticalCenter } color: "#414054" // TODO: Theme! - font: UM.Theme.getFont("large") // 16pt, bold + font: UM.Theme.getFont("large_bold") // 16pt, bold text: { if (printer && printer.state == "disabled") { @@ -229,7 +229,7 @@ Item id: printerJobNameLabel color: printer.activePrintJob && printer.activePrintJob.isActive ? "#414054" : "#babac1" // TODO: Theme! elide: Text.ElideRight - font: UM.Theme.getFont("large") // 16pt, bold + font: UM.Theme.getFont("large_bold") // 16pt, bold text: base.printer.activePrintJob ? base.printer.activePrintJob.name : "Untitled" // TODO: I18N width: parent.width diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 4d59e0eb6b..0008295301 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -97,7 +97,7 @@ Component top: parent.top } color: UM.Theme.getColor("text") - font: UM.Theme.getFont("large_nonbold") + font: UM.Theme.getFont("large") text: catalog.i18nc("@label", "Queued") } diff --git a/resources/qml/Account/AccountDetails.qml b/resources/qml/Account/AccountDetails.qml index bfb23930c6..45f822e41f 100644 --- a/resources/qml/Account/AccountDetails.qml +++ b/resources/qml/Account/AccountDetails.qml @@ -44,7 +44,7 @@ Column 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") + font: loggedIn ? UM.Theme.getFont("large_bold") : UM.Theme.getFont("default") color: UM.Theme.getColor("text") } diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 7177120f35..c3d39e8251 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -62,7 +62,7 @@ Button id: buttonText text: button.text color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") visible: text != "" renderType: Text.NativeRendering anchors.verticalCenter: parent.verticalCenter diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index add84614e0..ac115a0e5f 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -51,7 +51,7 @@ UM.Dialog id: version text: catalog.i18nc("@label","version: %1").arg(UM.Application.version) - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") anchors.right : logo.right anchors.top: logo.bottom diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index bb0b347b7e..0ab9df308e 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -48,7 +48,7 @@ Item id: extruderNumberText anchors.centerIn: parent text: index + 1 - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("small") width: contentWidth height: contentHeight visible: extruderEnabled diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index 68c56c7c4b..af229e4cc0 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -16,7 +16,7 @@ Item { id: header text: catalog.i18nc("@header", "Configurations") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") height: contentHeight renderType: Text.NativeRendering diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 8429e2c093..8f38edfe5b 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -23,7 +23,7 @@ Item { id: header text: catalog.i18nc("@header", "Custom") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") height: contentHeight renderType: Text.NativeRendering diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index fd7d2287c4..99640b1059 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -168,7 +168,7 @@ Item anchors.leftMargin: UM.Theme.getSize("thick_margin").width color: base.statusColor - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") text: statusText } @@ -179,7 +179,7 @@ Item anchors.right: progressBar.right color: base.statusColor - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") text: Math.round(progress) + "%" visible: showProgress } diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index bc75b9bc72..de65579cd3 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -70,7 +70,7 @@ UM.ManagementPage { id: machineName text: base.currentItem && base.currentItem.name ? base.currentItem.name : "" - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") width: parent.width elide: Text.ElideRight } diff --git a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml index 92970f40e2..eb4a63250f 100644 --- a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml +++ b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml @@ -65,7 +65,7 @@ Item Label { text: materialProperties.name - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") } } diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index d7ffbb3152..70f9881b1e 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -471,7 +471,7 @@ Item Label { text: base.currentItemName - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") } } diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 247bb3a27d..a19c02b0dd 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -80,7 +80,7 @@ Item id: extruderCurrentTemperature text: Math.round(extruderModel.hotendTemperature) + "°C" color: UM.Theme.getColor("text") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") anchors.right: extruderTargetTemperature.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width @@ -326,7 +326,7 @@ Item return UM.Theme.getColor("action_button_text"); } } - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") text: { if(extruderModel == null) diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 33cf5cd1e2..77421c8aad 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -67,7 +67,7 @@ Item { id: bedCurrentTemperature text: printerModel != null ? printerModel.bedTemperature + "°C" : "" - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") anchors.right: bedTargetTemperature.left anchors.top: parent.top @@ -320,7 +320,7 @@ Item return UM.Theme.getColor("action_button_text"); } } - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") text: { if(printerModel == null) diff --git a/resources/qml/PrinterOutput/MonitorSection.qml b/resources/qml/PrinterOutput/MonitorSection.qml index 7ef89dabf7..63b4b385e5 100644 --- a/resources/qml/PrinterOutput/MonitorSection.qml +++ b/resources/qml/PrinterOutput/MonitorSection.qml @@ -27,7 +27,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width text: label - font: UM.Theme.getFont("setting_category") + font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("setting_category_text") } } diff --git a/resources/qml/PrinterOutput/OutputDeviceHeader.qml b/resources/qml/PrinterOutput/OutputDeviceHeader.qml index 16280eab5f..47f855266b 100644 --- a/resources/qml/PrinterOutput/OutputDeviceHeader.qml +++ b/resources/qml/PrinterOutput/OutputDeviceHeader.qml @@ -31,7 +31,7 @@ Item Label { id: outputDeviceNameLabel - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("text") anchors.left: parent.left anchors.top: parent.top diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index b88af35f82..39e63d27c3 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -42,7 +42,7 @@ Button } text: machineSelectorButton.text color: UM.Theme.getColor("text") - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") visible: text != "" renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 5676bcedf9..93627dcb52 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -73,7 +73,7 @@ Button text: definition.label textFormat: Text.PlainText renderType: Text.NativeRendering - font: UM.Theme.getFont("setting_category") + font: UM.Theme.getFont("medium_bold") color: { if (!base.enabled) diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index f2906f9d4c..58749c09f2 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -105,7 +105,7 @@ Cura.ExpandablePopup id: buttonText text: viewsSelectorButton.text color: UM.Theme.getColor("text") - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter elide: Text.ElideRight diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index bcc754f4ca..86f4100687 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -208,8 +208,8 @@ QtObject anchors.verticalCenter: parent.verticalCenter; text: control.text; - font: Theme.getFont("button_tooltip"); - color: Theme.getColor("tooltip_text"); + font: Theme.getFont("default") + color: Theme.getColor("tooltip_text") } } @@ -716,7 +716,7 @@ QtObject return UM.Theme.getColor("action_button_text"); } } - font: UM.Theme.getFont("action_button") + font: UM.Theme.getFont("medium") text: control.text } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 3dc216ad70..9cfae3b311 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -6,63 +6,43 @@ "fonts": { "large": { "size": 1.35, - "weight": 63, + "weight": 40, "family": "Noto Sans" }, - "large_nonbold": { + "large_bold": { "size": 1.35, - "weight": 50, + "weight": 60, "family": "Noto Sans" }, "medium": { "size": 1.16, - "weight": 50, + "weight": 40, "family": "Noto Sans" }, "medium_bold": { "size": 1.16, - "weight": 63, + "weight": 60, "family": "Noto Sans" }, "default": { "size": 1.0, - "weight": 50, + "weight": 40, "family": "Noto Sans" }, "default_bold": { "size": 1.0, - "weight": 63, + "weight": 60, "family": "Noto Sans" }, "default_italic": { "size": 1.0, - "weight": 50, + "weight": 40, "italic": true, "family": "Noto Sans" }, "small": { - "size": 0.85, - "weight": 50, - "family": "Noto Sans" - }, - "very_small": { "size": 0.7, - "weight": 50, - "family": "Noto Sans" - }, - "button_tooltip": { - "size": 1.0, - "weight": 50, - "family": "Noto Sans" - }, - "setting_category": { - "size": 1.15, - "weight": 63, - "family": "Noto Sans" - }, - "action_button": { - "size": 1.15, - "weight": 50, + "weight": 40, "family": "Noto Sans" } }, From 973970a89505fea4cb3e0f4d003c8360b2b2353e Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 12 Dec 2018 09:53:26 +0100 Subject: [PATCH 004/120] Every print ouput device should define its connection type(usb, network, cluster and etc) CURA-6011 --- .../NetworkedPrinterOutputDevice.py | 6 ++--- cura/PrinterOutputDevice.py | 19 ++++++++++++++- .../resources/qml/DiscoverUM3Action.qml | 2 +- .../src/ClusterUM3OutputDevice.py | 3 ++- .../src/DiscoverUM3Action.py | 23 ++++++++++++------- .../src/LegacyUM3OutputDevice.py | 3 ++- plugins/USBPrinting/USBPrinterOutputDevice.py | 4 ++-- .../PrinterSelector/MachineSelectorList.qml | 2 +- 8 files changed, 44 insertions(+), 18 deletions(-) diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index 9a3be936a2..c288596f0c 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -6,7 +6,7 @@ from UM.Logger import Logger from UM.Scene.SceneNode import SceneNode #For typing. from cura.CuraApplication import CuraApplication -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState +from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication @@ -28,8 +28,8 @@ class AuthState(IntEnum): class NetworkedPrinterOutputDevice(PrinterOutputDevice): authenticationStateChanged = pyqtSignal() - def __init__(self, device_id, address: str, properties: Dict[bytes, bytes], parent: QObject = None) -> None: - super().__init__(device_id = device_id, parent = parent) + def __init__(self, device_id, address: str, properties: Dict[bytes, bytes], connection_type: ConnectionType = ConnectionType.networkConnection, parent: QObject = None) -> None: + super().__init__(device_id = device_id, connection_type = connection_type, parent = parent) self._manager = None # type: Optional[QNetworkAccessManager] self._last_manager_create_time = None # type: Optional[float] self._recreate_network_manager_time = 30 diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 99c48189cc..3a72fba4e3 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -34,6 +34,12 @@ class ConnectionState(IntEnum): busy = 3 error = 4 +class ConnectionType(IntEnum): + none = 0 + usbConnection = 1 + networkConnection = 2 + clusterConnection = 3 + cloudConnection = 4 ## Printer output device adds extra interface options on top of output device. # @@ -62,7 +68,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Signal to indicate that the configuration of one of the printers has changed. uniqueConfigurationsChanged = pyqtSignal() - def __init__(self, device_id: str, parent: QObject = None) -> None: + def __init__(self, device_id: str, connection_type: ConnectionType, parent: QObject = None) -> None: super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] @@ -84,6 +90,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._update_timer.timeout.connect(self._update) self._connection_state = ConnectionState.closed #type: ConnectionState + self._connection_type = connection_type self._firmware_updater = None #type: Optional[FirmwareUpdater] self._firmware_name = None #type: Optional[str] @@ -117,6 +124,16 @@ class PrinterOutputDevice(QObject, OutputDevice): self._connection_state = connection_state self.connectionStateChanged.emit(self._id) + def checkConnectionType(self, connection_type: ConnectionType) -> bool: + return connection_type == self._connection_type + + def getConnectionType(self) -> ConnectionType: + return self._connection_type + + def setConnectionType(self, new_connection_type: ConnectionType) -> None: + if self._connection_type != new_connection_type: + self._connection_type = new_connection_type + @pyqtProperty(str, notify = connectionStateChanged) def connectionState(self) -> ConnectionState: return self._connection_state diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index e5f668c70d..2c9ab2df03 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -28,7 +28,7 @@ Cura.MachineAction // Check if there is another instance with the same key if (!manager.existsKey(printerKey)) { - manager.setKey(printerKey) + manager.setKey(base.selectedDevice) manager.setGroupName(printerName) // TODO To change when the groups have a name completed() } diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index ef890fc4ed..206654ff88 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -22,6 +22,7 @@ from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationM from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutputDevice import ConnectionType from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController from .SendMaterialJob import SendMaterialJob @@ -54,7 +55,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): clusterPrintersChanged = pyqtSignal() def __init__(self, device_id, address, properties, parent = None) -> None: - super().__init__(device_id = device_id, address = address, properties=properties, parent = parent) + super().__init__(device_id = device_id, address = address, properties=properties, connection_type = ConnectionType.clusterConnection, parent = parent) self._api_prefix = "/cluster-api/v1/" self._number_of_extruders = 2 diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index be83e04585..9cd21de036 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -3,7 +3,7 @@ import os.path import time -from typing import cast, Optional +from typing import Optional from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject @@ -13,6 +13,7 @@ from UM.i18n import i18nCatalog from cura.CuraApplication import CuraApplication from cura.MachineAction import MachineAction +from cura.PrinterOutputDevice import PrinterOutputDevice from .UM3OutputDevicePlugin import UM3OutputDevicePlugin @@ -116,22 +117,28 @@ class DiscoverUM3Action(MachineAction): # Ensure that the connection states are refreshed. self._network_plugin.reCheckConnections() - @pyqtSlot(str) - def setKey(self, key: str) -> None: - Logger.log("d", "Attempting to set the network key of the active machine to %s", key) + @pyqtSlot(QObject) + def setKey(self, printer_device: Optional[PrinterOutputDevice]) -> None: + Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() if global_container_stack: meta_data = global_container_stack.getMetaData() if "um_network_key" in meta_data: previous_network_key= meta_data["um_network_key"] - global_container_stack.setMetaDataEntry("um_network_key", key) + global_container_stack.setMetaDataEntry("um_network_key", printer_device.key) # Delete old authentication data. - Logger.log("d", "Removing old authentication id %s for device %s", global_container_stack.getMetaDataEntry("network_authentication_id", None), key) + Logger.log("d", "Removing old authentication id %s for device %s", global_container_stack.getMetaDataEntry("network_authentication_id", None), printer_device.key) global_container_stack.removeMetaDataEntry("network_authentication_id") global_container_stack.removeMetaDataEntry("network_authentication_key") - CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = key) + CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = printer_device.key) + + if "um_connection_type" in meta_data: + previous_connection_type = meta_data["um_connection_type"] + global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value) + CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value) else: - global_container_stack.setMetaDataEntry("um_network_key", key) + global_container_stack.setMetaDataEntry("um_network_key", printer_device.key) + global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value) if self._network_plugin: # Ensure that the connection states are refreshed. diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 18af22e72f..0ae9e8a004 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -7,6 +7,7 @@ from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutp from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel +from cura.PrinterOutputDevice import ConnectionType from cura.Settings.ContainerManager import ContainerManager from cura.Settings.ExtruderManager import ExtruderManager @@ -43,7 +44,7 @@ i18n_catalog = i18nCatalog("cura") # 5. As a final step, we verify the authentication, as this forces the QT manager to setup the authenticator. class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): def __init__(self, device_id, address: str, properties, parent = None) -> None: - super().__init__(device_id = device_id, address = address, properties = properties, parent = parent) + super().__init__(device_id = device_id, address = address, properties = properties, connection_type = ConnectionType.networkConnection, parent = parent) self._api_prefix = "/api/v1/" self._number_of_extruders = 2 diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 1d42e70366..a8cb240b03 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -7,7 +7,7 @@ from UM.i18n import i18nCatalog from UM.Qt.Duration import DurationFormat from cura.CuraApplication import CuraApplication -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState +from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.GenericOutputController import GenericOutputController @@ -29,7 +29,7 @@ catalog = i18nCatalog("cura") class USBPrinterOutputDevice(PrinterOutputDevice): def __init__(self, serial_port: str, baud_rate: Optional[int] = None) -> None: - super().__init__(serial_port) + super().__init__(serial_port, connection_type=ConnectionType.usbConnection) self.setName(catalog.i18nc("@item:inmenu", "USB printing")) self.setShortDescription(catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print via USB")) self.setDescription(catalog.i18nc("@info:tooltip", "Print via USB")) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 54d766a6e0..3324b9948b 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -32,7 +32,7 @@ Column id: networkedPrintersModel filter: { - "type": "machine", "um_network_key": "*", "hidden": "False" + "type": "machine", "um_network_key": "*", "hidden": "False", "um_connection_type": "[2,3,4]" } } From 6bf39a32a941dfc4ef96a3f250527c04d9060541 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 09:56:06 +0100 Subject: [PATCH 005/120] Rename Enum names to camal cases CURA-6011 --- .../NetworkedPrinterOutputDevice.py | 10 +++---- cura/PrinterOutputDevice.py | 26 ++++++++++--------- .../src/ClusterUM3OutputDevice.py | 2 +- .../src/LegacyUM3OutputDevice.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 8 +++--- .../USBPrinterOutputDeviceManager.py | 2 +- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index c288596f0c..14f1364601 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -28,7 +28,7 @@ class AuthState(IntEnum): class NetworkedPrinterOutputDevice(PrinterOutputDevice): authenticationStateChanged = pyqtSignal() - def __init__(self, device_id, address: str, properties: Dict[bytes, bytes], connection_type: ConnectionType = ConnectionType.networkConnection, parent: QObject = None) -> None: + def __init__(self, device_id, address: str, properties: Dict[bytes, bytes], connection_type: ConnectionType = ConnectionType.NetworkConnection, parent: QObject = None) -> None: super().__init__(device_id = device_id, connection_type = connection_type, parent = parent) self._manager = None # type: Optional[QNetworkAccessManager] self._last_manager_create_time = None # type: Optional[float] @@ -125,7 +125,7 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice): if self._connection_state_before_timeout is None: self._connection_state_before_timeout = self._connection_state - self.setConnectionState(ConnectionState.closed) + self.setConnectionState(ConnectionState.Closed) # We need to check if the manager needs to be re-created. If we don't, we get some issues when OSX goes to # sleep. @@ -133,7 +133,7 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice): if self._last_manager_create_time is None or time() - self._last_manager_create_time > self._recreate_network_manager_time: self._createNetworkManager() assert(self._manager is not None) - elif self._connection_state == ConnectionState.closed: + elif self._connection_state == ConnectionState.Closed: # Go out of timeout. if self._connection_state_before_timeout is not None: # sanity check, but it should never be None here self.setConnectionState(self._connection_state_before_timeout) @@ -285,8 +285,8 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice): self._last_response_time = time() - if self._connection_state == ConnectionState.connecting: - self.setConnectionState(ConnectionState.connected) + if self._connection_state == ConnectionState.Connecting: + self.setConnectionState(ConnectionState.Connected) callback_key = reply.url().toString() + str(reply.operation()) try: diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 3a72fba4e3..51be3c0465 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -28,18 +28,20 @@ i18n_catalog = i18nCatalog("cura") ## The current processing state of the backend. class ConnectionState(IntEnum): - closed = 0 - connecting = 1 - connected = 2 - busy = 3 + Closed = 0 + Connecting = 1 + Connected = 2 + Busy = 3 error = 4 + class ConnectionType(IntEnum): none = 0 - usbConnection = 1 - networkConnection = 2 - clusterConnection = 3 - cloudConnection = 4 + UsbConnection = 1 + NetworkConnection = 2 + ClusterConnection = 3 + CloudConnection = 4 + ## Printer output device adds extra interface options on top of output device. # @@ -89,7 +91,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._update_timer.setSingleShot(False) self._update_timer.timeout.connect(self._update) - self._connection_state = ConnectionState.closed #type: ConnectionState + self._connection_state = ConnectionState.Closed #type: ConnectionState self._connection_type = connection_type self._firmware_updater = None #type: Optional[FirmwareUpdater] @@ -117,7 +119,7 @@ class PrinterOutputDevice(QObject, OutputDevice): callback(QMessageBox.Yes) def isConnected(self) -> bool: - return self._connection_state != ConnectionState.closed and self._connection_state != ConnectionState.error + return self._connection_state != ConnectionState.Closed and self._connection_state != ConnectionState.error def setConnectionState(self, connection_state: ConnectionState) -> None: if self._connection_state != connection_state: @@ -191,13 +193,13 @@ class PrinterOutputDevice(QObject, OutputDevice): ## Attempt to establish connection def connect(self) -> None: - self.setConnectionState(ConnectionState.connecting) + self.setConnectionState(ConnectionState.Connecting) self._update_timer.start() ## Attempt to close the connection def close(self) -> None: self._update_timer.stop() - self.setConnectionState(ConnectionState.closed) + self.setConnectionState(ConnectionState.Closed) ## Ensure that close gets called when object is destroyed def __del__(self) -> None: diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 206654ff88..d85cbeb27b 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -55,7 +55,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): clusterPrintersChanged = pyqtSignal() def __init__(self, device_id, address, properties, parent = None) -> None: - super().__init__(device_id = device_id, address = address, properties=properties, connection_type = ConnectionType.clusterConnection, parent = parent) + super().__init__(device_id = device_id, address = address, properties=properties, connection_type = ConnectionType.ClusterConnection, parent = parent) self._api_prefix = "/cluster-api/v1/" self._number_of_extruders = 2 diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 0ae9e8a004..3ce0460d6b 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -44,7 +44,7 @@ i18n_catalog = i18nCatalog("cura") # 5. As a final step, we verify the authentication, as this forces the QT manager to setup the authenticator. class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): def __init__(self, device_id, address: str, properties, parent = None) -> None: - super().__init__(device_id = device_id, address = address, properties = properties, connection_type = ConnectionType.networkConnection, parent = parent) + super().__init__(device_id = device_id, address = address, properties = properties, connection_type = ConnectionType.NetworkConnection, parent = parent) self._api_prefix = "/api/v1/" self._number_of_extruders = 2 diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index a8cb240b03..08cf29baf4 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -29,7 +29,7 @@ catalog = i18nCatalog("cura") class USBPrinterOutputDevice(PrinterOutputDevice): def __init__(self, serial_port: str, baud_rate: Optional[int] = None) -> None: - super().__init__(serial_port, connection_type=ConnectionType.usbConnection) + super().__init__(serial_port, connection_type=ConnectionType.UsbConnection) self.setName(catalog.i18nc("@item:inmenu", "USB printing")) self.setShortDescription(catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print via USB")) self.setDescription(catalog.i18nc("@info:tooltip", "Print via USB")) @@ -179,7 +179,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): return CuraApplication.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged) self._onGlobalContainerStackChanged() - self.setConnectionState(ConnectionState.connected) + self.setConnectionState(ConnectionState.Connected) self._update_thread.start() def _onGlobalContainerStackChanged(self): @@ -208,7 +208,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._sendCommand(command) def _sendCommand(self, command: Union[str, bytes]): - if self._serial is None or self._connection_state != ConnectionState.connected: + if self._serial is None or self._connection_state != ConnectionState.Connected: return new_command = cast(bytes, command) if type(command) is bytes else cast(str, command).encode() # type: bytes @@ -222,7 +222,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._command_received.set() def _update(self): - while self._connection_state == ConnectionState.connected and self._serial is not None: + while self._connection_state == ConnectionState.Connected and self._serial is not None: try: line = self._serial.readline() except: diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index bd207d9d96..d4c0d1828e 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -66,7 +66,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin): return changed_device = self._usb_output_devices[serial_port] - if changed_device.connectionState == ConnectionState.connected: + if changed_device.connectionState == ConnectionState.Connected: self.getOutputDeviceManager().addOutputDevice(changed_device) else: self.getOutputDeviceManager().removeOutputDevice(serial_port) From 0aa49270ebb53521b3364ce5ab795b51d3e3adba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 09:57:40 +0100 Subject: [PATCH 006/120] Remove unused function checkConnectionType() CURA-6011 --- cura/PrinterOutputDevice.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 51be3c0465..dce470f442 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -126,9 +126,6 @@ class PrinterOutputDevice(QObject, OutputDevice): self._connection_state = connection_state self.connectionStateChanged.emit(self._id) - def checkConnectionType(self, connection_type: ConnectionType) -> bool: - return connection_type == self._connection_type - def getConnectionType(self) -> ConnectionType: return self._connection_type From 644944bc4171a98b9abd8ee54493d967d6732779 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 10:00:18 +0100 Subject: [PATCH 007/120] Remove unused function setConnectionType() CURA-6011 --- cura/PrinterOutputDevice.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index dce470f442..0b2f10c570 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -129,10 +129,6 @@ class PrinterOutputDevice(QObject, OutputDevice): def getConnectionType(self) -> ConnectionType: return self._connection_type - def setConnectionType(self, new_connection_type: ConnectionType) -> None: - if self._connection_type != new_connection_type: - self._connection_type = new_connection_type - @pyqtProperty(str, notify = connectionStateChanged) def connectionState(self) -> ConnectionState: return self._connection_state From 3e1993d87679c0d29f3df5cc1a14962b32ccb18a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 10:10:54 +0100 Subject: [PATCH 008/120] Rename Enum name to camal cases CURA-6011 --- cura/PrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 0b2f10c570..f6d15f5a4a 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -32,7 +32,7 @@ class ConnectionState(IntEnum): Connecting = 1 Connected = 2 Busy = 3 - error = 4 + Error = 4 class ConnectionType(IntEnum): From 8bb8ae8652d1abb7f153aa8bcd309dd183b2b262 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 10:48:23 +0100 Subject: [PATCH 009/120] Rename ConnectionType.none to ConnectionType.Unknown CURA-6011 Cannot use None --- cura/PrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index f6d15f5a4a..b664e30d0b 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -36,7 +36,7 @@ class ConnectionState(IntEnum): class ConnectionType(IntEnum): - none = 0 + Unknown = 0 UsbConnection = 1 NetworkConnection = 2 ClusterConnection = 3 From 99cee1dfe766b16b5a9b0cedf3c439ca7ded39b5 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 10:54:52 +0100 Subject: [PATCH 010/120] Use double-quotes for custom type hinting in functions CURA-6011 --- cura/PrinterOutputDevice.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index b664e30d0b..2db03a4e87 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -70,7 +70,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Signal to indicate that the configuration of one of the printers has changed. uniqueConfigurationsChanged = pyqtSignal() - def __init__(self, device_id: str, connection_type: ConnectionType, parent: QObject = None) -> None: + def __init__(self, device_id: str, connection_type: "ConnectionType", parent: QObject = None) -> None: super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] @@ -119,18 +119,18 @@ class PrinterOutputDevice(QObject, OutputDevice): callback(QMessageBox.Yes) def isConnected(self) -> bool: - return self._connection_state != ConnectionState.Closed and self._connection_state != ConnectionState.error + return self._connection_state != ConnectionState.Closed and self._connection_state != ConnectionState.Error - def setConnectionState(self, connection_state: ConnectionState) -> None: + def setConnectionState(self, connection_state: "ConnectionState") -> None: if self._connection_state != connection_state: self._connection_state = connection_state self.connectionStateChanged.emit(self._id) - def getConnectionType(self) -> ConnectionType: + def getConnectionType(self) -> "ConnectionType": return self._connection_type @pyqtProperty(str, notify = connectionStateChanged) - def connectionState(self) -> ConnectionState: + def connectionState(self) -> "ConnectionState": return self._connection_state def _update(self) -> None: From aba3b6dd8ee66ea05273e8f0ec74ae7a9c06611b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 10:55:34 +0100 Subject: [PATCH 011/120] Rename setKey() and add docs CURA-6011 --- .../resources/qml/DiscoverUM3Action.qml | 2 +- plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 2c9ab2df03..80b5c2f99e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -28,7 +28,7 @@ Cura.MachineAction // Check if there is another instance with the same key if (!manager.existsKey(printerKey)) { - manager.setKey(base.selectedDevice) + manager.associateActiveMachineWithPrinterDevice(base.selectedDevice) manager.setGroupName(printerName) // TODO To change when the groups have a name completed() } diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index 9cd21de036..2e59810317 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -3,7 +3,7 @@ import os.path import time -from typing import Optional +from typing import Optional, TYPE_CHECKING from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject @@ -13,10 +13,12 @@ from UM.i18n import i18nCatalog from cura.CuraApplication import CuraApplication from cura.MachineAction import MachineAction -from cura.PrinterOutputDevice import PrinterOutputDevice from .UM3OutputDevicePlugin import UM3OutputDevicePlugin +if TYPE_CHECKING: + from cura.PrinterOutputDevice import PrinterOutputDevice + catalog = i18nCatalog("cura") @@ -117,8 +119,10 @@ class DiscoverUM3Action(MachineAction): # Ensure that the connection states are refreshed. self._network_plugin.reCheckConnections() + # Associates the currently active machine with the given printer device. The network connection information will be + # stored into the metadata of the currently active machine. @pyqtSlot(QObject) - def setKey(self, printer_device: Optional[PrinterOutputDevice]) -> None: + def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None: Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key) global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() if global_container_stack: From 4252b956039f4875e63735944ee8d1f36d5c1cb8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 11:28:18 +0100 Subject: [PATCH 012/120] Make ConnectionType Enum type accessible to QML CURA-6011 --- cura/CuraApplication.py | 3 +++ cura/PrinterOutputDevice.py | 8 +++++++- resources/qml/PrinterSelector/MachineSelectorList.qml | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7e11fd4d59..a50d7d55c8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -113,6 +113,7 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.ObjectsModel import ObjectsModel +from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage from UM.FlameProfiler import pyqtSlot @@ -975,6 +976,8 @@ class CuraApplication(QtApplication): qmlRegisterSingletonType(ContainerManager, "Cura", 1, 0, "ContainerManager", ContainerManager.getInstance) qmlRegisterType(SidebarCustomMenuItemsModel, "Cura", 1, 0, "SidebarCustomMenuItemsModel") + qmlRegisterType(PrinterOutputDevice, "Cura", 1, 0, "PrinterOutputDevice") + from cura.API import CuraAPI qmlRegisterSingletonType(CuraAPI, "Cura", 1, 1, "API", self.getCuraAPI) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 2db03a4e87..298c690b01 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -4,7 +4,7 @@ from UM.Decorators import deprecated from UM.i18n import i18nCatalog from UM.OutputDevice.OutputDevice import OutputDevice -from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QTimer, QUrl +from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QTimer, QUrl, Q_ENUMS from PyQt5.QtWidgets import QMessageBox from UM.Logger import Logger @@ -54,6 +54,12 @@ class ConnectionType(IntEnum): # For all other uses it should be used in the same way as a "regular" OutputDevice. @signalemitter class PrinterOutputDevice(QObject, OutputDevice): + + # Put ConnectionType here with Q_ENUMS() so it can be registered as a QML type and accessible via QML, and there is + # no need to remember what those Enum integer values mean. + ConnectionType = ConnectionType + Q_ENUMS(ConnectionType) + printersChanged = pyqtSignal() connectionStateChanged = pyqtSignal(str) acceptsCommandsChanged = pyqtSignal() diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 3324b9948b..bc3fe105a2 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -30,9 +30,16 @@ Column model: UM.ContainerStacksModel { id: networkedPrintersModel + property var umConnectionTypes: [Cura.PrinterOutputDevice.NetworkConnection, + Cura.PrinterOutputDevice.ClusterConnection, + Cura.PrinterOutputDevice.CloudConnection + ] filter: { - "type": "machine", "um_network_key": "*", "hidden": "False", "um_connection_type": "[2,3,4]" + "type": "machine", + "um_network_key": "*", + "hidden": "False", + "um_connection_type": "[" + umConnectionTypes.join(",") + "]" } } From a18203b2864358dfcde1206bf51250e523e6af91 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Dec 2018 11:37:30 +0100 Subject: [PATCH 013/120] Fix typing CURA-6011 --- cura/PrinterOutputDevice.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 298c690b01..ed65d5d700 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -57,7 +57,6 @@ class PrinterOutputDevice(QObject, OutputDevice): # Put ConnectionType here with Q_ENUMS() so it can be registered as a QML type and accessible via QML, and there is # no need to remember what those Enum integer values mean. - ConnectionType = ConnectionType Q_ENUMS(ConnectionType) printersChanged = pyqtSignal() From 226d05246877a95c46c0799160cbd0015bff714c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 14 Dec 2018 17:10:58 +0100 Subject: [PATCH 014/120] Move the machines from machinelist into their own model CURA-6011 --- cura/CuraApplication.py | 2 + cura/PrintersModel.py | 65 ++++++++++++++++ .../src/UM3OutputDevicePlugin.py | 1 + .../qml/PrinterSelector/MachineSelector.qml | 6 ++ .../PrinterSelector/MachineSelectorList.qml | 76 ++++++------------- 5 files changed, 97 insertions(+), 53 deletions(-) create mode 100644 cura/PrintersModel.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a50d7d55c8..c773dae998 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -51,6 +51,7 @@ from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray from cura.MultiplyObjectsJob import MultiplyObjectsJob +from cura.PrintersModel import PrintersModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator @@ -955,6 +956,7 @@ class CuraApplication(QtApplication): qmlRegisterType(MultiBuildPlateModel, "Cura", 1, 0, "MultiBuildPlateModel") qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") + qmlRegisterType(PrintersModel, "Cura", 1, 0, "PrintersModel") qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel") qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel") diff --git a/cura/PrintersModel.py b/cura/PrintersModel.py new file mode 100644 index 0000000000..83471a2e2a --- /dev/null +++ b/cura/PrintersModel.py @@ -0,0 +1,65 @@ +# Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from UM.Qt.ListModel import ListModel + +from PyQt5.QtCore import pyqtProperty, Qt, pyqtSignal + +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.ContainerStack import ContainerStack + +from cura.PrinterOutputDevice import ConnectionType + +from cura.Settings.GlobalStack import GlobalStack + +class PrintersModel(ListModel): + NameRole = Qt.UserRole + 1 + IdRole = Qt.UserRole + 2 + HasRemoteConnectionRole = Qt.UserRole + 3 + ConnectionTypeRole = Qt.UserRole + 4 + MetaDataRole = Qt.UserRole + 5 + + def __init__(self, parent = None): + super().__init__(parent) + self.addRoleName(self.NameRole, "name") + self.addRoleName(self.IdRole, "id") + self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") + self.addRoleName(self.ConnectionTypeRole, "connectionType") + self.addRoleName(self.MetaDataRole, "metadata") + self._container_stacks = [] + + # Listen to changes + ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged) + ContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged) + ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged) + self._filter_dict = {} + self._update() + + ## Handler for container added/removed events from registry + def _onContainerChanged(self, container): + # We only need to update when the added / removed container GlobalStack + if isinstance(container, GlobalStack): + self._update() + + ## Handler for container name change events. + def _onContainerNameChanged(self): + self._update() + + def _update(self) -> None: + items = [] + for container in self._container_stacks: + container.nameChanged.disconnect(self._onContainerNameChanged) + + container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") + + for container_stack in container_stacks: + connection_type = container_stack.getMetaDataEntry("connection_type") + has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection), str(ConnectionType.ClusterConnection)] + + # TODO: Remove reference to connect group name. + items.append({"name": container_stack.getMetaDataEntry("connect_group_name", container_stack.getName()), + "id": container_stack.getId(), + "hasRemoteConnection": has_remote_connection, + "connectionType": connection_type}) + items.sort(key=lambda i: not i["hasRemoteConnection"]) + self.setItems(items) \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index b96c508d70..43290c8e44 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -283,6 +283,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack and device.getId() == global_container_stack.getMetaDataEntry("um_network_key"): + global_container_stack.setMetaDataEntry("connection_type", str(device.getConnectionType())) device.connect() device.connectionStateChanged.connect(self._onDeviceConnectionStateChanged) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 7cda4f1d2e..6e120e89c7 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -123,6 +123,12 @@ Cura.ExpandablePopup scroll.height = Math.min(height, maximumHeight) popup.height = scroll.height + buttonRow.height } + Component.onCompleted: + { + scroll.height = Math.min(height, maximumHeight) + popup.height = scroll.height + buttonRow.height + } + } } diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index bc3fe105a2..b157f9a4f6 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -7,46 +7,48 @@ import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura -Column +ListView { - id: machineSelectorList + id: listView + height: childrenRect.height + width: 200 + model: Cura.PrintersModel {} + section.property: "hasRemoteConnection" - Label + section.delegate: Label { - text: catalog.i18nc("@label", "Connected printers") - visible: networkedPrintersModel.items.length > 0 + text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") + width: parent.width 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 } + delegate: MachineSelectorButton + { + text: model.name + width: listView.width + } +} + /* + + + Repeater { id: networkedPrinters - model: UM.ContainerStacksModel + model: Cura.PrintersModel { id: networkedPrintersModel - property var umConnectionTypes: [Cura.PrinterOutputDevice.NetworkConnection, - Cura.PrinterOutputDevice.ClusterConnection, - Cura.PrinterOutputDevice.CloudConnection - ] - filter: - { - "type": "machine", - "um_network_key": "*", - "hidden": "False", - "um_connection_type": "[" + umConnectionTypes.join(",") + "]" - } } delegate: MachineSelectorButton { - text: model.metadata["connect_group_name"] - checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + text: model.name //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 @@ -55,37 +57,5 @@ Column 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 b8a4d8e80d39c81dbb2670e3236709a3ad4df4ba Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 14 Dec 2018 17:14:56 +0100 Subject: [PATCH 015/120] Remove the cluster connection type CURA-6011 --- cura/PrinterOutputDevice.py | 3 +-- cura/PrintersModel.py | 2 +- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index ed65d5d700..b33993f150 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -39,8 +39,7 @@ class ConnectionType(IntEnum): Unknown = 0 UsbConnection = 1 NetworkConnection = 2 - ClusterConnection = 3 - CloudConnection = 4 + CloudConnection = 3 ## Printer output device adds extra interface options on top of output device. diff --git a/cura/PrintersModel.py b/cura/PrintersModel.py index 83471a2e2a..26b65409c5 100644 --- a/cura/PrintersModel.py +++ b/cura/PrintersModel.py @@ -54,7 +54,7 @@ class PrintersModel(ListModel): for container_stack in container_stacks: connection_type = container_stack.getMetaDataEntry("connection_type") - has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection), str(ConnectionType.ClusterConnection)] + has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)] # TODO: Remove reference to connect group name. items.append({"name": container_stack.getMetaDataEntry("connect_group_name", container_stack.getName()), diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index d85cbeb27b..bebccc54e3 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -55,7 +55,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): clusterPrintersChanged = pyqtSignal() def __init__(self, device_id, address, properties, parent = None) -> None: - super().__init__(device_id = device_id, address = address, properties=properties, connection_type = ConnectionType.ClusterConnection, parent = parent) + super().__init__(device_id = device_id, address = address, properties=properties, connection_type = ConnectionType.NetworkConnection, parent = parent) self._api_prefix = "/cluster-api/v1/" self._number_of_extruders = 2 From 938287095f3c2705b97df881feba30924733f291 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 Dec 2018 10:47:14 +0100 Subject: [PATCH 016/120] Use connection type instead of um_network_key to see if a printer has a network connection CURA-6011 --- cura/Settings/MachineManager.py | 9 ++++++++- .../qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 2 +- resources/qml/MonitorSidebar.qml | 4 ++-- resources/qml/PrinterSelector/MachineSelector.qml | 2 +- resources/qml/PrinterSelector/MachineSelectorList.qml | 1 + 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index c375ce01d1..342f53aac6 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -23,7 +23,7 @@ from UM.Settings.SettingFunction import SettingFunction from UM.Signal import postponeSignals, CompressTechnique from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch -from cura.PrinterOutputDevice import PrinterOutputDevice +from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel @@ -521,6 +521,13 @@ class MachineManager(QObject): def printerConnected(self): return bool(self._printer_output_devices) + @pyqtProperty(bool, notify=printerConnectedStatusChanged) + def activeMachineHasRemoteConnection(self) -> bool: + if self._global_container_stack: + connection_type = self._global_container_stack.getMetaDataEntry("connection_type") + return connection_type in [ConnectionType.NetworkConnection, ConnectionType.CloudConnection] + return False + @pyqtProperty(str, notify = printerConnectedStatusChanged) def activeMachineNetworkKey(self) -> str: if self._global_container_stack: diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 33a317b42b..8e9c276c0d 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -134,7 +134,7 @@ Cura.ExpandablePopup 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. + is_connected = Cura.MachineManager.activeMachineHasRemoteConnection && 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. diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index 669bdbfb8f..70ee60377d 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -21,7 +21,7 @@ Rectangle property bool hideView: Cura.MachineManager.activeMachineName == "" // Is there an output device for this printer? - property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection 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 @@ -205,7 +205,7 @@ Rectangle target: Cura.MachineManager onGlobalContainerChanged: { - base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != "" + base.isNetworkPrinter = Cura.MachineManager.activeMachineHasRemoteConnection base.printerConnected = Cura.MachineManager.printerOutputDevices.length != 0 } } diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 6e120e89c7..8a7b87f409 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -11,7 +11,7 @@ Cura.ExpandablePopup { id: machineSelector - property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection property bool isPrinterConnected: Cura.MachineManager.printerConnected property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index b157f9a4f6..e0dc6f5e44 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -30,6 +30,7 @@ ListView { text: model.name width: listView.width + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null } } /* From ee74b9f89f04f8bfaaf71ab852a2abea8b9be250 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 Dec 2018 13:09:01 +0100 Subject: [PATCH 017/120] Once the connectiontype is recovered, it's converted to a string So we need to check if that's the case. CURA-6011 --- cura/Settings/MachineManager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 342f53aac6..db43207cc9 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -525,10 +525,9 @@ class MachineManager(QObject): def activeMachineHasRemoteConnection(self) -> bool: if self._global_container_stack: connection_type = self._global_container_stack.getMetaDataEntry("connection_type") - return connection_type in [ConnectionType.NetworkConnection, ConnectionType.CloudConnection] + return connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)] return False - @pyqtProperty(str, notify = printerConnectedStatusChanged) def activeMachineNetworkKey(self) -> str: if self._global_container_stack: return self._global_container_stack.getMetaDataEntry("um_network_key", "") @@ -756,7 +755,7 @@ class MachineManager(QObject): self.setActiveMachine(other_machine_stacks[0]["id"]) metadata = CuraContainerRegistry.getInstance().findContainerStacksMetadata(id = machine_id)[0] - network_key = metadata["um_network_key"] if "um_network_key" in metadata else None + network_key = metadata.get("um_network_key", None) ExtruderManager.getInstance().removeMachineExtruders(machine_id) containers = CuraContainerRegistry.getInstance().findInstanceContainersMetadata(type = "user", machine = machine_id) for container in containers: From aad7540366e6b7b71619574f77961499493fd4f8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 Dec 2018 13:31:38 +0100 Subject: [PATCH 018/120] Fix situation where multiple connect configurations would cause issues CURA-6011 --- cura/PrintersModel.py | 6 +++- cura/Settings/MachineManager.py | 11 ++++--- .../PrinterSelector/MachineSelectorList.qml | 32 +++++-------------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/cura/PrintersModel.py b/cura/PrintersModel.py index 26b65409c5..0c58d9bf8c 100644 --- a/cura/PrintersModel.py +++ b/cura/PrintersModel.py @@ -56,10 +56,14 @@ class PrintersModel(ListModel): connection_type = container_stack.getMetaDataEntry("connection_type") has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)] + if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: + continue + # TODO: Remove reference to connect group name. items.append({"name": container_stack.getMetaDataEntry("connect_group_name", container_stack.getName()), "id": container_stack.getId(), "hasRemoteConnection": has_remote_connection, - "connectionType": connection_type}) + "connectionType": connection_type, + "metadata": container_stack.getMetaData().copy()}) items.sort(key=lambda i: not i["hasRemoteConnection"]) self.setItems(items) \ No newline at end of file diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index db43207cc9..c51c26f1b9 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1321,17 +1321,18 @@ class MachineManager(QObject): # Get the definition id corresponding to this machine name machine_definition_id = CuraContainerRegistry.getInstance().findDefinitionContainers(name = machine_name)[0].getId() # Try to find a machine with the same network key - new_machine = self.getMachine(machine_definition_id, metadata_filter = {"um_network_key": self.activeMachineNetworkKey}) + new_machine = self.getMachine(machine_definition_id, metadata_filter = {"um_network_key": self.activeMachineNetworkKey()}) # If there is no machine, then create a new one and set it to the non-hidden instance if not new_machine: new_machine = CuraStackBuilder.createMachine(machine_definition_id + "_sync", machine_definition_id) if not new_machine: return - new_machine.setMetaDataEntry("um_network_key", self.activeMachineNetworkKey) + new_machine.setMetaDataEntry("um_network_key", self.activeMachineNetworkKey()) new_machine.setMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName) new_machine.setMetaDataEntry("hidden", False) + new_machine.setMetaDataEntry("connection_type", self._global_container_stack.getMetaDataEntry("connection_type")) else: - Logger.log("i", "Found a %s with the key %s. Let's use it!", machine_name, self.activeMachineNetworkKey) + Logger.log("i", "Found a %s with the key %s. Let's use it!", machine_name, self.activeMachineNetworkKey()) new_machine.setMetaDataEntry("hidden", False) # Set the current printer instance to hidden (the metadata entry must exist) @@ -1391,10 +1392,10 @@ class MachineManager(QObject): # After updating from 3.2 to 3.3 some group names may be temporary. If there is a mismatch in the name of the group # then all the container stacks are updated, both the current and the hidden ones. def checkCorrectGroupName(self, device_id: str, group_name: str) -> None: - if self._global_container_stack and device_id == self.activeMachineNetworkKey: + if self._global_container_stack and device_id == self.activeMachineNetworkKey(): # Check if the connect_group_name is correct. If not, update all the containers connected to the same printer if self.activeMachineNetworkGroupName != group_name: - metadata_filter = {"um_network_key": self.activeMachineNetworkKey} + metadata_filter = {"um_network_key": self.activeMachineNetworkKey()} containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter) for container in containers: container.setMetaDataEntry("connect_group_name", group_name) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index e0dc6f5e44..52cea0ea80 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -31,32 +31,16 @@ ListView text: model.name width: listView.width outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - } -} - /* - - - Repeater - { - id: networkedPrinters - - model: Cura.PrintersModel + checked: { - id: networkedPrintersModel - } - - delegate: MachineSelectorButton - { - text: model.name //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 + // If the machine has a remote connection + var result = Cura.MachineManager.activeMachineId == model.id + if (Cura.MachineManager.activeMachineHasRemoteConnection) { - target: Cura.MachineManager - onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] } + return result } - }*/ - + } +} \ No newline at end of file From 4d135c13bb8dc5f6971d07eb6682962433826b55 Mon Sep 17 00:00:00 2001 From: alekseisasin Date: Mon, 17 Dec 2018 16:46:02 +0100 Subject: [PATCH 019/120] Cura used wrong firmware version for UMO+. The firmware was from UMO. The reason of this issue because it used a heated firmware from his parent(UMO) printer. To avoid this case we need to define externally the firmware_hbk_file property in umo+ defintion file CURA-5994 --- resources/definitions/ultimaker_original_plus.def.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/definitions/ultimaker_original_plus.def.json b/resources/definitions/ultimaker_original_plus.def.json index 5ad7ae66e8..bdb8a3d788 100644 --- a/resources/definitions/ultimaker_original_plus.def.json +++ b/resources/definitions/ultimaker_original_plus.def.json @@ -16,7 +16,8 @@ { "0": "ultimaker_original_plus_extruder_0" }, - "firmware_file": "MarlinUltimaker-UMOP-{baudrate}.hex" + "firmware_file": "MarlinUltimaker-UMOP-{baudrate}.hex", + "firmware_hbk_file": "MarlinUltimaker-UMOP-{baudrate}.hex" }, "overrides": { From 7d6e698f431c24126d0521b408bd2dafb79788ec Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 17 Dec 2018 17:37:21 +0100 Subject: [PATCH 020/120] Fix (USB) print monitor in dark theme --- plugins/USBPrinting/MonitorItem.qml | 2 ++ resources/qml/PrintMonitor.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/USBPrinting/MonitorItem.qml b/plugins/USBPrinting/MonitorItem.qml index 8041698ef0..c86353f814 100644 --- a/plugins/USBPrinting/MonitorItem.qml +++ b/plugins/USBPrinting/MonitorItem.qml @@ -13,6 +13,8 @@ Component { Rectangle { + color: UM.Theme.getColor("main_background") + anchors.right: parent.right width: parent.width * 0.3 anchors.top: parent.top diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 6d8edf0deb..d44acf0adb 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -12,7 +12,7 @@ import Cura 1.0 as Cura import "PrinterOutput" -Rectangle +Item { id: base UM.I18nCatalog { id: catalog; name: "cura"} From 6017c2b4d2cd52110856e3cb835638a40458a6b6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Dec 2018 08:55:55 +0100 Subject: [PATCH 021/120] Replace isProfileUserCreated with hasCustomQuality CURA-6028 --- cura/Settings/MachineManager.py | 4 +++ cura/Settings/SimpleModeSettingsManager.py | 32 ------------------- .../RecommendedQualityProfileSelector.qml | 23 ++++--------- 3 files changed, 10 insertions(+), 49 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index e26b82e487..5e0bbea1ee 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1529,6 +1529,10 @@ class MachineManager(QObject): def activeQualityChangesGroup(self) -> Optional["QualityChangesGroup"]: return self._current_quality_changes_group + @pyqtProperty(bool, notify = activeQualityChangesGroupChanged) + def hasCustomQuality(self) -> bool: + return self._current_quality_changes_group is not None + @pyqtProperty(str, notify = activeQualityGroupChanged) def activeQualityOrQualityChangesName(self) -> str: name = empty_quality_container.getName() diff --git a/cura/Settings/SimpleModeSettingsManager.py b/cura/Settings/SimpleModeSettingsManager.py index b22aea15ea..b1896a9205 100644 --- a/cura/Settings/SimpleModeSettingsManager.py +++ b/cura/Settings/SimpleModeSettingsManager.py @@ -17,15 +17,11 @@ class SimpleModeSettingsManager(QObject): self._is_profile_user_created = False # True when profile was custom created by user self._machine_manager.activeStackValueChanged.connect(self._updateIsProfileCustomized) - self._machine_manager.activeQualityGroupChanged.connect(self.updateIsProfileUserCreated) - self._machine_manager.activeQualityChangesGroupChanged.connect(self.updateIsProfileUserCreated) # update on create as the activeQualityChanged signal is emitted before this manager is created when Cura starts self._updateIsProfileCustomized() - self.updateIsProfileUserCreated() isProfileCustomizedChanged = pyqtSignal() - isProfileUserCreatedChanged = pyqtSignal() @pyqtProperty(bool, notify = isProfileCustomizedChanged) def isProfileCustomized(self): @@ -58,34 +54,6 @@ class SimpleModeSettingsManager(QObject): self._is_profile_customized = has_customized_user_settings self.isProfileCustomizedChanged.emit() - @pyqtProperty(bool, notify = isProfileUserCreatedChanged) - def isProfileUserCreated(self): - return self._is_profile_user_created - - @pyqtSlot() - def updateIsProfileUserCreated(self) -> None: - quality_changes_keys = set() # type: Set[str] - - if not self._machine_manager.activeMachine: - return - - global_stack = self._machine_manager.activeMachine - - # check quality changes settings in the global stack - quality_changes_keys.update(global_stack.qualityChanges.getAllKeys()) - - # check quality changes settings in the extruder stacks - if global_stack.extruders: - for extruder_stack in global_stack.extruders.values(): - quality_changes_keys.update(extruder_stack.qualityChanges.getAllKeys()) - - # check if the qualityChanges container is not empty (meaning it is a user created profile) - has_quality_changes = len(quality_changes_keys) > 0 - - if has_quality_changes != self._is_profile_user_created: - self._is_profile_user_created = has_quality_changes - self.isProfileUserCreatedChanged.emit() - # These are the settings included in the Simple ("Recommended") Mode, so only when the other settings have been # changed, we consider it as a user customized profile in the Simple ("Recommended") Mode. __ignored_custom_setting_keys = ["support_enable", diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index e6b3f1b9eb..1e71134404 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -39,17 +39,6 @@ Item { target: Cura.QualityProfilesDropDownMenuModel onItemsChanged: qualityModel.update() - onDataChanged: - { - // If a custom profile is selected and then a user decides to change any of setting the slider should show - // the reset button. After clicking the reset button the QualityProfilesDropDownMenuModel(ListModel) is - // updated before the property isProfileCustomized is called to update. - if (Cura.SimpleModeSettingsManager.isProfileCustomized) - { - Cura.SimpleModeSettingsManager.updateIsProfileUserCreated() - } - qualityModel.update() - } } Connections { @@ -97,7 +86,7 @@ Item 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) + if (Cura.MachineManager.hasCustomQuality) { qualityModel.qualitySliderActiveIndex = -1 } @@ -192,7 +181,7 @@ Item { id: customisedSettings - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated + visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality height: visible ? UM.Theme.getSize("print_setup_icon").height : 0 width: height anchors @@ -358,7 +347,7 @@ Item { anchors.fill: parent hoverEnabled: true - enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated + enabled: !Cura.MachineManager.hasCustomQuality onEntered: { 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") @@ -417,7 +406,7 @@ Item 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 + visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.MachineManager.hasCustomQuality && qualityModel.existingQualityProfile } } @@ -441,7 +430,7 @@ Item anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.NoButton - enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated + enabled: !Cura.MachineManager.hasCustomQuality } } @@ -451,7 +440,7 @@ Item { anchors.fill: parent hoverEnabled: true - visible: Cura.SimpleModeSettingsManager.isProfileUserCreated + visible: Cura.MachineManager.hasCustomQuality onEntered: { From 9f52a52ea3ee9e497c8b7dc220a9077ad7c64c59 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Dec 2018 09:32:11 +0100 Subject: [PATCH 022/120] 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 84a7f2e5a2d1ec96f74ffb15b9b08f053af44198 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 Dec 2018 09:40:08 +0100 Subject: [PATCH 023/120] Fix review comments CURA-6011 --- cura/PrintersModel.py | 2 +- cura/Settings/MachineManager.py | 4 ++-- plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py | 10 +++++----- .../UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cura/PrintersModel.py b/cura/PrintersModel.py index 0c58d9bf8c..8b5d2f6cc9 100644 --- a/cura/PrintersModel.py +++ b/cura/PrintersModel.py @@ -54,7 +54,7 @@ class PrintersModel(ListModel): for container_stack in container_stacks: connection_type = container_stack.getMetaDataEntry("connection_type") - has_remote_connection = connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)] + has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index c51c26f1b9..e1ae0d761c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -521,11 +521,11 @@ class MachineManager(QObject): def printerConnected(self): return bool(self._printer_output_devices) - @pyqtProperty(bool, notify=printerConnectedStatusChanged) + @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineHasRemoteConnection(self) -> bool: if self._global_container_stack: connection_type = self._global_container_stack.getMetaDataEntry("connection_type") - return connection_type in [str(ConnectionType.NetworkConnection), str(ConnectionType.CloudConnection)] + return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] return False def activeMachineNetworkKey(self) -> str: diff --git a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index 2e59810317..6ce99e4891 100644 --- a/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -136,13 +136,13 @@ class DiscoverUM3Action(MachineAction): global_container_stack.removeMetaDataEntry("network_authentication_key") CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = printer_device.key) - if "um_connection_type" in meta_data: - previous_connection_type = meta_data["um_connection_type"] - global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value) - CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value) + if "connection_type" in meta_data: + previous_connection_type = meta_data["connection_type"] + global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value) + CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value) else: global_container_stack.setMetaDataEntry("um_network_key", printer_device.key) - global_container_stack.setMetaDataEntry("um_connection_type", printer_device.getConnectionType().value) + global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value) if self._network_plugin: # Ensure that the connection states are refreshed. diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 43290c8e44..80212fcf00 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -283,7 +283,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack and device.getId() == global_container_stack.getMetaDataEntry("um_network_key"): - global_container_stack.setMetaDataEntry("connection_type", str(device.getConnectionType())) + global_container_stack.setMetaDataEntry("connection_type", device.getConnectionType().value) device.connect() device.connectionStateChanged.connect(self._onDeviceConnectionStateChanged) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 08cf29baf4..19a703e605 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -29,7 +29,7 @@ catalog = i18nCatalog("cura") class USBPrinterOutputDevice(PrinterOutputDevice): def __init__(self, serial_port: str, baud_rate: Optional[int] = None) -> None: - super().__init__(serial_port, connection_type=ConnectionType.UsbConnection) + super().__init__(serial_port, connection_type = ConnectionType.UsbConnection) self.setName(catalog.i18nc("@item:inmenu", "USB printing")) self.setShortDescription(catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print via USB")) self.setDescription(catalog.i18nc("@info:tooltip", "Print via USB")) From aa0c8c75ee40373b1b2faac4055b72b06164d3ee Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 Dec 2018 09:45:26 +0100 Subject: [PATCH 024/120] Add a sane default to connection type CURA-6011 --- cura/PrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index b33993f150..3102d73bb0 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -74,7 +74,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Signal to indicate that the configuration of one of the printers has changed. uniqueConfigurationsChanged = pyqtSignal() - def __init__(self, device_id: str, connection_type: "ConnectionType", parent: QObject = None) -> None: + def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.Unknown, parent: QObject = None) -> None: super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] From be9d35d45f63d5a3c6896abcfca1a74165ec0f1b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 Dec 2018 09:47:51 +0100 Subject: [PATCH 025/120] Fix some minor layout issues CURA-6011 --- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 52cea0ea80..ea8068fa95 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -11,7 +11,6 @@ ListView { id: listView height: childrenRect.height - width: 200 model: Cura.PrintersModel {} section.property: "hasRemoteConnection" @@ -19,6 +18,7 @@ ListView { text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") width: parent.width + height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 leftPadding: UM.Theme.getSize("default_margin").width renderType: Text.NativeRendering font: UM.Theme.getFont("medium") From cc462ef3a609be1df9ee0fb9d94ce4a541db2183 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 18 Dec 2018 10:29:44 +0100 Subject: [PATCH 026/120] Add a placeholder for a pattern in the header, if the theme wants to add one. --- resources/qml/Cura.qml | 11 + .../cura-light/images/header_pattern.svg | 1901 ----------------- 2 files changed, 11 insertions(+), 1901 deletions(-) delete mode 100644 resources/themes/cura-light/images/header_pattern.svg diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 8ab943b93b..8a34c7e219 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -123,6 +123,17 @@ UM.MainWindow } } } + + // This is a placehoder for adding a pattern in the header + Image + { + id: backgroundPattern + anchors.fill: parent + fillMode: Image.Tile + source: UM.Theme.getImage("header_pattern") + horizontalAlignment: Image.AlignLeft + verticalAlignment: Image.AlignTop + } } MainWindowHeader diff --git a/resources/themes/cura-light/images/header_pattern.svg b/resources/themes/cura-light/images/header_pattern.svg deleted file mode 100644 index eff5f01cfa..0000000000 --- a/resources/themes/cura-light/images/header_pattern.svg +++ /dev/null @@ -1,1901 +0,0 @@ - - - - Desktop HD - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From dff9a3dfb24301d27e6ef53365bd4786d9d926a9 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Dec 2018 10:52:11 +0100 Subject: [PATCH 027/120] Fix None problem in project loading --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 9ee2ef0dd4..55296979b5 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -794,7 +794,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # Clear all existing containers quality_changes_info.global_info.container.clear() for container_info in quality_changes_info.extruder_info_dict.values(): - container_info.container.clear() + if container_info.container: + container_info.container.clear() # Loop over everything and override the existing containers global_info = quality_changes_info.global_info From 9b6e52a5be95471b96baa4fe53f674c719f37b00 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 18 Dec 2018 13:08:18 +0100 Subject: [PATCH 028/120] Make monitor item background themable --- plugins/USBPrinting/MonitorItem.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/USBPrinting/MonitorItem.qml b/plugins/USBPrinting/MonitorItem.qml index 8041698ef0..14b1402e50 100644 --- a/plugins/USBPrinting/MonitorItem.qml +++ b/plugins/USBPrinting/MonitorItem.qml @@ -17,6 +17,7 @@ Component width: parent.width * 0.3 anchors.top: parent.top anchors.bottom: parent.bottom + color: UM.Theme.getColor("main_background") Cura.PrintMonitor { From 627c647fbcca9555807770fa640fa69b47c9877c Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 18 Dec 2018 13:17:25 +0100 Subject: [PATCH 029/120] Center navigation dots Contributes to CL-1151 --- .../resources/qml/MonitorCarousel.qml | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml index 476e3c2aa1..a3e2517b45 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml @@ -211,7 +211,7 @@ Item } } - Item + Row { id: navigationDots anchors @@ -220,23 +220,20 @@ Item top: centerSection.bottom topMargin: 36 * screenScaleFactor // TODO: Theme! } - Row + spacing: 8 * screenScaleFactor // TODO: Theme! + Repeater { - spacing: 8 * screenScaleFactor // TODO: Theme! - Repeater + model: OutputDevice.printers + Button { - model: OutputDevice.printers - Button + background: Rectangle { - background: Rectangle - { - color: model.index == currentIndex ? "#777777" : "#d8d8d8" // TODO: Theme! - radius: Math.floor(width / 2) - width: 12 * screenScaleFactor // TODO: Theme! - height: width // TODO: Theme! - } - onClicked: navigateTo(model.index) + color: model.index == currentIndex ? "#777777" : "#d8d8d8" // TODO: Theme! + radius: Math.floor(width / 2) + width: 12 * screenScaleFactor // TODO: Theme! + height: width // TODO: Theme! } + onClicked: navigateTo(model.index) } } } From 279812e4ff356170463dbf0e693e86689a063945 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 13:55:12 +0100 Subject: [PATCH 030/120] Round width of buttons They were getting rendered a bit weird if your pixel scale was not an integer (for me it's 1.25). --- resources/qml/Preferences/MachinesPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index bc75b9bc72..4acefdb493 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.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.7 @@ -91,7 +91,7 @@ UM.ManagementPage Item { - width: childrenRect.width + 2 * screenScaleFactor + width: Math.round(childrenRect.width + 2 * screenScaleFactor) height: childrenRect.height Button { From 1ac5403c21a6b55f372f19329328ef618ecf03fb Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 15:52:26 +0100 Subject: [PATCH 031/120] 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 1b11164340d93ee6f955a6b710dd2dbe3865489a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:09:19 +0100 Subject: [PATCH 032/120] Remove unused import and add documentation --- cura/Machines/Models/FavoriteMaterialsModel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/Machines/Models/FavoriteMaterialsModel.py b/cura/Machines/Models/FavoriteMaterialsModel.py index cc273e55ce..98a2a01597 100644 --- a/cura/Machines/Models/FavoriteMaterialsModel.py +++ b/cura/Machines/Models/FavoriteMaterialsModel.py @@ -1,10 +1,9 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from UM.Logger import Logger from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel - +## Model that shows the list of favorite materials. class FavoriteMaterialsModel(BaseMaterialsModel): def __init__(self, parent = None): super().__init__(parent) From c66257bf4d42c5649606de352cf41496bd7a90dd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:18:01 +0100 Subject: [PATCH 033/120] Use item instead of transparent rectangle This is faster to render. Contributes to issue CURA-6032. --- .../qml/Preferences/Materials/MaterialsBrandSection.qml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index a3a0e4708f..c40693e343 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -1,5 +1,5 @@ // Copyright (c) 2018 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 1.4 @@ -69,11 +69,7 @@ Rectangle } style: ButtonStyle { - background: Rectangle - { - anchors.fill: parent - color: "transparent" - } + background: Item { } } } } From 7cf1df74354022c5cceba84ae8ab304ad0d16b1e Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 16:19:21 +0100 Subject: [PATCH 034/120] 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 c0c45519a06847d49a745dd2d23537350b937710 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:49:41 +0100 Subject: [PATCH 035/120] Change another useless rectangle into an item It's more efficient to render. Also changed some code style. Contributes to issue CURA-6032. --- .../qml/Preferences/Materials/MaterialsSlot.qml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index a706aaf2b9..fb3cb9607d 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -1,5 +1,5 @@ // Copyright (c) 2018 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 1.4 @@ -70,7 +70,8 @@ Rectangle } onClicked: { - if (materialSlot.is_favorite) { + if (materialSlot.is_favorite) + { base.materialManager.removeFavorite(material.root_material_id) materialSlot.is_favorite = false return @@ -81,13 +82,10 @@ Rectangle } style: ButtonStyle { - background: Rectangle - { - anchors.fill: parent - color: "transparent" - } + background: Item { } } - UM.RecolorImage { + UM.RecolorImage + { anchors { verticalCenter: favorite_button.verticalCenter From 66ed9ed201dd3873c98fda46508243e4902a41ce Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:52:04 +0100 Subject: [PATCH 036/120] Remove optimisation that broke updates of models upon metadata change If the metadata changed, such as whether a material was favourite or not, then the materials models were not updating any more because the actual list of available materials was still the same. I've removed this optimisation and tested performance locally. It seems to be slightly slower (though that might be placebo or measurement error). However most of the performance boost of cura-6016 was resulting from different changes there so the interface still seems to be quite a lot faster than what it used to be. Contributes to issue CURA-6032. --- cura/Machines/Models/BaseMaterialsModel.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py index 629e5c2b48..212e4fcf1e 100644 --- a/cura/Machines/Models/BaseMaterialsModel.py +++ b/cura/Machines/Models/BaseMaterialsModel.py @@ -106,10 +106,7 @@ class BaseMaterialsModel(ListModel): return False extruder_stack = global_stack.extruders[extruder_position] - available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) - if available_materials == self._available_materials: - return False - self._available_materials = available_materials + self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) if self._available_materials is None: return False From 6987d5ff782c53253c1b85b9f280ee4b9b328b59 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 19 Dec 2018 09:33:46 +0100 Subject: [PATCH 037/120] Add a radius to the printer type label --- resources/qml/PrinterTypeLabel.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrinterTypeLabel.qml b/resources/qml/PrinterTypeLabel.qml index 7feae32e16..cfc9e56513 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -19,6 +19,7 @@ Item { anchors.fill: parent color: UM.Theme.getColor("printer_type_label_background") + radius: UM.Theme.getSize("checkbox_radius").width } Label From 382286509f6cc5b1af6093b7e3b003965e955958 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 19 Dec 2018 09:49:12 +0100 Subject: [PATCH 038/120] Change the buildplate information to use a reusable component Boy scouting. Contributes to CURA-6025. --- .../ConfigurationMenu/ConfigurationItem.qml | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 728a0cbe9a..7e1b7e5af7 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -90,25 +90,13 @@ Button 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 - source: UM.Theme.getIcon("buildplate") - color: UM.Theme.getColor("text") - } - - Label + // Show the type of buildplate. The first letter is capitalized + Cura.IconWithText { 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: UM.Theme.getColor("text") + source: UM.Theme.getIcon("buildplate") + text: configuration.buildplateConfiguration.charAt(0).toUpperCase() + configuration.buildplateConfiguration.substr(1) + anchors.left: parent.left } } } From f1c28498a67aa73f93ada591bfdcb01c7ec14e59 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 11:00:00 +0100 Subject: [PATCH 039/120] 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 040/120] 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 041/120] 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 acabd06542ea4907d503055bba6174c19a5ab89e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 19 Dec 2018 12:32:18 +0100 Subject: [PATCH 042/120] Change the large_nonbold to large in one remaining component Contributes to CURA-6025. --- plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index 884dbabc2f..f2a0e785b8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -23,7 +23,7 @@ Item top: parent.top } color: UM.Theme.getColor("text") - font: UM.Theme.getFont("large_nonbold") + font: UM.Theme.getFont("large") text: catalog.i18nc("@label", "Queued") } From 9acaf9abd772643de75a51d4a8c47878c8ee2079 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 19 Dec 2018 13:30:25 +0100 Subject: [PATCH 043/120] 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 044/120] 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 045/120] 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 046/120] 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 047/120] 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 048/120] 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 049/120] 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 9dbc6429674cf13f9f763a0a5dd76f0dae6f6446 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 19 Dec 2018 17:34:31 +0100 Subject: [PATCH 050/120] SendMaterials: Make sure the base-material is compared to and make case insensitive. [CURA-6035] --- plugins/UM3NetworkPrinting/src/SendMaterialJob.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py index f536fad49a..a1ddf37461 100644 --- a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py @@ -101,11 +101,10 @@ class SendMaterialJob(Job): continue file_name = os.path.basename(file_path) - material_id = urllib.parse.unquote_plus(mime_type.stripExtension(file_name)) + material_id = urllib.parse.unquote_plus(mime_type.stripExtension(file_name)).lower() if material_id not in materials_to_send: # If the material does not have to be sent we skip it. continue - self._sendMaterialFile(file_path, file_name, material_id) ## Send a single material file to the printer. @@ -182,6 +181,7 @@ class SendMaterialJob(Job): # Create a new local material local_material = LocalMaterial(**material) + local_material.id = material["base_file"].lower() # Don't compare each profile, only base materials. if local_material.GUID not in result or \ local_material.version > result.get(local_material.GUID).version: From 8bff0d17e8b2b15e67d5da8f02bda41ea0fe3576 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 09:43:01 +0100 Subject: [PATCH 051/120] 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 052/120] 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 d93e19d530e93b0fb02c79a591b49aa6b8593967 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 20 Dec 2018 10:45:03 +0100 Subject: [PATCH 053/120] Add getAllMaterialGroups() CURA-6035 --- cura/Machines/MaterialManager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cura/Machines/MaterialManager.py b/cura/Machines/MaterialManager.py index aee96f3153..4d9574bf38 100644 --- a/cura/Machines/MaterialManager.py +++ b/cura/Machines/MaterialManager.py @@ -302,6 +302,10 @@ class MaterialManager(QObject): def getMaterialGroupListByGUID(self, guid: str) -> Optional[List[MaterialGroup]]: return self._guid_material_groups_map.get(guid) + # Returns a dict of all material groups organized by root_material_id. + def getAllMaterialGroups(self) -> Dict[str, "MaterialGroup"]: + return self._material_group_map + # # Return a dict with all root material IDs (k) and ContainerNodes (v) that's suitable for the given setup. # From 68372aff6038064892becda076e6c642a36e92b7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 20 Dec 2018 10:45:38 +0100 Subject: [PATCH 054/120] Use MaterialManager in SendMaterialJob CURA-6035 --- .../UM3NetworkPrinting/src/SendMaterialJob.py | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py index a1ddf37461..7a0da24098 100644 --- a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py @@ -2,17 +2,14 @@ # Cura is released under the terms of the LGPLv3 or higher. import json import os -import urllib.parse from typing import Dict, TYPE_CHECKING, Set from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest -from UM.Application import Application from UM.Job import Job from UM.Logger import Logger -from UM.MimeTypeDatabase import MimeTypeDatabase -from UM.Resources import Resources from cura.CuraApplication import CuraApplication + # Absolute imports don't work in plugins from .Models import ClusterMaterial, LocalMaterial @@ -91,21 +88,22 @@ class SendMaterialJob(Job): # # \param materials_to_send A set with id's of materials that must be sent. def _sendMaterials(self, materials_to_send: Set[str]) -> None: - file_paths = Resources.getAllResourcesOfType(CuraApplication.ResourceTypes.MaterialInstanceContainer) + container_registry = CuraApplication.getInstance().getContainerRegistry() + material_manager = CuraApplication.getInstance().getMaterialManager() + material_group_dict = material_manager.getAllMaterialGroups() - # Find all local material files and send them if needed. - for file_path in file_paths: - try: - mime_type = MimeTypeDatabase.getMimeTypeForFile(file_path) - except MimeTypeDatabase.MimeTypeNotFoundError: + for root_material_id in material_group_dict: + if root_material_id not in materials_to_send: + # If the material does not have to be sent we skip it. + continue + + file_path = container_registry.getContainerFilePathById(root_material_id) + if not file_path: + Logger.log("e", "Cannot get file path for material container [%s]", root_material_id) continue file_name = os.path.basename(file_path) - material_id = urllib.parse.unquote_plus(mime_type.stripExtension(file_name)).lower() - if material_id not in materials_to_send: - # If the material does not have to be sent we skip it. - continue - self._sendMaterialFile(file_path, file_name, material_id) + self._sendMaterialFile(file_path, file_name, root_material_id) ## Send a single material file to the printer. # @@ -115,7 +113,6 @@ class SendMaterialJob(Job): # \param file_name The name of the material file. # \param material_id The ID of the material in the file. def _sendMaterialFile(self, file_path: str, file_name: str, material_id: str) -> None: - parts = [] # Add the material file. @@ -170,28 +167,31 @@ class SendMaterialJob(Job): # \return a dictionary of LocalMaterial objects by GUID def _getLocalMaterials(self) -> Dict[str, LocalMaterial]: result = {} # type: Dict[str, LocalMaterial] - container_registry = Application.getInstance().getContainerRegistry() - material_containers = container_registry.findContainersMetadata(type = "material") + material_manager = CuraApplication.getInstance().getMaterialManager() + + material_group_dict = material_manager.getAllMaterialGroups() # Find the latest version of all material containers in the registry. - for material in material_containers: + for root_material_id, material_group in material_group_dict.items(): + material_metadata = material_group.root_material_node.getMetadata() + try: # material version must be an int - material["version"] = int(material["version"]) + material_metadata["version"] = int(material_metadata["version"]) # Create a new local material - local_material = LocalMaterial(**material) - local_material.id = material["base_file"].lower() # Don't compare each profile, only base materials. + local_material = LocalMaterial(**material_metadata) + local_material.id = root_material_id if local_material.GUID not in result or \ local_material.version > result.get(local_material.GUID).version: result[local_material.GUID] = local_material except KeyError: - Logger.logException("w", "Local material {} has missing values.".format(material["id"])) + Logger.logException("w", "Local material {} has missing values.".format(material_metadata["id"])) except ValueError: - Logger.logException("w", "Local material {} has invalid values.".format(material["id"])) + Logger.logException("w", "Local material {} has invalid values.".format(material_metadata["id"])) except TypeError: - Logger.logException("w", "Local material {} has invalid values.".format(material["id"])) + Logger.logException("w", "Local material {} has invalid values.".format(material_metadata["id"])) return result From dc473dc78d63c15a62dfd5a197162f43b0780b8f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Dec 2018 11:09:02 +0100 Subject: [PATCH 055/120] 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 056/120] 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 057/120] 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 e79f312fa0fa3e35bfc407e4c7d59a572d044686 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 20 Dec 2018 14:20:31 +0100 Subject: [PATCH 058/120] Fix unit tests for SendMaterialJob CURA-6035 --- .../UM3NetworkPrinting/src/SendMaterialJob.py | 10 +- .../tests/TestSendMaterialJob.py | 135 +++++++++++++----- 2 files changed, 102 insertions(+), 43 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py index 7a0da24098..ab6ebfef2e 100644 --- a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py @@ -6,9 +6,9 @@ from typing import Dict, TYPE_CHECKING, Set from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest +from UM.Application import Application from UM.Job import Job from UM.Logger import Logger -from cura.CuraApplication import CuraApplication # Absolute imports don't work in plugins from .Models import ClusterMaterial, LocalMaterial @@ -34,7 +34,6 @@ class SendMaterialJob(Job): # # \param reply The reply from the printer, a json file. def _onGetRemoteMaterials(self, reply: QNetworkReply) -> None: - # Got an error from the HTTP request. If we did not receive a 200 something happened. if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200: Logger.log("e", "Error fetching materials from printer: %s", reply.errorString()) @@ -49,7 +48,6 @@ class SendMaterialJob(Job): # # \param remote_materials_by_guid The remote materials by GUID. def _sendMissingMaterials(self, remote_materials_by_guid: Dict[str, ClusterMaterial]) -> None: - # Collect local materials local_materials_by_guid = self._getLocalMaterials() if len(local_materials_by_guid) == 0: @@ -88,8 +86,8 @@ class SendMaterialJob(Job): # # \param materials_to_send A set with id's of materials that must be sent. def _sendMaterials(self, materials_to_send: Set[str]) -> None: - container_registry = CuraApplication.getInstance().getContainerRegistry() - material_manager = CuraApplication.getInstance().getMaterialManager() + container_registry = Application.getInstance().getContainerRegistry() + material_manager = Application.getInstance().getMaterialManager() material_group_dict = material_manager.getAllMaterialGroups() for root_material_id in material_group_dict: @@ -167,7 +165,7 @@ class SendMaterialJob(Job): # \return a dictionary of LocalMaterial objects by GUID def _getLocalMaterials(self) -> Dict[str, LocalMaterial]: result = {} # type: Dict[str, LocalMaterial] - material_manager = CuraApplication.getInstance().getMaterialManager() + material_manager = Application.getInstance().getMaterialManager() material_group_dict = material_manager.getAllMaterialGroups() diff --git a/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py b/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py index b669eb192a..4303f89c20 100644 --- a/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py @@ -1,26 +1,29 @@ # Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import copy import io import json from unittest import TestCase, mock -from unittest.mock import patch, call +from unittest.mock import patch, call, MagicMock from PyQt5.QtCore import QByteArray -from UM.MimeTypeDatabase import MimeType from UM.Application import Application + +from cura.Machines.MaterialGroup import MaterialGroup +from cura.Machines.MaterialNode import MaterialNode + from plugins.UM3NetworkPrinting.src.SendMaterialJob import SendMaterialJob +_FILES_MAP = {"generic_pla_white": "/materials/generic_pla_white.xml.fdm_material", + "generic_pla_black": "/materials/generic_pla_black.xml.fdm_material", + } + @patch("builtins.open", lambda _, __: io.StringIO("")) -@patch("UM.MimeTypeDatabase.MimeTypeDatabase.getMimeTypeForFile", - lambda _: MimeType(name = "application/x-ultimaker-material-profile", comment = "Ultimaker Material Profile", - suffixes = ["xml.fdm_material"])) -@patch("UM.Resources.Resources.getAllResourcesOfType", lambda _: ["/materials/generic_pla_white.xml.fdm_material"]) -@patch("plugins.UM3NetworkPrinting.src.ClusterUM3OutputDevice") -@patch("PyQt5.QtNetwork.QNetworkReply") class TestSendMaterialJob(TestCase): + # version 1 _LOCAL_MATERIAL_WHITE = {"type": "material", "status": "unknown", "id": "generic_pla_white", "base_file": "generic_pla_white", "setting_version": "5", "name": "White PLA", "brand": "Generic", "material": "PLA", "color_name": "White", @@ -29,6 +32,37 @@ class TestSendMaterialJob(TestCase): "properties": {"density": "1.00", "diameter": "2.85", "weight": "750"}, "definition": "fdmprinter", "compatible": True} + # version 2 + _LOCAL_MATERIAL_WHITE_NEWER = {"type": "material", "status": "unknown", "id": "generic_pla_white", + "base_file": "generic_pla_white", "setting_version": "5", "name": "White PLA", + "brand": "Generic", "material": "PLA", "color_name": "White", + "GUID": "badb0ee7-87c8-4f3f-9398-938587b67dce", "version": "2", + "color_code": "#ffffff", + "description": "Test PLA White", "adhesion_info": "Use glue.", + "approximate_diameter": "3", + "properties": {"density": "1.00", "diameter": "2.85", "weight": "750"}, + "definition": "fdmprinter", "compatible": True} + + # invalid version: "one" + _LOCAL_MATERIAL_WHITE_INVALID_VERSION = {"type": "material", "status": "unknown", "id": "generic_pla_white", + "base_file": "generic_pla_white", "setting_version": "5", "name": "White PLA", + "brand": "Generic", "material": "PLA", "color_name": "White", + "GUID": "badb0ee7-87c8-4f3f-9398-938587b67dce", "version": "one", + "color_code": "#ffffff", + "description": "Test PLA White", "adhesion_info": "Use glue.", + "approximate_diameter": "3", + "properties": {"density": "1.00", "diameter": "2.85", "weight": "750"}, + "definition": "fdmprinter", "compatible": True} + + _LOCAL_MATERIAL_WHITE_ALL_RESULT = {"generic_pla_white": MaterialGroup("generic_pla_white", + MaterialNode(_LOCAL_MATERIAL_WHITE))} + + _LOCAL_MATERIAL_WHITE_NEWER_ALL_RESULT = {"generic_pla_white": MaterialGroup("generic_pla_white", + MaterialNode(_LOCAL_MATERIAL_WHITE_NEWER))} + + _LOCAL_MATERIAL_WHITE_INVALID_VERSION_ALL_RESULT = {"generic_pla_white": MaterialGroup("generic_pla_white", + MaterialNode(_LOCAL_MATERIAL_WHITE_INVALID_VERSION))} + _LOCAL_MATERIAL_BLACK = {"type": "material", "status": "unknown", "id": "generic_pla_black", "base_file": "generic_pla_black", "setting_version": "5", "name": "Yellow CPE", "brand": "Ultimaker", "material": "CPE", "color_name": "Black", @@ -37,6 +71,9 @@ class TestSendMaterialJob(TestCase): "properties": {"density": "1.01", "diameter": "2.85", "weight": "750"}, "definition": "fdmprinter", "compatible": True} + _LOCAL_MATERIAL_BLACK_ALL_RESULT = {"generic_pla_black": MaterialGroup("generic_pla_black", + MaterialNode(_LOCAL_MATERIAL_BLACK))} + _REMOTE_MATERIAL_WHITE = { "guid": "badb0ee7-87c8-4f3f-9398-938587b67dce", "material": "PLA", @@ -55,14 +92,17 @@ class TestSendMaterialJob(TestCase): "density": 1.00 } - def test_run(self, device_mock, reply_mock): + def test_run(self): + device_mock = MagicMock() job = SendMaterialJob(device_mock) job.run() # We expect the materials endpoint to be called when the job runs. device_mock.get.assert_called_with("materials/", on_finished = job._onGetRemoteMaterials) - def test__onGetRemoteMaterials_withFailedRequest(self, reply_mock, device_mock): + def test__onGetRemoteMaterials_withFailedRequest(self): + reply_mock = MagicMock() + device_mock = MagicMock() reply_mock.attribute.return_value = 404 job = SendMaterialJob(device_mock) job._onGetRemoteMaterials(reply_mock) @@ -70,7 +110,9 @@ class TestSendMaterialJob(TestCase): # We expect the device not to be called for any follow up. self.assertEqual(0, device_mock.createFormPart.call_count) - def test__onGetRemoteMaterials_withWrongEncoding(self, reply_mock, device_mock): + def test__onGetRemoteMaterials_withWrongEncoding(self): + reply_mock = MagicMock() + device_mock = MagicMock() reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(json.dumps([self._REMOTE_MATERIAL_WHITE]).encode("cp500")) job = SendMaterialJob(device_mock) @@ -79,7 +121,9 @@ class TestSendMaterialJob(TestCase): # Given that the parsing fails we do no expect the device to be called for any follow up. self.assertEqual(0, device_mock.createFormPart.call_count) - def test__onGetRemoteMaterials_withBadJsonAnswer(self, reply_mock, device_mock): + def test__onGetRemoteMaterials_withBadJsonAnswer(self): + reply_mock = MagicMock() + device_mock = MagicMock() reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(b"Six sick hicks nick six slick bricks with picks and sticks.") job = SendMaterialJob(device_mock) @@ -88,7 +132,9 @@ class TestSendMaterialJob(TestCase): # Given that the parsing fails we do no expect the device to be called for any follow up. self.assertEqual(0, device_mock.createFormPart.call_count) - def test__onGetRemoteMaterials_withMissingGuidInRemoteMaterial(self, reply_mock, device_mock): + def test__onGetRemoteMaterials_withMissingGuidInRemoteMaterial(self): + reply_mock = MagicMock() + device_mock = MagicMock() reply_mock.attribute.return_value = 200 remote_material_without_guid = self._REMOTE_MATERIAL_WHITE.copy() del remote_material_without_guid["guid"] @@ -99,18 +145,20 @@ class TestSendMaterialJob(TestCase): # Given that parsing fails we do not expect the device to be called for any follow up. self.assertEqual(0, device_mock.createFormPart.call_count) + @patch("cura.Machines.MaterialManager.MaterialManager") @patch("cura.Settings.CuraContainerRegistry") @patch("UM.Application") def test__onGetRemoteMaterials_withInvalidVersionInLocalMaterial(self, application_mock, container_registry_mock, - reply_mock, device_mock): + material_manager_mock): + reply_mock = MagicMock() + device_mock = MagicMock() + application_mock.getContainerRegistry.return_value = container_registry_mock + application_mock.getMaterialManager.return_value = material_manager_mock + reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(json.dumps([self._REMOTE_MATERIAL_WHITE]).encode("ascii")) - localMaterialWhiteWithInvalidVersion = self._LOCAL_MATERIAL_WHITE.copy() - localMaterialWhiteWithInvalidVersion["version"] = "one" - container_registry_mock.findContainersMetadata.return_value = [localMaterialWhiteWithInvalidVersion] - - application_mock.getContainerRegistry.return_value = container_registry_mock + material_manager_mock.getAllMaterialGroups.return_value = self._LOCAL_MATERIAL_WHITE_INVALID_VERSION_ALL_RESULT.copy() with mock.patch.object(Application, "getInstance", new = lambda: application_mock): job = SendMaterialJob(device_mock) @@ -118,15 +166,19 @@ class TestSendMaterialJob(TestCase): self.assertEqual(0, device_mock.createFormPart.call_count) + @patch("cura.Machines.MaterialManager") @patch("cura.Settings.CuraContainerRegistry") @patch("UM.Application") - def test__onGetRemoteMaterials_withNoUpdate(self, application_mock, container_registry_mock, reply_mock, - device_mock): + def test__onGetRemoteMaterials_withNoUpdate(self, application_mock, container_registry_mock, + material_manager_mock): + reply_mock = MagicMock() + device_mock = MagicMock() application_mock.getContainerRegistry.return_value = container_registry_mock + application_mock.getMaterialManager.return_value = material_manager_mock device_mock.createFormPart.return_value = "_xXx_" - container_registry_mock.findContainersMetadata.return_value = [self._LOCAL_MATERIAL_WHITE] + material_manager_mock.getAllMaterialGroups.return_value = self._LOCAL_MATERIAL_WHITE_ALL_RESULT.copy() reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(json.dumps([self._REMOTE_MATERIAL_WHITE]).encode("ascii")) @@ -138,24 +190,25 @@ class TestSendMaterialJob(TestCase): self.assertEqual(0, device_mock.createFormPart.call_count) self.assertEqual(0, device_mock.postFormWithParts.call_count) - @patch("cura.Settings.CuraContainerRegistry") - @patch("UM.Application") - def test__onGetRemoteMaterials_withUpdatedMaterial(self, application_mock, container_registry_mock, reply_mock, - device_mock): - application_mock.getContainerRegistry.return_value = container_registry_mock + @patch("UM.Application.Application.getInstance") + def test__onGetRemoteMaterials_withUpdatedMaterial(self, get_instance_mock): + reply_mock = MagicMock() + device_mock = MagicMock() + application_mock = get_instance_mock.return_value + container_registry_mock = application_mock.getContainerRegistry.return_value + material_manager_mock = application_mock.getMaterialManager.return_value + + container_registry_mock.getContainerFilePathById = lambda x: _FILES_MAP.get(x) device_mock.createFormPart.return_value = "_xXx_" - localMaterialWhiteWithHigherVersion = self._LOCAL_MATERIAL_WHITE.copy() - localMaterialWhiteWithHigherVersion["version"] = "2" - container_registry_mock.findContainersMetadata.return_value = [localMaterialWhiteWithHigherVersion] + material_manager_mock.getAllMaterialGroups.return_value = self._LOCAL_MATERIAL_WHITE_NEWER_ALL_RESULT.copy() reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(json.dumps([self._REMOTE_MATERIAL_WHITE]).encode("ascii")) - with mock.patch.object(Application, "getInstance", new = lambda: application_mock): - job = SendMaterialJob(device_mock) - job._onGetRemoteMaterials(reply_mock) + job = SendMaterialJob(device_mock) + job._onGetRemoteMaterials(reply_mock) self.assertEqual(1, device_mock.createFormPart.call_count) self.assertEqual(1, device_mock.postFormWithParts.call_count) @@ -164,16 +217,24 @@ class TestSendMaterialJob(TestCase): call.postFormWithParts(target = "materials/", parts = ["_xXx_"], on_finished = job.sendingFinished)], device_mock.method_calls) + @patch("cura.Machines.MaterialManager.MaterialManager") @patch("cura.Settings.CuraContainerRegistry") @patch("UM.Application") - def test__onGetRemoteMaterials_withNewMaterial(self, application_mock, container_registry_mock, reply_mock, - device_mock): + def test__onGetRemoteMaterials_withNewMaterial(self, application_mock, container_registry_mock, + material_manager_mock): + reply_mock = MagicMock() + device_mock = MagicMock() application_mock.getContainerRegistry.return_value = container_registry_mock + application_mock.getMaterialManager.return_value = material_manager_mock + + container_registry_mock.getContainerFilePathById = lambda x: _FILES_MAP.get(x) device_mock.createFormPart.return_value = "_xXx_" - container_registry_mock.findContainersMetadata.return_value = [self._LOCAL_MATERIAL_WHITE, - self._LOCAL_MATERIAL_BLACK] + all_results = self._LOCAL_MATERIAL_WHITE_ALL_RESULT.copy() + for key, value in self._LOCAL_MATERIAL_BLACK_ALL_RESULT.items(): + all_results[key] = value + material_manager_mock.getAllMaterialGroups.return_value = all_results reply_mock.attribute.return_value = 200 reply_mock.readAll.return_value = QByteArray(json.dumps([self._REMOTE_MATERIAL_BLACK]).encode("ascii")) From 346d8d884e3f39e8aaae740ca1dcbf26022b3e0f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 20 Dec 2018 14:23:37 +0100 Subject: [PATCH 059/120] Remove unnecessary patches in TestSendMaterialJob CURA-6035 --- .../tests/TestSendMaterialJob.py | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py b/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py index 4303f89c20..6eac892af6 100644 --- a/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/tests/TestSendMaterialJob.py @@ -166,15 +166,12 @@ class TestSendMaterialJob(TestCase): self.assertEqual(0, device_mock.createFormPart.call_count) - @patch("cura.Machines.MaterialManager") - @patch("cura.Settings.CuraContainerRegistry") - @patch("UM.Application") - def test__onGetRemoteMaterials_withNoUpdate(self, application_mock, container_registry_mock, - material_manager_mock): + @patch("UM.Application.Application.getInstance") + def test__onGetRemoteMaterials_withNoUpdate(self, application_mock): reply_mock = MagicMock() device_mock = MagicMock() - application_mock.getContainerRegistry.return_value = container_registry_mock - application_mock.getMaterialManager.return_value = material_manager_mock + container_registry_mock = application_mock.getContainerRegistry.return_value + material_manager_mock = application_mock.getMaterialManager.return_value device_mock.createFormPart.return_value = "_xXx_" @@ -217,15 +214,12 @@ class TestSendMaterialJob(TestCase): call.postFormWithParts(target = "materials/", parts = ["_xXx_"], on_finished = job.sendingFinished)], device_mock.method_calls) - @patch("cura.Machines.MaterialManager.MaterialManager") - @patch("cura.Settings.CuraContainerRegistry") - @patch("UM.Application") - def test__onGetRemoteMaterials_withNewMaterial(self, application_mock, container_registry_mock, - material_manager_mock): + @patch("UM.Application.Application.getInstance") + def test__onGetRemoteMaterials_withNewMaterial(self, application_mock): reply_mock = MagicMock() device_mock = MagicMock() - application_mock.getContainerRegistry.return_value = container_registry_mock - application_mock.getMaterialManager.return_value = material_manager_mock + container_registry_mock = application_mock.getContainerRegistry.return_value + material_manager_mock = application_mock.getMaterialManager.return_value container_registry_mock.getContainerFilePathById = lambda x: _FILES_MAP.get(x) From f3a0b44d5ebfb7a69d54cf1610a50eeec0285941 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 20 Dec 2018 14:24:00 +0100 Subject: [PATCH 060/120] 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 061/120] 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 062/120] 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 063/120] 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 7cfb29e337ae47884c0faf80be7394ea19ddb604 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 20 Dec 2018 18:12:40 +0100 Subject: [PATCH 064/120] If a connected printer has a selected material which is unknown for Cura then show a message for downloading it from Marketplace CURA-6033 --- .../ConfigurationMenu/ConfigurationItem.qml | 104 +++++++++++++++++- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 862e1475a9..16d683adca 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -14,6 +14,23 @@ Button property var configuration: null hoverEnabled: true + property bool isValidMaterial: + { + var extruderConfigurations = configuration.extruderConfigurations + + for (var index = 0; index < extruderConfigurations.length; index++) + { + var name = extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.name : "" + + if (name == "" || name == "Unknown") + { + hoverEnabled = false + return false + } + } + return true + } + background: Rectangle { color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") @@ -40,19 +57,102 @@ Button right: parent.right rightMargin: UM.Theme.getSize("wide_margin").width } - + height: childrenRect.height spacing: UM.Theme.getSize("default_margin").width Repeater { id: repeater - model: configuration.extruderConfigurations + model: + { + if (configurationItem.isValidMaterial) + { + return configuration.extruderConfigurations + } + return [] + } + delegate: PrintCoreConfiguration { width: Math.round(parent.width / 2) printCoreConfiguration: modelData } } + + // Unknown material + Rectangle + { + id: unknownMaterial + height: unknownMaterialMessage.height + UM.Theme.getSize("thin_margin").width / 2 + width: parent.width + + anchors.top: parent.top + anchors.topMargin: + { + return UM.Theme.getSize("thin_margin").width / 2 + } + + visible: !configurationItem.isValidMaterial + + UM.RecolorImage + { + id: icon + anchors.verticalCenter: unknownMaterialMessage.verticalCenter + + source: UM.Theme.getIcon("warning") + color: UM.Theme.getColor("warning") + width: UM.Theme.getSize("section_icon").width + height: width + } + + Label + { + id: unknownMaterialMessage + text: + { + var extruderConfigurations = configuration.extruderConfigurations + var unknownMaterials = [] + for (var index = 0; index < extruderConfigurations.length; index++) + { + var name = extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.name : "" + + if (name == "" || name == "Unknown") + { + unknownMaterials.push(extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.brand : "Unknown Brand") + } + } + + unknownMaterials = "" + unknownMaterials + "" + var draftResult = catalog.i18nc("@label", "This configuration is not available because %1 is not recognized. Please visit %2 to download the correct material profile."); + var result = draftResult.arg(unknownMaterials).arg("" + catalog.i18nc("@label","Marketplace") + " ") + + return result + } + width: extruderRow.width + + anchors.left: icon.right + anchors.right: unknownMaterial.right + anchors.leftMargin: UM.Theme.getSize("wide_margin").height + anchors.top: unknownMaterial.top + + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignVCenter + linkColor: UM.Theme.getColor("text_link") + + onLinkActivated: + { + Cura.Actions.browsePackages.trigger() + } + } + + MouseArea { + anchors.fill: parent + cursorShape: unknownMaterialMessage.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.NoButton + } + } } //Buildplate row separator From 9430c421ebcf202caca4c6dda40af920678e396d Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 20 Dec 2018 18:19:59 +0100 Subject: [PATCH 065/120] Code refactor CURA-6033 --- 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 16d683adca..4cf0437098 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -87,10 +87,7 @@ Button width: parent.width anchors.top: parent.top - anchors.topMargin: - { - return UM.Theme.getSize("thin_margin").width / 2 - } + anchors.topMargin: UM.Theme.getSize("thin_margin").width / 2 visible: !configurationItem.isValidMaterial From 81a6531f47f3b7356146827f27a8bf430b93a94e Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 20 Dec 2018 20:37:48 +0100 Subject: [PATCH 066/120] Fix range slider label position in LayerSlider.qml. --- plugins/SimulationView/LayerSlider.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 42b8cf0ba0..88f298d1f5 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -163,9 +163,9 @@ Item id: rangleHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x + parent.width + UM.Theme.getSize("default_margin").width + x: parent.x - width - UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width + width, y + height / 2) + target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent // custom properties From 75fbdf2c94a5e0f004dbecaba71447cb491a87e0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 10:40:37 +0100 Subject: [PATCH 067/120] 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 068/120] 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 069/120] 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 070/120] 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 071/120] 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 01783e7f685cda2a24ce6a0de846ab7cca79d17d Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 21 Dec 2018 13:54:01 +0100 Subject: [PATCH 072/120] Check material name instead of material brand CURA-6033 --- 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 4cf0437098..9e2fed0767 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -20,7 +20,7 @@ Button for (var index = 0; index < extruderConfigurations.length; index++) { - var name = extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.name : "" + var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" if (name == "" || name == "Unknown") { @@ -111,7 +111,7 @@ Button var unknownMaterials = [] for (var index = 0; index < extruderConfigurations.length; index++) { - var name = extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.name : "" + var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" if (name == "" || name == "Unknown") { From 766fc2293e1e5e635fdf0d5b2b5fbb75071df816 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 14:35:41 +0100 Subject: [PATCH 073/120] 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 c8994102da49ac08f3fcd041df12c7ffaa12eb88 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 21 Dec 2018 14:44:25 +0100 Subject: [PATCH 074/120] Use short for each javascript function CURA-6033 --- .../qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 9e2fed0767..b23bcc4b8c 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -18,7 +18,7 @@ Button { var extruderConfigurations = configuration.extruderConfigurations - for (var index = 0; index < extruderConfigurations.length; index++) + for (var index in extruderConfigurations) { var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" @@ -109,7 +109,7 @@ Button { var extruderConfigurations = configuration.extruderConfigurations var unknownMaterials = [] - for (var index = 0; index < extruderConfigurations.length; index++) + for (var index in extruderConfigurations) { var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" @@ -144,7 +144,8 @@ Button } } - MouseArea { + MouseArea + { anchors.fill: parent cursorShape: unknownMaterialMessage.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor acceptedButtons: Qt.NoButton From e8ea742cf6c9cb533604fd7741a94381a33b27d7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 16:27:38 +0100 Subject: [PATCH 075/120] Retain binding with isValidMaterial on hover So that if a material becomes valid, it updates this property. Contributes to issue CURA-6033. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index b23bcc4b8c..31569c58d2 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -12,7 +12,7 @@ Button id: configurationItem property var configuration: null - hoverEnabled: true + hoverEnabled: isValidMaterial property bool isValidMaterial: { @@ -24,7 +24,6 @@ Button if (name == "" || name == "Unknown") { - hoverEnabled = false return false } } From 5e9854454185fee9490b0d9aa996d36f65b7e2fd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 16:33:16 +0100 Subject: [PATCH 076/120] Don't change the model depending on isValidMaterial That would cause a circular dependency in a way. Contributes to issue CURA-6033. --- .../qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 31569c58d2..6a17353459 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -62,19 +62,13 @@ Button Repeater { id: repeater - model: - { - if (configurationItem.isValidMaterial) - { - return configuration.extruderConfigurations - } - return [] - } + model: configuration.extruderConfigurations delegate: PrintCoreConfiguration { width: Math.round(parent.width / 2) printCoreConfiguration: modelData + visible: configurationItem.isValidMaterial } } From a720cca5b6f279696e398e96abe919491c12775e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 16:40:24 +0100 Subject: [PATCH 077/120] Fix background colour for dark theme The default colour for Rectangle is white. So this Rectangle, not defining a colour, became white. Instead we should use an Item, which cannot have a background colour and thus becomes transparent, making the background colour the same as the button below, which was intended. It's also slightly faster to render. Contributes to issue CURA-6033. --- 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 6a17353459..81f2183488 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -73,7 +73,7 @@ Button } // Unknown material - Rectangle + Item { id: unknownMaterial height: unknownMaterialMessage.height + UM.Theme.getSize("thin_margin").width / 2 From 2277a3d316ae2ded6c8f6df18e43de9277181e38 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Dec 2018 16:43:45 +0100 Subject: [PATCH 078/120] Prevent syncing with invalid configurations Contributes to issue CURA-6033. --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 81f2183488..75a1b21186 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -216,6 +216,9 @@ Button onClicked: { - Cura.MachineManager.applyRemoteConfiguration(configuration) + if(isValidMaterial) + { + Cura.MachineManager.applyRemoteConfiguration(configuration); + } } } From f627560751761f25b75733412b91a14cd2357e1e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Dec 2018 17:12:07 +0100 Subject: [PATCH 079/120] 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 c6f4cb492761f1b80e71021d322ed78852e8af5f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 24 Dec 2018 15:31:47 +0100 Subject: [PATCH 080/120] Make the settings panel resizable You can now drag the bottom side of the panel to make it bigger or smaller. Contributes to issue CURA-6054. --- cura/CuraApplication.py | 2 +- .../Custom/CustomPrintSetup.qml | 5 +- .../PrintSetupSelectorContents.qml | 48 ++++++++++++++++++- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9ec2435f0b..905c367cd1 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -499,7 +499,7 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/choice_on_profile_override", "always_ask") preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/use_multi_build_plate", False) - + preferences.addPreference("view/settings_list_height", 600) preferences.addPreference("cura/currency", "€") preferences.addPreference("cura/material_settings", "{}") diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 51eb14a441..98bb5c0405 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -11,7 +11,6 @@ import Cura 1.0 as Cura Item { id: customPrintSetup - height: childrenRect.height + padding property real padding: UM.Theme.getSize("default_margin").width property bool multipleExtruders: extrudersModel.count > 1 @@ -98,15 +97,15 @@ Item Rectangle { - height: UM.Theme.getSize("print_setup_widget").height anchors { top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom + topMargin: -UM.Theme.getSize("default_lining").width left: parent.left leftMargin: parent.padding right: parent.right rightMargin: parent.padding - topMargin: -UM.Theme.getSize("default_lining").width + bottom: parent.bottom } 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 6c678f7ce5..52c2807b81 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -15,7 +15,7 @@ Item id: content width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + height: contents.height + buttonRow.height enum Mode { @@ -71,6 +71,15 @@ Item right: parent.right top: parent.top } + height: UM.Preferences.getValue("view/settings_list_height") - UM.Theme.getSize("default_margin").height + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + customPrintSetup.height = UM.Preferences.getValue("view/settings_list_height"); + } + } visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom } } @@ -94,13 +103,14 @@ Item anchors { - top: buttonsSeparator.bottom + bottom: parent.bottom left: parent.left right: parent.right } Cura.SecondaryButton { + id: recommendedButton anchors.top: parent.top anchors.left: parent.left anchors.margins: parent.padding @@ -125,5 +135,39 @@ Item visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Custom } + + //Invisible area at the bottom with which you can resize the panel. + MouseArea + { + anchors + { + left: parent.left + right: parent.right + bottom: parent.bottom + top: recommendedButton.bottom + topMargin: UM.Theme.getSize("default_lining").height + } + cursorShape: Qt.SplitVCursor + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom + drag + { + target: parent + axis: Drag.YAxis + } + onMouseYChanged: + { + if(drag.active) + { + // position of mouse relative to dropdown align vertical centre of mouse area to cursor + // v------------------------------v v------------v + var h = mouseY + buttonRow.y + content.y - height / 2 | 0; + if(h < 200 * screenScaleFactor) //Enforce a minimum size. + { + h = 200 * screenScaleFactor; + } + UM.Preferences.setValue("view/settings_list_height", h); + } + } + } } } \ No newline at end of file From b7a23399f5bac16e0275647b23564558ada9185e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 24 Dec 2018 15:37:48 +0100 Subject: [PATCH 081/120] Move action panel in front of settings panel The settings panel can now be so long that they overlap (if the user so chooses). This causes the action panel to be hidden behind the settings. We'd prefer to show the action panel in front, always. Contributes to issue CURA-6054. --- resources/qml/ActionPanel/ActionPanelWidget.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/ActionPanel/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml index a1cd81e9e9..1d9ee95548 100644 --- a/resources/qml/ActionPanel/ActionPanelWidget.qml +++ b/resources/qml/ActionPanel/ActionPanelWidget.qml @@ -23,6 +23,7 @@ Rectangle border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width + z: 10 property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled From c6c09a83271d368e68afec1ce106b246b770f1f4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 24 Dec 2018 16:16:23 +0100 Subject: [PATCH 082/120] Limit height of settings drop-down to window size It seems to be very hard to limit it to not overlap with the action panel. Well, going out of the window is a bigger problem so at least we can fix that. Contributes to issue CURA-6054. --- .../qml/PrintSetupSelector/PrintSetupSelectorContents.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 52c2807b81..35c5f008b6 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -165,6 +165,14 @@ Item { h = 200 * screenScaleFactor; } + + //Absolute mouse Y position in the window, to prevent it from going outside the window. + var mouse_absolute_y = mapToGlobal(mouseX, mouseY).y - UM.Preferences.getValue("general/window_top"); + if(mouse_absolute_y > base.height) + { + h -= mouse_absolute_y - base.height; + } + UM.Preferences.setValue("view/settings_list_height", h); } } From f2a32e62fc8ab19b1dad9352a3a8e9aca965e149 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 27 Dec 2018 11:06:09 +0100 Subject: [PATCH 083/120] Rename 'Protected profiles' to 'Default profiles' We agreed that it looks better, especially when listed right above 'Custom profiles'. --- resources/qml/Preferences/ProfilesPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 7fb17b7aa1..d20519b361 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -408,7 +408,7 @@ Item { anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_lining").width - text: section == "true" ? catalog.i18nc("@label", "Protected profiles") : catalog.i18nc("@label", "Custom profiles") + text: section == "true" ? catalog.i18nc("@label", "Default profiles") : catalog.i18nc("@label", "Custom profiles") font.bold: true } } From abe684c1bda37bb1ca7c7f82dd07b6720a5d22c1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 27 Dec 2018 13:08:25 +0100 Subject: [PATCH 084/120] 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 From 52d97dfbd21bfc0d190955734163a702cefdfe86 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 09:32:16 +0100 Subject: [PATCH 085/120] Change back the behavior of the output device selector to the old way Although the new way was discussed with our UXers, we got a number of reports that it was confusing. I also accidentally started a print while using it --- resources/qml/ActionPanel/OutputDevicesActionButton.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index fc0f9b8303..3bfaab0fc1 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -93,7 +93,6 @@ Item onClicked: { UM.OutputDeviceManager.setActiveDevice(model.id) - widget.requestWriteToDevice() popup.close() } } From a16e40650754f45f178cdc33f0ef9076863cd55b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 11:01:30 +0100 Subject: [PATCH 086/120] Properly display the full type + brand of unknown material CURA-6033 --- .../src/ClusterUM3OutputDevice.py | 3 ++- .../ConfigurationMenu/ConfigurationItem.qml | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index bebccc54e3..5e8aaa9fa9 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -620,8 +620,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): if material_group_list is None: 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", ""), + type = material_data.get("material", ""), color = material_data.get("color", ""), brand = material_data.get("brand", ""), name = material_data.get("name", material_name) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 75a1b21186..51ba77d012 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -105,10 +105,22 @@ Button for (var index in extruderConfigurations) { var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" - if (name == "" || name == "Unknown") { - unknownMaterials.push(extruderConfigurations[index].material.brand ? extruderConfigurations[index].material.brand : "Unknown Brand") + var materialType = extruderConfigurations[index].material.type + if (extruderConfigurations[index].material.type == "") + { + materialType = "Unknown" + } + + var brand = extruderConfigurations[index].material.brand + if (brand == "") + { + brand = "Unknown" + } + + name = materialType + " (" + brand + ")" + unknownMaterials.push(name) } } From fd9b29fee2558e9e387d2cdb9f74fed5c69bbf53 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 11:09:39 +0100 Subject: [PATCH 087/120] Rename printersModel to GlobalStacksModel This is a better description for the model anyway. CURA-6011 --- cura/CuraApplication.py | 4 ++-- cura/{PrintersModel.py => GlobalStacksModel.py} | 3 ++- resources/qml/Menus/LocalPrinterMenu.qml | 2 +- resources/qml/Menus/NetworkPrinterMenu.qml | 2 +- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) rename cura/{PrintersModel.py => GlobalStacksModel.py} (98%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 905c367cd1..0edf6c1899 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -51,7 +51,7 @@ from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray from cura.MultiplyObjectsJob import MultiplyObjectsJob -from cura.PrintersModel import PrintersModel +from cura.GlobalStacksModel import GlobalStacksModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator @@ -971,7 +971,7 @@ class CuraApplication(QtApplication): qmlRegisterType(MultiBuildPlateModel, "Cura", 1, 0, "MultiBuildPlateModel") qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") - qmlRegisterType(PrintersModel, "Cura", 1, 0, "PrintersModel") + qmlRegisterType(GlobalStacksModel, "Cura", 1, 0, "GlobalStacksModel") qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel") qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel") diff --git a/cura/PrintersModel.py b/cura/GlobalStacksModel.py similarity index 98% rename from cura/PrintersModel.py rename to cura/GlobalStacksModel.py index 8b5d2f6cc9..8ae6b05291 100644 --- a/cura/PrintersModel.py +++ b/cura/GlobalStacksModel.py @@ -12,7 +12,8 @@ from cura.PrinterOutputDevice import ConnectionType from cura.Settings.GlobalStack import GlobalStack -class PrintersModel(ListModel): + +class GlobalStacksModel(ListModel): NameRole = Qt.UserRole + 1 IdRole = Qt.UserRole + 2 HasRemoteConnectionRole = Qt.UserRole + 3 diff --git a/resources/qml/Menus/LocalPrinterMenu.qml b/resources/qml/Menus/LocalPrinterMenu.qml index e7c5037814..4da1de2abf 100644 --- a/resources/qml/Menus/LocalPrinterMenu.qml +++ b/resources/qml/Menus/LocalPrinterMenu.qml @@ -9,7 +9,7 @@ import Cura 1.0 as Cura Instantiator { - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} MenuItem { diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml index 8c607bc5ae..3cb0aae016 100644 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ b/resources/qml/Menus/NetworkPrinterMenu.qml @@ -9,7 +9,7 @@ import Cura 1.0 as Cura Instantiator { - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} MenuItem { text: model.metadata["connect_group_name"] diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index ea8068fa95..62ecf48cc5 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -11,7 +11,7 @@ ListView { id: listView height: childrenRect.height - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} section.property: "hasRemoteConnection" section.delegate: Label From 1277fbabc588634a78b6544f10abdcbc16f9c8ad Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 11:15:03 +0100 Subject: [PATCH 088/120] Fix connection type not always being seen correctly CURA-6011 --- cura/GlobalStacksModel.py | 3 +-- cura/Settings/MachineManager.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/GlobalStacksModel.py b/cura/GlobalStacksModel.py index 8ae6b05291..b0052900cd 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/GlobalStacksModel.py @@ -54,9 +54,8 @@ class GlobalStacksModel(ListModel): container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") for container_stack in container_stacks: - connection_type = container_stack.getMetaDataEntry("connection_type") + connection_type = int(container_stack.getMetaDataEntry("connection_type", "-1")) has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] - if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 2185bbce9d..5b99b73b3c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -527,7 +527,7 @@ class MachineManager(QObject): @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineHasRemoteConnection(self) -> bool: if self._global_container_stack: - connection_type = self._global_container_stack.getMetaDataEntry("connection_type") + connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", "-1")) return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] return False From 89040b6d8f9957d41b92c7b88bc78f6fb25fca2e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 11:18:17 +0100 Subject: [PATCH 089/120] Remove unneeded nameChanged signal connection CURA-6011 --- cura/GlobalStacksModel.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cura/GlobalStacksModel.py b/cura/GlobalStacksModel.py index b0052900cd..3ad110b7d0 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/GlobalStacksModel.py @@ -42,14 +42,8 @@ class GlobalStacksModel(ListModel): if isinstance(container, GlobalStack): self._update() - ## Handler for container name change events. - def _onContainerNameChanged(self): - self._update() - def _update(self) -> None: items = [] - for container in self._container_stacks: - container.nameChanged.disconnect(self._onContainerNameChanged) container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") From d9d1c93bd08d262a52aafe61024498ea4421f9a3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 11:25:23 +0100 Subject: [PATCH 090/120] Use "NotConnected" as default for the connection state CURA-6011 --- cura/GlobalStacksModel.py | 2 +- cura/PrinterOutputDevice.py | 4 ++-- cura/Settings/MachineManager.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/GlobalStacksModel.py b/cura/GlobalStacksModel.py index 3ad110b7d0..939809151d 100644 --- a/cura/GlobalStacksModel.py +++ b/cura/GlobalStacksModel.py @@ -48,7 +48,7 @@ class GlobalStacksModel(ListModel): container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") for container_stack in container_stacks: - connection_type = int(container_stack.getMetaDataEntry("connection_type", "-1")) + connection_type = int(container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value)) has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index aeeb0381b2..99e8835c2f 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -36,7 +36,7 @@ class ConnectionState(IntEnum): class ConnectionType(IntEnum): - Unknown = 0 + NotConnected = 0 UsbConnection = 1 NetworkConnection = 2 CloudConnection = 3 @@ -74,7 +74,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Signal to indicate that the configuration of one of the printers has changed. uniqueConfigurationsChanged = pyqtSignal() - def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.Unknown, parent: QObject = None) -> None: + def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.NotConnected, parent: QObject = None) -> None: super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 5b99b73b3c..32b83ead28 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -527,7 +527,7 @@ class MachineManager(QObject): @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineHasRemoteConnection(self) -> bool: if self._global_container_stack: - connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", "-1")) + connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value)) return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] return False From b5c406dc43930f2eca4fe866e07cc96cbb237b98 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:11:24 +0100 Subject: [PATCH 091/120] Make default font size slightly smaller In accordance with the designs. Contributes to issue CURA-6025. --- 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 5be1de1cfb..b14fdf0b4f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -25,17 +25,17 @@ "family": "Noto Sans" }, "default": { - "size": 1.0, + "size": 0.95, "weight": 40, "family": "Noto Sans" }, "default_bold": { - "size": 1.0, + "size": 0.95, "weight": 60, "family": "Noto Sans" }, "default_italic": { - "size": 1.0, + "size": 0.95, "weight": 40, "italic": true, "family": "Noto Sans" From 8dbebaa23c0ba8132e0245a62221cababb6bf3b4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 31 Dec 2018 13:14:08 +0100 Subject: [PATCH 092/120] Ensure that the machine selector list scales properly The old implementation directly listend to the height (instead of childrenRect). This caused issues, since other things apart from adding / removing machines could influence the height. CURA-6060 --- resources/qml/PrinterSelector/MachineSelector.qml | 8 +++++--- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 28e01c7ae9..9f0d3b4ac6 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -93,14 +93,16 @@ Cura.ExpandablePopup width: scroll.width - scroll.leftPadding - scroll.rightPadding property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height - onHeightChanged: + // We use an extra property here, since we only want to to be informed about the content size changes. + onContentHeightChanged: { - scroll.height = Math.min(height, maximumHeight) + scroll.height = Math.min(contentHeight, maximumHeight) popup.height = scroll.height + buttonRow.height } + Component.onCompleted: { - scroll.height = Math.min(height, maximumHeight) + scroll.height = Math.min(contentHeight, maximumHeight) popup.height = scroll.height + buttonRow.height } diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 62ecf48cc5..604e0f668d 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -10,9 +10,9 @@ import Cura 1.0 as Cura ListView { id: listView - height: childrenRect.height model: Cura.GlobalStacksModel {} section.property: "hasRemoteConnection" + property real contentHeight: childrenRect.height section.delegate: Label { From c6fb0d70af8877f840f6cbbc8348eaa4dc63b8de Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:22:53 +0100 Subject: [PATCH 093/120] Use medium font size for everything in stage menu Except the material manufacturer, which should remain default. Contributes to issue CURA-6025. --- plugins/SimulationView/SimulationViewMenuComponent.qml | 4 ++-- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 4 ++-- resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml | 4 ++++ resources/qml/ViewsSelector.qml | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index fe32fe9eb1..4c952d4c43 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -43,7 +43,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_medium") renderType: Text.NativeRendering } @@ -60,7 +60,7 @@ Cura.ExpandableComponent } height: parent.height elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 207b65afc7..3001efac54 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -86,7 +86,7 @@ Cura.ExpandablePopup { text: model.material elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") renderType: Text.NativeRendering @@ -107,7 +107,7 @@ Cura.ExpandablePopup { text: catalog.i18nc("@label", "Select configuration") elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") renderType: Text.NativeRendering diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index 94da5bdd6f..5ae9488cd3 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -29,6 +29,7 @@ RowLayout } return "" } + font: UM.Theme.getFont("medium") UM.SettingPropertyProvider { @@ -43,6 +44,7 @@ RowLayout { source: UM.Theme.getIcon("category_infill") text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%" + font: UM.Theme.getFont("medium") UM.SettingPropertyProvider { @@ -57,6 +59,7 @@ RowLayout { source: UM.Theme.getIcon("category_support") text: supportEnabled.properties.value == "True" ? enabledText : disabledText + font: UM.Theme.getFont("medium") UM.SettingPropertyProvider { @@ -71,6 +74,7 @@ RowLayout { source: UM.Theme.getIcon("category_adhesion") text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText + font: UM.Theme.getFont("medium") UM.SettingPropertyProvider { diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index 1f5a0bbc85..da9693be6e 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -51,7 +51,7 @@ Cura.ExpandablePopup verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_medium") renderType: Text.NativeRendering } From d020a49b751d885ff366f648c1d1b0d0c46ee003 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:26:55 +0100 Subject: [PATCH 094/120] Assign a font to Marketplace button Otherwise the font face may be different, and the theme has no effect on the font. Contributes to issue CURA-6025. --- resources/qml/MainWindow/MainWindowHeader.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index e3b7e199fa..3e296ead40 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -102,6 +102,7 @@ Item { id: label text: marketplaceButton.text + font: UM.Theme.getFont("default") color: marketplaceButton.hovered ? UM.Theme.getColor("main_window_header_background") : UM.Theme.getColor("primary_text") width: contentWidth verticalAlignment: Text.AlignVCenter From c74d6fc1e7c6fe01a4e03719861e580e5bbc4640 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:32:49 +0100 Subject: [PATCH 095/120] Make printerTypeLabel smaller More in line with the theme. Contributes to issue CURA-6025. --- 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 cfc9e56513..b445228e83 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -29,7 +29,7 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter renderType: Text.NativeRendering - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("small") color: UM.Theme.getColor("text") } } \ No newline at end of file From 8d8133d521d546b19bf32c2fa58a96894a7d152e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:34:57 +0100 Subject: [PATCH 096/120] Make synced material name larger than the rest In accordance with the designs. Contributes to issue CURA-6025. --- .../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 a344e31d4f..db6a97aa65 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -39,7 +39,7 @@ Row 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") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") } Label From 60a5438db6b10942357ba77d40b9d61202780886 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:43:31 +0100 Subject: [PATCH 097/120] Make expandable component header fonts larger As per the design. Contributes to issue CURA-6025. --- resources/qml/ExpandableComponentHeader.qml | 2 +- resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml | 2 +- resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 2 +- resources/qml/ViewsSelector.qml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponentHeader.qml b/resources/qml/ExpandableComponentHeader.qml index 09ea262c82..94066340e3 100644 --- a/resources/qml/ExpandableComponentHeader.qml +++ b/resources/qml/ExpandableComponentHeader.qml @@ -25,7 +25,7 @@ Cura.RoundedRectangle { id: headerLabel text: "" - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter color: UM.Theme.getColor("small_button_text") diff --git a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml index a3ed5040b7..18409dd43a 100644 --- a/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml @@ -16,7 +16,7 @@ Item { id: header text: catalog.i18nc("@header", "Configurations") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("small_button_text") height: contentHeight renderType: Text.NativeRendering diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 4d6d80c1b4..5cecda4e5c 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -23,7 +23,7 @@ Item { id: header text: catalog.i18nc("@header", "Custom") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("small_button_text") height: contentHeight renderType: Text.NativeRendering diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index da9693be6e..0e9be649db 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -68,7 +68,7 @@ Cura.ExpandablePopup } height: parent.height elide: Text.ElideRight - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") renderType: Text.NativeRendering } From 44f21b37ac613fc229e32fa507077b1641d2fede Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:49:03 +0100 Subject: [PATCH 098/120] Make labels on left side of recommended mode larger Contributes to issue CURA-6025. --- .../Recommended/RecommendedAdhesionSelector.qml | 1 + .../Recommended/RecommendedInfillDensitySelector.qml | 1 + .../Recommended/RecommendedQualityProfileSelector.qml | 1 + .../Recommended/RecommendedSupportSelector.qml | 1 + 4 files changed, 4 insertions(+) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml index a5f35f333b..941199707c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -26,6 +26,7 @@ Item anchors.left: parent.left source: UM.Theme.getIcon("category_adhesion") text: catalog.i18nc("@label", "Adhesion") + font: UM.Theme.getFont("medium") width: labelColumnWidth } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 0da53cc1c1..b733a576e4 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -63,6 +63,7 @@ Item anchors.left: parent.left source: UM.Theme.getIcon("category_infill") text: catalog.i18nc("@label", "Infill") + " (%)" + font: UM.Theme.getFont("medium") width: labelColumnWidth } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 1e71134404..af145410b5 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -173,6 +173,7 @@ Item id: qualityRowTitle source: UM.Theme.getIcon("category_layer_height") text: catalog.i18nc("@label", "Layer Height") + font: UM.Theme.getFont("medium") anchors.left: parent.left anchors.right: customisedSettings.left } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 87fb664713..0e834ac4df 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -27,6 +27,7 @@ Item visible: enableSupportCheckBox.visible source: UM.Theme.getIcon("category_support") text: catalog.i18nc("@label", "Support") + font: UM.Theme.getFont("medium") width: labelColumnWidth } From 4be9fbb75ec6f31d51fbed3e44086dc756b22f08 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 13:57:49 +0100 Subject: [PATCH 099/120] Give tick marks a font Otherwise it uses your system's font, which is not consistent. Contributes to issue CURA-6025. --- .../Recommended/RecommendedInfillDensitySelector.qml | 1 + .../Recommended/RecommendedQualityProfileSelector.qml | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index b733a576e4..19f199fea6 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -141,6 +141,7 @@ Item Label { text: index + font: UM.Theme.getFont("default") visible: (index % 20) == 0 // Only show steps of 20% anchors.horizontalCenter: parent.horizontalCenter y: UM.Theme.getSize("thin_margin").height diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index af145410b5..801e76382b 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -272,6 +272,7 @@ Item return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2)) } } + font: UM.Theme.getFont("default") } } } From cf6cce5df0f4da01adbb8631d3349d4b8e8d2d33 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 14:00:39 +0100 Subject: [PATCH 100/120] Make 'Profile' text larger As per the design. Contributes to issue CURA-6025. --- .../qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml index 8baaf9a7ae..32c07a52a6 100644 --- a/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Custom/GlobalProfileSelector.qml @@ -25,7 +25,7 @@ Item right: globalProfileSelection.left } text: catalog.i18nc("@label", "Profile") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter } From 66aeb2d1dd0bd8e59dbd4c988b282fbb664c48c9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 14:27:01 +0100 Subject: [PATCH 101/120] Give print time estimate a large font Contributes to issue CURA-6025. --- 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 03fa00d504..223ddacb31 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -51,7 +51,7 @@ Column text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("large_bold") } Cura.IconWithText From c92a0f1fd43d79e24f70ff3e7f09774769743fcb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:09:15 +0100 Subject: [PATCH 102/120] Fix bold fonts on Linux I'm not sure how this performs on other platforms, but on mine it needs at least 63 weight for bold. This is because there is a normal font at weight 40 and a bold font at weight 85. From 63+ it rounds to the bold font with the closest weight then. Contributes to issue CURA-6025. --- 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 b14fdf0b4f..dbd1ad34b1 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -11,7 +11,7 @@ }, "large_bold": { "size": 1.35, - "weight": 60, + "weight": 63, "family": "Noto Sans" }, "medium": { @@ -21,7 +21,7 @@ }, "medium_bold": { "size": 1.16, - "weight": 60, + "weight": 63, "family": "Noto Sans" }, "default": { @@ -31,7 +31,7 @@ }, "default_bold": { "size": 0.95, - "weight": 60, + "weight": 63, "family": "Noto Sans" }, "default_italic": { From df0351acd44386e6a50809d842c379cece3938d7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:14:23 +0100 Subject: [PATCH 103/120] Fix fonts of plug-in tiles Contributes to issue CURA-6025. --- plugins/Toolbox/resources/qml/SmallRatingWidget.qml | 2 +- plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml | 2 +- resources/qml/PrintSetupTooltip.qml | 3 ++- resources/qml/ToolTip.qml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/Toolbox/resources/qml/SmallRatingWidget.qml b/plugins/Toolbox/resources/qml/SmallRatingWidget.qml index 4950ea9242..965b81dc0f 100644 --- a/plugins/Toolbox/resources/qml/SmallRatingWidget.qml +++ b/plugins/Toolbox/resources/qml/SmallRatingWidget.qml @@ -30,7 +30,7 @@ Row width: contentWidth anchors.verticalCenter: starIcon.verticalCenter color: starIcon.color - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering } } \ No newline at end of file diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index 58e4f070e0..a11c6ee963 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -112,7 +112,7 @@ Item elide: Text.ElideRight width: parent.width wrapMode: Text.WordWrap - color: UM.Theme.getColor("text_medium") + color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") anchors.top: name.bottom anchors.bottom: rating.top diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 693b703813..6b1538d849 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -41,7 +41,8 @@ UM.PointingRectangle { base.opacity = 0; } - Label { + Label + { id: label; anchors { top: parent.top; diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml index 87586f76d8..e82caf01b2 100644 --- a/resources/qml/ToolTip.qml +++ b/resources/qml/ToolTip.qml @@ -25,7 +25,7 @@ ToolTip text: "" delay: 500 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 From 30ab1a957ff935872ba6cad4a8cf1fcc461bdc61 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:18:50 +0100 Subject: [PATCH 104/120] Make headers of Marketplace large As per the design. Contributes to issue CURA-6025. --- plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml | 2 +- plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml index 85f0ff8be4..a9fcb39b28 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml @@ -22,7 +22,7 @@ Column text: gridArea.heading width: parent.width color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("large") renderType: Text.NativeRendering } Grid diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml index 820b74554a..795622cf82 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml @@ -23,7 +23,7 @@ Rectangle text: catalog.i18nc("@label", "Featured") width: parent.width color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("large") renderType: Text.NativeRendering } Grid From 346c8209597ad3c7357320ae4cd6475d82a6ef41 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:22:34 +0100 Subject: [PATCH 105/120] Remove hover color for Marketplace header tabs It was not desirable, as discussed with the designer. Contributes to issue CURA-6025. --- 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 dbd1ad34b1..fa8f96b6b3 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -298,7 +298,7 @@ "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_inactive": [0, 0, 0, 255], "toolbox_header_button_text_hovered": [0, 0, 0, 255], "favorites_header_bar": [245, 245, 245, 255], From 7ef8287e52c686cab72cf674a7cbd7c3df713aa5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:33:37 +0100 Subject: [PATCH 106/120] Fix theming of back button in Marketplace Give it a bit more space for if the translated text is wider, and if it is wider also align it properly with the arrow. Contributes to issue CURA-6025. --- plugins/Toolbox/resources/qml/ToolboxBackColumn.qml | 9 +++++++-- plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml | 2 +- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml b/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml index edb1967fee..dba9f19ccd 100644 --- a/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml +++ b/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml @@ -61,8 +61,13 @@ Item id: labelStyle text: control.text color: control.enabled ? (control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive") - font: UM.Theme.getFont("default_bold") - horizontalAlignment: Text.AlignRight + font: UM.Theme.getFont("medium_bold") + horizontalAlignment: Text.AlignLeft + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + } width: control.width renderType: Text.NativeRendering } diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml index e1d01db59a..a85a69cbac 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml @@ -37,7 +37,7 @@ ScrollView width: page.width text: catalog.i18nc("@title:tab", "Plugins") color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("large") renderType: Text.NativeRendering } Rectangle diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index fa8f96b6b3..e0a1c0f9bd 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -487,7 +487,7 @@ "toolbox_detail_header": [1.0, 14.0], "toolbox_detail_tile": [1.0, 8.0], "toolbox_back_column": [6.0, 1.0], - "toolbox_back_button": [4.0, 2.0], + "toolbox_back_button": [6.0, 2.0], "toolbox_installed_tile": [1.0, 8.0], "toolbox_property_label": [1.0, 2.0], "toolbox_heading_label": [1.0, 3.8], From 4177faa6eac5b65d796fe27f3e16a0c82ec1cf34 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:37:31 +0100 Subject: [PATCH 107/120] Fix font usage in installed plug-ins Several different font sizes should be used here. Contributes to issue CURA-6025. --- plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml index 593e024309..333d4dd50a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml @@ -49,13 +49,14 @@ Item width: parent.width height: Math.floor(UM.Theme.getSize("toolbox_property_label").height) wrapMode: Text.WordWrap - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("large_bold") color: pluginInfo.color renderType: Text.NativeRendering } Label { text: model.description + font: UM.Theme.getFont("default") maximumLineCount: 3 elide: Text.ElideRight width: parent.width @@ -82,6 +83,7 @@ Item return model.author_name } } + font: UM.Theme.getFont("medium") width: parent.width height: Math.floor(UM.Theme.getSize("toolbox_property_label").height) wrapMode: Text.WordWrap @@ -96,6 +98,7 @@ Item Label { text: model.version + font: UM.Theme.getFont("default") width: parent.width height: UM.Theme.getSize("toolbox_property_label").height color: UM.Theme.getColor("text") From 6092402a878c6ba4bab877b31dbf1033dc9c8a8e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 31 Dec 2018 15:44:09 +0100 Subject: [PATCH 108/120] Fix 'Slicing...' message when not autoslicing Also changes the 'auto slicing' text to just 'slicing', because that's more what the user expects. Discussed with UX. Contributes to issue CURA-6025. --- 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 6c3b136ca0..51c5e4cac7 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,9 +44,9 @@ Column { id: autoSlicingLabel width: parent.width - visible: prepareButtons.autoSlice && (widget.backendState == UM.Backend.Processing || widget.backendState == UM.Backend.NotStarted) + visible: progressBar.visible - text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...") + text: catalog.i18nc("@label:PrintjobStatus", "Slicing...") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") renderType: Text.NativeRendering From a0031853d365a3ad9d44f898be77df66899a3a9d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Jan 2019 11:32:49 +0100 Subject: [PATCH 109/120] Fix button color in toolpanel for dark theme --- resources/themes/cura-light/styles.qml | 2 +- resources/themes/cura-light/theme.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 89729fc08c..2c4dab7c89 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -256,7 +256,7 @@ QtObject source: control.iconSource width: Theme.getSize("button_icon").width height: Theme.getSize("button_icon").height - color: Theme.getColor("toolbar_button_text") + color: Theme.getColor("icon") sourceSize: Theme.getSize("button_icon") } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2b9ce3d218..d56869d895 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -118,7 +118,6 @@ "warning": [245, 166, 35, 255], "disabled": [229, 229, 229, 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], From 9be1f8aa7bff7d3c8bc1b107c7656de920e86603 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Jan 2019 11:33:49 +0100 Subject: [PATCH 110/120] Removed marketplace menu item from top menu It was a bit double since we had the marketplace button in the top bar --- resources/qml/MainWindow/ApplicationMenu.qml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 04c068cb54..a694b8e403 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -83,14 +83,6 @@ Item } } - Menu - { - id: plugin_menu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Marketplace") - - MenuItem { action: Cura.Actions.browsePackages } - } - Menu { id: preferencesMenu From df23097a99b1b1d027b55c64332354ec5d070ae2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Jan 2019 11:36:07 +0100 Subject: [PATCH 111/120] Changed the label for when no remote configurations are loaded yet --- resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 684e575bfd..e57b21cb78 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -51,7 +51,7 @@ Item anchors.left: icon.right anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.") + text: catalog.i18nc("@label", "Downloading the configurations from the remote printer") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") renderType: Text.NativeRendering From 9e0a423f28775c59204b62482f04e46464589a23 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 2 Jan 2019 13:30:16 +0100 Subject: [PATCH 112/120] Disable visibility of glass buildplate configuration in sync menu Because the build plate swapping is not implemented yet. --- 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 51ba77d012..5e47cafcf1 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -187,7 +187,7 @@ Button rightMargin: UM.Theme.getSize("wide_margin").width } height: childrenRect.height - visible: configuration.buildplateConfiguration != "" + visible: configuration.buildplateConfiguration != "" && false //Buildplate is disabled as long as we have no printers that properly support buildplate swapping (so we can't test). UM.RecolorImage { From 71632fd098fd4e55a54948adaeb6c6af460d5782 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Jan 2019 13:53:35 +0100 Subject: [PATCH 113/120] Add the postProcessing button back next to the slice button CURA-6043 --- .../qml/ActionPanel/SliceProcessWidget.qml | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 6c3b136ca0..4c5ae24f25 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -107,7 +107,13 @@ Column { id: sliceButton fixedWidthMode: true - anchors.fill: parent + + height: parent.height + + anchors.right: additionalComponents.left + anchors.rightMargin: additionalComponents.width != 0 ? UM.Theme.getSize("default_margin").width : 0 + anchors.left: parent.left + text: catalog.i18nc("@button", "Slice") tooltip: catalog.i18nc("@label", "Start the slicing process") enabled: widget.backendState != UM.Backend.Error @@ -119,12 +125,47 @@ Column { id: cancelButton fixedWidthMode: true - anchors.fill: parent + height: parent.height + anchors.left: parent.left + + anchors.right: additionalComponents.left + anchors.rightMargin: additionalComponents.width != 0 ? UM.Theme.getSize("default_margin").width : 0 text: catalog.i18nc("@button", "Cancel") enabled: sliceButton.enabled visible: !sliceButton.visible onClicked: sliceOrStopSlicing() } + Item + { + id: additionalComponents + width: childrenRect.width + anchors.right: parent.right + height: parent.height + Row + { + id: additionalComponentsRow + anchors.verticalCenter: parent.verticalCenter + spacing: UM.Theme.getSize("default_margin").width + } + } + Component.onCompleted: prepareButtons.addAdditionalComponents("saveButton") + + Connections + { + target: CuraApplication + onAdditionalComponentsChanged: prepareButtons.addAdditionalComponents("saveButton") + } + + function addAdditionalComponents (areaId) + { + if(areaId == "saveButton") + { + for (var component in CuraApplication.additionalComponents["saveButton"]) + { + CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow + } + } + } } From 96a6b7559eec9d6c79925cc253c754e615a5bb68 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 2 Jan 2019 14:04:56 +0100 Subject: [PATCH 114/120] Remember opened state of settings panel So if you restart Cura while the settings panel was open, it'll stay open when Cura is started back up. Contributes to issue CURA-6069. --- cura/CuraApplication.py | 1 + resources/qml/ExpandableComponent.qml | 2 +- resources/qml/PrintSetupSelector/PrintSetupSelector.qml | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 0edf6c1899..4d1c530237 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -500,6 +500,7 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/use_multi_build_plate", False) preferences.addPreference("view/settings_list_height", 600) + preferences.addPreference("view/settings_visible", False) preferences.addPreference("cura/currency", "€") preferences.addPreference("cura/material_settings", "{}") diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index afe15bcb1d..025c63d754 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -64,7 +64,7 @@ Item property alias iconSize: collapseButton.height // Is the "drawer" open? - readonly property alias expanded: contentContainer.visible + 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 diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 2d4d7f6cf1..48ac07679d 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -29,4 +29,7 @@ Cura.ExpandableComponent property var extrudersModel: CuraApplication.getExtrudersModel() contentItem: PrintSetupSelectorContents {} + + onExpandedChanged: UM.Preferences.setValue("view/settings_visible", expanded) + Component.onCompleted: expanded = UM.Preferences.getValue("view/settings_visible") } \ No newline at end of file From a5385b229acf0afc5f1b1fca9cd7dee368c3054d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 2 Jan 2019 16:37:19 +0100 Subject: [PATCH 115/120] Make text in printer type label bigger Just shown it to our UX designer and she thinks it's better this way. Contributes to issue CURA-6025. --- 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 b445228e83..cfc9e56513 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -29,7 +29,7 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter renderType: Text.NativeRendering - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } } \ No newline at end of file From ee72284616bbf191cdc71c7ac9b1471dca926ba6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 3 Jan 2019 08:32:39 +0100 Subject: [PATCH 116/120] Use appropriate log level CURA-6035 --- plugins/UM3NetworkPrinting/src/SendMaterialJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py index ab6ebfef2e..9d0d3dbbad 100644 --- a/plugins/UM3NetworkPrinting/src/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py @@ -97,7 +97,7 @@ class SendMaterialJob(Job): file_path = container_registry.getContainerFilePathById(root_material_id) if not file_path: - Logger.log("e", "Cannot get file path for material container [%s]", root_material_id) + Logger.log("w", "Cannot get file path for material container [%s]", root_material_id) continue file_name = os.path.basename(file_path) From 3505eb321f5e7908840caeb49e8faa0a9dcdf5c7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 3 Jan 2019 09:42:22 +0100 Subject: [PATCH 117/120] Also add space for the savebutton additional components with the output widget CURA-6043 --- .../qml/ActionPanel/OutputProcessWidget.qml | 56 ++++++++++++++----- .../qml/ActionPanel/SliceProcessWidget.qml | 1 + 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 03fa00d504..a8797670b4 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -40,8 +40,7 @@ Column anchors { left: parent.left - right: printInformationPanel.left - rightMargin: printInformationPanel.visible ? UM.Theme.getSize("thin_margin").width : 0 + right: parent.right } Cura.IconWithText @@ -52,6 +51,13 @@ Column text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("default_bold") + PrintInformationWidget + { + id: printInformationPanel + visible: !preSlicedData + anchors.left: parent.left + anchors.leftMargin: parent.contentWidth + UM.Theme.getSize("default_margin").width + } } Cura.IconWithText @@ -84,20 +90,43 @@ Column return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } source: UM.Theme.getIcon("spool") + + Item + { + id: additionalComponents + width: childrenRect.width + anchors.right: parent.right + height: parent.height + Row + { + id: additionalComponentsRow + anchors.right: parent.right + anchors.bottom: parent.bottom + spacing: UM.Theme.getSize("default_margin").width + } + } + Component.onCompleted: addAdditionalComponents("saveButton") + + Connections + { + target: CuraApplication + onAdditionalComponentsChanged: addAdditionalComponents("saveButton") + } + + function addAdditionalComponents (areaId) + { + if(areaId == "saveButton") + { + for (var component in CuraApplication.additionalComponents["saveButton"]) + { + CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow + } + } + } } } - PrintInformationWidget - { - id: printInformationPanel - visible: !preSlicedData - anchors - { - right: parent.right - verticalCenter: timeAndCostsInformation.verticalCenter - } - } } Item @@ -127,9 +156,6 @@ Column 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 4c5ae24f25..127f454902 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -135,6 +135,7 @@ Column visible: !sliceButton.visible onClicked: sliceOrStopSlicing() } + Item { id: additionalComponents From 195d39f698cda58b1bedcfcf2d75acb4c2de344d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 3 Jan 2019 09:47:48 +0100 Subject: [PATCH 118/120] Update the style of the postprocessing button CURA-6043 --- .../PostProcessingPlugin.qml | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 09fda8d454..5aa7660237 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -484,7 +484,7 @@ UM.Dialog onClicked: dialog.accept() } - Button + Cura.SecondaryButton { objectName: "postProcessingSaveAreaButton" visible: activeScriptsList.count > 0 @@ -492,41 +492,7 @@ UM.Dialog width: height tooltip: catalog.i18nc("@info:tooltip", "Change active post-processing scripts") onClicked: dialog.show() - - 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") : - control.pressed ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - color: !control.enabled ? UM.Theme.getColor("action_button_disabled") : - 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) - - width: parent.height - height: parent.height - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(parent.width / 2) - height: Math.round(parent.height / 2) - 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") - source: "postprocessing.svg" - } - } - label: Label { } - } + iconSource: "postprocessing.svg" + fixedWidthMode: true } } \ No newline at end of file From 979fd507dee720501422e17045b71c5abc46f467 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 3 Jan 2019 10:39:43 +0100 Subject: [PATCH 119/120] Give the section delegates a fixed height This fixes the issue where the first printer would be drawn over the section label CURA-6011 --- resources/qml/PrinterSelector/MachineSelectorList.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 604e0f668d..b9c20d0de1 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -18,7 +18,7 @@ ListView { text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") width: parent.width - height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width renderType: Text.NativeRendering font: UM.Theme.getFont("medium") From 707c3a26a88400bc2e0cd781053a0f5a3a3de938 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 3 Jan 2019 11:05:54 +0100 Subject: [PATCH 120/120] Make job specs not bold As per the design. Contributes to issue CURA-6025. --- resources/qml/JobSpecs.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index c7f82b8876..144616c22d 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -97,7 +97,7 @@ Item style: TextFieldStyle { textColor: UM.Theme.getColor("text_scene") - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("default") background: Rectangle { opacity: 0 @@ -115,7 +115,7 @@ Item height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_scene") text: CuraApplication.getSceneBoundingBoxString }