CURA-5035 Don't show required plugins

Also renamed folder of UserAgreementPlugin to UserAgreement
This commit is contained in:
Ian Paschal 2018-04-26 15:11:32 +02:00
parent 2751299fd3
commit 679f87ebb3
8 changed files with 34 additions and 28 deletions

View file

@ -249,8 +249,6 @@ class CuraApplication(QtApplication):
self.initialize() self.initialize()
self._cura_package_manager.getAllInstalledPackagesInfo()
# FOR TESTING ONLY # FOR TESTING ONLY
if kwargs["parsed_command_line"].get("trigger_early_crash", False): if kwargs["parsed_command_line"].get("trigger_early_crash", False):
assert not "This crash is triggered by the trigger_early_crash command line argument." 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.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
self.setRequiredPlugins([ self.setRequiredPlugins([
# Misc.:
"ConsoleLogger",
"CuraEngineBackend", "CuraEngineBackend",
"UserAgreement", "UserAgreement",
"SolidView",
"SimulationView",
"STLReader",
"SelectionTool",
"CameraTool",
"GCodeWriter",
"LocalFileOutputDevice",
"TranslateTool",
"FileLogger", "FileLogger",
"XmlMaterialProfile", "XmlMaterialProfile",
"Toolbox", "Toolbox",
"PrepareStage", "PrepareStage",
"MonitorStage" "MonitorStage",
"LocalFileOutputDevice",
# Views:
"SimpleView",
"SimulationView",
"SolidView",
# Readers & Writers:
"GCodeWriter",
"STLReader",
# Tools:
"CameraTool",
"MirrorTool",
"RotateTool",
"ScaleTool",
"SelectionTool",
"TranslateTool"
]) ])
self._physics = None self._physics = None
self._volume = None self._volume = None

View file

@ -10,6 +10,7 @@ import tempfile
from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal
from UM.Application import Application
from UM.Logger import Logger from UM.Logger import Logger
from UM.Resources import Resources from UM.Resources import Resources
from UM.Version import Version from UM.Version import Version
@ -102,15 +103,20 @@ class CuraPackageManager(QObject):
return None 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 = 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) 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 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> # map of <package_type> -> <package_id> -> <package_info>
installed_packages_dict = {} installed_packages_dict = {}
for package_id in installed_package_id_set: 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: if package_id in self._to_install_package_dict:
package_info = self._to_install_package_dict[package_id]["package_info"] package_info = self._to_install_package_dict[package_id]["package_info"]
else: else:
@ -133,6 +139,8 @@ class CuraPackageManager(QObject):
package_id = plugin_package_info["package_id"] package_id = plugin_package_info["package_id"]
if package_id in managed_package_id_set: if package_id in managed_package_id_set:
continue 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_bundled"] = True if plugin_package_info["author"]["name"] == "Ultimaker B.V." else False
plugin_package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) plugin_package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id)

View file

@ -9,7 +9,9 @@ import UM 1.1 as UM
Column 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 width: parent.width
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Label Label

View file

@ -119,11 +119,6 @@ class Toolbox(QObject, Extension):
# possible values include "overview", "detail" or "author". # possible values include "overview", "detail" or "author".
self._view_page = "loading" 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, # Active package refers to which package is currently being downloaded,
# installed, or otherwise modified. # installed, or otherwise modified.
self._active_package = None self._active_package = None
@ -473,7 +468,6 @@ class Toolbox(QObject, Extension):
Logger.log("w", "Toolbox: Received invalid JSON for showcase.") Logger.log("w", "Toolbox: Received invalid JSON for showcase.")
return return
else: else:
# Ignore any operation that is not a get operation # Ignore any operation that is not a get operation
pass pass
@ -511,6 +505,7 @@ class Toolbox(QObject, Extension):
return return
# Getter & Setters for Properties: # Getter & Setters for Properties:
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
def setDownloadProgress(self, progress: int): def setDownloadProgress(self, progress: int):
@ -550,15 +545,6 @@ class Toolbox(QObject, Extension):
def viewPage(self) -> str: def viewPage(self) -> str:
return self._view_page 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: # Expose Models: