diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 363b8034ec..6422469bdf 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -1,6 +1,8 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from typing import List, Tuple + from cura.CuraApplication import CuraApplication #To find some resource types. from cura.Settings.GlobalStack import GlobalStack @@ -22,7 +24,7 @@ class CuraPackageManager(PackageManager): # empty if it is never used. # It loops through all the package contents and see if some of the ids are used. # The list consists of 3-tuples: (global_stack, extruder_nr, container_id) - def getMachinesUsingPackage(self, package_id: str): + def getMachinesUsingPackage(self, package_id: str) -> Tuple[List[Tuple[GlobalStack, str, str]], List[Tuple[GlobalStack, str, str]]]: ids = self.getPackageContainerIds(package_id) container_stacks = self._application.getContainerRegistry().findContainerStacks() global_stacks = [container_stack for container_stack in container_stacks if isinstance(container_stack, GlobalStack)] diff --git a/cura/Machines/MaterialGroup.py b/cura/Machines/MaterialGroup.py index e05647e674..8a73796a7a 100644 --- a/cura/Machines/MaterialGroup.py +++ b/cura/Machines/MaterialGroup.py @@ -24,8 +24,8 @@ class MaterialGroup: def __init__(self, name: str, root_material_node: "MaterialNode") -> None: self.name = name self.is_read_only = False - self.root_material_node = root_material_node # type: MaterialNode - self.derived_material_node_list = [] # type: List[MaterialNode] + self.root_material_node = root_material_node # type: MaterialNode + self.derived_material_node_list = [] # type: List[MaterialNode] def __str__(self) -> str: return "%s[%s]" % (self.__class__.__name__, self.name) diff --git a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml b/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml index 83ace5f80b..4aa8b883b7 100644 --- a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml +++ b/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml @@ -32,11 +32,14 @@ UM.Dialog { UM.I18nCatalog { id: catalog; name: "cura" } - anchors.fill: parent - anchors.leftMargin: Math.round(20 * screenScaleFactor) - anchors.rightMargin: Math.round(20 * screenScaleFactor) - anchors.topMargin: Math.round(10 * screenScaleFactor) - anchors.bottomMargin: Math.round(10 * screenScaleFactor) + anchors + { + fill: parent + leftMargin: Math.round(20 * screenScaleFactor) + rightMargin: Math.round(20 * screenScaleFactor) + topMargin: Math.round(10 * screenScaleFactor) + bottomMargin: Math.round(10 * screenScaleFactor) + } spacing: Math.round(15 * screenScaleFactor) Label diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 31b9dda9f4..b1128722e9 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -330,7 +330,10 @@ class Toolbox(QObject, Extension): if self._confirm_reset_dialog is None: self._confirm_reset_dialog = self._createDialog("ToolboxConfirmUninstallResetDialog.qml") self.uninstallVariablesChanged.emit() - self._confirm_reset_dialog.show() + if self._confirm_reset_dialog is None: + Logger.log("e", "ToolboxConfirmUninstallResetDialog should have been initialized, but it is not. Not showing dialog and not uninstalling package.") + else: + self._confirm_reset_dialog.show() else: # Plain uninstall self.uninstall(package_id) @@ -368,13 +371,13 @@ class Toolbox(QObject, Extension): default_quality_group = quality_manager.getDefaultQualityType(global_stack) machine_manager.setQualityGroup(default_quality_group, global_stack = global_stack) - self._markPackageMaterialsAsRemove(self._package_id_to_uninstall) + self._markPackageMaterialsAsToBeUninstalled(self._package_id_to_uninstall) self.uninstall(self._package_id_to_uninstall) self._resetUninstallVariables() self.closeConfirmResetDialog() - def _markPackageMaterialsAsRemove(self, package_id: str) -> None: + def _markPackageMaterialsAsToBeUninstalled(self, package_id: str) -> None: container_registry = self._application.getContainerRegistry() all_containers = self._package_manager.getPackageContainerIds(package_id) diff --git a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py index 4c5d56e0da..f38c1a1c7a 100644 --- a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py @@ -455,8 +455,14 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): self.setAuthenticationState(AuthState.AuthenticationDenied) self._authentication_failed_message.show() - def _saveAuthentication(self): + def _saveAuthentication(self) -> None: global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() + if self._authentication_key is None: + Logger.log("e", "Authentication key is None, nothing to save.") + return + if self._authentication_id is None: + Logger.log("e", "Authentication id is None, nothing to save.") + return if global_container_stack: global_container_stack.setMetaDataEntry("network_authentication_key", self._authentication_key) @@ -631,4 +637,4 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): result = "********" + result return result - return self._authentication_key \ No newline at end of file + return self._authentication_key