-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a brf encoding option to the system menu allowing a choice of bra…
…ille ascii or euro braille
- Loading branch information
Showing
20 changed files
with
338 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from ..state import state | ||
|
||
|
||
# create a function to call when the button is pressed | ||
# (otherwise the function call happens immediately) | ||
def select_encoding(index): | ||
return lambda: state.app.encoding.select_encoding(index) | ||
|
||
|
||
buttons = { | ||
'single': { | ||
'L': state.app.close_menu, | ||
'2': select_encoding(0), | ||
'3': select_encoding(1), | ||
'4': select_encoding(2), | ||
'5': select_encoding(3), | ||
'6': select_encoding(4), | ||
'7': select_encoding(5), | ||
'8': select_encoding(6), | ||
'9': select_encoding(7), | ||
'<': state.app.previous_page, | ||
'>': state.app.next_page, | ||
'R': state.app.help_menu.toggle | ||
}, | ||
'long': { | ||
'L': state.app.close_menu, | ||
'2': select_encoding(0), | ||
'3': select_encoding(1), | ||
'4': select_encoding(2), | ||
'5': select_encoding(3), | ||
'6': select_encoding(4), | ||
'7': select_encoding(5), | ||
'8': select_encoding(6), | ||
'9': select_encoding(7), | ||
'<': state.app.previous_page, | ||
'>': state.app.next_page, | ||
'R': state.app.help_menu.toggle, | ||
'X': state.hardware.reset_display | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from ..braille import BUILTIN_ENCODINGS, set_encoding | ||
from .. import state | ||
|
||
|
||
class EncodingState: | ||
def __init__(self, root: 'state.RootState'): | ||
self.root = root | ||
self.available = BUILTIN_ENCODINGS | ||
|
||
def select_encoding(self, value): | ||
enc = abs(int(value)) | ||
keys = list(self.available.keys()) | ||
if enc < len(keys): | ||
encoding = keys[enc] | ||
set_encoding(encoding) | ||
self.root.app.user.current_encoding = encoding | ||
self.root.app.location = 'book' | ||
self.root.refresh_display() | ||
self.root.save_state() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from ..braille import from_ascii, format_title, to_ueb_number, from_unicode | ||
|
||
def render_help(width, height): | ||
data = [] | ||
para = _('''\ | ||
You can change the braille encoding by pressing the \ | ||
line select button to the left of your chosen encoding. \ | ||
The encoding will be used to display BRF files. \ | ||
''') | ||
|
||
for line in para.split('\n'): | ||
data.append(from_unicode(line)) | ||
|
||
while len(data) % height: | ||
data.append(tuple()) | ||
|
||
return tuple(data) | ||
|
||
|
||
async def render(width, height, state): | ||
help_menu = state.app.help_menu.visible | ||
if help_menu: | ||
all_lines = render_help(width, height) | ||
num_pages = len(all_lines) // height | ||
page_num = min(state.app.help_menu.page, num_pages - 1) | ||
first_line = page_num * height | ||
off_end = first_line + height | ||
page = all_lines[first_line:off_end] | ||
return page | ||
|
||
enc = state.app.user.current_encoding | ||
encodings = state.app.encoding.available | ||
current_enc = _(encodings.get(enc).title) | ||
|
||
try: | ||
cur_index = list(encodings.keys()).index(enc) | ||
except ValueError: | ||
cur_index = -1 | ||
|
||
# TRANSLATORS: A menu title, to which the encoding title is appended | ||
title = _('encoding:') + ' {}' | ||
title = format_title( | ||
title.format(current_enc), | ||
width, cur_index, len(encodings.keys())) | ||
data = [title] | ||
|
||
for enc in encodings: | ||
encs = list(encodings.keys()).index(enc) | ||
n = from_ascii(to_ueb_number(encs + 1) + ' ') | ||
data.append(n + tuple(from_unicode(_(encodings[enc].title)))) | ||
|
||
while len(data) < height: | ||
data.append(tuple()) | ||
|
||
return tuple(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-05-20 13:12+0100\n" | ||
"POT-Creation-Date: 2024-05-20 18:54+0100\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -17,6 +17,14 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.13.1\n" | ||
|
||
#: ui/braille.py:144 | ||
msgid "North American Braille ASCII" | ||
msgstr "" | ||
|
||
#: ui/braille.py:147 | ||
msgid "Eurobraille" | ||
msgstr "" | ||
|
||
#. TRANSLATORS: This is a language name menu item, so should always appear | ||
#. in the language it denotes so that it remains readable to those who | ||
#. speak only that language, just as "Deutsch" should always be left as | ||
|
@@ -138,6 +146,18 @@ msgstr "" | |
msgid "end of book" | ||
msgstr "" | ||
|
||
#: ui/encoding/view.py:5 | ||
msgid "" | ||
"You can change the braille encoding by pressing the line select button to" | ||
" the left of your chosen encoding. The encoding will be used to display " | ||
"BRF files. " | ||
msgstr "" | ||
|
||
#. TRANSLATORS: A menu title, to which the encoding title is appended | ||
#: ui/encoding/view.py:41 | ||
msgid "encoding:" | ||
msgstr "" | ||
|
||
#: ui/go_to_page/view.py:6 | ||
msgid "" | ||
"You can navigate to a page within a file by entering the page number " | ||
|
@@ -251,14 +271,18 @@ msgid "shutdown" | |
msgstr "" | ||
|
||
#: ui/system_menu/view.py:35 | ||
msgid "backup log to USB stick" | ||
msgid "select language and code" | ||
msgstr "" | ||
|
||
#: ui/system_menu/view.py:36 | ||
msgid "select language and code" | ||
msgid "choose BRF encoding" | ||
msgstr "" | ||
|
||
#: ui/system_menu/view.py:37 | ||
msgid "backup log to USB stick" | ||
msgstr "" | ||
|
||
#: ui/system_menu/view.py:38 | ||
msgid "install upgrade from " | ||
msgstr "" | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,26 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-05-20 13:12+0100\n" | ||
"PO-Revision-Date: 2024-05-20 12:25+0000\n" | ||
"Last-Translator: Ulf Beckmann <[email protected]>\n" | ||
"Language-Team: German (Germany) (https://www.transifex.com/bristol-braille-technology/teams/87456/de_DE/)\n" | ||
"Language: de_DE\n" | ||
"POT-Creation-Date: 2024-05-20 18:54+0100\n" | ||
"PO-Revision-Date: 2024-05-20 17:58+0000\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"Generated-By: Babel 2.6.0\n" | ||
"X-Generator: Poedit 3.4\n" | ||
|
||
#: ui/braille.py:144 | ||
msgid "North American Braille ASCII" | ||
msgstr "⠨⠝⠕⠗⠞⠓⠀⠨⠁⠍⠑⠗⠊⠉⠁⠝⠀⠨⠃⠗⠁⠊⠇⠇⠑⠀⠘⠁⠎⠉⠊⠊" | ||
|
||
#: ui/braille.py:147 | ||
msgid "Eurobraille" | ||
msgstr "⠨⠣⠗⠕⠃⠗⠁⠊⠇⠇⠑" | ||
|
||
#. TRANSLATORS: This is a language name menu item, so should always appear | ||
#. in the language it denotes so that it remains readable to those who | ||
#. speak only that language, just as "Deutsch" should always be left as | ||
|
@@ -151,6 +159,22 @@ msgstr "⠾⠁⠗⠞⠀⠙⠑⠎⠀⠃⠥⠹⠑⠎" | |
msgid "end of book" | ||
msgstr "⠑⠝⠙⠑⠀⠙⠑⠎⠀⠃⠥⠹⠑⠎" | ||
|
||
#: ui/encoding/view.py:5 | ||
msgid "" | ||
"You can change the braille encoding by pressing the line select button to " | ||
"the left of your chosen encoding. The encoding will be used to display BRF " | ||
"files. " | ||
msgstr "" | ||
"⠨⠽⠕⠥⠀⠉⠁⠝⠀⠹⠁⠝⠛⠑⠀⠞⠓⠑⠀⠃⠗⠁⠊⠇⠇⠑⠀⠑⠝⠉⠕⠙⠊⠝⠛⠀⠃⠽⠀⠏\n" | ||
"⠗⠑⠎⠎⠊⠝⠛⠀⠞⠓⠑⠀⠇⠊⠝⠑⠀⠎⠑⠇⠑⠉⠞⠀⠃⠥⠞⠞⠕⠝⠀⠞⠕⠀⠞⠓⠑⠀⠇⠑\n" | ||
"⠋⠞⠀⠕⠋⠀⠽⠕⠥⠗⠀⠹⠕⠎⠑⠝⠀⠑⠝⠉⠕⠙⠊⠝⠛⠄⠀⠨⠞⠓⠑⠀⠑⠝⠉⠕⠙⠊⠝⠛\n" | ||
"⠀⠺⠊⠇⠇⠀⠃⠑⠀⠥⠎⠑⠙⠀⠞⠕⠀⠙⠊⠎⠏⠇⠁⠽⠀⠘⠃⠗⠋⠀⠋⠊⠇⠑⠎⠄⠀" | ||
|
||
#. TRANSLATORS: A menu title, to which the encoding title is appended | ||
#: ui/encoding/view.py:41 | ||
msgid "encoding:" | ||
msgstr "⠑⠝⠉⠕⠙⠊⠝⠛⠒" | ||
|
||
#: ui/go_to_page/view.py:6 | ||
msgid "" | ||
"You can navigate to a page within a file by entering the page number using the line select buttons on the left hand side the display. For example, for page 10 press button 1 followed by button 0. Press the forward button to confirm your selection. Line 3 will refresh to show your selected page. Press the large forward button on the front surface to navigate to your page.\n" | ||
|
@@ -283,14 +307,18 @@ msgid "shutdown" | |
msgstr "⠡⠎⠱⠁⠇⠞⠑⠝" | ||
|
||
#: ui/system_menu/view.py:35 | ||
msgid "backup log to USB stick" | ||
msgstr "⠏⠗⠕⠞⠕⠅⠕⠇⠇⠀⠡⠋⠀⠥⠎⠃⠤⠾⠊⠉⠅⠀⠎⠊⠹⠑⠗⠝" | ||
|
||
#: ui/system_menu/view.py:36 | ||
msgid "select language and code" | ||
msgstr "⠛⠑⠺⠜⠓⠇⠞⠑⠀⠎⠏⠗⠁⠹⠑⠀⠥⠝⠙⠀⠅⠕⠙⠑" | ||
|
||
#: ui/system_menu/view.py:36 | ||
msgid "choose BRF encoding" | ||
msgstr "⠹⠕⠕⠎⠑⠀⠘⠃⠗⠋⠀⠑⠝⠉⠕⠙⠊⠝⠛" | ||
|
||
#: ui/system_menu/view.py:37 | ||
msgid "backup log to USB stick" | ||
msgstr "⠏⠗⠕⠞⠕⠅⠕⠇⠇⠀⠡⠋⠀⠥⠎⠃⠤⠾⠊⠉⠅⠀⠎⠊⠹⠑⠗⠝" | ||
|
||
#: ui/system_menu/view.py:38 | ||
msgid "install upgrade from " | ||
msgstr "⠊⠝⠾⠁⠇⠇⠀⠥⠏⠛⠗⠁⠙⠑⠀⠋⠗⠕⠍⠀" | ||
|
||
|
Binary file not shown.
Oops, something went wrong.