diff options
author | jspijker <j.spijker@ultimaker.com> | 2022-07-08 13:37:32 +0300 |
---|---|---|
committer | jspijker <j.spijker@ultimaker.com> | 2022-07-08 13:37:32 +0300 |
commit | f9d4628b950c4bf85895d8e32b1112f7c6be6999 (patch) | |
tree | 37b7dbe01973f707cda1464add78e3d5cb0b0dce /plugins | |
parent | 8750c218db0a0da2705718d8d6614c34f71df31c (diff) | |
parent | d1cd4eec7667572d2abc89c639d0582bd4ed40c8 (diff) |
Merge branch 'main' into CURA-9365
# Conflicts:
# .github/workflows/ci.yml
# .github/workflows/cura-installer.yml
# .github/workflows/requirements-conan-package.txt
# resources/definitions/Mark2_for_Ultimaker2.def.json
# resources/definitions/elegoo_neptune_2.def.json
# resources/definitions/elegoo_neptune_2D.def.json
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py | 15 | ||||
-rw-r--r-- | plugins/Marketplace/Marketplace.py | 11 |
2 files changed, 15 insertions, 11 deletions
diff --git a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py index 69bf4b1233..4defd2f409 100644 --- a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py +++ b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py @@ -1,5 +1,6 @@ -# Copyright (c) 2021 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. + import json import threading from json import JSONDecodeError @@ -135,6 +136,9 @@ class DFFileExportAndUploadManager: else: Logger.log("e", "Wrong response type received. Aborting uploading file to the Digital Library") return + if file_name not in self._file_upload_job_metadata: + Logger.error(f"API response for uploading doesn't match the file name we just uploaded: {file_name} was never uploaded.") + return with self._message_lock: self.progress_message.show() self._file_upload_job_metadata[file_name]["file_upload_response"] = file_upload_response @@ -335,10 +339,11 @@ class DFFileExportAndUploadManager: self._handleNextUploadJob() def _handleNextUploadJob(self): - match self._upload_jobs: - case [job, *jobs]: - job.start() - self._upload_jobs = jobs + try: + job = self._upload_jobs.pop(0) + job.start() + except IndexError: + pass # Empty list, do nothing. def initializeFileUploadJobMetadata(self) -> Dict[str, Any]: metadata = {} diff --git a/plugins/Marketplace/Marketplace.py b/plugins/Marketplace/Marketplace.py index b2c729c2cd..86910f8f4a 100644 --- a/plugins/Marketplace/Marketplace.py +++ b/plugins/Marketplace/Marketplace.py @@ -22,7 +22,6 @@ class Marketplace(Extension, QObject): QObject.__init__(self, parent) Extension.__init__(self) self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here. - self._plugin_registry: Optional[PluginRegistry] = None self._package_manager = CuraApplication.getInstance().getPackageManager() self._material_package_list: Optional[RemotePackageList] = None @@ -81,9 +80,9 @@ class Marketplace(Extension, QObject): If the window hadn't been loaded yet into Qt, it will be created lazily. """ if self._window is None: - self._plugin_registry = PluginRegistry.getInstance() - self._plugin_registry.pluginsEnabledOrDisabledChanged.connect(self.checkIfRestartNeeded) - plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId()) + plugin_registry = PluginRegistry.getInstance() + plugin_registry.pluginsEnabledOrDisabledChanged.connect(self.checkIfRestartNeeded) + plugin_path = plugin_registry.getPluginPath(self.getPluginId()) if plugin_path is None: plugin_path = os.path.dirname(__file__) path = os.path.join(plugin_path, "resources", "qml", "Marketplace.qml") @@ -108,7 +107,7 @@ class Marketplace(Extension, QObject): return if self._package_manager.hasPackagesToRemoveOrInstall or \ - cast(PluginRegistry, self._plugin_registry).getCurrentSessionActivationChangedPlugins(): + PluginRegistry.getInstance().getCurrentSessionActivationChangedPlugins(): self._restart_needed = True else: self._restart_needed = False @@ -116,7 +115,7 @@ class Marketplace(Extension, QObject): showRestartNotificationChanged = pyqtSignal() - @pyqtProperty(bool, notify=showRestartNotificationChanged) + @pyqtProperty(bool, notify = showRestartNotificationChanged) def showRestartNotification(self) -> bool: return self._restart_needed |