Browse Source

CURA-5035 Don't show required plugins

Also renamed folder of UserAgreementPlugin to UserAgreement
Ian Paschal 6 years ago
parent
commit
679f87ebb3

+ 21 - 11
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

+ 9 - 1
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 <package_type> -> <package_id> -> <package_info>
         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)

+ 3 - 1
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

+ 1 - 15
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:

+ 0 - 0
plugins/UserAgreementPlugin/UserAgreement.py → plugins/UserAgreement/UserAgreement.py


+ 0 - 0
plugins/UserAgreementPlugin/UserAgreement.qml → plugins/UserAgreement/UserAgreement.qml


+ 0 - 0
plugins/UserAgreementPlugin/__init__.py → plugins/UserAgreement/__init__.py


+ 0 - 0
plugins/UserAgreementPlugin/plugin.json → plugins/UserAgreement/plugin.json