Updated message with message types

Contributes to CURA-8418
This commit is contained in:
Jelle Spijker 2021-07-28 08:45:42 +02:00
parent 900db57f0f
commit 2263969d5f
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
26 changed files with 136 additions and 82 deletions

View file

@ -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(["<li>{} ({})</li>".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(

View file

@ -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."),

View file

@ -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:

View file

@ -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),

View file

@ -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
)

View file

@ -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

View file

@ -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,

View file

@ -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
)

View file

@ -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