mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Use updated type definitions
CURA-9146
This commit is contained in:
parent
773ff5fa7e
commit
d0a35bad3d
7 changed files with 20 additions and 20 deletions
|
@ -5,14 +5,14 @@ from cura.UltimakerCloud import UltimakerCloudConstants
|
|||
|
||||
|
||||
class CloudApiModel:
|
||||
sdk_version = ApplicationMetadata.CuraSDKVersion # type: Union[str, int]
|
||||
cloud_api_version = UltimakerCloudConstants.CuraCloudAPIVersion # type: str
|
||||
cloud_api_root = UltimakerCloudConstants.CuraCloudAPIRoot # type: str
|
||||
api_url = "{cloud_api_root}/cura-packages/v{cloud_api_version}/cura/v{sdk_version}".format(
|
||||
sdk_version: Union[str, int] = ApplicationMetadata.CuraSDKVersion
|
||||
cloud_api_version: str = UltimakerCloudConstants.CuraCloudAPIVersion
|
||||
cloud_api_root: str = UltimakerCloudConstants.CuraCloudAPIRoot
|
||||
api_url: str = "{cloud_api_root}/cura-packages/v{cloud_api_version}/cura/v{sdk_version}".format(
|
||||
cloud_api_root = cloud_api_root,
|
||||
cloud_api_version = cloud_api_version,
|
||||
sdk_version = sdk_version
|
||||
) # type: str
|
||||
)
|
||||
|
||||
# https://api.ultimaker.com/cura-packages/v1/user/packages
|
||||
api_url_user_packages = "{cloud_api_root}/cura-packages/v{cloud_api_version}/user/packages".format(
|
||||
|
|
|
@ -27,7 +27,7 @@ class CloudApiClient:
|
|||
if self.__instance is not None:
|
||||
raise RuntimeError("This is a Singleton. use getInstance()")
|
||||
|
||||
self._scope = JsonDecoratorScope(UltimakerCloudScope(app)) # type: JsonDecoratorScope
|
||||
self._scope: JsonDecoratorScope = JsonDecoratorScope(UltimakerCloudScope(app))
|
||||
|
||||
app.getPackageManager().packageInstalled.connect(self._onPackageInstalled)
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ class CloudPackageChecker(QObject):
|
|||
super().__init__()
|
||||
|
||||
self.discrepancies = Signal() # Emits SubscribedPackagesModel
|
||||
self._application = application # type: CuraApplication
|
||||
self._application: CuraApplication = application
|
||||
self._scope = JsonDecoratorScope(UltimakerCloudScope(application))
|
||||
self._model = SubscribedPackagesModel()
|
||||
self._message = None # type: Optional[Message]
|
||||
self._message: Optional[Message] = None
|
||||
|
||||
self._application.initializationFinished.connect(self._onAppInitialized)
|
||||
self._i18n_catalog = i18nCatalog("cura")
|
||||
|
|
|
@ -21,7 +21,7 @@ class DiscrepanciesPresenter(QObject):
|
|||
|
||||
self._app = app
|
||||
self._package_manager = app.getPackageManager()
|
||||
self._dialog = None # type: Optional[QObject]
|
||||
self._dialog: Optional[QObject] = None
|
||||
self._compatibility_dialog_path = "resources/qml/CompatibilityDialog.qml"
|
||||
|
||||
def present(self, plugin_path: str, model: SubscribedPackagesModel) -> None:
|
||||
|
|
|
@ -37,8 +37,8 @@ class DownloadPresenter:
|
|||
|
||||
self._started = False
|
||||
self._progress_message = self._createProgressMessage()
|
||||
self._progress = {} # type: Dict[str, Dict[str, Any]] # package_id, Dict
|
||||
self._error = [] # type: List[str] # package_id
|
||||
self._progress: Dict[str, Dict[str, Any]] = {}
|
||||
self._error: List[str] = []
|
||||
|
||||
def download(self, model: SubscribedPackagesModel) -> None:
|
||||
if self._started:
|
||||
|
|
|
@ -29,18 +29,18 @@ class LicensePresenter(QObject):
|
|||
self._presented = False
|
||||
"""Whether present() has been called and state is expected to be initialized"""
|
||||
|
||||
self._dialog = None # type: Optional[QObject]
|
||||
self._package_manager = app.getPackageManager() # type: PackageManager
|
||||
self._dialog: Optional[QObject] = None
|
||||
self._package_manager: PackageManager = app.getPackageManager()
|
||||
# Emits List[Dict[str, [Any]] containing for example
|
||||
# [{ "package_id": "BarbarianPlugin", "package_path" : "/tmp/dg345as", "accepted" : True }]
|
||||
self.licenseAnswers = Signal()
|
||||
|
||||
self._current_package_idx = 0
|
||||
self._package_models = [] # type: List[Dict]
|
||||
self._package_models: List[Dict] = []
|
||||
|
||||
self._catalog = i18nCatalog("cura")
|
||||
decline_button_text = self._catalog.i18nc("@button", "Decline and remove from account")
|
||||
self._license_model = LicenseModel(decline_button_text=decline_button_text) # type: LicenseModel
|
||||
self._license_model: LicenseModel = LicenseModel(decline_button_text=decline_button_text)
|
||||
self._page_count = 0
|
||||
|
||||
self._app = app
|
||||
|
|
|
@ -45,17 +45,17 @@ class SyncOrchestrator(Extension):
|
|||
|
||||
self._package_manager = app.getPackageManager()
|
||||
# Keep a reference to the CloudApiClient. it watches for installed packages and subscribes to them
|
||||
self._cloud_api = CloudApiClient.getInstance(app) # type: CloudApiClient
|
||||
self._cloud_api: CloudApiClient = CloudApiClient.getInstance(app)
|
||||
|
||||
self._checker = CloudPackageChecker(app) # type: CloudPackageChecker
|
||||
self._checker: CloudPackageChecker = CloudPackageChecker(app)
|
||||
self._checker.discrepancies.connect(self._onDiscrepancies)
|
||||
|
||||
self._discrepancies_presenter = DiscrepanciesPresenter(app) # type: DiscrepanciesPresenter
|
||||
self._discrepancies_presenter: DiscrepanciesPresenter = DiscrepanciesPresenter(app)
|
||||
self._discrepancies_presenter.packageMutations.connect(self._onPackageMutations)
|
||||
|
||||
self._download_presenter = DownloadPresenter(app) # type: DownloadPresenter
|
||||
self._download_presenter: DownloadPresenter = DownloadPresenter(app)
|
||||
|
||||
self._license_presenter = LicensePresenter(app) # type: LicensePresenter
|
||||
self._license_presenter: LicensePresenter = LicensePresenter(app)
|
||||
self._license_presenter.licenseAnswers.connect(self._onLicenseAnswers)
|
||||
|
||||
self._restart_presenter = RestartApplicationPresenter(app)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue