From 67feaab385d831f109c4d82b5f9e0bbd3291d8db Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 25 Apr 2018 18:01:45 +0200 Subject: [PATCH 01/10] Updating changelog about engine icon Added more details about the work I did. Additionally, I think your effort in designing the final icon should be also mentioned! I'm left-handed with UI designing as you know.. --- plugins/ChangeLogPlugin/ChangeLog.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index d132f17b5c..1aea958e37 100755 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -66,8 +66,8 @@ Generate a cube mesh to prevent support material generation in specific areas of *Real bridging - smartavionics New experimental feature that detects bridges, adjusting the print speed, slow and fan speed to enhance print quality on bridging parts. -*Updated CuraEngine executable - thopiekar -The CuraEngine executable now contains a dedicated icon, author information and a license. +*Updated CuraEngine executable - thopiekar & Ultimaker B.V. +The CuraEngine executable contains a dedicated icon, author and license info on Windows now. The icon has been designed by Ultimaker B.V. *Use RapidJSON and ClipperLib from system libraries Application updated to use verified copies of libraries, reducing maintenance time keeping them up to date (the operating system is now responsible), as well as reducing the amount of code shipped (as necessary code is already on the user’s system). From 86d4c51e62f3e075b104fd9f39ed2c31bf87cb07 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 25 Apr 2018 18:04:12 +0200 Subject: [PATCH 02/10] Adding some love I doubt (too) serious people will stand this.. --- plugins/ChangeLogPlugin/ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index 1aea958e37..9cb9a60e79 100755 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -66,7 +66,7 @@ Generate a cube mesh to prevent support material generation in specific areas of *Real bridging - smartavionics New experimental feature that detects bridges, adjusting the print speed, slow and fan speed to enhance print quality on bridging parts. -*Updated CuraEngine executable - thopiekar & Ultimaker B.V. +*Updated CuraEngine executable - thopiekar & Ultimaker B.V. ❤️ The CuraEngine executable contains a dedicated icon, author and license info on Windows now. The icon has been designed by Ultimaker B.V. *Use RapidJSON and ClipperLib from system libraries From 8e3e5f50b4d3d7fb5263fe1a90ca66f3ae7e8943 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 11 May 2018 09:32:52 +0200 Subject: [PATCH 03/10] Improve translation of short time format It wasn't short enough. Fixes #3692. --- resources/i18n/de_DE/cura.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/i18n/de_DE/cura.po b/resources/i18n/de_DE/cura.po index 2c44fd7da5..046c5a30d6 100644 --- a/resources/i18n/de_DE/cura.po +++ b/resources/i18n/de_DE/cura.po @@ -3558,7 +3558,7 @@ msgstr "Druckeinrichtung deaktiviert\nG-Code-Dateien können nicht geändert wer #: /home/ruben/Projects/Cura/resources/qml/Sidebar.qml:380 msgctxt "@label Hours and minutes" msgid "00h 00min" -msgstr "00 Stunden 00 Minuten" +msgstr "00 St. 00 M." #: /home/ruben/Projects/Cura/resources/qml/Sidebar.qml:398 msgctxt "@tooltip" @@ -5493,7 +5493,7 @@ msgstr "Cura-Profil-Reader" #~ msgctxt "@label" #~ msgid "00h 00min" -#~ msgstr "00 Stunden 00 Minuten" +#~ msgstr "00 St. 00 M." #~ msgctxt "@tooltip" #~ msgid "Time information" @@ -5517,7 +5517,7 @@ msgstr "Cura-Profil-Reader" #~ msgctxt "@label" #~ msgid "Check material compatibility" -#~ msgstr "Materialkompatibilität prüfen" #~ msgctxt "name" #~ msgid "UM3 Network Connection (Cluster)" From 7d725936efd63cbb8f06330f2b88083ad9294771 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 11:43:34 +0200 Subject: [PATCH 04/10] Clean up the package manager a bit: - Remove an unused method. - Safely check if the plugin info exist --- cura/CuraPackageManager.py | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index e3e187ad50..6b8391832d 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -130,7 +130,6 @@ class CuraPackageManager(QObject): return None def getAllInstalledPackagesInfo(self) -> dict: - # Add bundled, installed, and to-install packages to the set of installed package IDs all_installed_ids = set() @@ -150,6 +149,7 @@ class CuraPackageManager(QObject): if package_id in Application.getInstance().getRequiredPlugins(): continue + package_info = None # Add bundled plugins if package_id in self._bundled_package_dict: package_info = self._bundled_package_dict[package_id]["package_info"] @@ -162,47 +162,24 @@ class CuraPackageManager(QObject): if package_id in self._to_install_package_dict: package_info = self._to_install_package_dict[package_id]["package_info"] + if package_info is None: + continue + # We also need to get information from the plugin registry such as if a plugin is active - if package_info["package_type"] == "plugin": - package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) - else: - package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) + package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) # If the package ID is in bundled, label it as such - if package_info["package_id"] in self._bundled_package_dict.keys(): - package_info["is_bundled"] = True - else: - package_info["is_bundled"] = False + package_info["is_bundled"] = package_info["package_id"] in self._bundled_package_dict.keys() # If there is not a section in the dict for this type, add it if package_info["package_type"] not in installed_packages_dict: installed_packages_dict[package_info["package_type"]] = [] # Finally, add the data - installed_packages_dict[package_info["package_type"]].append( package_info ) + installed_packages_dict[package_info["package_type"]].append(package_info) return installed_packages_dict - def __convertPluginMetadataToPackageMetadata(self, plugin_metadata: dict) -> dict: - package_metadata = { - "package_id": plugin_metadata["id"], - "package_type": "plugin", - "display_name": plugin_metadata["plugin"]["name"], - "description": plugin_metadata["plugin"].get("description"), - "package_version": plugin_metadata["plugin"]["version"], - "cura_version": int(plugin_metadata["plugin"]["api"]), - "website": "", - "author_id": plugin_metadata["plugin"].get("author", "UnknownID"), - "author": { - "author_id": plugin_metadata["plugin"].get("author", "UnknownID"), - "display_name": plugin_metadata["plugin"].get("author", ""), - "email": "", - "website": "", - }, - "tags": ["plugin"] - } - return package_metadata - # Checks if the given package is installed. def isPackageInstalled(self, package_id: str) -> bool: return self.getInstalledPackageInfo(package_id) is not None From 16c9c4a3887e97c8d3ae8baee789be33325487e3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 11 May 2018 11:47:18 +0200 Subject: [PATCH 05/10] Don't correct bed origin any more It's not needed with current versions of the Printrbot Simple version of Marlin, or even the version that the printers are shipped with. Thanks to tenten8401 for the debugging. Fixes #3711. --- resources/definitions/printrbot_simple.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/printrbot_simple.def.json b/resources/definitions/printrbot_simple.def.json index 7c86617ce5..e56a9d8647 100644 --- a/resources/definitions/printrbot_simple.def.json +++ b/resources/definitions/printrbot_simple.def.json @@ -32,7 +32,7 @@ "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" }, "machine_start_gcode": { - "default_value": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;home X/Y\nG28 Z0 ;home Z\nG92 E0 ;zero the extruded length\nG29 ;initiate auto bed leveling sequence\nG92 X132.4 Y20 ;correct bed origin (G29 changes it)" + "default_value": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;home X/Y\nG28 Z0 ;home Z\nG92 E0 ;zero the extruded length\nG29 ;initiate auto bed leveling sequence" }, "machine_end_gcode": { "default_value": "M104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nM106 S0 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit\nG1 Z+1 E-5 F9000 ;move Z up a bit and retract even more\nG28 X0 Y0 ;home X/Y, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" From 806b1f707ffa66d4a8dc8dfc72fdc7bee671fe06 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 14:03:28 +0200 Subject: [PATCH 06/10] Change layout of the installed plugins tab. - There were some alignment problems when there were more than 2 buttons in a column (disable, uninstall and update) - Now the progress bar shows on top of the "Update" button. --- .../resources/qml/ToolboxInstalledTile.qml | 247 +++++------------- .../qml/ToolboxInstalledTileActions.qml | 93 +++++++ resources/themes/cura-light/theme.json | 3 - 3 files changed, 159 insertions(+), 184 deletions(-) create mode 100644 plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml index dd089debca..6004832a57 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml @@ -1,21 +1,18 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM Item { + height: UM.Theme.getSize("toolbox_installed_tile").height + width: parent.width property bool canUpdate: false property bool isEnabled: true - height: UM.Theme.getSize("toolbox_installed_tile").height - anchors - { - left: parent.left - right: parent.right - } + Rectangle { color: UM.Theme.getColor("lining") @@ -23,198 +20,86 @@ Item height: UM.Theme.getSize("default_lining").height anchors.bottom: parent.bottom } - Column + Row { - id: pluginInfo - property var color: model.type === "plugin" && !isEnabled ? UM.Theme.getColor("lining") : UM.Theme.getColor("text") + id: tileRow height: parent.height - anchors - { - left: parent.left - top: parent.top - right: authorInfo.left - topMargin: UM.Theme.getSize("default_margin").height - rightMargin: UM.Theme.getSize("default_margin").width - } - Label - { - text: model.name - width: parent.width - height: UM.Theme.getSize("toolbox_property_label").height - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default_bold") - color: pluginInfo.color - } - Text - { - text: model.description - maximumLineCount: 3 - elide: Text.ElideRight - width: parent.width - wrapMode: Text.WordWrap - color: pluginInfo.color - } - } - Column - { - id: authorInfo - height: parent.height - width: Math.floor(UM.Theme.getSize("toolbox_action_button").width * 1.25) - anchors - { - top: parent.top - topMargin: UM.Theme.getSize("default_margin").height - right: pluginActions.left - rightMargin: UM.Theme.getSize("default_margin").width - } - Label - { - text: - { - if (model.author_email) - { - return "" + model.author_name + "" - } - else - { - return model.author_name - } - } - width: parent.width - height: UM.Theme.getSize("toolbox_property_label").height - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignLeft - onLinkActivated: Qt.openUrlExternally("mailto:" + model.author_email + "?Subject=Cura: " + model.name + " Plugin") - color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("lining") - linkColor: UM.Theme.getColor("text_link") - } - } - Column - { - id: pluginActions - width: childrenRect.width - height: childrenRect.height - spacing: UM.Theme.getSize("default_margin").height - anchors - { - top: parent.top - right: parent.right - topMargin: UM.Theme.getSize("default_margin").height - } - Button + width: parent.width + spacing: UM.Theme.getSize("default_margin").width + topPadding: UM.Theme.getSize("default_margin").height + + CheckBox { id: disableButton - text: isEnabled ? catalog.i18nc("@action:button", "Disable") : catalog.i18nc("@action:button", "Enable") + checked: isEnabled visible: model.type == "plugin" + width: visible ? UM.Theme.getSize("checkbox").width : 0 enabled: !toolbox.isDownloading - style: ButtonStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: "transparent" - border - { - width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") - } - } - label: Label - { - text: control.text - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } + style: UM.Theme.styles.checkbox onClicked: toolbox.isEnabled(model.id) ? toolbox.disable(model.id) : toolbox.enable(model.id) } - Button + Column { - id: removeButton - text: catalog.i18nc("@action:button", "Uninstall") - visible: !model.is_bundled - enabled: !toolbox.isDownloading - style: ButtonStyle + id: pluginInfo + topPadding: UM.Theme.getSize("default_margin").height / 2 + property var color: model.type === "plugin" && !isEnabled ? UM.Theme.getColor("lining") : UM.Theme.getColor("text") + width: tileRow.width - (authorInfo.width + pluginActions.width + 2 * tileRow.spacing + ((disableButton.visible) ? disableButton.width + tileRow.spacing : 0)) + Label { - background: Rectangle + text: model.name + width: parent.width + height: UM.Theme.getSize("toolbox_property_label").height + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default_bold") + color: pluginInfo.color + } + Label + { + text: model.description + maximumLineCount: 3 + elide: Text.ElideRight + width: parent.width + wrapMode: Text.WordWrap + color: pluginInfo.color + } + } + Column + { + id: authorInfo + width: Math.floor(UM.Theme.getSize("toolbox_action_button").width * 1.25) + + Label + { + text: { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: "transparent" - border + if (model.author_email) { - width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") + return "" + model.author_name + "" + } + else + { + return model.author_name } } - label: Label - { - text: control.text - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } + width: parent.width + height: UM.Theme.getSize("toolbox_property_label").height + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + onLinkActivated: Qt.openUrlExternally("mailto:" + model.author_email + "?Subject=Cura: " + model.name + " Plugin") + color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("lining") + linkColor: UM.Theme.getColor("text_link") } - onClicked: toolbox.uninstall(model.id) } - Button + ToolboxInstalledTileActions { - id: updateButton - text: catalog.i18nc("@action:button", "Update") - visible: canUpdate - style: ButtonStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("toolbox_action_button").width - implicitHeight: UM.Theme.getSize("toolbox_action_button").height - color: control.hovered ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary") - } - label: Label - { - text: control.text - color: control.hovered ? UM.Theme.getColor("button_text") : UM.Theme.getColor("button_text_hover") - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font: UM.Theme.getFont("default_bold") - } - } - onClicked: toolbox.update(model.id) + id: pluginActions } - ProgressBar + Connections { - id: progressbar - anchors - { - left: updateButton.left - right: updateButton.right - top: updateButton.bottom - topMargin: Math.floor(UM.Theme.getSize("default_margin") / 4) - } - value: toolbox.isDownloading ? toolbox.downloadProgress : 0 - visible: toolbox.isDownloading - style: ProgressBarStyle - { - background: Rectangle - { - color: UM.Theme.getColor("lining") - implicitHeight: Math.floor(UM.Theme.getSize("toolbox_progress_bar").height) - } - progress: Rectangle - { - color: UM.Theme.getColor("primary") - } - } + target: toolbox + onEnabledChanged: isEnabled = toolbox.isEnabled(model.id) + onMetadataChanged: canUpdate = toolbox.canUpdate(model.id) } } - Connections - { - target: toolbox - onEnabledChanged: isEnabled = toolbox.isEnabled(model.id) - onMetadataChanged: canUpdate = toolbox.canUpdate(model.id) - } -} +} \ No newline at end of file diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml new file mode 100644 index 0000000000..1921bcb58e --- /dev/null +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -0,0 +1,93 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Toolbox is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +Column +{ + width: UM.Theme.getSize("toolbox_action_button").width + spacing: UM.Theme.getSize("narrow_margin").height + + Item + { + width: parent.width + height: childrenRect.height + visible: canUpdate + Button + { + id: updateButton + text: catalog.i18nc("@action:button", "Update") + style: ButtonStyle + { + background: Rectangle + { + implicitWidth: UM.Theme.getSize("toolbox_action_button").width + implicitHeight: UM.Theme.getSize("toolbox_action_button").height + color: control.hovered ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary") + } + label: Label + { + text: control.text + color: control.hovered ? UM.Theme.getColor("button_text") : UM.Theme.getColor("button_text_hover") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font: UM.Theme.getFont("default_bold") + } + } + onClicked: toolbox.update(model.id) + } + ProgressBar + { + id: progressbar + width: parent.width + value: toolbox.isDownloading ? toolbox.downloadProgress : 0 + visible: toolbox.isDownloading + style: ProgressBarStyle + { + background: Rectangle + { + color: "transparent" + implicitHeight: UM.Theme.getSize("toolbox_action_button").height + } + progress: Rectangle + { + // TODO Define a good color that fits the purpuse + color: "blue" + opacity: 0.5 + } + } + } + } + Button + { + id: removeButton + text: catalog.i18nc("@action:button", "Uninstall") + visible: !model.is_bundled + enabled: !toolbox.isDownloading + style: ButtonStyle + { + background: Rectangle + { + implicitWidth: UM.Theme.getSize("toolbox_action_button").width + implicitHeight: UM.Theme.getSize("toolbox_action_button").height + color: "transparent" + border + { + width: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("lining") + } + } + label: Label + { + text: control.text + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + onClicked: toolbox.uninstall(model.id) + } +} \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 1be61b523a..f2309fb4a9 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -69,8 +69,6 @@ "colors": { - - "sidebar": [255, 255, 255, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], @@ -458,7 +456,6 @@ "toolbox_property_label": [1.0, 2.0], "toolbox_heading_label": [1.0, 4.0], "toolbox_header": [1.0, 4.0], - "toolbox_action_button": [8.0, 2.5], "toolbox_progress_bar": [8.0, 0.5], "toolbox_chart_row": [1.0, 2.0], "toolbox_action_button": [8.0, 2.5] From 418bedc8f0ca44ee71940eaa79bb3b89a0492920 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 14:10:53 +0200 Subject: [PATCH 07/10] Small fixes and change the "plugins" text to "packages" --- plugins/Toolbox/resources/qml/Toolbox.qml | 2 +- plugins/Toolbox/resources/qml/ToolboxFooter.qml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index f7784ec7ce..01654b7d60 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -78,7 +78,7 @@ Window { id: footer visible: toolbox.restartRequired - height: toolbox.restartRequired ? UM.Theme.getSize("toolbox_footer").height : 0 + height: visible ? UM.Theme.getSize("toolbox_footer").height : 0 } // TODO: Clean this up: Connections diff --git a/plugins/Toolbox/resources/qml/ToolboxFooter.qml b/plugins/Toolbox/resources/qml/ToolboxFooter.qml index b83d14a08b..980ac5f8c9 100644 --- a/plugins/Toolbox/resources/qml/ToolboxFooter.qml +++ b/plugins/Toolbox/resources/qml/ToolboxFooter.qml @@ -14,8 +14,7 @@ Item height: visible ? Math.floor(UM.Theme.getSize("toolbox_footer").height) : 0 Label { - visible: toolbox.restartRequired - text: catalog.i18nc("@info", "You will need to restart Cura before changes in plugins have effect.") + text: catalog.i18nc("@info", "You will need to restart Cura before changes in packages have effect.") height: Math.floor(UM.Theme.getSize("toolbox_footer_button").height) verticalAlignment: Text.AlignVCenter anchors @@ -38,7 +37,6 @@ Item right: parent.right rightMargin: UM.Theme.getSize("wide_margin").width } - visible: toolbox.restartRequired iconName: "dialog-restart" onClicked: toolbox.restart() style: ButtonStyle @@ -61,7 +59,7 @@ Item } ToolboxShadow { - visible: toolbox.restartRequired + visible: footer.visible anchors.bottom: footer.top reversed: true } From 675b5b199791c6925750e97928384d6ba41abf2d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 14:47:56 +0200 Subject: [PATCH 08/10] Use the application language for the dates --- plugins/Toolbox/resources/qml/ToolboxDetailPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index d57acac52d..120a422b53 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -115,7 +115,7 @@ Item text: { var date = new Date(details.last_updated) - return date.toLocaleString(Qt.locale()) + return date.toLocaleString(UM.Preferences.getValue("general/language")) } font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text") From fa97d5830b9ae89f8dcef47e4a4e76904e69f769 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 15:23:40 +0200 Subject: [PATCH 09/10] Fix some crashes and issues in the Toolbox when working with no internet connection. --- .../Toolbox/resources/qml/ToolboxHeader.qml | 6 +- .../resources/qml/ToolboxTabButton.qml | 2 +- plugins/Toolbox/src/Toolbox.py | 89 ++++++++++--------- 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxHeader.qml b/plugins/Toolbox/resources/qml/ToolboxHeader.qml index 59dbe23ea4..88495e3f63 100644 --- a/plugins/Toolbox/resources/qml/ToolboxHeader.qml +++ b/plugins/Toolbox/resources/qml/ToolboxHeader.qml @@ -24,7 +24,8 @@ Item ToolboxTabButton { text: catalog.i18nc("@title:tab", "Plugins") - active: toolbox.viewCategory == "plugin" + active: toolbox.viewCategory == "plugin" && enabled + enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" onClicked: { toolbox.filterModelByProp("packages", "type", "plugin") @@ -35,7 +36,8 @@ Item ToolboxTabButton { text: catalog.i18nc("@title:tab", "Materials") - active: toolbox.viewCategory == "material" + active: toolbox.viewCategory == "material" && enabled + enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" onClicked: { toolbox.filterModelByProp("authors", "package_types", "material") diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml index 0f759c75fb..22fb6d73ca 100644 --- a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxTabButton.qml @@ -43,7 +43,7 @@ Button return UM.Theme.getColor("topbar_button_text_inactive"); } } - font: control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium") + font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic") verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 492439f860..f64e1cd1b9 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -333,8 +333,8 @@ class Toolbox(QObject, Extension): # Handlers for Network Events # -------------------------------------------------------------------------- - def _onNetworkAccessibleChanged(self, accessible: int) -> None: - if accessible == 0: + def _onNetworkAccessibleChanged(self, network_accessibility: QNetworkAccessManager.NetworkAccessibility) -> None: + if network_accessibility == QNetworkAccessManager.NotAccessible: self.resetDownload() def _onRequestFinished(self, reply: QNetworkReply) -> None: @@ -354,50 +354,55 @@ class Toolbox(QObject, Extension): if reply.operation() == QNetworkAccessManager.GetOperation: for type, url in self._request_urls.items(): if reply.url() == url: - try: - json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) + if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: + try: + json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) + + # Check for errors: + if "errors" in json_data: + for error in json_data["errors"]: + Logger.log("e", "%s", error["title"]) + return + + # Create model and apply metadata: + if not self._models[type]: + Logger.log("e", "Could not find the %s model.", type) + break + + # HACK: Eventually get rid of the code from here... + if type is "plugins_showcase" or type is "materials_showcase": + self._metadata["plugins_showcase"] = json_data["data"]["plugin"]["packages"] + self._models["plugins_showcase"].setMetadata(self._metadata["plugins_showcase"]) + self._metadata["materials_showcase"] = json_data["data"]["material"]["authors"] + self._models["materials_showcase"].setMetadata(self._metadata["materials_showcase"]) + else: + # ...until here. + # This hack arises for multiple reasons but the main + # one is because there are not separate API calls + # for different kinds of showcases. + self._metadata[type] = json_data["data"] + self._models[type].setMetadata(self._metadata[type]) + + # Do some auto filtering + # TODO: Make multiple API calls in the future to handle this + if type is "packages": + self._models[type].setFilter({"type": "plugin"}) + if type is "authors": + self._models[type].setFilter({"package_types": "material"}) + + self.metadataChanged.emit() + + if self.loadingComplete() is True: + self.setViewPage("overview") - # Check for errors: - if "errors" in json_data: - for error in json_data["errors"]: - Logger.log("e", "%s", error["title"]) return - - # Create model and apply metadata: - if not self._models[type]: - Logger.log("e", "Could not find the %s model.", type) + except json.decoder.JSONDecodeError: + Logger.log("w", "Toolbox: Received invalid JSON for %s.", type) break - - # HACK: Eventually get rid of the code from here... - if type is "plugins_showcase" or type is "materials_showcase": - self._metadata["plugins_showcase"] = json_data["data"]["plugin"]["packages"] - self._models["plugins_showcase"].setMetadata(self._metadata["plugins_showcase"]) - self._metadata["materials_showcase"] = json_data["data"]["material"]["authors"] - self._models["materials_showcase"].setMetadata(self._metadata["materials_showcase"]) - else: - # ...until here. - # This hack arises for multiple reasons but the main - # one is because there are not separate API calls - # for different kinds of showcases. - self._metadata[type] = json_data["data"] - self._models[type].setMetadata(self._metadata[type]) - - # Do some auto filtering - # TODO: Make multiple API calls in the future to handle this - if type is "packages": - self._models[type].setFilter({"type": "plugin"}) - if type is "authors": - self._models[type].setFilter({"package_types": "material"}) - - self.metadataChanged.emit() - - if self.loadingComplete() is True: - self.setViewPage("overview") - + else: + self.setViewPage("errored") + self.resetDownload() return - except json.decoder.JSONDecodeError: - Logger.log("w", "Toolbox: Received invalid JSON for %s.", type) - break else: # Ignore any operation that is not a get operation From 527f269b5d61614212f803c0321e84a9d70cd8bc Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 11 May 2018 16:32:31 +0200 Subject: [PATCH 10/10] Fix an issue that kept the plugins in the "installed" list despite of already being removed from the data folder. --- cura/CuraPackageManager.py | 1 + plugins/Toolbox/src/Toolbox.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 6b8391832d..c4ae67b228 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -97,6 +97,7 @@ class CuraPackageManager(QObject): def _removeAllScheduledPackages(self) -> None: for package_id in self._to_remove_package_set: self._purgePackage(package_id) + del self._installed_package_dict[package_id] self._to_remove_package_set.clear() self._saveManagementData() diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index f64e1cd1b9..cecfd1b637 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -251,7 +251,6 @@ class Toolbox(QObject, Extension): @pyqtSlot() def restart(self): - self._package_manager._removeAllScheduledPackages() CuraApplication.getInstance().windowClosed() # Checks