diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-04-02 15:34:17 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-04-02 15:34:17 +0300 |
commit | 8ba71fde442af7a274ae21f4d90fffaaa1d014ee (patch) | |
tree | 7ffe46da9f419841f9ce48107b92aa3f25786a8d /plugins/Toolbox | |
parent | da2723f81f76de5e934bfed2dada220a681c762b (diff) | |
parent | 8d6cbdf6739c55f7052b0d9fe67cb4f0887de3c0 (diff) |
Merge branch 'split_bundled_unbundled_option_2' of github.com:Ultimaker/Cura
Diffstat (limited to 'plugins/Toolbox')
-rw-r--r-- | plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml | 5 | ||||
-rw-r--r-- | plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml | 119 | ||||
-rw-r--r-- | plugins/Toolbox/src/Toolbox.py | 17 |
3 files changed, 132 insertions, 9 deletions
diff --git a/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml index f85a1056b7..a73e745ddb 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 { @@ -48,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 diff --git a/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index 99590c712c..48620d5def 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 @@ -31,9 +30,9 @@ 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") + font: UM.Theme.getFont("medium") renderType: Text.NativeRendering } @@ -61,11 +60,19 @@ ScrollView } Repeater { - id: materialList + id: pluginList model: toolbox.pluginsInstalledModel - delegate: ToolboxInstalledTile {} + 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 @@ -76,7 +83,7 @@ ScrollView right: parent.right margins: parent.padding } - text: catalog.i18nc("@title:tab", "Materials") + text: catalog.i18nc("@title:tab", "Installed materials") color: UM.Theme.getColor("text_medium") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering @@ -106,8 +113,106 @@ ScrollView } Repeater { - id: pluginList + id: installedMaterialsList model: toolbox.materialsInstalledModel + 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 + { + anchors + { + left: parent.left + right: parent.right + margins: parent.padding + } + 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.pluginsBundledModel + delegate: ToolboxInstalledTile { } + } + } + } + + 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.materialsBundledModel delegate: ToolboxInstalledTile {} } } diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 38666bb6e2..3b1f85a69e 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) @@ -758,6 +765,10 @@ class Toolbox(QObject, Extension): 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 @@ -770,6 +781,10 @@ class Toolbox(QObject, Extension): 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 |