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

@ -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 <filename> or <message>!", "Failed to export profile to <filename>{0}</filename>: <message>{1}</message>", 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 <filename>!", "Failed to export profile to <filename>{0}</filename>: Writer plugin reported failure.", file_name),
m = Message(catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!",
"Failed to export profile to <filename>{0}</filename>: <message>{1}</message>",
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 <filename>!", "Exported profile to <filename>{0}</filename>", 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 <filename>!",
"Failed to export profile to <filename>{0}</filename>: 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 <filename>!",
"Exported profile to <filename>{0}</filename>",
file_name),
title = catalog.i18nc("@info:title", "Export succeeded"),
message_type = Message.MessageType.POSITIVE)
m.show()