utility module¶
Utility¶
contains various utility methods used by many of the modules
-
exception
utility.
FormfeedConversionException
[source]¶ Bases:
exceptions.Exception
-
exception
utility.
LinefeedConversionException
[source]¶ Bases:
exceptions.Exception
-
utility.
alpha_to_pin_num
(alpha)[source]¶ convert a single alpha, digit or some punctuation to 6 pin braille will raise Formfeed or Linefeed ConversionExceptions if they are found other unknown characters will be logged and a space will be returned.
-
utility.
find_files
(directory, extensions)[source]¶ recursively look for files that end in the extensions tuple (case insensitive)
-
utility.
find_ui_update
(config)[source]¶ recursively look for firmware in the usb_dir, firmware file is called canute-ui.tar.gz returns first one found
-
utility.
format_title
(title, width, page_number, total_pages, capitalize=True)[source]¶ - format a title like this:
- title on the top line.
- use two dot-six characters to indicate all uppercase for the title.
- page numbers all the way at the right,
e.g. ‘,,library menu #1/#3’.
-
utility.
test_book
(dimensions, content=None)[source]¶ returns a book of 8 pages with each page showing all possible combinations of the 8 rotor positions
-
utility.
to_braille
(alphas)[source]¶ convert a list of alphas to pin numbers using
alpha_to_pin_num()
form feed and line feed characters are supressed
-
utility.
unicode_to_pin_num
(uni_char)[source]¶ converts a unicode braille character to a decimal number that can then be used to load a picture to display the character
used to convert PEF format to CANUTE format http://en.wikipedia.org/wiki/Braille_Patterns