From 9f21c2bd86a9eca6e878f5cfa1143ddfb6f61f3a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 May 2018 10:15:20 +0200 Subject: [PATCH 1/5] Add CuraPackageVersion --- cura/CuraVersion.py.in | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/CuraVersion.py.in b/cura/CuraVersion.py.in index c489485c2c..1d55f4dd95 100644 --- a/cura/CuraVersion.py.in +++ b/cura/CuraVersion.py.in @@ -4,3 +4,4 @@ CuraVersion = "@CURA_VERSION@" CuraBuildType = "@CURA_BUILDTYPE@" CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False +CuraPackagesVersion = "@CURA_PACKAGES_VERSION" From ea421204f3ab5512072e0216d6d6fc7ed10857f6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 May 2018 11:02:12 +0200 Subject: [PATCH 2/5] Add CURA_PACKAGES_VERSION to CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9296c4ce4e..470d5c966f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ endif() set(CURA_VERSION "master" CACHE STRING "Version name of Cura") set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'") +set(CURA_PACKAGES_VERSION "${CURA_PACKAGES_VERSION}" CACHE STRING "Packages version of Cura") configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY) configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) From 95a4edb8de285ea0af65315945659f4e3026dbba Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 22 May 2018 11:34:41 +0200 Subject: [PATCH 3/5] CURA-5296 Improve button styling --- .../resources/qml/ToolboxDetailTile.qml | 30 +-------- .../qml/ToolboxDetailTileActions.qml | 66 +++++++++++++++++++ .../qml/ToolboxInstalledTileActions.qml | 13 +++- .../resources/qml/ToolboxProgressButton.qml | 41 +++++++++++- resources/bundled_packages.json | 2 +- 5 files changed, 118 insertions(+), 34 deletions(-) create mode 100644 plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml index da53fc94af..355fa5dece 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml @@ -9,7 +9,6 @@ import UM 1.1 as UM Item { id: tile - property bool installed: toolbox.isInstalled(model.id) width: detailList.width - UM.Theme.getSize("wide_margin").width height: normalData.height + compatibilityChart.height + 4 * UM.Theme.getSize("default_margin").height Item @@ -46,7 +45,7 @@ Item } } - Item + ToolboxDetailTileActions { id: controls anchors.right: tile.right @@ -54,28 +53,6 @@ Item width: childrenRect.width height: childrenRect.height - ToolboxProgressButton - { - id: installButton - active: toolbox.isDownloading && toolbox.activePackage == model - complete: tile.installed - readyAction: function() - { - toolbox.activePackage = model - toolbox.startDownload(model.download_url) - } - activeAction: function() - { - toolbox.cancelDownload() - } - completeAction: function() - { - toolbox.viewCategory = "installed" - } - // Don't allow installing while another download is running - enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model) - opacity: enabled ? 1.0 : 0.5 - } } ToolboxCompatibilityChart @@ -94,9 +71,4 @@ Item anchors.top: compatibilityChart.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height + UM.Theme.getSize("wide_margin").height //Normal margin for spacing after chart, wide margin between items. } - Connections - { - target: toolbox - onInstallChanged: installed = toolbox.isInstalled(model.id) - } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml new file mode 100644 index 0000000000..f82fb049d8 --- /dev/null +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml @@ -0,0 +1,66 @@ +// 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 +{ + property bool installed: toolbox.isInstalled(model.id) + property bool canUpdate: toolbox.canUpdate(model.id) + width: UM.Theme.getSize("toolbox_action_button").width + spacing: UM.Theme.getSize("narrow_margin").height + + ToolboxProgressButton + { + id: installButton + active: toolbox.isDownloading && toolbox.activePackage == model + complete: installed + readyAction: function() + { + toolbox.activePackage = model + toolbox.startDownload(model.download_url) + } + activeAction: function() + { + toolbox.cancelDownload() + } + completeAction: function() + { + toolbox.viewCategory = "installed" + } + // Don't allow installing while another download is running + enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model) + opacity: enabled ? 1.0 : 0.5 + } + + ToolboxProgressButton + { + id: updateButton + active: toolbox.isDownloading && toolbox.activePackage == model + readyLabel: catalog.i18nc("@action:button", "Update") + activeLabel: catalog.i18nc("@action:button", "Updating") + completeLabel: catalog.i18nc("@action:button", "Updated") + readyAction: function() + { + toolbox.activePackage = model + toolbox.update(model.id) + } + activeAction: function() + { + toolbox.cancelDownload() + } + // Don't allow installing while another download is running + enabled: !(toolbox.isDownloading && toolbox.activePackage != model) + opacity: enabled ? 1.0 : 0.5 + visible: installed && canUpdate + } + Connections + { + target: toolbox + onInstallChanged: installed = toolbox.isInstalled(model.id) + onMetadataChanged: canUpdate = toolbox.canUpdate(model.id) + } +} diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml index 8bdec4da5f..204b755909 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml +++ b/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml @@ -49,7 +49,17 @@ Column border { width: UM.Theme.getSize("default_lining").width - color: UM.Theme.getColor("lining") + color: + { + if (control.hovered) + { + return UM.Theme.getColor("primary_hover") + } + else + { + return UM.Theme.getColor("lining") + } + } } } label: Label @@ -58,6 +68,7 @@ Column color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + font: UM.Theme.getFont("default") } } onClicked: toolbox.uninstall(model.id) diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index a977ef999b..b598bd96d0 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -68,7 +68,7 @@ Item { if (base.complete) { - return UM.Theme.getColor("action_button_disabled") + return "transparent" } else { @@ -82,6 +82,31 @@ Item } } } + border + { + width: + { + if (base.complete) + { + UM.Theme.getSize("default_lining").width + } + else + { + return 0 + } + } + color: + { + if (control.hovered) + { + return UM.Theme.getColor("primary_hover") + } + else + { + return UM.Theme.getColor("lining") + } + } + } } label: Label { @@ -90,7 +115,7 @@ Item { if (base.complete) { - return UM.Theme.getColor("action_button_disabled_text") + return UM.Theme.getColor("text") } else { @@ -106,7 +131,17 @@ Item } verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - font: UM.Theme.getFont("default_bold") + font: + { + if (base.complete) + { + return UM.Theme.getFont("default") + } + else + { + return UM.Theme.getFont("default_bold") + } + } } } } diff --git a/resources/bundled_packages.json b/resources/bundled_packages.json index 8d58f226b0..5f5ce12554 100644 --- a/resources/bundled_packages.json +++ b/resources/bundled_packages.json @@ -974,7 +974,7 @@ "package_type": "material", "display_name": "Ultimaker ABS", "description": "Example package for material and quality profiles for Ultimaker materials.", - "package_version": "1.0.0", + "package_version": "0.5.0", "cura_version": 4, "website": "https://ultimaker.com/products/materials/abs", "author": { From eea9b7ab4662bba30a5e7f15ea6d50be5cc0e485 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 22 May 2018 12:05:33 +0200 Subject: [PATCH 4/5] CURA-5254 Keep track of the latest manual entry key, so it is then selected in the list. --- plugins/UM3NetworkPrinting/DiscoverUM3Action.py | 10 +++++++++- plugins/UM3NetworkPrinting/DiscoverUM3Action.qml | 5 ++++- plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/DiscoverUM3Action.py index 4c32a1c19c..9b25de7f42 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/DiscoverUM3Action.py @@ -45,6 +45,8 @@ class DiscoverUM3Action(MachineAction): @pyqtSlot() def reset(self): Logger.log("d", "Reset the list of found devices.") + if self._network_plugin: + self._network_plugin.resetLastManualDevice() self.discoveredDevicesChanged.emit() @pyqtSlot() @@ -131,7 +133,7 @@ class DiscoverUM3Action(MachineAction): self._network_plugin.reCheckConnections() @pyqtSlot(result = str) - def getStoredKey(self): + def getStoredKey(self) -> str: global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: meta_data = global_container_stack.getMetaData() @@ -140,6 +142,12 @@ class DiscoverUM3Action(MachineAction): return "" + @pyqtSlot(result = str) + def getLastManualEntryKey(self) -> str: + if self._network_plugin: + return self._network_plugin.getLastManualDevice() + return "" + @pyqtSlot(str, result = bool) def existsKey(self, key) -> bool: return Application.getInstance().getMachineManager().existNetworkInstances(network_key = key) diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml index 1cf2074979..3662fe291e 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml @@ -158,7 +158,10 @@ Cura.MachineAction model: manager.foundDevices onModelChanged: { - var selectedKey = manager.getStoredKey(); + var selectedKey = manager.getLastManualEntryKey() + // If there is no last manual entry key, then we select the stored key (if any) + if (selectedKey == "") + selectedKey = manager.getStoredKey() for(var i = 0; i < model.length; i++) { if(model[i].key == selectedKey) { diff --git a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py index 74a4b044ff..bf5ac96197 100644 --- a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py @@ -60,6 +60,9 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._manual_instances = self._preferences.getValue("um3networkprinting/manual_instances").split(",") + # Store the last manual entry key + self._last_manual_entry_key = "" # type: str + # The zero-conf service changed requests are handled in a separate thread, so we can re-schedule the requests # which fail to get detailed service info. # Any new or re-scheduled requests will be appended to the request queue, and the handling thread will pick @@ -72,6 +75,12 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): def getDiscoveredDevices(self): return self._discovered_devices + def getLastManualDevice(self) -> str: + return self._last_manual_entry_key + + def resetLastManualDevice(self) -> None: + self._last_manual_entry_key = "" + ## Start looking for devices on network. def start(self): self.startDiscovery() @@ -93,6 +102,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): for address in self._manual_instances: if address: self.addManualDevice(address) + self.resetLastManualDevice() def reCheckConnections(self): active_machine = Application.getInstance().getGlobalContainerStack() @@ -136,6 +146,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): if not address: address = self._discovered_devices[key].ipAddress self._onRemoveDevice(key) + self.resetLastManualDevice() if address in self._manual_instances: self._manual_instances.remove(address) @@ -157,6 +168,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): if instance_name not in self._discovered_devices: # Add a preliminary printer instance self._onAddDevice(instance_name, address, properties) + self._last_manual_entry_key = instance_name self._checkManualDevice(address) From fea37b52be2f5bc316d0ec8d80f60f13915d925a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 May 2018 12:06:43 +0200 Subject: [PATCH 5/5] Fix CURA_PACKAGES_VERSION --- CMakeLists.txt | 2 +- cura/CuraVersion.py.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 470d5c966f..96efd68a2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ endif() set(CURA_VERSION "master" CACHE STRING "Version name of Cura") set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'") -set(CURA_PACKAGES_VERSION "${CURA_PACKAGES_VERSION}" CACHE STRING "Packages version of Cura") +set(CURA_PACKAGES_VERSION "" CACHE STRING "Packages version of Cura") configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY) configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) diff --git a/cura/CuraVersion.py.in b/cura/CuraVersion.py.in index 1d55f4dd95..f45a24cae9 100644 --- a/cura/CuraVersion.py.in +++ b/cura/CuraVersion.py.in @@ -4,4 +4,4 @@ CuraVersion = "@CURA_VERSION@" CuraBuildType = "@CURA_BUILDTYPE@" CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False -CuraPackagesVersion = "@CURA_PACKAGES_VERSION" +CuraPackagesVersion = "@CURA_PACKAGES_VERSION@"