From 3adf7d49d017bd16b26de0f6cc1c41cf32260642 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 5 Apr 2019 10:51:06 +0200 Subject: [PATCH 01/22] Switch to the first enabled extruder after setActiveMachine CURA-5930 --- cura/Settings/MachineManager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 3cee636d1d..87f16888cf 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -362,7 +362,6 @@ class MachineManager(QObject): # Mark global stack as invalid ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) return # We're done here - ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder self._global_container_stack = global_stack self._application.setGlobalContainerStack(global_stack) @@ -370,6 +369,11 @@ class MachineManager(QObject): self._initMachineState(global_stack) self._onGlobalContainerChanged() + # Switch to the first enabled extruder + self.updateDefaultExtruder() + default_extruder_position = int(self.defaultExtruderPosition) + ExtruderManager.getInstance().setActiveExtruderIndex(default_extruder_position) + self.__emitChangedSignals() ## Given a definition id, return the machine with this id. From 8fb3a73c3a460f2db87a8fc703223213a12f17e2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 09:40:38 +0200 Subject: [PATCH 02/22] Use boundingBoxChanged signal to recompute convex hull The boundingbox is the signal we should be listening for, since it does the same as the previous ones (and more!). This also fixes the issue that group nodes didn't get their convex hull set correctly on first creation CURA-6416 --- cura/Scene/ConvexHullDecorator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index da71f6920e..1aae97942a 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -60,13 +60,11 @@ class ConvexHullDecorator(SceneNodeDecorator): previous_node = self._node # Disconnect from previous node signals if previous_node is not None and node is not previous_node: - previous_node.transformationChanged.disconnect(self._onChanged) - previous_node.parentChanged.disconnect(self._onChanged) + previous_node.boundingBoxChanged.disconnect(self._onChanged) super().setNode(node) - # Mypy doesn't understand that self._node is no longer optional, so just use the node. - node.transformationChanged.connect(self._onChanged) - node.parentChanged.connect(self._onChanged) + + node.boundingBoxChanged.connect(self._onChanged) self._onChanged() From 0962481bc154ce3cd40e8fce873582b56e7e01da Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 09:43:35 +0200 Subject: [PATCH 03/22] Fix printer type update in the main printer selection menu CURA-6057 --- resources/qml/PrinterSelector/MachineSelectorButton.qml | 6 +++++- resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 33d7958340..98e2042448 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -25,13 +25,17 @@ Button property var outputDevice: null property var printerTypesList: [] + // Indicates if only to update the printer types list when this button is checked + property bool updatePrinterTypesOnlyWhenChecked: true + property var updatePrinterTypesFunction: updatePrinterTypesList // This function converts the printer type string to another string. property var printerTypeLabelConversionFunction: Cura.MachineManager.getAbbreviatedMachineName function updatePrinterTypesList() { - printerTypesList = (outputDevice != null) ? outputDevice.uniquePrinterTypes : [] + var to_update = (updatePrinterTypesOnlyWhenChecked && checked) || !updatePrinterTypesOnlyWhenChecked + printerTypesList = (to_update && outputDevice != null) ? outputDevice.uniquePrinterTypes : [] } contentItem: Item diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 53a3241527..924eeb930d 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -97,6 +97,8 @@ Item printerTypeLabelAutoFit: true + // update printer types for all items in the list + updatePrinterTypesOnlyWhenChecked: false updatePrinterTypesFunction: updateMachineTypes // show printer type as it is printerTypeLabelConversionFunction: function(value) { return value } From b1fe110f9fd8ef32671c3954130195a45a5b4d21 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 5 Apr 2019 08:23:24 +0200 Subject: [PATCH 04/22] Add Cura.TextField CURA-6435 CURA-6057 --- resources/qml/Widgets/TextField.qml | 47 +++++++++++++++++++++++++++++ resources/qml/qmldir | 1 + 2 files changed, 48 insertions(+) create mode 100644 resources/qml/Widgets/TextField.qml diff --git a/resources/qml/Widgets/TextField.qml b/resources/qml/Widgets/TextField.qml new file mode 100644 index 0000000000..8161dfe532 --- /dev/null +++ b/resources/qml/Widgets/TextField.qml @@ -0,0 +1,47 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// Cura-style TextField +// +TextField +{ + id: textField + + UM.I18nCatalog { id: catalog; name: "cura" } + + property int controlWidth: UM.Theme.getSize("setting_control").width + property int controlHeight: UM.Theme.getSize("setting_control").height + + hoverEnabled: true + selectByMouse: true + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + + background: Rectangle + { + anchors.fill: parent + anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) + radius: UM.Theme.getSize("setting_control_radius").width + + border.color: + { + if (!textField.enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + if (textField.hovered || textField.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + } +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index eda0411f42..5f9d209cbe 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -26,6 +26,7 @@ ComboBox 1.0 ComboBox.qml NotificationIcon 1.0 NotificationIcon.qml RadioButton 1.0 RadioButton.qml TabButton 1.0 TabButton.qml +TextField 1.0 TextField.qml # Cura/MachineSettings From 5cce4cd4cd26023625f2c7ba0eb2433925bbd357 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 09:56:32 +0200 Subject: [PATCH 05/22] Fix add by ip page styling CURA-6057 --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 5ec8bd42f8..a6d0f03c75 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -69,16 +69,14 @@ Item width: parent.width anchors.top: explainLabel.bottom - TextField + Cura.TextField { id: hostnameField + width: (parent.width / 2) | 0 + height: addPrinterButton.height anchors.verticalCenter: addPrinterButton.verticalCenter anchors.left: parent.left - height: addPrinterButton.height - anchors.right: addPrinterButton.left anchors.margins: UM.Theme.getSize("default_margin").width - font: UM.Theme.getFont("default") - selectByMouse: true validator: RegExpValidator { @@ -89,11 +87,11 @@ Item onAccepted: addPrinterButton.clicked() } - Cura.PrimaryButton + Cura.SecondaryButton { id: addPrinterButton anchors.top: parent.top - anchors.right: parent.right + anchors.left: hostnameField.right anchors.margins: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@button", "Add") From 086ae1c73513dcb9ac089fdce795c89dc428ef0e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 12:25:52 +0200 Subject: [PATCH 06/22] Make sure the unsuccessful manual device gets removed CURA-6057 --- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index a6bc13f3c2..8d923d3827 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -286,7 +286,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self.refreshConnections() - def _checkManualDevice(self, address): + def _checkManualDevice(self, address: str) -> None: # Check if a UM3 family device exists at this address. # If a printer responds, it will replace the preliminary printer created above # origin=manual is for tracking back the origin of the call @@ -307,7 +307,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): # - Something went wrong with checking the amount of printers the cluster has! # - Couldn't find printer at the address when trying to add it manually. if address in self._manual_instances: - self.removeManualDeviceSignal.emit(self.getPluginId(), "", address) + key = "manual:" + address + self.removeManualDevice(key, address) return if "system" in reply_url: From 0bac3e81114dc39c82c820c7c328d58575fd81ca Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 12:39:18 +0200 Subject: [PATCH 07/22] Fix button text CURA-6057 --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index a6d0f03c75..77a770b4fd 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -238,7 +238,7 @@ Item id: backButton anchors.left: parent.left anchors.bottom: parent.bottom - text: catalog.i18nc("@button", "Cancel") + text: catalog.i18nc("@button", "Back") onClicked: base.showPreviousPage() } From ad51d8f1b6d9fc38131413ad06fa9de8b9d590c4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 13:06:28 +0200 Subject: [PATCH 08/22] Show readable machine type in add by ip page CURA-6057 --- cura/Settings/MachineManager.py | 1 + resources/qml/WelcomePages/AddPrinterByIpContent.qml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 69978ae69f..7d0e7506b8 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1630,6 +1630,7 @@ class MachineManager(QObject): return abbr_machine + @pyqtSlot(str, result = str) def getMachineTypeNameFromId(self, machine_type_id: str) -> str: machine_type_name = "" results = self._container_registry.findDefinitionContainersMetadata(id = machine_type_id) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 77a770b4fd..2930bc8dbe 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -196,7 +196,10 @@ Item { if (UM.OutputDeviceManager.hasManualDevice) { - typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type") + const type_id = UM.OutputDeviceManager.manualDeviceProperty("printer_type") + var readable_type = Cura.MachineManager.getMachineTypeNameFromId(type_id) + readable_type = (readable_type != "") ? readable_type : catalog.i18nc("@label", "Unknown") + typeText.text = readable_type firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version") addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address") } From 0bad57259c866c2e5abc1e05a3e4398df3760822 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 13:27:30 +0200 Subject: [PATCH 09/22] Increased the font size of notification icon to make it more readable CURA-6151 --- resources/qml/Widgets/NotificationIcon.qml | 8 ++++++-- resources/themes/cura-light/theme.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/qml/Widgets/NotificationIcon.qml b/resources/qml/Widgets/NotificationIcon.qml index d06d9f16be..5cf4d17777 100644 --- a/resources/qml/Widgets/NotificationIcon.qml +++ b/resources/qml/Widgets/NotificationIcon.qml @@ -25,12 +25,16 @@ Rectangle Label { id: notificationLabel - anchors.centerIn: parent anchors.fill: parent color: UM.Theme.getColor("primary_text") horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("default") renderType: Text.NativeRendering + + // This is a bit of a hack, but we don't really have enough room for 2 characters (eg 9+). The default font + // does have a tad bit to much spacing. So instead of adding a whole new font, we just modify it a bit for this + // specific instance. + Component.onCompleted: font.letterSpacing = -1 } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index f287e60310..4b2f92e6e5 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -604,7 +604,7 @@ "toolbox_action_button": [8.0, 2.5], "toolbox_loader": [2.0, 2.0], - "notification_icon": [1.4, 1.4], + "notification_icon": [1.5, 1.5], "avatar_image": [6.8, 6.8], From cbfe10a748ae6caf2abb2da19d7c7351587e7c04 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 13:36:48 +0200 Subject: [PATCH 10/22] Prevent a zeroDivision error from crashing the usb printing This fixes #5592 --- plugins/USBPrinting/USBPrinterOutputDevice.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 0c195e9017..667a969e87 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -371,10 +371,17 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._sendCommand("N%d%s*%d" % (self._gcode_position, line, checksum)) - progress = (self._gcode_position / len(self._gcode)) + print_job = self._printers[0].activePrintJob + try: + progress = self._gcode_position / len(self._gcode) + except ZeroDivisionError: + # There is nothing to send! + if print_job is not None: + print_job.updateState("error") + return elapsed_time = int(time() - self._print_start_time) - print_job = self._printers[0].activePrintJob + if print_job is None: controller = GenericOutputController(self) controller.setCanUpdateFirmware(True) From 2a7df3ceddbc568404e2b9c387f24fa6c66b1756 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 8 Apr 2019 13:45:09 +0200 Subject: [PATCH 11/22] Fix untranslated string Contributes to CL-1302 --- plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 8c63e1ef1a..aa4893b3b9 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -140,7 +140,7 @@ Item { id: printerConfiguration anchors.verticalCenter: parent.verticalCenter - buildplate: printer ? "Glass" : null // 'Glass' as a default + buildplate: printer ? catalog.i18nc("@label", "Glass") : null // 'Glass' as a default configurations: { var configs = [] From 4f1282df04b2fb051223fa01c6f8ed56bd5b0679 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 14:10:15 +0200 Subject: [PATCH 12/22] Add ScrollableTextArea CURA-6057 --- resources/qml/Widgets/ScrollableTextArea.qml | 31 ++++++++++++++++++++ resources/qml/qmldir | 1 + 2 files changed, 32 insertions(+) create mode 100644 resources/qml/Widgets/ScrollableTextArea.qml diff --git a/resources/qml/Widgets/ScrollableTextArea.qml b/resources/qml/Widgets/ScrollableTextArea.qml new file mode 100644 index 0000000000..f219f4bb6f --- /dev/null +++ b/resources/qml/Widgets/ScrollableTextArea.qml @@ -0,0 +1,31 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + + +// +// Cura-style TextArea with scrolls +// +ScrollView +{ + property alias textArea: _textArea + + TextArea + { + id: _textArea + font: UM.Theme.getFont("default") + textFormat: TextEdit.PlainText + renderType: Text.NativeRendering + + background: Rectangle // Border + { + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + } + } +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 5f9d209cbe..68c4fa82bc 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -25,6 +25,7 @@ CheckBox 1.0 CheckBox.qml ComboBox 1.0 ComboBox.qml NotificationIcon 1.0 NotificationIcon.qml RadioButton 1.0 RadioButton.qml +Scrollable 1.0 Scrollable.qml TabButton 1.0 TabButton.qml TextField 1.0 TextField.qml From ac1b1a99023ced552bb137ed3bce15715d593b25 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 14:11:25 +0200 Subject: [PATCH 13/22] Use ScrollableTextArea in whats new page CURA-6057 --- .../qml/WelcomePages/WhatsNewContent.qml | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index db6cd3b576..415acae05c 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -27,8 +27,10 @@ Item renderType: Text.NativeRendering } - Rectangle + Cura.ScrollableTextArea { + id: whatsNewTextArea + anchors.top: titleLabel.bottom anchors.bottom: getStartedButton.top anchors.topMargin: UM.Theme.getSize("wide_margin").height @@ -36,27 +38,12 @@ Item anchors.left: parent.left anchors.right: parent.right - border.color: "#dfdfdf" - border.width: UM.Theme.getSize("default_lining").width + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollView - { - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_lining").width - - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - TextArea - { - id: whatsNewTextArea - text: CuraApplication.getTextManager().getChangeLogText() - textFormat: Text.RichText - wrapMode: Text.WordWrap - readOnly: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - } - } + textArea.text: CuraApplication.getTextManager().getChangeLogText() + textArea.textFormat: Text.RichText + textArea.wrapMode: Text.WordWrap + textArea.readOnly: true } Cura.PrimaryButton From 3bf8a1f257aea598dbb1930066f502d9ea37ae4e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 14:12:03 +0200 Subject: [PATCH 14/22] New style more info dialog for SliceInfo CURA-6057 --- plugins/SliceInfoPlugin/MoreInfoWindow.qml | 190 ++++++++++--------- plugins/SliceInfoPlugin/SliceInfo.py | 2 +- resources/qml/Widgets/ScrollableTextArea.qml | 1 + 3 files changed, 99 insertions(+), 94 deletions(-) diff --git a/plugins/SliceInfoPlugin/MoreInfoWindow.qml b/plugins/SliceInfoPlugin/MoreInfoWindow.qml index e00ad6730d..82d5044bed 100644 --- a/plugins/SliceInfoPlugin/MoreInfoWindow.qml +++ b/plugins/SliceInfoPlugin/MoreInfoWindow.qml @@ -1,150 +1,154 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 +import QtQuick.Controls 2.3 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import UM 1.3 as UM -import Cura 1.0 as Cura +import Cura 1.1 as Cura -UM.Dialog +Window { + UM.I18nCatalog { id: catalog; name: "cura" } + id: baseDialog title: catalog.i18nc("@title:window", "More information on anonymous data collection") visible: false + modality: Qt.ApplicationModal + minimumWidth: 500 * screenScaleFactor minimumHeight: 400 * screenScaleFactor width: minimumWidth height: minimumHeight - property bool allowSendData: true // for saving the user's choice + color: UM.Theme.getColor("main_background") - onAccepted: manager.setSendSliceInfo(allowSendData) + property bool allowSendData: true // for saving the user's choice onVisibilityChanged: { if (visible) { - baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info"); + baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info") if (baseDialog.allowSendData) { - allowSendButton.checked = true; + allowSendButton.checked = true } else { - dontSendButton.checked = true; + dontSendButton.checked = true } } } + // Main content area Item { - id: textRow - anchors - { - top: parent.top - bottom: radioButtonsRow.top - bottomMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right - } + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width - Label + Item // Text part { - id: headerText + id: textRow anchors { top: parent.top - left: parent.left - right: parent.right - } - - text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.") - wrapMode: Text.WordWrap - } - - TextArea - { - id: exampleData - anchors - { - top: headerText.bottom - topMargin: UM.Theme.getSize("default_margin").height - bottom: parent.bottom + bottom: radioButtonsRow.top bottomMargin: UM.Theme.getSize("default_margin").height left: parent.left right: parent.right } - text: manager.getExampleData() - readOnly: true - textFormat: TextEdit.PlainText - } - } - - Column - { - id: radioButtonsRow - width: parent.width - anchors.bottom: buttonRow.top - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - - ExclusiveGroup { id: group } - - RadioButton - { - id: dontSendButton - text: catalog.i18nc("@text:window", "I don't want to send this data") - exclusiveGroup: group - onClicked: + Label { - baseDialog.allowSendData = !checked; + id: headerText + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.") + wrapMode: Text.WordWrap + renderType: Text.NativeRendering } - } - RadioButton - { - id: allowSendButton - text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura") - exclusiveGroup: group - onClicked: + + Cura.ScrollableTextArea { - baseDialog.allowSendData = checked; - } - } - } + anchors + { + top: headerText.bottom + topMargin: UM.Theme.getSize("default_margin").height + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_margin").height + left: parent.left + right: parent.right + } - Item - { - id: buttonRow - anchors.bottom: parent.bottom - width: parent.width - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - - UM.I18nCatalog { id: catalog; name: "cura" } - - Button - { - anchors.right: parent.right - text: catalog.i18nc("@action:button", "OK") - onClicked: - { - baseDialog.accepted() - baseDialog.hide() + textArea.text: manager.getExampleData() + textArea.readOnly: true } } - Button + Column // Radio buttons for agree and disagree { + id: radioButtonsRow anchors.left: parent.left - text: catalog.i18nc("@action:button", "Cancel") - onClicked: + anchors.right: parent.right + anchors.bottom: buttonRow.top + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + + Cura.RadioButton { - baseDialog.rejected() - baseDialog.hide() + id: dontSendButton + text: catalog.i18nc("@text:window", "I don't want to send this data") + onClicked: + { + baseDialog.allowSendData = !checked + } + } + Cura.RadioButton + { + id: allowSendButton + text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura") + onClicked: + { + baseDialog.allowSendData = checked + } + } + } + + Item // Bottom buttons + { + id: buttonRow + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + height: childrenRect.height + + Cura.PrimaryButton + { + anchors.right: parent.right + text: catalog.i18nc("@action:button", "OK") + onClicked: + { + manager.setSendSliceInfo(allowSendData) + baseDialog.hide() + } + } + + Cura.SecondaryButton + { + anchors.left: parent.left + text: catalog.i18nc("@action:button", "Cancel") + onClicked: + { + baseDialog.hide() + } } } } diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 065923c43d..3763db5534 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -62,7 +62,7 @@ class SliceInfo(QObject, Extension): def showMoreInfoDialog(self): if self._more_info_dialog is None: self._more_info_dialog = self._createDialog("MoreInfoWindow.qml") - self._more_info_dialog.open() + self._more_info_dialog.show() def _createDialog(self, qml_name): Logger.log("d", "Creating dialog [%s]", qml_name) diff --git a/resources/qml/Widgets/ScrollableTextArea.qml b/resources/qml/Widgets/ScrollableTextArea.qml index f219f4bb6f..065d5e60df 100644 --- a/resources/qml/Widgets/ScrollableTextArea.qml +++ b/resources/qml/Widgets/ScrollableTextArea.qml @@ -21,6 +21,7 @@ ScrollView font: UM.Theme.getFont("default") textFormat: TextEdit.PlainText renderType: Text.NativeRendering + selectByMouse: true background: Rectangle // Border { From 75e92aaa7823bf793ff1d46c076389ce2f927790 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 14:49:52 +0200 Subject: [PATCH 15/22] Adjust printer setup page for Mac CURA-6057 --- .../MachineSettingsAction/MachineSettingsExtruderTab.qml | 8 ++++---- .../MachineSettingsAction/MachineSettingsPrinterTab.qml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml index f941d13561..e05d8e75fc 100644 --- a/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml @@ -20,12 +20,12 @@ Item anchors.right: parent.right anchors.top: parent.top - property int labelWidth: 180 - property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 + property int labelWidth: 210 * screenScaleFactor + property int controlWidth: (UM.Theme.getSize("setting_control").width * 3 / 4) | 0 property var labelFont: UM.Theme.getFont("medium") - property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 - property int columnSpacing: 3 + property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0 + property int columnSpacing: 3 * screenScaleFactor property int propertyStoreIndex: manager.storeContainerIndex // definition_changes property string extruderStackId: "" diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index ccc0548059..3287643286 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -20,12 +20,12 @@ Item anchors.right: parent.right anchors.top: parent.top - property int labelWidth: 130 - property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4 + property int labelWidth: 120 * screenScaleFactor + property int controlWidth: (UM.Theme.getSize("setting_control").width * 3 / 4) | 0 property var labelFont: UM.Theme.getFont("default") - property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2 - property int columnSpacing: 3 + property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0 + property int columnSpacing: 3 * screenScaleFactor property int propertyStoreIndex: manager.storeContainerIndex // definition_changes property string machineStackId: Cura.MachineManager.activeMachineId From a0a9f204546efc580ac2da6a043b600495590a0a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 8 Apr 2019 15:06:37 +0200 Subject: [PATCH 16/22] Fix disagree user agreement CURA-6057 --- resources/qml/WelcomePages/UserAgreementContent.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 7c83df29cd..2c8196f0e1 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -70,7 +70,6 @@ Item onClicked: { CuraApplication.writeToLog("i", "User declined the User Agreement.") - base.endWizard() CuraApplication.closeApplication() // NOTE: Hard exit, don't use if anything needs to be saved! } } From 7bf25a3be50d6e1e31095a2a3d263cbe068c17c0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Apr 2019 16:26:14 +0200 Subject: [PATCH 17/22] Also allow upper case CURAPACKAGE filenames --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 982f371a7b..b6f1268e7f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -211,7 +211,7 @@ UM.MainWindow for (var i = 0; i < drop.urls.length; i++) { var filename = drop.urls[i]; - if (filename.endsWith(".curapackage")) + if (filename.toLowerCase().endsWith(".curapackage")) { // Try to install plugin & close. CuraApplication.getPackageManager().installPackageViaDragAndDrop(filename); From 2765122b957b2dd3c6eefe582fbbc0d788958240 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 17:32:43 +0200 Subject: [PATCH 18/22] Fix case where aborting a download would cause a crash --- plugins/Toolbox/src/Toolbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 306ab8b137..f204445218 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -559,7 +559,7 @@ class Toolbox(QObject, Extension): if self._download_reply: try: self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) - except TypeError: # Raised when the method is not connected to the signal yet. + except (TypeError, RuntimeError): # Raised when the method is not connected to the signal yet. pass # Don't need to disconnect. self._download_reply.abort() self._download_reply = None From 49a9561625b2b324d7efe2030b7794b3db448d5e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 17:43:03 +0200 Subject: [PATCH 19/22] Added exception handling for serial write --- plugins/USBPrinting/USBPrinterOutputDevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 667a969e87..6ce042f32d 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -226,6 +226,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice): except SerialTimeoutException: Logger.log("w", "Timeout when sending command to printer via USB.") self._command_received.set() + except SerialException: + Logger.logException("w", "An unexpected exception occurred while writing to the serial.") + self.setConnectionState(ConnectionState.Error) def _update(self): while self._connection_state == ConnectionState.Connected and self._serial is not None: From 87c4c0328361620636f0727615313827711d0d94 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 9 Apr 2019 10:47:55 +0200 Subject: [PATCH 20/22] Fix incorrect tag in start g-code Fixes #5591 --- resources/definitions/alya3dp.def.json | 2 +- resources/definitions/alyanx3dp.def.json | 2 +- resources/definitions/kupido.def.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/definitions/alya3dp.def.json b/resources/definitions/alya3dp.def.json index f449a89970..7187048da0 100644 --- a/resources/definitions/alya3dp.def.json +++ b/resources/definitions/alya3dp.def.json @@ -44,7 +44,7 @@ }, "machine_end_gcode": { - "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" + "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" } } } \ No newline at end of file diff --git a/resources/definitions/alyanx3dp.def.json b/resources/definitions/alyanx3dp.def.json index efc97c09d1..085acc20c1 100644 --- a/resources/definitions/alyanx3dp.def.json +++ b/resources/definitions/alyanx3dp.def.json @@ -44,7 +44,7 @@ }, "machine_end_gcode": { - "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" + "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" } } } \ No newline at end of file diff --git a/resources/definitions/kupido.def.json b/resources/definitions/kupido.def.json index 577a63581e..191e02ba34 100644 --- a/resources/definitions/kupido.def.json +++ b/resources/definitions/kupido.def.json @@ -43,7 +43,7 @@ }, "machine_end_gcode": { - "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" + "default_value": ";End GCode\nM104 S0 ;extruder heater off \nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" } } } \ No newline at end of file From 74fe1c5aa8f183aa28d76c48ee5965b800ebf3d0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 9 Apr 2019 11:14:52 +0200 Subject: [PATCH 21/22] Set the alignWhenCentered to false so the radio button is perfectly centered instead of shifted Contributes to CURA-6057. --- resources/qml/Widgets/RadioButton.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Widgets/RadioButton.qml b/resources/qml/Widgets/RadioButton.qml index eaa18c44cb..b101b3739b 100644 --- a/resources/qml/Widgets/RadioButton.qml +++ b/resources/qml/Widgets/RadioButton.qml @@ -27,6 +27,7 @@ RadioButton implicitWidth: UM.Theme.getSize("radio_button").width implicitHeight: UM.Theme.getSize("radio_button").height anchors.verticalCenter: parent.verticalCenter + anchors.alignWhenCentered: false radius: width / 2 border.width: UM.Theme.getSize("default_lining").width border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") From 9cc4665db860557a3bc80d9d1765ee73a8ad2113 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 9 Apr 2019 17:10:18 +0200 Subject: [PATCH 22/22] Fix crash for when resetDownload is called after a long wait CURA-6448 --- plugins/Toolbox/src/Toolbox.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index f204445218..085c5d1bde 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -561,7 +561,13 @@ class Toolbox(QObject, Extension): self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) except (TypeError, RuntimeError): # Raised when the method is not connected to the signal yet. pass # Don't need to disconnect. - self._download_reply.abort() + try: + self._download_reply.abort() + except RuntimeError: + # In some cases the garbage collector is a bit to agressive, which causes the dowload_reply + # to be deleted (especially if the machine has been put to sleep). As we don't know what exactly causes + # this (The issue probably lives in the bowels of (py)Qt somewhere), we can only catch and ignore it. + pass self._download_reply = None self._download_request = None self.setDownloadProgress(0)