diff --git a/ui/locale/canute.pot b/ui/locale/canute.pot index bca9775..e1b440f 100644 --- a/ui/locale/canute.pot +++ b/ui/locale/canute.pot @@ -1,14 +1,14 @@ # Translations template for PROJECT. -# Copyright (C) 2023 ORGANIZATION +# Copyright (C) 2024 ORGANIZATION # This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2023. +# FIRST AUTHOR , 2024. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-12-20 14:35+0000\n" +"POT-Creation-Date: 2024-04-26 15:25+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -209,15 +209,15 @@ msgstr "" msgid "go to book list" msgstr "" -#: ui/library/view.py:73 +#: ui/library/view.py:74 msgid "LIBRARY menu" msgstr "" -#: ui/library/view.py:83 +#: ui/library/view.py:84 msgid "back to directory list" msgstr "" -#: ui/library/view.py:89 +#: ui/library/view.py:90 msgid "more directories" msgstr "" @@ -232,31 +232,39 @@ msgid "" "files in the library." msgstr "" -#: ui/system_menu/system_menu.py:52 +#: ui/system_menu/view.py:15 +msgid "run in standalone mode" +msgstr "" + +#: ui/system_menu/view.py:19 msgid "emulated" msgstr "" -#: ui/system_menu/system_menu.py:62 +#: ui/system_menu/view.py:34 msgid "shutdown" msgstr "" -#: ui/system_menu/system_menu.py:63 +#: ui/system_menu/view.py:35 msgid "backup log to USB stick" msgstr "" -#: ui/system_menu/system_menu.py:64 +#: ui/system_menu/view.py:36 msgid "select language and code" msgstr "" -#: ui/system_menu/system_menu.py:68 +#: ui/system_menu/view.py:37 +msgid "install upgrade from " +msgstr "" + +#: ui/system_menu/view.py:40 msgid "release:" msgstr "" -#: ui/system_menu/system_menu.py:69 +#: ui/system_menu/view.py:41 msgid "serial:" msgstr "" -#: ui/system_menu/view.py:23 +#: ui/system_menu/view.py:49 msgid "system menu" msgstr "" diff --git a/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.mo b/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.mo index 24e85ba..a3df51b 100644 Binary files a/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.mo and b/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.mo differ diff --git a/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.po b/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.po index d2b859f..1eeec59 100644 --- a/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.po +++ b/ui/locale/en_GB.UTF-8@ueb1/LC_MESSAGES/canute.po @@ -3,8 +3,8 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-11-08 10:00+0000\n" -"PO-Revision-Date: 2023-11-08 11:18+0000\n" +"POT-Creation-Date: 2024-04-26 15:25+0100\n" +"PO-Revision-Date: 2024-04-26 14:27+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -117,7 +117,7 @@ msgstr "" "⠃⠥⠞⠞⠕⠝ ⠞⠕ ⠞⠓⠑ ⠇⠑⠋⠞ ⠕⠋ ⠦⠧⠊⠑⠺ ⠎⠽⠎⠞⠑⠍ ⠍⠑⠝⠥⠴\n" "⠕⠝ ⠞⠓⠑ ⠙⠊⠎⠏⠇⠁⠽⠲" -#: ui/book/view.py:11 +#: ui/book/view.py:10 msgid "go to page" msgstr "⠛⠕ ⠞⠕ ⠏⠁⠛⠑" @@ -291,15 +291,15 @@ msgstr "" msgid "go to book list" msgstr "⠛⠕⠀⠞⠕⠀⠃⠕⠕⠅⠀⠇⠊⠎⠞" -#: ui/library/view.py:73 +#: ui/library/view.py:74 msgid "LIBRARY menu" msgstr "⠠⠠⠇⠊⠃⠗⠁⠗⠽⠀⠍⠑⠝⠥" -#: ui/library/view.py:83 +#: ui/library/view.py:84 msgid "back to directory list" msgstr "⠃⠁⠉⠅⠀⠞⠕⠀⠙⠊⠗⠑⠉⠞⠕⠗⠽⠀⠇⠊⠎⠞" -#: ui/library/view.py:89 +#: ui/library/view.py:90 msgid "more directories" msgstr "⠍⠕⠗⠑⠀⠙⠊⠗⠑⠉⠞⠕⠗⠊⠑⠎" @@ -322,29 +322,38 @@ msgstr "" "⠇⠊⠃⠗⠁⠗⠽⠲" #: ui/system_menu/system_menu.py:52 +#: ui/system_menu/view.py:15 +msgid "run in standalone mode" +msgstr "⠗⠥⠝⠀⠊⠝⠀⠎⠞⠁⠝⠙⠁⠇⠕⠝⠑⠀⠍⠕⠙⠑" + +#: ui/system_menu/view.py:19 msgid "emulated" msgstr "⠑⠍⠥⠇⠁⠞⠑⠙" -#: ui/system_menu/system_menu.py:62 +#: ui/system_menu/view.py:34 msgid "shutdown" msgstr "⠎⠓⠥⠞⠙⠕⠺⠝" -#: ui/system_menu/system_menu.py:63 +#: ui/system_menu/view.py:35 msgid "backup log to USB stick" msgstr "⠃⠁⠉⠅⠥⠏ ⠇⠕⠛ ⠞⠕ ⠠⠠⠥⠎⠃ ⠎⠞⠊⠉⠅" -#: ui/system_menu/system_menu.py:64 +#: ui/system_menu/view.py:36 msgid "select language and code" msgstr "⠎⠑⠇⠑⠉⠞ ⠇⠁⠝⠛⠥⠁⠛⠑ ⠁⠝⠙ ⠉⠕⠙⠑" -#: ui/system_menu/system_menu.py:68 +#: ui/system_menu/view.py:37 +msgid "install upgrade from " +msgstr "⠊⠝⠎⠞⠁⠇⠇⠀⠥⠏⠛⠗⠁⠙⠑⠀⠋⠗⠕⠍⠀" + +#: ui/system_menu/view.py:40 msgid "release:" msgstr "⠗⠑⠇⠑⠁⠎⠑⠒" -#: ui/system_menu/system_menu.py:69 +#: ui/system_menu/view.py:41 msgid "serial:" msgstr "⠎⠑⠗⠊⠁⠇⠒" -#: ui/system_menu/view.py:23 +#: ui/system_menu/view.py:49 msgid "system menu" msgstr "⠎⠽⠎⠞⠑⠍ ⠍⠑⠝⠥" diff --git a/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.mo b/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.mo index cca6f67..affa2e8 100644 Binary files a/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.mo and b/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.mo differ diff --git a/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.po b/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.po index 88db38c..80359ff 100644 --- a/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.po +++ b/ui/locale/en_GB.UTF-8@ueb2/LC_MESSAGES/canute.po @@ -3,8 +3,8 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-11-08 10:00+0000\n" -"PO-Revision-Date: 2023-11-08 11:18+0000\n" +"POT-Creation-Date: 2024-04-26 15:25+0100\n" +"PO-Revision-Date: 2024-04-26 14:27+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -110,7 +110,7 @@ msgstr "" "⠏⠗⠑⠎⠎ ⠮ ⠇⠔⠑ ⠎⠑⠇⠑⠉⠞ ⠃⠥⠞⠞⠕⠝ ⠞⠕ ⠮ ⠇⠑⠋⠞ ⠷\n" "⠦⠧⠊⠑⠺ ⠎⠽⠌⠑⠍ ⠍⠢⠥⠴ ⠕⠝ ⠮ ⠲⠏⠇⠁⠽⠲" -#: ui/book/view.py:11 +#: ui/book/view.py:10 msgid "go to page" msgstr "⠛ ⠞⠕ ⠏⠁⠛⠑" @@ -268,15 +268,15 @@ msgstr "" msgid "go to book list" msgstr "⠛⠀⠞⠕⠀⠃⠕⠕⠅⠀⠇⠊⠌" -#: ui/library/view.py:73 +#: ui/library/view.py:74 msgid "LIBRARY menu" msgstr "⠠⠠⠇⠊⠃⠗⠜⠽⠀⠍⠢⠥" -#: ui/library/view.py:83 +#: ui/library/view.py:84 msgid "back to directory list" msgstr "⠃⠁⠉⠅⠀⠞⠕⠀⠙⠊⠗⠑⠉⠞⠕⠗⠽⠀⠇⠊⠌" -#: ui/library/view.py:89 +#: ui/library/view.py:90 msgid "more directories" msgstr "⠍⠀⠙⠊⠗⠑⠉⠞⠕⠗⠊⠑⠎" @@ -295,30 +295,38 @@ msgstr "" "⠡⠁⠝⠛⠑ ⠮ ⠎⠽⠌⠑⠍ ⠇⠁⠝⠛⠥⠁⠛⠑ ⠕⠗ ⠠⠃⠗⠇ ⠉⠕⠙⠑⠂ ⠝ ⠮\n" "⠇⠁⠝⠛⠥⠁⠛⠑ ⠕⠗ ⠉⠕⠙⠑ ⠷ ⠁⠝⠽ ⠋⠊⠇⠑⠎ ⠔ ⠮ ⠇⠊⠃⠗⠜⠽⠲" -#: ui/system_menu/system_menu.py:52 +#: ui/system_menu/view.py:15 +msgid "run in standalone mode" +msgstr "⠗⠥⠝⠀⠔⠀⠌⠯⠁⠇⠐⠕⠀⠍⠕⠙⠑" + +#: ui/system_menu/view.py:19 msgid "emulated" msgstr "⠑⠍⠥⠇⠁⠞⠫" -#: ui/system_menu/system_menu.py:62 +#: ui/system_menu/view.py:34 msgid "shutdown" msgstr "⠩⠥⠞⠙⠪⠝" -#: ui/system_menu/system_menu.py:63 +#: ui/system_menu/view.py:35 msgid "backup log to USB stick" msgstr "⠃⠁⠉⠅⠥⠏ ⠇⠕⠛ ⠞⠕ ⠠⠠⠥⠎⠃ ⠌⠊⠉⠅" -#: ui/system_menu/system_menu.py:64 +#: ui/system_menu/view.py:36 msgid "select language and code" msgstr "⠎⠑⠇⠑⠉⠞ ⠇⠁⠝⠛⠥⠁⠛⠑ ⠯ ⠉⠕⠙⠑" -#: ui/system_menu/system_menu.py:68 +#: ui/system_menu/view.py:37 +msgid "install upgrade from " +msgstr "⠔⠌⠁⠇⠇⠀⠥⠏⠛⠗⠁⠙⠑⠀⠋⠀" + +#: ui/system_menu/view.py:40 msgid "release:" msgstr "⠗⠑⠇⠂⠎⠑⠒" -#: ui/system_menu/system_menu.py:69 +#: ui/system_menu/view.py:41 msgid "serial:" msgstr "⠎⠻⠊⠁⠇⠒" -#: ui/system_menu/view.py:23 +#: ui/system_menu/view.py:49 msgid "system menu" msgstr "⠎⠽⠌⠑⠍ ⠍⠢⠥" diff --git a/ui/system_menu/buttons.py b/ui/system_menu/buttons.py index 7509409..a9a1fae 100644 --- a/ui/system_menu/buttons.py +++ b/ui/system_menu/buttons.py @@ -1,9 +1,15 @@ from ..state import state +from . import upgrade + +def install_upgrade(): + if upgrade.available: + upgrade.upgrade() buttons = { 'single': { '2': state.app.shutdown, '3': state.app.go_to_language_menu, + '4': install_upgrade, 'R': state.app.help_menu.toggle, '>': state.app.next_page, '<': state.app.previous_page, @@ -12,6 +18,7 @@ 'long': { '2': state.app.shutdown, '3': state.app.go_to_language_menu, + '4': install_upgrade, 'R': state.app.help_menu.toggle, '>': state.app.next_page, '<': state.app.previous_page, diff --git a/ui/system_menu/upgrade.py b/ui/system_menu/upgrade.py new file mode 100644 index 0000000..992dcf4 --- /dev/null +++ b/ui/system_menu/upgrade.py @@ -0,0 +1,26 @@ +import os +from ..config_loader import load + +def mounted_paths(): + config = load() + media_dir = config.get('files', {}).get('media_dir') + source_dirs = config.get('files', {}).get('library', []) + + for source_dir in source_dirs: + source_path = os.path.join(media_dir, source_dir.get('path')) + if source_dir.get('mountpoint', False) and os.path.ismount(source_path): + yield source_path, source_dir.get('name') + +available = False +source_paths = mounted_paths() +for source_path, source_name in source_paths: + for upgrade in ['sysupgrade', 'sysupgrade.sh']: + upgrade_file = os.path.join(source_path, upgrade) + if os.path.exists(upgrade_file): + available = True + break + +def upgrade(): + go_file = os.path.join(source_path, 'sysupgrade-now.txt') + open(go_file, 'a').close() + os.system('shutdown -r now') diff --git a/ui/system_menu/view.py b/ui/system_menu/view.py index fdd85fb..b4ac02e 100644 --- a/ui/system_menu/view.py +++ b/ui/system_menu/view.py @@ -1,8 +1,8 @@ import os from ..braille import format_title, brailleify, from_unicode +from . import upgrade from .help import render_help - # This exists on a Pi and reading it yields a useful board identifier. # But existence will do for right now. if os.path.exists('/sys/firmware/devicetree/base/model'): @@ -34,7 +34,7 @@ async def render(width, height, state): _('shutdown'), _('backup log to USB stick'), _('select language and code'), - '', + _('install upgrade from ') + upgrade.source_name if upgrade.available else '', '', '', _('release:') + ' ' + release,