From 3eb80216c4c1c9c34f8567cc75dc407f21f0dcb6 Mon Sep 17 00:00:00 2001 From: Andy Wood Date: Fri, 26 Apr 2024 15:34:30 +0100 Subject: [PATCH] Candidate manual system upgrade menu action --- ui/locale/canute.pot | 34 +++++++++++------- .../en_GB.UTF-8@ueb1/LC_MESSAGES/canute.mo | Bin 21596 -> 21804 bytes .../en_GB.UTF-8@ueb1/LC_MESSAGES/canute.po | 33 ++++++++++------- .../en_GB.UTF-8@ueb2/LC_MESSAGES/canute.mo | Bin 18489 -> 18667 bytes .../en_GB.UTF-8@ueb2/LC_MESSAGES/canute.po | 34 +++++++++++------- ui/system_menu/buttons.py | 7 ++++ ui/system_menu/upgrade.py | 26 ++++++++++++++ ui/system_menu/view.py | 4 +-- 8 files changed, 98 insertions(+), 40 deletions(-) create mode 100644 ui/system_menu/upgrade.py 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 24e85baa0844797c353096a90f34640f9b6468cc..a3df51b982d87fe33dc2c9bfa081d74aa5358526 100644 GIT binary patch delta 905 zcmYMxUr19?9KiA4w7>o-E4NvcUJ7bh!|T`-NA|~xR06l95CpOit>LH3E zE5?wB$$jY$>D!){WY9}gP*4ORbYFU?9)kAdLw(P#*x23Y{C?+me&^h?ug_fb&t2K2 zt!whaXD`oAo>MLr{r^l>iEJk~g^i?VsvYOCj`$@;*NVKuA3WMdkzVTS>P41uXp=~* zs%a4UP5tCHkurIcW*(8OB>43*aTRMYhs`*P8?c16_!@oq0XO3^s`^?MZ$S^Xpby>H zi)wxt*;@?UjT5N)7SO}~@`OPXi4v~IPb&pW$V*tuKmwR zkrU*n`kjWa2B@Rax`=aA{WwT$AbZOTq_=#=6qeDC=b|EaQyoda~PIDzUWN~q>P;vW2o>aS?vR0-6v3-j29?~!+wzk^adTlKcl zZJ48D@l;A1zjPrJPb9VTne>R3+vn}`WX4U+Fg2#lL_C!?liEl+ku0XY)vi#`uLu2s z4y`>D4utmW?YdqQ8SuxFmyJ;)ZTgSL$C6(Wz4Jq delta 679 zcmYMw%}Z2a6vy%3olzQ7OKWWI#FUW{k`8lkzA!UP7&*}}i)vN0nzQN1*0Ry;*jrb8e@e7{CZ8Ybr*owcf9Rn0I@lNDU_25-Z zqp3HBHonAD+^^}A#2hx0SU_`O8L#74Y{P9d7agD}?5D~qodmI$4mZQn9pXofF@^C< zbdE(FX9`RBoIh*qmR@td*e?y17~Nh%n&8*E2c#*+{OO)_m$;Ly6@2@EgB1FPW-@>9 z5k?-?I(dcE)(pPDGDfj2CtburH2V>JjI(I!?BcM)hm|LZH_?n{4oxR3Xgc3NiTevu z2m1(`QQyXAIEwV3?-;|sNRx_H-ut$K-bg4@*$DZpmY%5VMxFQ-*GW1~m*aR_w%z\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/can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*o1$u9V;nj;yp-DMX?i;XzIO1 z8yB#G{(4_ZY+@aW9W)I;VmBUP3!b5AbcLpH8C4EANf6(0JIAfk3*r-8V*;~iZuJD) zDR_wyc2LhL4q2aYsF(3`RfAHYT)G>Q{3L!plN{ow&m~^@lhOz#@gc6EX|RW8W9P`8 zbdA$kJ0?BFH)!J7(maO~%zvP{;m|mLt63Q12e0P%n1VSp4ZdLjZ%S6Dq&DV{k;5vE zukj^D@d$hI7j|PHzv3$dz4>rD|2^!p8lw@{jX3cR*BN%4e#h|&wq5r>=nlK_{I$Ip Y@%9Ho-ly?(Z?wPJvj;=@?bIvlFS-y~WdHyG 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,