From 85490dc58ac789d88415c51254d7f13b0c2f8a7c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 31 Mar 2020 11:52:55 +0200 Subject: [PATCH 1/7] [Marketplace] De-emphasize pre-installed packages. Tried to do it the elegant way, couldn't get that to work within timebox. part of CURA-7240 --- .../qml/pages/ToolboxInstalledPage.qml | 102 ++++++++++++++++-- 1 file changed, 96 insertions(+), 6 deletions(-) diff --git a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index 99590c712c..a85850ae00 100644 --- a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml @@ -31,7 +31,7 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Plugins") + text: catalog.i18nc("@title:tab", "Installed Plugins") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("large") renderType: Text.NativeRendering @@ -61,9 +61,9 @@ ScrollView } Repeater { - id: materialList + id: pluginList model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile {} + delegate: ToolboxInstalledTile { visible: ! model.is_bundled } } } } @@ -76,7 +76,52 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Materials") + text: catalog.i18nc("@title:tab", "Bundled Plugins") + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("large") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + id: bundledPlugins + color: "transparent" + height: childrenRect.height + UM.Theme.getSize("default_margin").width + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + Column + { + anchors + { + top: parent.top + right: parent.right + left: parent.left + margins: UM.Theme.getSize("default_margin").width + } + Repeater + { + id: bundledPluginsList + model: toolbox.pluginsInstalledModel + delegate: ToolboxInstalledTile { visible: model.is_bundled } + } + } + } + + Label + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + text: catalog.i18nc("@title:tab", "Installed Materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering @@ -106,9 +151,54 @@ ScrollView } Repeater { - id: pluginList + id: installedMaterialsList model: toolbox.materialsInstalledModel - delegate: ToolboxInstalledTile {} + delegate: ToolboxInstalledTile { visible: ! model.is_bundled } + } + } + } + + Label + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + text: catalog.i18nc("@title:tab", "Bundled Materials") + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + id: bundledMaterials + color: "transparent" + height: childrenRect.height + UM.Theme.getSize("default_margin").width + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + Column + { + anchors + { + top: parent.top + right: parent.right + left: parent.left + margins: UM.Theme.getSize("default_margin").width + } + Repeater + { + id: bundledMaterialsList + model: toolbox.materialsInstalledModel + delegate: ToolboxInstalledTile { visible: model.is_bundled } } } } From d89fce6240ede4fe5c1490cbf4a1581b59932f80 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 31 Mar 2020 12:02:46 +0200 Subject: [PATCH 2/7] Order bundled/installed packages/materials section. And other finishing touches. part of CURA-7240 --- .../qml/pages/ToolboxInstalledPage.qml | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index a85850ae00..dc0bd9c84d 100644 --- a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml @@ -31,9 +31,9 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Installed Plugins") + text: catalog.i18nc("@title:tab", "My installed plugins") color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("medium") renderType: Text.NativeRendering } @@ -76,52 +76,7 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Bundled Plugins") - color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("large") - renderType: Text.NativeRendering - } - - Rectangle - { - anchors - { - left: parent.left - right: parent.right - margins: parent.padding - } - id: bundledPlugins - color: "transparent" - height: childrenRect.height + UM.Theme.getSize("default_margin").width - border.color: UM.Theme.getColor("lining") - border.width: UM.Theme.getSize("default_lining").width - Column - { - anchors - { - top: parent.top - right: parent.right - left: parent.left - margins: UM.Theme.getSize("default_margin").width - } - Repeater - { - id: bundledPluginsList - model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile { visible: model.is_bundled } - } - } - } - - Label - { - anchors - { - left: parent.left - right: parent.right - margins: parent.padding - } - text: catalog.i18nc("@title:tab", "Installed Materials") + text: catalog.i18nc("@title:tab", "My installed materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering @@ -166,7 +121,52 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Bundled Materials") + text: catalog.i18nc("@title:tab", "Bundled plugins") + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } + + Rectangle + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + id: bundledPlugins + color: "transparent" + height: childrenRect.height + UM.Theme.getSize("default_margin").width + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + Column + { + anchors + { + top: parent.top + right: parent.right + left: parent.left + margins: UM.Theme.getSize("default_margin").width + } + Repeater + { + id: bundledPluginsList + model: toolbox.pluginsInstalledModel + delegate: ToolboxInstalledTile { visible: model.is_bundled } + } + } + } + + Label + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + text: catalog.i18nc("@title:tab", "Bundled materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering From c764326c251a383dbc30abced08963572ead547f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 31 Mar 2020 15:57:08 +0200 Subject: [PATCH 3/7] Fix marketplace installed plugins/materials empty rectangle CURA-7240 --- .../qml/pages/ToolboxInstalledPage.qml | 15 +++++++++------ plugins/Toolbox/src/Toolbox.py | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index dc0bd9c84d..33a98f66ed 100644 --- a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml @@ -20,7 +20,6 @@ ScrollView width: page.width spacing: UM.Theme.getSize("default_margin").height padding: UM.Theme.getSize("wide_margin").width - visible: toolbox.pluginsInstalledModel.items.length > 0 height: childrenRect.height + 2 * UM.Theme.getSize("wide_margin").height Label @@ -35,6 +34,7 @@ ScrollView color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + visible: toolbox.pluginsInstalledModel.count > 0 } Rectangle @@ -50,6 +50,7 @@ ScrollView height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width + visible: toolbox.pluginsInstalledModel.count > 0 Column { anchors @@ -80,6 +81,7 @@ ScrollView color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + visible: toolbox.materialsInstalledModel.count > 0 } Rectangle @@ -95,6 +97,7 @@ ScrollView height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width + visible: toolbox.materialsInstalledModel.count > 0 Column { anchors @@ -108,7 +111,7 @@ ScrollView { id: installedMaterialsList model: toolbox.materialsInstalledModel - delegate: ToolboxInstalledTile { visible: ! model.is_bundled } + delegate: ToolboxInstalledTile { } } } } @@ -152,8 +155,8 @@ ScrollView Repeater { id: bundledPluginsList - model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile { visible: model.is_bundled } + model: toolbox.pluginsBundledModel + delegate: ToolboxInstalledTile { } } } } @@ -197,8 +200,8 @@ ScrollView Repeater { id: bundledMaterialsList - model: toolbox.materialsInstalledModel - delegate: ToolboxInstalledTile { visible: model.is_bundled } + model: toolbox.materialsBundledModel + delegate: ToolboxInstalledTile {} } } } diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 38666bb6e2..af9d6c96f1 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -77,10 +77,15 @@ class Toolbox(QObject, Extension): self._plugins_showcase_model = PackagesModel(self) self._plugins_available_model = PackagesModel(self) self._plugins_installed_model = PackagesModel(self) - + self._plugins_installed_model.setFilter({"is_bundled": "False"}) + self._plugins_bundled_model = PackagesModel(self) + self._plugins_bundled_model.setFilter({"is_bundled": "True"}) self._materials_showcase_model = AuthorsModel(self) self._materials_available_model = AuthorsModel(self) self._materials_installed_model = PackagesModel(self) + self._materials_installed_model.setFilter({"is_bundled": "False"}) + self._materials_bundled_model = PackagesModel(self) + self._materials_bundled_model.setFilter({"is_bundled": "True"}) self._materials_generic_model = PackagesModel(self) self._license_model = LicenseModel() @@ -289,9 +294,11 @@ class Toolbox(QObject, Extension): self._old_plugin_metadata = {k: v for k, v in self._old_plugin_metadata.items() if k in self._old_plugin_ids} self._plugins_installed_model.setMetadata(all_packages["plugin"] + list(self._old_plugin_metadata.values())) + self._plugins_bundled_model.setMetadata(all_packages["plugin"] + list(self._old_plugin_metadata.values())) self.metadataChanged.emit() if "material" in all_packages: self._materials_installed_model.setMetadata(all_packages["material"]) + self._materials_bundled_model.setMetadata(all_packages["material"]) self.metadataChanged.emit() @pyqtSlot(str) @@ -757,6 +764,10 @@ class Toolbox(QObject, Extension): def pluginsInstalledModel(self) -> PackagesModel: return self._plugins_installed_model + @pyqtProperty(QObject, constant=True) + def pluginsBundledModel(self) -> PackagesModel: + return self._plugins_bundled_model + @pyqtProperty(QObject, constant = True) def materialsShowcaseModel(self) -> AuthorsModel: return self._materials_showcase_model @@ -769,6 +780,10 @@ class Toolbox(QObject, Extension): def materialsInstalledModel(self) -> PackagesModel: return self._materials_installed_model + @pyqtProperty(QObject, constant=True) + def materialsBundledModel(self) -> PackagesModel: + return self._materials_bundled_model + @pyqtProperty(QObject, constant = True) def materialsGenericModel(self) -> PackagesModel: return self._materials_generic_model From 90ffa2a77261648449b38b4705f63db013de9512 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 31 Mar 2020 16:56:45 +0200 Subject: [PATCH 4/7] Explain empty installed materials/plugins brackets. part of CURA-7240 --- .../qml/pages/ToolboxInstalledPage.qml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index 33a98f66ed..48620d5def 100644 --- a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml @@ -30,11 +30,10 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "My installed plugins") + text: catalog.i18nc("@title:tab", "Installed plugins") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering - visible: toolbox.pluginsInstalledModel.count > 0 } Rectangle @@ -50,7 +49,6 @@ ScrollView height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width - visible: toolbox.pluginsInstalledModel.count > 0 Column { anchors @@ -64,9 +62,17 @@ ScrollView { id: pluginList model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile { visible: ! model.is_bundled } + delegate: ToolboxInstalledTile { } } } + Label + { + visible: toolbox.pluginsInstalledModel.count < 1 + padding: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@info", "No plugin has been installed.") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } } Label @@ -77,11 +83,10 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "My installed materials") + text: catalog.i18nc("@title:tab", "Installed materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering - visible: toolbox.materialsInstalledModel.count > 0 } Rectangle @@ -97,7 +102,6 @@ ScrollView height: childrenRect.height + UM.Theme.getSize("default_margin").width border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width - visible: toolbox.materialsInstalledModel.count > 0 Column { anchors @@ -114,6 +118,14 @@ ScrollView delegate: ToolboxInstalledTile { } } } + Label + { + visible: toolbox.materialsInstalledModel.count < 1 + padding: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@info", "No material has been installed.") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + } } Label From 4edef85346ad01d2f81fdfce0c05878fdab934ac Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Apr 2020 17:35:40 +0200 Subject: [PATCH 5/7] Code style: Space around binary operators Contributes to issue CURA-7240. --- plugins/Toolbox/src/Toolbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index af9d6c96f1..3b1f85a69e 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -764,7 +764,7 @@ class Toolbox(QObject, Extension): def pluginsInstalledModel(self) -> PackagesModel: return self._plugins_installed_model - @pyqtProperty(QObject, constant=True) + @pyqtProperty(QObject, constant = True) def pluginsBundledModel(self) -> PackagesModel: return self._plugins_bundled_model @@ -780,7 +780,7 @@ class Toolbox(QObject, Extension): def materialsInstalledModel(self) -> PackagesModel: return self._materials_installed_model - @pyqtProperty(QObject, constant=True) + @pyqtProperty(QObject, constant = True) def materialsBundledModel(self) -> PackagesModel: return self._materials_bundled_model From 07569c6b88e1e85e0ae77731b1756002a27076ad Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Apr 2020 17:54:56 +0200 Subject: [PATCH 6/7] Fix extra line after plugin/materials list. CURA-7240 --- .../Toolbox/resources/qml/components/ToolboxInstalledTile.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml index f85a1056b7..8347412e27 100644 --- a/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml @@ -17,7 +17,8 @@ Item color: UM.Theme.getColor("lining") width: parent.width height: Math.floor(UM.Theme.getSize("default_lining").height) - anchors.bottom: parent.bottom + anchors.bottom: parent.top + visible: index != 0 } Row { From 8d6cbdf6739c55f7052b0d9fe67cb4f0887de3c0 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Apr 2020 17:57:33 +0200 Subject: [PATCH 7/7] Fix long materials title causes misalign. CURA-7240 --- .../Toolbox/resources/qml/components/ToolboxInstalledTile.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml index 8347412e27..a73e745ddb 100644 --- a/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml @@ -49,6 +49,8 @@ Item { text: model.name width: parent.width + maximumLineCount: 1 + elide: Text.ElideRight wrapMode: Text.WordWrap font: UM.Theme.getFont("large_bold") color: pluginInfo.color