From 977c0958a337505b3ef982bc6d77c11e5b8614b6 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 3 Aug 2018 13:40:54 +0200 Subject: [PATCH 1/7] The manually added priters by IP have "(manual) suffix --- plugins/UM3NetworkPrinting/DiscoverUM3Action.qml | 7 +------ plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml index 8ecbe016f1..e4d75e8f6d 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml @@ -349,11 +349,6 @@ Cura.MachineAction addressField.focus = true; } - onAccepted: - { - manager.setManualDevice(printerKey, addressText) - } - Column { anchors.fill: parent spacing: UM.Theme.getSize("default_margin").height @@ -393,7 +388,7 @@ Cura.MachineAction text: catalog.i18nc("@action:button", "OK") onClicked: { - manualPrinterDialog.accept() + manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) manualPrinterDialog.hide() } enabled: manualPrinterDialog.addressText.trim() != "" diff --git a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py index 3644bbf056..f4749a6747 100644 --- a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py @@ -198,7 +198,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version instance_name = "manual:%s" % address properties = { - b"name": system_info["name"].encode("utf-8"), + b"name": (system_info["name"] + " (manual)").encode("utf-8"), b"address": address.encode("utf-8"), b"firmware_version": system_info["firmware"].encode("utf-8"), b"manual": b"true", From 99cb9e93b30fcc8ca061ef379d0df81b7b9ba1d4 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 3 Aug 2018 13:46:22 +0200 Subject: [PATCH 2/7] Revert "The manually added priters by IP have "(manual) suffix" This reverts commit 977c0958a337505b3ef982bc6d77c11e5b8614b6. --- plugins/UM3NetworkPrinting/DiscoverUM3Action.qml | 7 ++++++- plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml index e4d75e8f6d..8ecbe016f1 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml @@ -349,6 +349,11 @@ Cura.MachineAction addressField.focus = true; } + onAccepted: + { + manager.setManualDevice(printerKey, addressText) + } + Column { anchors.fill: parent spacing: UM.Theme.getSize("default_margin").height @@ -388,7 +393,7 @@ Cura.MachineAction text: catalog.i18nc("@action:button", "OK") onClicked: { - manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) + manualPrinterDialog.accept() manualPrinterDialog.hide() } enabled: manualPrinterDialog.addressText.trim() != "" diff --git a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py index f4749a6747..3644bbf056 100644 --- a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py @@ -198,7 +198,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version instance_name = "manual:%s" % address properties = { - b"name": (system_info["name"] + " (manual)").encode("utf-8"), + b"name": system_info["name"].encode("utf-8"), b"address": address.encode("utf-8"), b"firmware_version": system_info["firmware"].encode("utf-8"), b"manual": b"true", From 2a6da9fe8ea901aaa3942b20363285ec78fe55c8 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 3 Aug 2018 14:28:45 +0200 Subject: [PATCH 3/7] Only show material packages when clicking an author Contributes to CURA-5604 --- .../resources/qml/ToolboxDownloadsGridTile.qml | 4 ++++ plugins/Toolbox/src/Toolbox.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index 392b867071..f7b964b957 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -115,6 +115,10 @@ Item { toolbox.viewPage = "author" toolbox.filterModelByProp("packages", "author_id", model.id) + toolbox.setFilters("packages", { + "author_id": model.id, + "type": "material" + }) } break default: diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index a9d0bb03d1..fbc2f98b3b 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -783,7 +783,16 @@ class Toolbox(QObject, Extension): self._models[modelType].setFilter({ filterType: parameter }) self.filterChanged.emit() - @pyqtSlot() + @pyqtSlot(str, "QVariantMap") + def setFilters(self, modelType: str, filterDict: dict): + if not self._models[modelType]: + Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", modelType) + return + print(filterDict) + self._models[modelType].setFilter(filterDict) + self.filterChanged.emit() + + @pyqtSlot(str) def removeFilters(self, modelType: str): if not self._models[modelType]: Logger.log("w", "Toolbox: Couldn't remove filters on %s model because it doesn't exist.", modelType) From 7856e4746711c648a24d34b25a9d95f821495763 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 3 Aug 2018 14:30:49 +0200 Subject: [PATCH 4/7] Remove old filtering Contributes to CURA-5604 --- plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml index f7b964b957..ebd4c006f8 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml @@ -114,7 +114,6 @@ Item else { toolbox.viewPage = "author" - toolbox.filterModelByProp("packages", "author_id", model.id) toolbox.setFilters("packages", { "author_id": model.id, "type": "material" From 8268419eda658541ca03e793047a0ff064954aad Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 3 Aug 2018 14:31:30 +0200 Subject: [PATCH 5/7] Remove debug print() Contributes to CURA-5604 --- plugins/Toolbox/src/Toolbox.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index fbc2f98b3b..e948236baf 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -788,7 +788,6 @@ class Toolbox(QObject, Extension): if not self._models[modelType]: Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", modelType) return - print(filterDict) self._models[modelType].setFilter(filterDict) self.filterChanged.emit() From 1bacdabf358ae8a52342aca8b29263cc680c42f2 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 3 Aug 2018 14:42:34 +0200 Subject: [PATCH 6/7] Minor refactor --- plugins/Toolbox/src/Toolbox.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index e948236baf..c4205b8ed5 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -776,25 +776,25 @@ class Toolbox(QObject, Extension): # Filter Models: # -------------------------------------------------------------------------- @pyqtSlot(str, str, str) - def filterModelByProp(self, modelType: str, filterType: str, parameter: str): - if not self._models[modelType]: - Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", modelType) + def filterModelByProp(self, model_type: str, filter_type: str, parameter: str) -> None: + if not self._models[model_type]: + Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", model_type) return - self._models[modelType].setFilter({ filterType: parameter }) + self._models[model_type].setFilter({filter_type: parameter}) self.filterChanged.emit() @pyqtSlot(str, "QVariantMap") - def setFilters(self, modelType: str, filterDict: dict): - if not self._models[modelType]: - Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", modelType) + def setFilters(self, model_type: str, filter_dict: dict) -> None: + if not self._models[model_type]: + Logger.log("w", "Toolbox: Couldn't filter %s model because it doesn't exist.", model_type) return - self._models[modelType].setFilter(filterDict) + self._models[model_type].setFilter(filter_dict) self.filterChanged.emit() @pyqtSlot(str) - def removeFilters(self, modelType: str): - if not self._models[modelType]: - Logger.log("w", "Toolbox: Couldn't remove filters on %s model because it doesn't exist.", modelType) + def removeFilters(self, model_type: str) -> None: + if not self._models[model_type]: + Logger.log("w", "Toolbox: Couldn't remove filters on %s model because it doesn't exist.", model_type) return - self._models[modelType].setFilter({}) + self._models[model_type].setFilter({}) self.filterChanged.emit() From 944ababa1cb44e7c33249e81692ce2a5c8d5994e Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 3 Aug 2018 14:48:04 +0200 Subject: [PATCH 7/7] Copy normal tile behavior to showcase tiles Contributes to CURA-5604 --- .../qml/ToolboxDownloadsShowcaseTile.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml index 2ca0b522fe..15d1ae302c 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml @@ -105,8 +105,21 @@ Rectangle switch(toolbox.viewCategory) { case "material": - toolbox.viewPage = "author" - toolbox.filterModelByProp("packages", "author_name", model.name) + + // If model has a type, it must be a package + if (model.type !== undefined) + { + toolbox.viewPage = "detail" + toolbox.filterModelByProp("packages", "id", model.id) + } + else + { + toolbox.viewPage = "author" + toolbox.setFilters("packages", { + "author_id": model.id, + "type": "material" + }) + } break default: toolbox.viewPage = "detail"