From 900db57f0f21c27e8ccd5a23671f0cd7dbf6b9e3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 27 Jul 2021 11:54:43 +0200 Subject: [PATCH 1/4] Update messages to use the message_types CURA-8418 --- cura/API/Account.py | 4 +++- cura/Arranging/ArrangeObjectsJob.py | 2 +- cura/Backups/Backup.py | 7 +++++-- cura/CuraApplication.py | 10 ++++++---- cura/MultiplyObjectsJob.py | 3 ++- cura/OAuth2/AuthorizationService.py | 3 ++- cura/Settings/CuraContainerRegistry.py | 6 ++++-- plugins/3MFReader/ThreeMFWorkspaceReader.py | 12 ++++++++---- plugins/CuraDrive/src/DrivePluginExtension.py | 8 ++++++-- .../src/DFFileExportAndUploadManager.py | 3 +-- .../DigitalLibrary/src/DigitalFactoryController.py | 11 ++++++++--- plugins/ModelChecker/ModelChecker.py | 3 ++- .../RemovableDriveOutputDevice.py | 11 ++++++++--- plugins/SimulationView/SimulationView.py | 10 +++++++--- plugins/SolidView/SolidView.py | 3 ++- plugins/Toolbox/src/CloudSync/SyncOrchestrator.py | 2 +- .../Messages/LegacyDeviceNoLongerSupportedMessage.py | 3 ++- .../src/Messages/NotClusterHostMessage.py | 3 ++- .../src/Messages/PrintJobUploadBlockedMessage.py | 3 ++- .../src/Messages/PrintJobUploadErrorMessage.py | 3 ++- .../src/Messages/PrintJobUploadQueueFullMessage.py | 3 ++- .../src/Messages/PrintJobUploadSuccessMessage.py | 3 ++- plugins/USBPrinting/USBPrinterOutputDevice.py | 4 +++- 23 files changed, 81 insertions(+), 39 deletions(-) diff --git a/cura/API/Account.py b/cura/API/Account.py index 2e48a040ad..59ac5381f3 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -178,7 +178,9 @@ class Account(QObject): if self._error_message: self._error_message.hide() Logger.log("w", "Failed to login: %s", error_message) - self._error_message = Message(error_message, title = i18n_catalog.i18nc("@info:title", "Login failed")) + self._error_message = Message(error_message, + title = i18n_catalog.i18nc("@info:title", "Login failed"), + message_type = Message.MessageType.ERROR) self._error_message.show() self._logged_in = False self.loginStateChanged.emit(False) diff --git a/cura/Arranging/ArrangeObjectsJob.py b/cura/Arranging/ArrangeObjectsJob.py index e65a442acb..d45dc2c67f 100644 --- a/cura/Arranging/ArrangeObjectsJob.py +++ b/cura/Arranging/ArrangeObjectsJob.py @@ -40,6 +40,6 @@ class ArrangeObjectsJob(Job): i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), title = i18n_catalog.i18nc("@info:title", "Can't Find Location"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) no_full_solution_message.show() self.finished.emit(self) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 1f6a961733..71567148ff 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -119,7 +119,7 @@ class Backup: def _showMessage(self, message: str) -> None: """Show a UI message.""" - Message(message, title=self.catalog.i18nc("@info:title", "Backup"), lifetime=30).show() + Message(message, title=self.catalog.i18nc("@info:title", "Backup")).show() def restore(self) -> bool: """Restore this back-up. @@ -154,7 +154,10 @@ class Backup: archive = ZipFile(io.BytesIO(self.zip_file), "r") except LookupError as e: Logger.log("d", f"The following error occurred while trying to restore a Cura backup: {str(e)}") - self._showMessage(self.catalog.i18nc("@info:backup_failed", "The following error occurred while trying to restore a Cura backup:") + str(e)) + Message(self.catalog.i18nc("@info:backup_failed", "The following error occurred while trying to restore a Cura backup:") + str(e), + title = self.catalog.i18nc("@info:title", "Backup"), + message_type = Message.MessageType.ERROR).show() + return False extracted = self._extractArchive(archive, version_data_dir) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c8570c33e6..463b121cad 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1798,8 +1798,9 @@ class CuraApplication(QtApplication): if extension in self._non_sliceable_extensions: message = Message( self._i18n_catalog.i18nc("@info:status", - "Only one G-code file can be loaded at a time. Skipped importing {0}", - filename), title = self._i18n_catalog.i18nc("@info:title", "Warning")) + "Only one G-code file can be loaded at a time. Skipped importing {0}", filename), + title = self._i18n_catalog.i18nc("@info:title", "Warning"), + message_type = Message.MessageType.WARNING) message.show() return # If file being loaded is non-slicable file, then prevent loading of any other files @@ -1808,8 +1809,9 @@ class CuraApplication(QtApplication): if extension in self._non_sliceable_extensions: message = Message( self._i18n_catalog.i18nc("@info:status", - "Can't open any other file if G-code is loading. Skipped importing {0}", - filename), title = self._i18n_catalog.i18nc("@info:title", "Error")) + "Can't open any other file if G-code is loading. Skipped importing {0}", filename), + title = self._i18n_catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) message.show() return diff --git a/cura/MultiplyObjectsJob.py b/cura/MultiplyObjectsJob.py index 1ba78edacf..4c1caf137c 100644 --- a/cura/MultiplyObjectsJob.py +++ b/cura/MultiplyObjectsJob.py @@ -74,5 +74,6 @@ class MultiplyObjectsJob(Job): if not found_solution_for_all: no_full_solution_message = Message( i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), - title = i18n_catalog.i18nc("@info:title", "Placing Object")) + title = i18n_catalog.i18nc("@info:title", "Placing Object"), + message_type = Message.MessageType.WARNING) no_full_solution_message.show() diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index 96091f9c11..e416fb63c4 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -187,7 +187,8 @@ class AuthorizationService: except OSError: Logger.logException("w", "Unable to create authorization request server") Message(i18n_catalog.i18nc("@info", "Unable to start a new sign in process. Check if another sign in attempt is still active."), - title=i18n_catalog.i18nc("@info:title", "Warning")).show() + title=i18n_catalog.i18nc("@info:title", "Warning"), + message_type = Message.MessageType.WARNING).show() return auth_url = self._generate_auth_url(query_parameters_dict, force_browser_logout) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 7e6c3f5d20..cd9255cdc0 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -150,11 +150,13 @@ class CuraContainerRegistry(ContainerRegistry): Logger.log("w", "Failed to export profile to %s: Writer plugin reported failure.", file_name) m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", "Failed to export profile to {0}: Writer plugin reported failure.", file_name), lifetime = 0, - title = catalog.i18nc("@info:title", "Error")) + title = catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) m.show() return False m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", "Exported profile to {0}", file_name), - title = catalog.i18nc("@info:title", "Export succeeded")) + title = catalog.i18nc("@info:title", "Export succeeded"), + message_type = Message.MessageType.POSITIVE) m.show() return True diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index d0442e083b..ee8652839d 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -540,7 +540,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader): "Project file {0} contains an unknown machine type" " {1}. Cannot import the machine." " Models will be imported instead.", file_name, machine_definition_id), - title = i18n_catalog.i18nc("@info:title", "Open Project File")) + title = i18n_catalog.i18nc("@info:title", "Open Project File"), + message_type = Message.MessageType.WARNING) message.show() Logger.log("i", "Could unknown machine definition %s in project file %s, cannot import it.", @@ -637,14 +638,16 @@ class ThreeMFWorkspaceReader(WorkspaceReader): except EnvironmentError as e: message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tags or !", "Project file {0} is suddenly inaccessible: {1}.", file_name, str(e)), - title = i18n_catalog.i18nc("@info:title", "Can't Open Project File")) + title = i18n_catalog.i18nc("@info:title", "Can't Open Project File"), + message_type = Message.MessageType.ERROR) message.show() self.setWorkspaceName("") return [], {} except zipfile.BadZipFile as e: message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tags or !", "Project file {0} is corrupt: {1}.", file_name, str(e)), - title = i18n_catalog.i18nc("@info:title", "Can't Open Project File")) + title = i18n_catalog.i18nc("@info:title", "Can't Open Project File"), + message_type = Message.MessageType.ERROR) message.show() self.setWorkspaceName("") return [], {} @@ -696,7 +699,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader): if not global_stacks: message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tag !", "Project file {0} is made using profiles that" - " are unknown to this version of Ultimaker Cura.", file_name)) + " are unknown to this version of Ultimaker Cura.", file_name), + message_type = Message.MessageType.ERROR) message.show() self.setWorkspaceName("") return [], {} diff --git a/plugins/CuraDrive/src/DrivePluginExtension.py b/plugins/CuraDrive/src/DrivePluginExtension.py index 3a7a59a172..f42ffea9f7 100644 --- a/plugins/CuraDrive/src/DrivePluginExtension.py +++ b/plugins/CuraDrive/src/DrivePluginExtension.py @@ -114,13 +114,17 @@ class DrivePluginExtension(QObject, Extension): self.restoringStateChanged.emit() if error_message: self.backupIdBeingRestored = "" - Message(error_message, title = catalog.i18nc("@info:title", "Backup")).show() + Message(error_message, + title = catalog.i18nc("@info:title", "Backup"), + message_type = Message.MessageType.ERROR).show() def _onCreatingStateChanged(self, is_creating: bool = False, error_message: str = None) -> None: self._is_creating_backup = is_creating self.creatingStateChanged.emit() if error_message: - Message(error_message, title = catalog.i18nc("@info:title", "Backup")).show() + Message(error_message, + title = catalog.i18nc("@info:title", "Backup"), + message_type = Message.MessageType.ERROR).show() else: self._storeBackupDate() if not is_creating and not error_message: diff --git a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py index 69163f9cdf..65489e8b5f 100644 --- a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py +++ b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py @@ -73,6 +73,7 @@ class DFFileExportAndUploadManager: text = "Your {} uploaded to '{}'.".format("file was" if len(self._file_upload_job_metadata) <= 1 else "files were", self._library_project_name), title = "Upload successful", lifetime = 0, + message_type=Message.MessageType.POSITIVE ) self._generic_success_message.addAction( "open_df_project", @@ -81,8 +82,6 @@ class DFFileExportAndUploadManager: ) self._generic_success_message.actionTriggered.connect(self._onMessageActionTriggered) - - def _onCuraProjectFileExported(self, job: ExportFileJob) -> None: """Handler for when the DF Library workspace file (3MF) has been created locally. diff --git a/plugins/DigitalLibrary/src/DigitalFactoryController.py b/plugins/DigitalLibrary/src/DigitalFactoryController.py index cd0f0be638..c0323100c8 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryController.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryController.py @@ -530,7 +530,8 @@ class DigitalFactoryController(QObject): Message( text = "Failed to write to temporary file for '{}'.".format(file_name), title = "File-system error", - lifetime = 10 + lifetime = 10, + message_type=Message.MessageType.ERROR ).show() return @@ -544,7 +545,8 @@ class DigitalFactoryController(QObject): Message( text = "Failed Digital Library download for '{}'.".format(f), title = "Network error {}".format(error), - lifetime = 10 + lifetime = 10, + message_type=Message.MessageType.ERROR ).show() download_manager = HttpRequestManager.getInstance() @@ -589,7 +591,10 @@ class DigitalFactoryController(QObject): if filename == "": Logger.log("w", "The file name cannot be empty.") - Message(text = "Cannot upload file with an empty name to the Digital Library", title = "Empty file name provided", lifetime = 0).show() + Message(text = "Cannot upload file with an empty name to the Digital Library", + title = "Empty file name provided", + lifetime = 0, + message_type = Message.MessageType.ERROR).show() return self._saveFileToSelectedProjectHelper(filename, formats) diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index 4f2f8bdf40..321ce8d007 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -28,7 +28,8 @@ class ModelChecker(QObject, Extension): self._caution_message = Message("", #Message text gets set when the message gets shown, to display the models in question. lifetime = 0, - title = catalog.i18nc("@info:title", "3D Model Assistant")) + title = catalog.i18nc("@info:title", "3D Model Assistant"), + message_type = Message.MessageType.WARNING) self._change_timer = QTimer() self._change_timer.setInterval(200) diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py index ccdd27ef16..556935756c 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py @@ -136,7 +136,8 @@ class RemovableDriveOutputDevice(OutputDevice): except: Logger.logException("w", "An execption occured while trying to write to removable drive.") message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(),str(job.getError())), - title = catalog.i18nc("@info:title", "Error")) + title = catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) message.show() self.writeError.emit(self) return @@ -144,13 +145,17 @@ class RemovableDriveOutputDevice(OutputDevice): self._writing = False self.writeFinished.emit(self) if job.getResult(): - message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())), title = catalog.i18nc("@info:title", "File Saved")) + message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())), + title = catalog.i18nc("@info:title", "File Saved"), + message_type = Message.MessageType.POSITIVE) message.addAction("eject", catalog.i18nc("@action:button", "Eject"), "eject", catalog.i18nc("@action", "Eject removable device {0}").format(self.getName())) message.actionTriggered.connect(self._onActionTriggered) message.show() self.writeSuccess.emit(self) else: - message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(), str(job.getError())), title = catalog.i18nc("@info:title", "Warning")) + message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(), str(job.getError())), + title = catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) message.show() self.writeError.emit(self) job.getStream().close() diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 57209f2678..5fc2669d2d 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -126,9 +126,13 @@ class SimulationView(CuraView): self._compatibility_mode = self._evaluateCompatibilityMode() self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled."), - title = catalog.i18nc("@info:title", "Simulation View")) - self._slice_first_warning_message = Message(catalog.i18nc("@info:status", "Nothing is shown because you need to slice first."), title = catalog.i18nc("@info:title", "No layers to show"), - option_text = catalog.i18nc("@info:option_text", "Do not show this message again"), option_state = False) + title = catalog.i18nc("@info:title", "Simulation View"), + message_type = Message.MessageType.WARNING) + self._slice_first_warning_message = Message(catalog.i18nc("@info:status", "Nothing is shown because you need to slice first."), + title = catalog.i18nc("@info:title", "No layers to show"), + option_text = catalog.i18nc("@info:option_text", "Do not show this message again"), + option_state = False, + message_type = Message.MessageType.WARNING) self._slice_first_warning_message.optionToggled.connect(self._onDontAskMeAgain) CuraApplication.getInstance().getPreferences().addPreference(self._no_layers_warning_preference, True) diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 3ecc84eb37..f12c1aae01 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -72,7 +72,8 @@ class SolidView(View): lifetime = 60 * 5, # leave message for 5 minutes title = catalog.i18nc("@info:title", "Model Errors"), option_text = catalog.i18nc("@info:option_text", "Do not show this message again"), - option_state = False + option_state = False, + message_type=Message.MessageType.WARNING ) self._xray_warning_message.optionToggled.connect(self._onDontAskMeAgain) application.getPreferences().addPreference(self._show_xray_warning_preference, True) diff --git a/plugins/Toolbox/src/CloudSync/SyncOrchestrator.py b/plugins/Toolbox/src/CloudSync/SyncOrchestrator.py index a85c13f639..bb37c6d4a9 100644 --- a/plugins/Toolbox/src/CloudSync/SyncOrchestrator.py +++ b/plugins/Toolbox/src/CloudSync/SyncOrchestrator.py @@ -111,4 +111,4 @@ class SyncOrchestrator(Extension): """Logs an error and shows it to the user""" Logger.error(text) - Message(text, lifetime=0).show() + Message(text, lifetime = 0, message_type = Message.MessageType.ERROR).show() diff --git a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py index 146767467a..9014cc2d70 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py @@ -19,7 +19,8 @@ class LegacyDeviceNoLongerSupportedMessage(Message): "running Ultimaker Connect. Please update the printer to the " "latest firmware."), title = I18N_CATALOG.i18nc("@info:title", "Update your printer"), - lifetime = 10 + lifetime = 10, + message_type = Message.MessageType.WARNING ) def show(self) -> None: diff --git a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py index 70bfa769ee..059b81b39e 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py @@ -29,7 +29,8 @@ class NotClusterHostMessage(Message): "it as a group host.", device.name), title = I18N_CATALOG.i18nc("@info:title", "Not a group host"), lifetime = 0, - dismissable = True + dismissable = True, + message_type = Message.MessageType.ERROR ) self._address = device.address self.addAction("", I18N_CATALOG.i18nc("@action", "Configure group"), "", "") diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py index 39dc985cb8..bfb6ece4cd 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py @@ -14,5 +14,6 @@ class PrintJobUploadBlockedMessage(Message): super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Please wait until the current job has been sent."), title = I18N_CATALOG.i18nc("@info:title", "Print error"), - lifetime = 10 + lifetime = 10, + message_type = Message.MessageType.WARNING ) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py index 9feb4b4970..4b30013b9c 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py @@ -13,5 +13,6 @@ class PrintJobUploadErrorMessage(Message): def __init__(self, message: str = None) -> None: super().__init__( text = message or I18N_CATALOG.i18nc("@info:text", "Could not upload the data to the printer."), - title = I18N_CATALOG.i18nc("@info:title", "Network error") + title = I18N_CATALOG.i18nc("@info:title", "Network error"), + message_type=Message.MessageType.ERROR ) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py index dc910e9e1b..b9f4b3b704 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py @@ -15,5 +15,6 @@ class PrintJobUploadQueueFullMessage(Message): super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job queue is full. The printer can't accept a new job."), title = I18N_CATALOG.i18nc("@info:title", "Queue Full"), - lifetime = 10 + lifetime = 10, + message_type=Message.MessageType.WARNING ) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py index aa3d72ccd8..7fa7340cff 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py @@ -13,5 +13,6 @@ class PrintJobUploadSuccessMessage(Message): def __init__(self) -> None: super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job was successfully sent to the printer."), - title = I18N_CATALOG.i18nc("@info:title", "Data Sent") + title = I18N_CATALOG.i18nc("@info:title", "Data Sent"), + message_type = Message.MessageType.POSITIVE ) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 70a1f4333e..1e4a83eba3 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -131,7 +131,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice): """ if self._is_printing: - message = Message(text = catalog.i18nc("@message", "A print is still in progress. Cura cannot start another print via USB until the previous print has completed."), title = catalog.i18nc("@message", "Print in Progress")) + message = Message(text = catalog.i18nc("@message", "A print is still in progress. Cura cannot start another print via USB until the previous print has completed."), + title = catalog.i18nc("@message", "Print in Progress"), + message_type = Message.MessageType.WARNING) message.show() return # Already printing self.writeStarted.emit(self) From 2263969d5f156a3858eead86b18f6b25cb813e2e Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 28 Jul 2021 08:45:42 +0200 Subject: [PATCH 2/4] Updated message with message types Contributes to CURA-8418 --- .../ArrangeObjectsAllBuildPlatesJob.py | 6 ++-- cura/Arranging/ArrangeObjectsJob.py | 2 +- cura/Backups/Backup.py | 25 ++++++++------- cura/CuraApplication.py | 14 +++++---- cura/MultiplyObjectsJob.py | 2 +- cura/OAuth2/AuthorizationService.py | 8 +++-- cura/Settings/CuraContainerRegistry.py | 25 +++++++++------ cura/Settings/MachineManager.py | 3 +- plugins/CuraDrive/src/CreateBackupJob.py | 4 ++- .../CuraEngineBackend/CuraEngineBackend.py | 31 +++++++++++++------ .../ProcessSlicedLayersJob.py | 4 +-- .../src/DFFileExportAndUploadManager.py | 22 ++++++++----- plugins/GCodeReader/FlavorParser.py | 3 +- .../RemovableDriveOutputDevice.py | 18 ++++++++--- plugins/SimulationView/SimulationView.py | 9 ++++-- .../CloudSync/RestartApplicationPresenter.py | 8 ++--- .../src/Cloud/CloudOutputDeviceManager.py | 6 ++-- .../LegacyDeviceNoLongerSupportedMessage.py | 2 +- .../src/Messages/MaterialSyncMessage.py | 5 +-- .../src/Messages/NotClusterHostMessage.py | 2 +- .../Messages/PrintJobUploadBlockedMessage.py | 4 +-- .../Messages/PrintJobUploadErrorMessage.py | 2 +- .../Messages/PrintJobUploadProgressMessage.py | 2 +- .../PrintJobUploadQueueFullMessage.py | 4 +-- .../Messages/PrintJobUploadSuccessMessage.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 5 +-- 26 files changed, 136 insertions(+), 82 deletions(-) diff --git a/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py b/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py index 0f337a229b..5f43b8e1a0 100644 --- a/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py +++ b/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py @@ -147,6 +147,8 @@ class ArrangeObjectsAllBuildPlatesJob(Job): status_message.hide() if not found_solution_for_all: - no_full_solution_message = Message(i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), - title = i18n_catalog.i18nc("@info:title", "Can't Find Location")) + no_full_solution_message = Message(i18n_catalog.i18nc("@info:status", + "Unable to find a location within the build volume for all objects"), + title = i18n_catalog.i18nc("@info:title", "Can't Find Location"), + message_type = Message.MessageType.ERROR) no_full_solution_message.show() diff --git a/cura/Arranging/ArrangeObjectsJob.py b/cura/Arranging/ArrangeObjectsJob.py index d45dc2c67f..e65a442acb 100644 --- a/cura/Arranging/ArrangeObjectsJob.py +++ b/cura/Arranging/ArrangeObjectsJob.py @@ -40,6 +40,6 @@ class ArrangeObjectsJob(Job): i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), title = i18n_catalog.i18nc("@info:title", "Can't Find Location"), - message_type = Message.MessageType.WARNING) + message_type = Message.MessageType.ERROR) no_full_solution_message.show() self.finished.emit(self) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 71567148ff..85510e6b4c 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -111,15 +111,15 @@ class Backup: return archive except (IOError, OSError, BadZipfile) as error: Logger.log("e", "Could not create archive from user data directory: %s", error) - self._showMessage( - self.catalog.i18nc("@info:backup_failed", - "Could not create archive from user data directory: {}".format(error))) + self._showMessage(self.catalog.i18nc("@info:backup_failed", + "Could not create archive from user data directory: {}".format(error)), + message_type = Message.MessageType.ERROR) return None - def _showMessage(self, message: str) -> None: + def _showMessage(self, message: str, message_type: Message.MessageType = Message.MessageType.NEUTRAL) -> None: """Show a UI message.""" - Message(message, title=self.catalog.i18nc("@info:title", "Backup")).show() + Message(message, title=self.catalog.i18nc("@info:title", "Backup"), message_type = message_type).show() def restore(self) -> bool: """Restore this back-up. @@ -130,9 +130,9 @@ class Backup: if not self.zip_file or not self.meta_data or not self.meta_data.get("cura_release", None): # We can restore without the minimum required information. Logger.log("w", "Tried to restore a Cura backup without having proper data or meta data.") - self._showMessage( - self.catalog.i18nc("@info:backup_failed", - "Tried to restore a Cura backup without having proper data or meta data.")) + self._showMessage(self.catalog.i18nc("@info:backup_failed", + "Tried to restore a Cura backup without having proper data or meta data."), + message_type = Message.MessageType.ERROR) return False current_version = Version(self._application.getVersion()) @@ -141,9 +141,9 @@ class Backup: if current_version < version_to_restore: # Cannot restore version newer than current because settings might have changed. Logger.log("d", "Tried to restore a Cura backup of version {version_to_restore} with cura version {current_version}".format(version_to_restore = version_to_restore, current_version = current_version)) - self._showMessage( - self.catalog.i18nc("@info:backup_failed", - "Tried to restore a Cura backup that is higher than the current version.")) + self._showMessage(self.catalog.i18nc("@info:backup_failed", + "Tried to restore a Cura backup that is higher than the current version."), + message_type = Message.MessageType.ERROR) return False # Get the current secrets and store since the back-up doesn't contain those @@ -154,7 +154,8 @@ class Backup: archive = ZipFile(io.BytesIO(self.zip_file), "r") except LookupError as e: Logger.log("d", f"The following error occurred while trying to restore a Cura backup: {str(e)}") - Message(self.catalog.i18nc("@info:backup_failed", "The following error occurred while trying to restore a Cura backup:") + str(e), + Message(self.catalog.i18nc("@info:backup_failed", + "The following error occurred while trying to restore a Cura backup:") + str(e), title = self.catalog.i18nc("@info:title", "Backup"), message_type = Message.MessageType.ERROR).show() diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 463b121cad..8d63e7ec12 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1798,9 +1798,10 @@ class CuraApplication(QtApplication): if extension in self._non_sliceable_extensions: message = Message( self._i18n_catalog.i18nc("@info:status", - "Only one G-code file can be loaded at a time. Skipped importing {0}", filename), - title = self._i18n_catalog.i18nc("@info:title", "Warning"), - message_type = Message.MessageType.WARNING) + "Only one G-code file can be loaded at a time. Skipped importing {0}", + filename), + title = self._i18n_catalog.i18nc("@info:title", "Warning"), + message_type = Message.MessageType.WARNING) message.show() return # If file being loaded is non-slicable file, then prevent loading of any other files @@ -1809,9 +1810,10 @@ class CuraApplication(QtApplication): if extension in self._non_sliceable_extensions: message = Message( self._i18n_catalog.i18nc("@info:status", - "Can't open any other file if G-code is loading. Skipped importing {0}", filename), - title = self._i18n_catalog.i18nc("@info:title", "Error"), - message_type = Message.MessageType.ERROR) + "Can't open any other file if G-code is loading. Skipped importing {0}", + filename), + title = self._i18n_catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) message.show() return diff --git a/cura/MultiplyObjectsJob.py b/cura/MultiplyObjectsJob.py index 4c1caf137c..dcfb60a921 100644 --- a/cura/MultiplyObjectsJob.py +++ b/cura/MultiplyObjectsJob.py @@ -75,5 +75,5 @@ class MultiplyObjectsJob(Job): no_full_solution_message = Message( i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), title = i18n_catalog.i18nc("@info:title", "Placing Object"), - message_type = Message.MessageType.WARNING) + message_type = Message.MessageType.ERROR) no_full_solution_message.show() diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index e416fb63c4..aba9558de8 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -186,7 +186,8 @@ class AuthorizationService: self._server.start(verification_code, state) except OSError: Logger.logException("w", "Unable to create authorization request server") - Message(i18n_catalog.i18nc("@info", "Unable to start a new sign in process. Check if another sign in attempt is still active."), + Message(i18n_catalog.i18nc("@info", + "Unable to start a new sign in process. Check if another sign in attempt is still active."), title=i18n_catalog.i18nc("@info:title", "Warning"), message_type = Message.MessageType.WARNING).show() return @@ -242,7 +243,10 @@ class AuthorizationService: if self._unable_to_get_data_message is not None: self._unable_to_get_data_message.hide() - self._unable_to_get_data_message = Message(i18n_catalog.i18nc("@info", "Unable to reach the Ultimaker account server."), title = i18n_catalog.i18nc("@info:title", "Warning")) + self._unable_to_get_data_message = Message(i18n_catalog.i18nc("@info", + "Unable to reach the Ultimaker account server."), + title = i18n_catalog.i18nc("@info:title", "Warning"), + message_type = Message.MessageType.ERROR) self._unable_to_get_data_message.show() except (ValueError, TypeError): Logger.logException("w", "Could not load auth data from preferences") diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index cd9255cdc0..295d843fd7 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -141,20 +141,27 @@ class CuraContainerRegistry(ContainerRegistry): success = profile_writer.write(file_name, container_list) except Exception as e: Logger.log("e", "Failed to export profile to %s: %s", file_name, str(e)) - m = Message(catalog.i18nc("@info:status Don't translate the XML tags or !", "Failed to export profile to {0}: {1}", file_name, str(e)), - lifetime = 0, - title = catalog.i18nc("@info:title", "Error")) - m.show() - return False - if not success: - Logger.log("w", "Failed to export profile to %s: Writer plugin reported failure.", file_name) - m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", "Failed to export profile to {0}: Writer plugin reported failure.", file_name), + m = Message(catalog.i18nc("@info:status Don't translate the XML tags or !", + "Failed to export profile to {0}: {1}", + file_name, str(e)), lifetime = 0, title = catalog.i18nc("@info:title", "Error"), message_type = Message.MessageType.ERROR) m.show() return False - m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", "Exported profile to {0}", file_name), + if not success: + Logger.log("w", "Failed to export profile to %s: Writer plugin reported failure.", file_name) + m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", + "Failed to export profile to {0}: Writer plugin reported failure.", + file_name), + lifetime = 0, + title = catalog.i18nc("@info:title", "Error"), + message_type = Message.MessageType.ERROR) + m.show() + return False + m = Message(catalog.i18nc("@info:status Don't translate the XML tag !", + "Exported profile to {0}", + file_name), title = catalog.i18nc("@info:title", "Export succeeded"), message_type = Message.MessageType.POSITIVE) m.show() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1a2ab72a33..70a8a6aae7 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -853,7 +853,8 @@ class MachineManager(QObject): self._global_container_stack.userChanges.setProperty(setting_key, "value", self._default_extruder_position) if add_user_changes: caution_message = Message( - catalog.i18nc("@info:message Followed by a list of settings.", "Settings have been changed to match the current availability of extruders:") + " [{settings_list}]".format(settings_list = ", ".join(add_user_changes)), + catalog.i18nc("@info:message Followed by a list of settings.", + "Settings have been changed to match the current availability of extruders:") + " [{settings_list}]".format(settings_list = ", ".join(add_user_changes)), lifetime = 0, title = catalog.i18nc("@info:title", "Settings updated")) caution_message.show() diff --git a/plugins/CuraDrive/src/CreateBackupJob.py b/plugins/CuraDrive/src/CreateBackupJob.py index ab1989f382..12bbc035ac 100644 --- a/plugins/CuraDrive/src/CreateBackupJob.py +++ b/plugins/CuraDrive/src/CreateBackupJob.py @@ -43,7 +43,9 @@ class CreateBackupJob(Job): """After the job completes, an empty string indicates success. Othrerwise, the value is a translated message.""" def run(self) -> None: - upload_message = Message(catalog.i18nc("@info:backup_status", "Creating your backup..."), title = self.MESSAGE_TITLE, progress = -1) + upload_message = Message(catalog.i18nc("@info:backup_status", "Creating your backup..."), + title = self.MESSAGE_TITLE, + progress = -1) upload_message.show() CuraApplication.getInstance().processEvents() cura_api = CuraApplication.getInstance().getCuraAPI() diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index fa9a8c5474..fd3b2b551d 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -391,7 +391,9 @@ class CuraEngineBackend(QObject, Backend): if job.getResult() == StartJobResult.MaterialIncompatible: if application.platformActivity: self._error_message = Message(catalog.i18nc("@info:status", - "Unable to slice with the current material as it is incompatible with the selected machine or configuration."), title = catalog.i18nc("@info:title", "Unable to slice")) + "Unable to slice with the current material as it is incompatible with the selected machine or configuration."), + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -421,8 +423,10 @@ class CuraEngineBackend(QObject, Backend): continue error_labels.add(definitions[0].label) - self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}").format(", ".join(error_labels)), - title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message = Message(catalog.i18nc("@info:status", + "Unable to slice with the current settings. The following settings have errors: {0}").format(", ".join(error_labels)), + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -445,8 +449,10 @@ class CuraEngineBackend(QObject, Backend): Logger.log("e", "When checking settings for errors, unable to find definition for key {key} in per-object stack.".format(key = key)) continue errors[key] = definition[0].label - self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice due to some per-model settings. The following settings have errors on one or more models: {error_labels}").format(error_labels = ", ".join(errors.values())), - title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message = Message(catalog.i18nc("@info:status", + "Unable to slice due to some per-model settings. The following settings have errors on one or more models: {error_labels}").format(error_labels = ", ".join(errors.values())), + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -454,8 +460,10 @@ class CuraEngineBackend(QObject, Backend): if job.getResult() == StartJobResult.BuildPlateError: if application.platformActivity: - self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."), - title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message = Message(catalog.i18nc("@info:status", + "Unable to slice because the prime tower or prime position(s) are invalid."), + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -463,8 +471,10 @@ class CuraEngineBackend(QObject, Backend): self.setState(BackendState.NotStarted) if job.getResult() == StartJobResult.ObjectsWithDisabledExtruder: - self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because there are objects associated with disabled Extruder %s.") % job.getMessage(), - title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message = Message(catalog.i18nc("@info:status", + "Unable to slice because there are objects associated with disabled Extruder %s.") % job.getMessage(), + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -476,7 +486,8 @@ class CuraEngineBackend(QObject, Backend): "\n- Fit within the build volume" "\n- Are assigned to an enabled extruder" "\n- Are not all set as modifier meshes"), - title = catalog.i18nc("@info:title", "Unable to slice")) + title = catalog.i18nc("@info:title", "Unable to slice"), + message_type = Message.MessageType.ERROR) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index e0a20177b5..02583a6e40 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -257,10 +257,10 @@ class ProcessSlicedLayersJob(Job): if self.isRunning(): if Application.getInstance().getController().getActiveView().getPluginId() == "SimulationView": if not self._progress_message: - self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information")) + self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, + catalog.i18nc("@info:title", "Information")) if self._progress_message.getProgress() != 100: self._progress_message.show() else: if self._progress_message: self._progress_message.hide() - diff --git a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py index 65489e8b5f..c8650004e9 100644 --- a/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py +++ b/plugins/DigitalLibrary/src/DFFileExportAndUploadManager.py @@ -73,7 +73,7 @@ class DFFileExportAndUploadManager: text = "Your {} uploaded to '{}'.".format("file was" if len(self._file_upload_job_metadata) <= 1 else "files were", self._library_project_name), title = "Upload successful", lifetime = 0, - message_type=Message.MessageType.POSITIVE + message_type = Message.MessageType.POSITIVE ) self._generic_success_message.addAction( "open_df_project", @@ -220,7 +220,8 @@ class DFFileExportAndUploadManager: self._file_upload_job_metadata[filename]["file_upload_failed_message"] = Message( text = "Failed to export the file '{}'. The upload process is aborted.".format(filename), title = "Export error", - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) self._on_upload_error() self._onFileUploadFinished(filename) @@ -242,7 +243,8 @@ class DFFileExportAndUploadManager: self._file_upload_job_metadata[filename_3mf]["file_upload_failed_message"] = Message( text = "Failed to upload the file '{}' to '{}'. {}".format(filename_3mf, self._library_project_name, human_readable_error), title = "File upload error", - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) self._on_upload_error() self._onFileUploadFinished(filename_3mf) @@ -264,7 +266,8 @@ class DFFileExportAndUploadManager: self._file_upload_job_metadata[filename_ufp]["file_upload_failed_message"] = Message( title = "File upload error", text = "Failed to upload the file '{}' to '{}'. {}".format(filename_ufp, self._library_project_name, human_readable_error), - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) self._on_upload_error() self._onFileUploadFinished(filename_ufp) @@ -300,7 +303,8 @@ class DFFileExportAndUploadManager: self._file_upload_job_metadata[filename]["file_upload_failed_message"] = Message( title = "File upload error", text = "Failed to upload the file '{}' to '{}'. {}".format(self._file_name, self._library_project_name, human_readable_error), - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) self._on_upload_error() @@ -337,11 +341,13 @@ class DFFileExportAndUploadManager: text = "'{}' was uploaded to '{}'.".format(filename_3mf, self._library_project_name), title = "Upload successful", lifetime = 0, + message_type = Message.MessageType.POSITIVE ), "file_upload_failed_message": Message( text = "Failed to upload the file '{}' to '{}'.".format(filename_3mf, self._library_project_name), title = "File upload error", - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) } job_3mf = ExportFileJob(self._file_handlers["3mf"], self._nodes, self._file_name, "3mf") @@ -359,11 +365,13 @@ class DFFileExportAndUploadManager: text = "'{}' was uploaded to '{}'.".format(filename_ufp, self._library_project_name), title = "Upload successful", lifetime = 0, + message_type = Message.MessageType.POSITIVE ), "file_upload_failed_message": Message( text = "Failed to upload the file '{}' to '{}'.".format(filename_ufp, self._library_project_name), title = "File upload error", - lifetime = 0 + lifetime = 0, + message_type = Message.MessageType.ERROR ) } job_ufp = ExportFileJob(self._file_handlers["ufp"], self._nodes, self._file_name, "ufp") diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 09495c527f..56e50d2145 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -500,7 +500,8 @@ class FlavorParser: "@info:generic", "Make sure the g-code is suitable for your printer and printer configuration before sending the file to it. The g-code representation may not be accurate."), lifetime=0, - title = catalog.i18nc("@info:title", "G-code Details")) + title = catalog.i18nc("@info:title", "G-code Details"), + message_type = Message.MessageType.WARNING) caution_message.show() # The "save/print" button's state is bound to the backend state. diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py index 556935756c..05543813db 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py @@ -93,7 +93,9 @@ class RemovableDriveOutputDevice(OutputDevice): job.progress.connect(self._onProgress) job.finished.connect(self._onFinished) - message = Message(catalog.i18nc("@info:progress Don't translate the XML tags !", "Saving to Removable Drive {0}").format(self.getName()), 0, False, -1, catalog.i18nc("@info:title", "Saving")) + message = Message(catalog.i18nc("@info:progress Don't translate the XML tags !", + "Saving to Removable Drive {0}").format(self.getName()), + 0, False, -1, catalog.i18nc("@info:title", "Saving")) message.show() self.writeStarted.emit(self) @@ -153,7 +155,9 @@ class RemovableDriveOutputDevice(OutputDevice): message.show() self.writeSuccess.emit(self) else: - message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(), str(job.getError())), + message = Message(catalog.i18nc("@info:status", + "Could not save to removable drive {0}: {1}").format(self.getName(), + str(job.getError())), title = catalog.i18nc("@info:title", "Error"), message_type = Message.MessageType.ERROR) message.show() @@ -164,8 +168,12 @@ class RemovableDriveOutputDevice(OutputDevice): if action == "eject": if Application.getInstance().getOutputDeviceManager().getOutputDevicePlugin("RemovableDriveOutputDevice").ejectDevice(self): message.hide() - - eject_message = Message(catalog.i18nc("@info:status", "Ejected {0}. You can now safely remove the drive.").format(self.getName()), title = catalog.i18nc("@info:title", "Safely Remove Hardware")) + eject_message = Message(catalog.i18nc("@info:status", + "Ejected {0}. You can now safely remove the drive.").format(self.getName()), + title = catalog.i18nc("@info:title", "Safely Remove Hardware")) else: - eject_message = Message(catalog.i18nc("@info:status", "Failed to eject {0}. Another program may be using the drive.").format(self.getName()), title = catalog.i18nc("@info:title", "Warning")) + eject_message = Message(catalog.i18nc("@info:status", + "Failed to eject {0}. Another program may be using the drive.").format(self.getName()), + title = catalog.i18nc("@info:title", "Warning"), + message_type = Message.MessageType.ERROR) eject_message.show() diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 5fc2669d2d..af6b538f26 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -125,12 +125,15 @@ class SimulationView(CuraView): self._only_show_top_layers = bool(Application.getInstance().getPreferences().getValue("view/only_show_top_layers")) self._compatibility_mode = self._evaluateCompatibilityMode() - self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled."), + self._wireprint_warning_message = Message(catalog.i18nc("@info:status", + "Cura does not accurately display layers when Wire Printing is enabled."), title = catalog.i18nc("@info:title", "Simulation View"), message_type = Message.MessageType.WARNING) - self._slice_first_warning_message = Message(catalog.i18nc("@info:status", "Nothing is shown because you need to slice first."), + self._slice_first_warning_message = Message(catalog.i18nc("@info:status", + "Nothing is shown because you need to slice first."), title = catalog.i18nc("@info:title", "No layers to show"), - option_text = catalog.i18nc("@info:option_text", "Do not show this message again"), + option_text = catalog.i18nc("@info:option_text", + "Do not show this message again"), option_state = False, message_type = Message.MessageType.WARNING) self._slice_first_warning_message.optionToggled.connect(self._onDontAskMeAgain) diff --git a/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py b/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py index d0222029fd..0a3bf5fcb2 100644 --- a/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py +++ b/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py @@ -15,10 +15,10 @@ class RestartApplicationPresenter: def present(self) -> None: app_name = self._app.getApplicationDisplayName() - message = Message(self._i18n_catalog.i18nc( - "@info:generic", - "You need to quit and restart {} before changes have effect.", app_name - )) + message = Message(self._i18n_catalog.i18nc("@info:generic", + "You need to quit and restart {} before changes have effect.", + app_name), + message_type = Message.MessageType.WARNING) message.addAction("quit", name="Quit " + app_name, diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index ac95624421..a900edeb75 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -230,7 +230,8 @@ class CloudOutputDeviceManager: ), progress = 0, lifetime = 0, - image_source = image_path + image_source = image_path, + message_type = Message.MessageType.POSITIVE ) message.show() @@ -316,7 +317,8 @@ class CloudOutputDeviceManager: "A cloud connection is not available for a printer", "A cloud connection is not available for some printers", len(self.reported_device_ids) - ) + ), + message_type = Message.MessageType.WARNING ) device_names = "".join(["
  • {} ({})
  • ".format(self._um_cloud_printers[device].name, self._um_cloud_printers[device].definition.name) for device in self.reported_device_ids]) message_text = self.i18n_catalog.i18ncp( diff --git a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py index 9014cc2d70..1a7c4ebe3b 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py @@ -14,7 +14,7 @@ class LegacyDeviceNoLongerSupportedMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self) -> None: - super().__init__( + super(LegacyDeviceNoLongerSupportedMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to a printer that is not " "running Ultimaker Connect. Please update the printer to the " "latest firmware."), diff --git a/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py b/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py index 6b481ff4a1..648a8005b5 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py @@ -20,12 +20,13 @@ class MaterialSyncMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self, device: "UltimakerNetworkedPrinterOutputDevice") -> None: - super().__init__( + super(MaterialSyncMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "Cura has detected material profiles that were not yet installed " "on the host printer of group {0}.", device.name), title = I18N_CATALOG.i18nc("@info:title", "Sending materials to printer"), lifetime = 10, - dismissable = True + dismissable = True, + message_type = Message.MessageType.POSITIVE ) def show(self) -> None: diff --git a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py index 059b81b39e..7bb1e231ba 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py @@ -23,7 +23,7 @@ class NotClusterHostMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self, device: "UltimakerNetworkedPrinterOutputDevice") -> None: - super().__init__( + super(NotClusterHostMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to {0} but it is not " "the host of a group. You can visit the web page to configure " "it as a group host.", device.name), diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py index bfb6ece4cd..d526d8423b 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py @@ -11,9 +11,9 @@ class PrintJobUploadBlockedMessage(Message): """Message shown when uploading a print job to a cluster is blocked because another upload is already in progress.""" def __init__(self) -> None: - super().__init__( + super(PrintJobUploadBlockedMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "Please wait until the current job has been sent."), title = I18N_CATALOG.i18nc("@info:title", "Print error"), lifetime = 10, - message_type = Message.MessageType.WARNING + message_type = Message.MessageType.ERROR ) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py index 4b30013b9c..ea9c1012a3 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadErrorMessage(Message): """Message shown when uploading a print job to a cluster failed.""" def __init__(self, message: str = None) -> None: - super().__init__( + super(PrintJobUploadErrorMessage, self).__init__( text = message or I18N_CATALOG.i18nc("@info:text", "Could not upload the data to the printer."), title = I18N_CATALOG.i18nc("@info:title", "Network error"), message_type=Message.MessageType.ERROR diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py index 63fa037890..03588f5c64 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadProgressMessage(Message): """Class responsible for showing a progress message while a mesh is being uploaded to the cloud.""" def __init__(self): - super().__init__( + super(PrintJobUploadProgressMessage, self).__init__( title = I18N_CATALOG.i18nc("@info:status", "Sending Print Job"), text = I18N_CATALOG.i18nc("@info:status", "Uploading print job to printer."), progress = -1, diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py index b9f4b3b704..a296b9fd57 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py @@ -12,9 +12,9 @@ class PrintJobUploadQueueFullMessage(Message): """Message shown when uploading a print job to a cluster and the print queue is full.""" def __init__(self) -> None: - super().__init__( + super(PrintJobUploadQueueFullMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job queue is full. The printer can't accept a new job."), title = I18N_CATALOG.i18nc("@info:title", "Queue Full"), lifetime = 10, - message_type=Message.MessageType.WARNING + message_type=Message.MessageType.ERROR ) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py index 7fa7340cff..e82a031a39 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadSuccessMessage(Message): """Message shown when uploading a print job to a cluster succeeded.""" def __init__(self) -> None: - super().__init__( + super(PrintJobUploadSuccessMessage, self).__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job was successfully sent to the printer."), title = I18N_CATALOG.i18nc("@info:title", "Data Sent"), message_type = Message.MessageType.POSITIVE diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 1e4a83eba3..92f4bf4e4d 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -131,9 +131,10 @@ class USBPrinterOutputDevice(PrinterOutputDevice): """ if self._is_printing: - message = Message(text = catalog.i18nc("@message", "A print is still in progress. Cura cannot start another print via USB until the previous print has completed."), + message = Message(text = catalog.i18nc("@message", + "A print is still in progress. Cura cannot start another print via USB until the previous print has completed."), title = catalog.i18nc("@message", "Print in Progress"), - message_type = Message.MessageType.WARNING) + message_type = Message.MessageType.ERROR) message.show() return # Already printing self.writeStarted.emit(self) From 2e6a488c98fe7fb6f80eeda171402ac35bef3881 Mon Sep 17 00:00:00 2001 From: jelle Spijker Date: Wed, 28 Jul 2021 09:47:14 +0200 Subject: [PATCH 3/4] Set "Unable to slice" msgs to warning types Contributes to CURA-8418 --- plugins/CuraEngineBackend/CuraEngineBackend.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index fd3b2b551d..f5f238c117 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -393,7 +393,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current material as it is incompatible with the selected machine or configuration."), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -426,7 +426,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}").format(", ".join(error_labels)), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -452,7 +452,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice due to some per-model settings. The following settings have errors on one or more models: {error_labels}").format(error_labels = ", ".join(errors.values())), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -463,7 +463,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -474,7 +474,7 @@ class CuraEngineBackend(QObject, Backend): self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because there are objects associated with disabled Extruder %s.") % job.getMessage(), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) @@ -487,7 +487,7 @@ class CuraEngineBackend(QObject, Backend): "\n- Are assigned to an enabled extruder" "\n- Are not all set as modifier meshes"), title = catalog.i18nc("@info:title", "Unable to slice"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) self._error_message.show() self.setState(BackendState.Error) self.backendError.emit(job) From b6665f1142ba3a566454c821e1d8c937d7b4119b Mon Sep 17 00:00:00 2001 From: jelle Spijker Date: Wed, 28 Jul 2021 11:32:29 +0200 Subject: [PATCH 4/4] Applied review comments Contributes to CURA-8418 --- cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py | 2 +- cura/MultiplyObjectsJob.py | 2 +- .../Toolbox/src/CloudSync/RestartApplicationPresenter.py | 3 +-- .../src/Messages/LegacyDeviceNoLongerSupportedMessage.py | 2 +- .../UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py | 6 ++---- .../src/Messages/NotClusterHostMessage.py | 2 +- .../src/Messages/PrintJobUploadBlockedMessage.py | 2 +- .../src/Messages/PrintJobUploadErrorMessage.py | 2 +- .../src/Messages/PrintJobUploadProgressMessage.py | 2 +- .../src/Messages/PrintJobUploadQueueFullMessage.py | 2 +- .../src/Messages/PrintJobUploadSuccessMessage.py | 2 +- 11 files changed, 12 insertions(+), 15 deletions(-) diff --git a/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py b/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py index 5f43b8e1a0..e18f8098df 100644 --- a/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py +++ b/cura/Arranging/ArrangeObjectsAllBuildPlatesJob.py @@ -150,5 +150,5 @@ class ArrangeObjectsAllBuildPlatesJob(Job): no_full_solution_message = Message(i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), title = i18n_catalog.i18nc("@info:title", "Can't Find Location"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) no_full_solution_message.show() diff --git a/cura/MultiplyObjectsJob.py b/cura/MultiplyObjectsJob.py index dcfb60a921..4c1caf137c 100644 --- a/cura/MultiplyObjectsJob.py +++ b/cura/MultiplyObjectsJob.py @@ -75,5 +75,5 @@ class MultiplyObjectsJob(Job): no_full_solution_message = Message( i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"), title = i18n_catalog.i18nc("@info:title", "Placing Object"), - message_type = Message.MessageType.ERROR) + message_type = Message.MessageType.WARNING) no_full_solution_message.show() diff --git a/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py b/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py index 0a3bf5fcb2..8776d1782a 100644 --- a/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py +++ b/plugins/Toolbox/src/CloudSync/RestartApplicationPresenter.py @@ -17,8 +17,7 @@ class RestartApplicationPresenter: message = Message(self._i18n_catalog.i18nc("@info:generic", "You need to quit and restart {} before changes have effect.", - app_name), - message_type = Message.MessageType.WARNING) + app_name)) message.addAction("quit", name="Quit " + app_name, diff --git a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py index 1a7c4ebe3b..9014cc2d70 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/LegacyDeviceNoLongerSupportedMessage.py @@ -14,7 +14,7 @@ class LegacyDeviceNoLongerSupportedMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self) -> None: - super(LegacyDeviceNoLongerSupportedMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to a printer that is not " "running Ultimaker Connect. Please update the printer to the " "latest firmware."), diff --git a/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py b/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py index 648a8005b5..887cfaa5e8 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/MaterialSyncMessage.py @@ -20,14 +20,12 @@ class MaterialSyncMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self, device: "UltimakerNetworkedPrinterOutputDevice") -> None: - super(MaterialSyncMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Cura has detected material profiles that were not yet installed " "on the host printer of group {0}.", device.name), title = I18N_CATALOG.i18nc("@info:title", "Sending materials to printer"), lifetime = 10, - dismissable = True, - message_type = Message.MessageType.POSITIVE - ) + dismissable = True) def show(self) -> None: if MaterialSyncMessage.__is_visible: diff --git a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py index 7bb1e231ba..059b81b39e 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/NotClusterHostMessage.py @@ -23,7 +23,7 @@ class NotClusterHostMessage(Message): """Singleton used to prevent duplicate messages of this type at the same time.""" def __init__(self, device: "UltimakerNetworkedPrinterOutputDevice") -> None: - super(NotClusterHostMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to {0} but it is not " "the host of a group. You can visit the web page to configure " "it as a group host.", device.name), diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py index d526d8423b..853f6a1380 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadBlockedMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadBlockedMessage(Message): """Message shown when uploading a print job to a cluster is blocked because another upload is already in progress.""" def __init__(self) -> None: - super(PrintJobUploadBlockedMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Please wait until the current job has been sent."), title = I18N_CATALOG.i18nc("@info:title", "Print error"), lifetime = 10, diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py index ea9c1012a3..4b30013b9c 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadErrorMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadErrorMessage(Message): """Message shown when uploading a print job to a cluster failed.""" def __init__(self, message: str = None) -> None: - super(PrintJobUploadErrorMessage, self).__init__( + super().__init__( text = message or I18N_CATALOG.i18nc("@info:text", "Could not upload the data to the printer."), title = I18N_CATALOG.i18nc("@info:title", "Network error"), message_type=Message.MessageType.ERROR diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py index 03588f5c64..63fa037890 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadProgressMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadProgressMessage(Message): """Class responsible for showing a progress message while a mesh is being uploaded to the cloud.""" def __init__(self): - super(PrintJobUploadProgressMessage, self).__init__( + super().__init__( title = I18N_CATALOG.i18nc("@info:status", "Sending Print Job"), text = I18N_CATALOG.i18nc("@info:status", "Uploading print job to printer."), progress = -1, diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py index a296b9fd57..fc05ce3389 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadQueueFullMessage.py @@ -12,7 +12,7 @@ class PrintJobUploadQueueFullMessage(Message): """Message shown when uploading a print job to a cluster and the print queue is full.""" def __init__(self) -> None: - super(PrintJobUploadQueueFullMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job queue is full. The printer can't accept a new job."), title = I18N_CATALOG.i18nc("@info:title", "Queue Full"), lifetime = 10, diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py index e82a031a39..7fa7340cff 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py @@ -11,7 +11,7 @@ class PrintJobUploadSuccessMessage(Message): """Message shown when uploading a print job to a cluster succeeded.""" def __init__(self) -> None: - super(PrintJobUploadSuccessMessage, self).__init__( + super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job was successfully sent to the printer."), title = I18N_CATALOG.i18nc("@info:title", "Data Sent"), message_type = Message.MessageType.POSITIVE