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