mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-19 04:09:40 +08:00
Fix typing
CURA-8588
This commit is contained in:
parent
7deeb26e13
commit
27e5905a32
@ -52,7 +52,8 @@ class LocalPackageList(PackageList):
|
||||
be updated, it is in the to remove list and isn't in the to be installed list
|
||||
"""
|
||||
package = self.getPackageModel(package_id)
|
||||
if not package.canUpdate and \
|
||||
|
||||
if package and not package.canUpdate and \
|
||||
package_id in self._package_manager.getToRemovePackageIDs() and \
|
||||
package_id not in self._package_manager.getPackagesToInstall():
|
||||
index = self.find("package", package_id)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
import os.path
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
|
||||
from typing import Optional
|
||||
from typing import Optional, cast
|
||||
|
||||
from cura.CuraApplication import CuraApplication # Creating QML objects and managing packages.
|
||||
|
||||
@ -100,7 +100,7 @@ class Marketplace(Extension, QObject):
|
||||
|
||||
def checkIfRestartNeeded(self) -> None:
|
||||
if self._package_manager.hasPackagesToRemoveOrInstall or \
|
||||
self._plugin_registry.getCurrentSessionActivationChangedPlugins():
|
||||
cast(PluginRegistry, self._plugin_registry).getCurrentSessionActivationChangedPlugins():
|
||||
self._restart_needed = True
|
||||
else:
|
||||
self._restart_needed = False
|
||||
|
@ -53,7 +53,6 @@ class PackageList(ListModel):
|
||||
|
||||
def __del__(self) -> None:
|
||||
""" When this object is deleted it will loop through all registered API requests and aborts them """
|
||||
|
||||
try:
|
||||
self.isLoadingChanged.disconnect()
|
||||
self.hasMoreChanged.disconnect()
|
||||
@ -192,7 +191,10 @@ class PackageList(ListModel):
|
||||
Logger.warning(f"Could not install {package_id}")
|
||||
return
|
||||
package = self.getPackageModel(package_id)
|
||||
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
||||
if package:
|
||||
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
||||
else:
|
||||
Logger.log("w", f"Unable to get data on package {package_id}")
|
||||
|
||||
def download(self, package_id: str, url: str, update: bool = False) -> None:
|
||||
"""Initiate the download request
|
||||
@ -283,7 +285,8 @@ class PackageList(ListModel):
|
||||
self.download(package_id, url, False)
|
||||
else:
|
||||
package = self.getPackageModel(package_id)
|
||||
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
||||
if package:
|
||||
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
||||
|
||||
def uninstallPackage(self, package_id: str) -> None:
|
||||
"""Uninstall a package from the Marketplace
|
||||
|
Loading…
x
Reference in New Issue
Block a user