From 679f87ebb3854982a1927694fd3f63831ab33a81 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 26 Apr 2018 15:11:32 +0200 Subject: [PATCH] CURA-5035 Don't show required plugins Also renamed folder of UserAgreementPlugin to UserAgreement --- cura/CuraApplication.py | 32 ++++++++++++------- cura/CuraPackageManager.py | 10 +++++- .../resources/qml/ToolboxDownloadsGrid.qml | 4 ++- plugins/Toolbox/src/Toolbox.py | 16 +--------- .../UserAgreement.py | 0 .../UserAgreement.qml | 0 .../__init__.py | 0 .../plugin.json | 0 8 files changed, 34 insertions(+), 28 deletions(-) rename plugins/{UserAgreementPlugin => UserAgreement}/UserAgreement.py (100%) rename plugins/{UserAgreementPlugin => UserAgreement}/UserAgreement.qml (100%) rename plugins/{UserAgreementPlugin => UserAgreement}/__init__.py (100%) rename plugins/{UserAgreementPlugin => UserAgreement}/plugin.json (100%) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 3f98de554f..a5bcd6a2f0 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -249,8 +249,6 @@ class CuraApplication(QtApplication): self.initialize() - self._cura_package_manager.getAllInstalledPackagesInfo() - # FOR TESTING ONLY if kwargs["parsed_command_line"].get("trigger_early_crash", False): assert not "This crash is triggered by the trigger_early_crash command line argument." @@ -262,21 +260,33 @@ class CuraApplication(QtApplication): self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) self.setRequiredPlugins([ + # Misc.: + "ConsoleLogger", "CuraEngineBackend", "UserAgreement", - "SolidView", - "SimulationView", - "STLReader", - "SelectionTool", - "CameraTool", - "GCodeWriter", - "LocalFileOutputDevice", - "TranslateTool", "FileLogger", "XmlMaterialProfile", "Toolbox", "PrepareStage", - "MonitorStage" + "MonitorStage", + "LocalFileOutputDevice", + + # Views: + "SimpleView", + "SimulationView", + "SolidView", + + # Readers & Writers: + "GCodeWriter", + "STLReader", + + # Tools: + "CameraTool", + "MirrorTool", + "RotateTool", + "ScaleTool", + "SelectionTool", + "TranslateTool" ]) self._physics = None self._volume = None diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 444e7462e8..5f998b4c18 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -10,6 +10,7 @@ import tempfile from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal +from UM.Application import Application from UM.Logger import Logger from UM.Resources import Resources from UM.Version import Version @@ -102,15 +103,20 @@ class CuraPackageManager(QObject): return None - def getAllInstalledPackagesInfo(self) -> dict: + def getAllInstalledPackagesInfo(self, includeRequired: bool = False) -> dict: installed_package_id_set = set(self._installed_package_dict.keys()) | set(self._to_install_package_dict.keys()) installed_package_id_set = installed_package_id_set.difference(self._to_remove_package_set) managed_package_id_set = set(installed_package_id_set) | self._to_remove_package_set + # TODO: For absolutely no reason, this function seems to run in a loop + # even though no loop is ever called with it. + # map of -> -> installed_packages_dict = {} for package_id in installed_package_id_set: + if package_id in Application.getInstance().getRequiredPlugins(): + continue if package_id in self._to_install_package_dict: package_info = self._to_install_package_dict[package_id]["package_info"] else: @@ -133,6 +139,8 @@ class CuraPackageManager(QObject): package_id = plugin_package_info["package_id"] if package_id in managed_package_id_set: continue + if package_id in Application.getInstance().getRequiredPlugins(): + continue plugin_package_info["is_bundled"] = True if plugin_package_info["author"]["name"] == "Ultimaker B.V." else False plugin_package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml index d770b7c74e..a719128a6d 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml @@ -9,7 +9,9 @@ import UM 1.1 as UM Column { - height: childrenRect.height + // HACK: GridLayouts don't render to the correct height with odd numbers of + // items, so if odd, add some extra space. + height: grid.model.items.length % 2 == 0 ? childrenRect.height : childrenRect.height + 3 * UM.Theme.getSize("wide_margin").height width: parent.width spacing: UM.Theme.getSize("default_margin").height Label diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index a39a36f80f..d3b0032b51 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -119,11 +119,6 @@ class Toolbox(QObject, Extension): # possible values include "overview", "detail" or "author". self._view_page = "loading" - # View selection defines what is currently selected and should be - # used in filtering. This could be an author name (if _view_page is set - # to "author" or a plugin name if it is set to "detail"). - self._view_selection = None - # Active package refers to which package is currently being downloaded, # installed, or otherwise modified. self._active_package = None @@ -473,7 +468,6 @@ class Toolbox(QObject, Extension): Logger.log("w", "Toolbox: Received invalid JSON for showcase.") return - else: # Ignore any operation that is not a get operation pass @@ -511,6 +505,7 @@ class Toolbox(QObject, Extension): return + # Getter & Setters for Properties: # -------------------------------------------------------------------------- def setDownloadProgress(self, progress: int): @@ -550,15 +545,6 @@ class Toolbox(QObject, Extension): def viewPage(self) -> str: return self._view_page - def setViewSelection(self, selection: dict): - selection.setParent(self) - self._view_selection = selection - self.viewChanged.emit() - @pyqtProperty(QObject, fset = setViewSelection, notify = viewChanged) - def viewSelection(self) -> dict: - print(dir(self._view_selection)) - return self._view_selection - # Expose Models: diff --git a/plugins/UserAgreementPlugin/UserAgreement.py b/plugins/UserAgreement/UserAgreement.py similarity index 100% rename from plugins/UserAgreementPlugin/UserAgreement.py rename to plugins/UserAgreement/UserAgreement.py diff --git a/plugins/UserAgreementPlugin/UserAgreement.qml b/plugins/UserAgreement/UserAgreement.qml similarity index 100% rename from plugins/UserAgreementPlugin/UserAgreement.qml rename to plugins/UserAgreement/UserAgreement.qml diff --git a/plugins/UserAgreementPlugin/__init__.py b/plugins/UserAgreement/__init__.py similarity index 100% rename from plugins/UserAgreementPlugin/__init__.py rename to plugins/UserAgreement/__init__.py diff --git a/plugins/UserAgreementPlugin/plugin.json b/plugins/UserAgreement/plugin.json similarity index 100% rename from plugins/UserAgreementPlugin/plugin.json rename to plugins/UserAgreement/plugin.json