Skip to content

Commit

Permalink
feat: Add support for cancelled print state notifications and transla…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
Clon1998 committed Dec 4, 2024
1 parent 546713b commit 4b4b766
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mobileraker/mobileraker_companion.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ def _state_notification(self, cfg: DeviceNotificationEntry, cur_snap: PrinterSna
body = "state_error_body"
elif cur_snap.print_state == "standby":
body = "state_standby_body"
elif cur_snap.print_state == "cancelled":
body = "state_cancelled_body"

if title is None or body is None:
raise AttributeError("Body or Title are none!")
Expand Down
8 changes: 8 additions & 0 deletions mobileraker/util/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'state_error_body': 'Error while printing file: "$file"',
'state_standby_body': 'Printer is in Standby',
'state_resumed_body': 'Resumed printing for: "$file"',
'state_cancelled_body': 'Cancelled printing of: "$file"',
'm117_custom_title': 'User Notification',
"filament_sensor_triggered_title": "Filament Sensor Triggered",
"filament_sensor_triggered_body": "$$sensor triggered on printer $printer_name",
Expand All @@ -38,6 +39,7 @@
'state_error_body': 'Erreur lors de l\'impression du fichier : "$file"',
'state_standby_body': 'L\'imprimante est en veille',
'state_resumed_body': 'Impression reprise pour : "$file"',
'state_cancelled_body': 'Impression annulée de : "$file"',
'm117_custom_title': 'Notification de l\'utilisateur',
"filament_sensor_triggered_title": "Capteur de filament déclenché",
"filament_sensor_triggered_body": "Capteur $$sensor déclenché sur l'imprimante $printer_name",
Expand All @@ -53,6 +55,7 @@
'state_error_body': 'Fehler beim Drucken der Datei: "$file"',
'state_standby_body': 'Drucker ist im Standby',
'state_resumed_body': 'Druck der Datei fortgesetzt: "$file"',
'state_cancelled_body': 'Drucken der Datei abgebrochen: "$file"',
'm117_custom_title': 'Benutzers-Benachrichtigung',
"filament_sensor_triggered_title": "Filamentsensor ausgelöst",
"filament_sensor_triggered_body": "Sensor $$sensor auf Drucker $printer_name ausgelöst",
Expand All @@ -68,6 +71,7 @@
'state_error_body': 'Hiba a nyomtatás közben: "$file"',
'state_standby_body': 'A nyomtató készenléti állapotban van',
'state_resumed_body': 'Nyomtatás folytatva: "$file"',
'state_cancelled_body': 'Nyomtatás megszakítva: "$file"',
'm117_custom_title': 'Felhasználói értesítés',
"filament_sensor_triggered_title": "Szálérzékelő aktiválva",
"filament_sensor_triggered_body": "$$sensor érzékelő aktiválva a $printer_name nyomtatón",
Expand All @@ -83,6 +87,7 @@
'state_error_body': 'Помилка під час друку файлу: "$file"',
'state_standby_body': 'Принтер у режимі очікування',
'state_resumed_body': 'Друк відновлено для: "$file"',
'state_cancelled_body': 'Друк файлу скасовано: "$file"',
'm117_custom_title': 'Повідомлення користувача',
"filament_sensor_triggered_title": "Датчик філамента спрацьовано",
"filament_sensor_triggered_body": "Датчик $$sensor спрацював на принтері $printer_name",
Expand All @@ -98,6 +103,7 @@
'state_error_body': 'Erro ao imprimir o arquivo: "$file"',
'state_standby_body': 'Impressora em espera',
'state_resumed_body': 'Impressão retomada para: "$file"',
'state_cancelled_body': 'Impressão cancelada de: "$file"',
'm117_custom_title': 'Notificação do usuário',
"filament_sensor_triggered_title": "Sensor de Filamento Ativado",
"filament_sensor_triggered_body": "Sensor $$sensor ativado na impressora $printer_name",
Expand All @@ -113,6 +119,7 @@
'state_error_body': '打印文件时出错: "$file"',
'state_standby_body': '打印机处于待机状态',
'state_resumed_body': '恢复打印: "$file"',
'state_cancelled_body': '取消打印: "$file"',
'm117_custom_title': '用户通知',
"filament_sensor_triggered_title": "检测到断料",
"filament_sensor_triggered_body": "打印机 $printer_name 上的 $$sensor 检测到断料",
Expand All @@ -128,6 +135,7 @@
'state_error_body': '打印文件时出错: "$file"',
'state_standby_body': '打印机处于待机状态',
'state_resumed_body': '恢复打印: "$file"',
'state_cancelled_body': '取消打印: "$file"',
'm117_custom_title': '用户通知',
"filament_sensor_triggered_title": "检测到断料",
"filament_sensor_triggered_body": "打印机 $printer_name 上的 $$sensor 检测到断料",
Expand Down

0 comments on commit 4b4b766

Please sign in to comment.