mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Added FirmwareUpdateCheckerMessage, so no variables have to be hidden in the action of a plain Message.
This commit is contained in:
parent
8c71a8855c
commit
931143ceaa
4 changed files with 40 additions and 22 deletions
|
@ -0,0 +1,31 @@
|
|||
|
||||
from UM.i18n import i18nCatalog
|
||||
from UM.Message import Message
|
||||
|
||||
i18n_catalog = i18nCatalog("cura")
|
||||
|
||||
|
||||
# Make a separate class, since we need an extra field: The machine-id that this message is about.
|
||||
class FirmwareUpdateCheckerMessage(Message):
|
||||
STR_ACTION_DOWNLOAD = "download"
|
||||
|
||||
def __init__(self, machine_id: int, machine_name: str) -> None:
|
||||
super().__init__(i18n_catalog.i18nc(
|
||||
"@info Don't translate {machine_name}, since it gets replaced by a printer name!",
|
||||
"New features are available for your {machine_name}! It is recommended to update the firmware on your printer.").format(
|
||||
machine_name=machine_name),
|
||||
title=i18n_catalog.i18nc(
|
||||
"@info:title The %s gets replaced with the printer name.",
|
||||
"New %s firmware available") % machine_name)
|
||||
|
||||
self._machine_id = machine_id
|
||||
|
||||
self.addAction(self.STR_ACTION_DOWNLOAD,
|
||||
i18n_catalog.i18nc("@action:button", "How to update"),
|
||||
"[no_icon]",
|
||||
"[no_description]",
|
||||
button_style=Message.ActionButtonStyle.LINK,
|
||||
button_align=Message.ActionButtonStyle.BUTTON_ALIGN_LEFT)
|
||||
|
||||
def getMachineId(self) -> int:
|
||||
return self._machine_id
|
Loading…
Add table
Add a link
Reference in a new issue