From cca33bb4a587cc6869b565d5bfd36e2ef0e5a199 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Mon, 10 Jul 2023 13:50:37 +0200 Subject: [PATCH 01/11] Added refresh moving icon for feedback purpose While refreshing the material sync, no feedback was provided before, now there is a refreshing icon animation available for "refresh in progress" fixes: CURA-8754 --- .../Materials/MaterialsSyncDialog.qml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 87a8d00ec42..5c40f938372 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -429,10 +429,59 @@ UM.Window Cura.SecondaryButton { id: refreshListButton + property int accountState: Cura.API.account.syncState Layout.alignment: Qt.AlignVCenter text: catalog.i18nc("@button", "Refresh List") iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") onClicked: Cura.API.account.sync(true) + + onAccountStateChanged: { + if (Cura.API.account.syncState == 0) + { + refreshListButton.visible = false; + } + if (Cura.API.account.syncState == 1) + { + refreshListButton.visible = true; + } + } + } + + Item + { + width: childrenRect.width + Layout.alignment: Qt.AlignVCenter + height: refreshListButton.height + visible: !refreshListButton.visible + + UM.ColorImage + { + id: refreshingIcon + height: UM.Theme.getSize("action_button_icon").height + width: height + anchors.verticalCenter: refreshingLabel.verticalCenter + source: UM.Theme.getIcon("ArrowDoubleCircleRight") + color: UM.Theme.getColor("primary") + + RotationAnimator + { + target: refreshingIcon + from: 0 + to: 360 + duration: 1000 + loops: Animation.Infinite + running: true + } + } + UM.Label + { + id: refreshingLabel + anchors.left: refreshingIcon.right + anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + text: catalog.i18nc("@button", "Refreshing...") + color: UM.Theme.getColor("primary") + font: UM.Theme.getFont("medium") + } } Cura.TertiaryButton From d12659f71f5838ac9442a6b302ba21cce2116a89 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Mon, 10 Jul 2023 14:36:14 +0200 Subject: [PATCH 02/11] Added refresh moving icon for feedback purpose While refreshing the material sync, no feedback was provided before, now there is a refreshing icon animation available for "refresh in progress" fixes: CURA-8754 --- resources/qml/Preferences/Materials/MaterialsSyncDialog.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 5c40f938372..a82789d01c6 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -430,17 +430,19 @@ UM.Window { id: refreshListButton property int accountState: Cura.API.account.syncState + readonly property int _AccountSyncState_SYNCING: 0 + readonly property int _AccountSyncState_SUCCESS: 1 Layout.alignment: Qt.AlignVCenter text: catalog.i18nc("@button", "Refresh List") iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") onClicked: Cura.API.account.sync(true) onAccountStateChanged: { - if (Cura.API.account.syncState == 0) + if (Cura.API.account.syncState == _AccountSyncState_SYNCING) { refreshListButton.visible = false; } - if (Cura.API.account.syncState == 1) + else if (Cura.API.account.syncState == _AccountSyncState_SUCCESS) { refreshListButton.visible = true; } From 63e78d313c66588b8425d08a948fe16e3c2f2e00 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Mon, 10 Jul 2023 15:10:00 +0200 Subject: [PATCH 03/11] Add some basic hardware specs to logs Contributes to CURA-10767 --- cura/CuraApplication.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6b04503ebcd..889e442eaa5 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -5,6 +5,7 @@ import sys import tempfile import time +import platform from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict import numpy @@ -828,6 +829,8 @@ def _setLoadingHint(self, hint: str): def run(self): super().run() + self._log_hardware_info() + if len(ApplicationMetadata.DEPENDENCY_INFO) > 0: Logger.debug("Using Conan managed dependencies: " + ", ".join( [dep["recipe"]["id"] for dep in ApplicationMetadata.DEPENDENCY_INFO["installed"] if dep["recipe"]["version"] != "latest"])) @@ -901,6 +904,14 @@ def run(self): self.exec() + def _log_hardware_info(self): + hardware_info = platform.uname() + Logger.info(f"System: {hardware_info.system}") + Logger.info(f"Release: {hardware_info.release}") + Logger.info(f"Version: {hardware_info.version}") + Logger.info(f"Processor name: {hardware_info.processor}") + Logger.info(f"CPU Cores: {os.cpu_count()}") + def __setUpSingleInstanceServer(self): if self._use_single_instance: self._single_instance.startServer() From 3e18082db610570bede2724aba09367f868fd4e7 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 11 Jul 2023 11:45:37 +0200 Subject: [PATCH 04/11] Code review comments fixes: CURA-8754 --- .../Materials/MaterialsSyncDialog.qml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index a82789d01c6..8fa2f72e60c 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -429,24 +429,13 @@ UM.Window Cura.SecondaryButton { id: refreshListButton - property int accountState: Cura.API.account.syncState - readonly property int _AccountSyncState_SYNCING: 0 - readonly property int _AccountSyncState_SUCCESS: 1 Layout.alignment: Qt.AlignVCenter + readonly property int _AccountSyncState_SYNCING: 0 + visible: Cura.API.account.syncState != _AccountSyncState_SYNCING + enabled: visible text: catalog.i18nc("@button", "Refresh List") iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") onClicked: Cura.API.account.sync(true) - - onAccountStateChanged: { - if (Cura.API.account.syncState == _AccountSyncState_SYNCING) - { - refreshListButton.visible = false; - } - else if (Cura.API.account.syncState == _AccountSyncState_SUCCESS) - { - refreshListButton.visible = true; - } - } } Item From 9407345377bf0479148308dbbe3ae2c7797b9724 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Wed, 12 Jul 2023 16:04:56 +0200 Subject: [PATCH 05/11] Color Picker from Qt 6.4 Native platform dialog is available on iOS,Linux (when running with the GTK+ platform theme) and macOS fixes: CURA-10687 --- resources/qml/ColorDialog.qml | 152 ------------------ .../Preferences/Materials/MaterialsView.qml | 6 +- 2 files changed, 3 insertions(+), 155 deletions(-) delete mode 100644 resources/qml/ColorDialog.qml diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml deleted file mode 100644 index 99d46ed3273..00000000000 --- a/resources/qml/ColorDialog.qml +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2022 UltiMaker -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.15 -import QtQuick.Controls 2.2 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.1 - -import UM 1.7 as UM -import Cura 1.7 as Cura - - -/* -* A dialog that provides the option to pick a color. Currently it only asks for a hex code and shows the color -* in a color swath -*/ -UM.Dialog -{ - id: base - - property variant catalog: UM.I18nCatalog { name: "cura" } - - margin: UM.Theme.getSize("default_margin").width - - property alias swatchGridColumns: colorSwatchGrid.columns - - // In this case we would like to let the content of the dialog determine the size of the dialog - // however with the current implementation of the dialog this is not possible, so instead we calculate - // the size of the dialog ourselves. - // Ugly workaround for windows having overlapping elements due to incorrect dialog width - minimumWidth: content.width + (Qt.platform.os === "windows" ? 4 * margin : 2 * margin) - minimumHeight: { - const footerHeight = Math.max(okButton.height, cancelButton.height); - return content.height + footerHeight + (Qt.platform.os === "windows" ? 5 * margin : 3 * margin); - } - - property alias color: colorInput.text - property var swatchColors: [ - "#2161AF", "#57AFB2", "#F7B32D", "#E33D4A", "#C088AD", - "#5D88BE", "#5ABD0E", "#E17239", "#F74E46", "#874AF9", - "#50C2EC", "#8DC15A", "#C3977A", "#CD7776", "#9086BA", - "#FFFFFF", "#D3D3D3", "#9E9E9E", "#5A5A5A", "#000000", - ] - - Component.onCompleted: updateSwatches() - onSwatchColorsChanged: updateSwatches() - - function updateSwatches() - { - swatchColorsModel.clear(); - for (const swatchColor of base.swatchColors) - { - swatchColorsModel.append({ swatchColor }); - } - } - - Column - { - id: content - width: childrenRect.width - height: childrenRect.height - spacing: UM.Theme.getSize("wide_margin").height - - GridLayout { - id: colorSwatchGrid - columns: 5 - width: childrenRect.width - height: childrenRect.height - columnSpacing: UM.Theme.getSize("thick_margin").width - rowSpacing: UM.Theme.getSize("thick_margin").height - - Repeater - { - model: ListModel - { - id: swatchColorsModel - } - - delegate: Rectangle - { - color: swatchColor - implicitWidth: UM.Theme.getSize("medium_button_icon").width - implicitHeight: UM.Theme.getSize("medium_button_icon").height - radius: width / 2 - - UM.ColorImage - { - anchors.fill: parent - visible: swatchColor == base.color - source: UM.Theme.getIcon("Check", "low") - color: UM.Theme.getColor("checkbox") - } - - MouseArea - { - anchors.fill: parent - onClicked: base.color = swatchColor - } - } - } - } - - RowLayout - { - width: parent.width - spacing: UM.Theme.getSize("default_margin").width - - UM.Label - { - text: catalog.i18nc("@label", "Hex") - } - - Cura.TextField - { - id: colorInput - Layout.fillWidth: true - text: "#FFFFFF" - selectByMouse: true - onTextChanged: { - if (!text.startsWith("#")) - { - text = `#${text}`; - } - } - validator: UM.HexColorValidator {} - } - - Rectangle - { - color: base.color - Layout.preferredHeight: parent.height - Layout.preferredWidth: height - } - } - } - - buttonSpacing: UM.Theme.getSize("thin_margin").width - - rightButtons: - [ - Cura.TertiaryButton { - id: cancelButton - text: catalog.i18nc("@action:button", "Cancel") - onClicked: base.close() - }, - Cura.PrimaryButton { - id: okButton - text: catalog.i18nc("@action:button", "OK") - onClicked: base.accept() - } - ] -} \ No newline at end of file diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index d37150075be..3245009a967 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -256,12 +256,12 @@ Item // popup dialog to select a new color // if successful it sets the properties.color_code value to the new color - Cura.ColorDialog + ColorDialog { id: colorDialog title: catalog.i18nc("@title", "Material color picker") - color: properties.color_code - onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color) + selectedColor: properties.color_code + onAccepted: base.setMetaDataEntry("color_code", properties.color_code, selectedColor) } } } From f5785cf2354e433409225426ce8811e372e32ba4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 14 Jul 2023 11:42:44 +0200 Subject: [PATCH 06/11] Add serialport logging to autobaudjob --- plugins/USBPrinting/AutoDetectBaudJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/AutoDetectBaudJob.py b/plugins/USBPrinting/AutoDetectBaudJob.py index 1b791f61872..9d7a045bccd 100644 --- a/plugins/USBPrinting/AutoDetectBaudJob.py +++ b/plugins/USBPrinting/AutoDetectBaudJob.py @@ -21,7 +21,7 @@ def __init__(self, serial_port: int) -> None: self._all_baud_rates = [115200, 250000, 500000, 230400, 76800, 57600, 38400, 19200, 9600] def run(self) -> None: - Logger.log("d", "Auto detect baud rate started.") + Logger.debug(f"Auto detect baud rate started for {self._serial_port}") wait_response_timeouts = [3, 15, 30] wait_bootloader_times = [1.5, 5, 15] write_timeout = 3 From 9d72cc6acab8b450f703a586b5c807e788b47e17 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 14 Jul 2023 11:45:04 +0200 Subject: [PATCH 07/11] Update logging for autodetect baudrate --- plugins/USBPrinting/AutoDetectBaudJob.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/USBPrinting/AutoDetectBaudJob.py b/plugins/USBPrinting/AutoDetectBaudJob.py index 9d7a045bccd..1a7187be4d7 100644 --- a/plugins/USBPrinting/AutoDetectBaudJob.py +++ b/plugins/USBPrinting/AutoDetectBaudJob.py @@ -46,8 +46,7 @@ def run(self) -> None: wait_bootloader = wait_bootloader_times[retry] else: wait_bootloader = wait_bootloader_times[-1] - Logger.log("d", "Checking {serial} if baud rate {baud_rate} works. Retry nr: {retry}. Wait timeout: {timeout}".format( - serial = self._serial_port, baud_rate = baud_rate, retry = retry, timeout = wait_response_timeout)) + Logger.debug(f"Checking {self._serial_port} if baud rate {baud_rate} works. Retry nr: {retry}. Wait timeout: {wait_response_timeout}") if serial is None: try: @@ -61,7 +60,9 @@ def run(self) -> None: serial.baudrate = baud_rate except ValueError: continue - sleep(wait_bootloader) # Ensure that we are not talking to the boot loader. 1.5 seconds seems to be the magic number + + # Ensure that we are not talking to the boot loader. 1.5 seconds seems to be the magic number + sleep(wait_bootloader) serial.write(b"\n") # Ensure we clear out previous responses serial.write(b"M105\n") @@ -83,4 +84,5 @@ def run(self) -> None: serial.write(b"M105\n") sleep(15) # Give the printer some time to init and try again. + Logger.debug(f"Unable to find a working baudrate for {serial}") self.setResult(None) # Unable to detect the correct baudrate. From e05feb642fcc63bc13b64274e6184269242eee07 Mon Sep 17 00:00:00 2001 From: Randy Zwitch Date: Sat, 15 Jul 2023 13:18:31 -0400 Subject: [PATCH 08/11] Update PULL_REQUEST_TEMPLATE.md When clicked from PR, the link is broken (Chrome, Windows 11). It appears that GitHub might be case-sensitive w.r.t URLs. --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a6327de3b6e..8a014c17bcd 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -28,6 +28,6 @@ This fixes... OR This improves... --> - [ ] My code follows the style guidelines of this project as described in [UltiMaker Meta](https://github.com/Ultimaker/Meta) and [Cura QML best practices](https://github.com/Ultimaker/Cura/wiki/QML-Best-Practices) -- [ ] I have read the [Contribution guide](https://github.com/Ultimaker/Cura/blob/main/contributing.md) +- [ ] I have read the [Contribution guide](https://github.com/Ultimaker/Cura/blob/main/CONTRIBUTING.md) - [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have uploaded any files required to test this change \ No newline at end of file +- [ ] I have uploaded any files required to test this change From 4d99dabefcae552affff698725f887f666bf5db3 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Mon, 17 Jul 2023 10:42:07 +0200 Subject: [PATCH 09/11] Discription added in the tooltip about skirt presence even after disabling it CURA-10758 --- .../Recommended/RecommendedAdhesionSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml index 2183ef7d5eb..07e9c1ffaac 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -17,7 +17,7 @@ RecommendedSettingSection enableSectionSwitchVisible: platformAdhesionType.properties.enabled === "True" enableSectionSwitchChecked: platformAdhesionType.properties.value !== "skirt" && platformAdhesionType.properties.value !== "none" enableSectionSwitchEnabled: recommendedPrintSetup.settingsEnabled - tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.") + tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards. Disabling it results in a skirt around object by default.") property var curaRecommendedMode: Cura.RecommendedMode {} From 62d3e1cf40863064a4a2186a5562f30a3d5a37fa Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 Jul 2023 12:55:52 +0200 Subject: [PATCH 10/11] Automatically scroll down in crash handler It was reaaaaaly annoying me that people would post screenshots all the time. Those screenshots would never include the info you need, because it would only capture the top of the exception / logs. --- cura/CrashHandler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index e6214d7073d..e2f20355c75 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -22,7 +22,7 @@ from PyQt6.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QUrl from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit, QGroupBox, QCheckBox, QPushButton -from PyQt6.QtGui import QDesktopServices +from PyQt6.QtGui import QDesktopServices, QTextCursor from UM.Application import Application from UM.Logger import Logger @@ -309,7 +309,7 @@ def _exceptionInfoWidget(self): trace = "".join(trace_list) text_area.setText(trace) text_area.setReadOnly(True) - + text_area.moveCursor(QTextCursor.MoveOperation.End) # Move cursor to end, so we see last bit of the exception layout.addWidget(text_area) group.setLayout(layout) @@ -400,7 +400,7 @@ def _logInfoWidget(self): text_area.setText(logdata) text_area.setReadOnly(True) - + text_area.moveCursor(QTextCursor.MoveOperation.End) # Move cursor to end, so we see last bit of the log layout.addWidget(text_area) group.setLayout(layout) From 228a3e821e3e9e295130904844f800fe287cc27f Mon Sep 17 00:00:00 2001 From: MariMakes <40423138+MariMakes@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:06:26 +0200 Subject: [PATCH 11/11] Add Support Structure to Basic We show this setting in recommended, so it's safe to say we can show it in basic. --- resources/setting_visibility/basic.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/setting_visibility/basic.cfg b/resources/setting_visibility/basic.cfg index 927989fee31..0193eb26ba7 100644 --- a/resources/setting_visibility/basic.cfg +++ b/resources/setting_visibility/basic.cfg @@ -45,6 +45,7 @@ support_extruder_nr support_type support_angle support_offset +support_structure [platform_adhesion] prime_blob_enable