diff --git a/plugins/Marketplace/Marketplace.py b/plugins/Marketplace/Marketplace.py index 858ea867ee..5ebc7830ed 100644 --- a/plugins/Marketplace/Marketplace.py +++ b/plugins/Marketplace/Marketplace.py @@ -13,7 +13,7 @@ from UM.PluginRegistry import PluginRegistry # To find out where we are stored from .RemotePackageList import RemotePackageList # To register this type with QML. from .LocalPackageList import LocalPackageList # To register this type with QML. -from .Manager import Manager # To register this type with QML. +from .RestartManager import RestartManager # To register this type with QML. if TYPE_CHECKING: from PyQt5.QtCore import QObject @@ -31,7 +31,7 @@ class Marketplace(Extension): qmlRegisterType(RemotePackageList, "Marketplace", 1, 0, "RemotePackageList") qmlRegisterType(LocalPackageList, "Marketplace", 1, 0, "LocalPackageList") - qmlRegisterType(Manager, "Marketplace", 1, 0, "Manager") + qmlRegisterType(RestartManager, "Marketplace", 1, 0, "RestartManager") @pyqtSlot() def show(self) -> None: diff --git a/plugins/Marketplace/Manager.py b/plugins/Marketplace/RestartManager.py similarity index 79% rename from plugins/Marketplace/Manager.py rename to plugins/Marketplace/RestartManager.py index f367579079..5b66ca0292 100644 --- a/plugins/Marketplace/Manager.py +++ b/plugins/Marketplace/RestartManager.py @@ -1,17 +1,21 @@ # Copyright (c) 2021 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional +from typing import Optional, TYPE_CHECKING from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal from cura.CuraApplication import CuraApplication -from UM.PluginRegistry import PluginRegistry -class Manager(QObject): +if TYPE_CHECKING: + from UM.PluginRegistry import PluginRegistry + from cura.CuraPackageManager import CuraPackageManager + + +class RestartManager(QObject): def __init__(self, parent: Optional[QObject] = None): super().__init__(parent = parent) self._manager: "CuraPackageManager" = CuraApplication.getInstance().getPackageManager() - self._plugin_registry: PluginRegistry = CuraApplication.getInstance().getPluginRegistry() + self._plugin_registry: "PluginRegistry" = CuraApplication.getInstance().getPluginRegistry() self._manager.installedPackagesChanged.connect(self.checkIfRestartNeeded) self._plugin_registry.hasPluginsEnabledOrDisabledChanged.connect(self.checkIfRestartNeeded) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index c04ef5c027..017a9e3dde 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -14,7 +14,7 @@ Window { id: marketplaceDialog property variant catalog: UM.I18nCatalog { name: "cura" } - property variant manager: Marketplace.Manager { } + property variant restartManager: Marketplace.RestartManager { } signal searchStringChanged(string new_search) @@ -234,7 +234,7 @@ Window { height: quitButton.height + 2 * UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("primary") - visible: manager.showRestartNotification + visible: restartManager.showRestartNotification anchors { left: parent.left