--- /srv/rebuilderd/tmp/rebuilderdxL5Ak9/inputs/luma.core-doc_2.4.2-1_all.deb +++ /srv/rebuilderd/tmp/rebuilderdxL5Ak9/out/luma.core-doc_2.4.2-1_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2024-05-12 20:46:18.000000 debian-binary │ -rw-r--r-- 0 0 0 2780 2024-05-12 20:46:18.000000 control.tar.xz │ --rw-r--r-- 0 0 0 117968 2024-05-12 20:46:18.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 117304 2024-05-12 20:46:18.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./control │ │ │ @@ -1,13 +1,13 @@ │ │ │ Package: luma.core-doc │ │ │ Source: luma.core │ │ │ Version: 2.4.2-1 │ │ │ Architecture: all │ │ │ Maintainer: Debian Electronics Team │ │ │ -Installed-Size: 2306 │ │ │ +Installed-Size: 2273 │ │ │ Depends: libjs-jquery (>= 3.6.0), libjs-sphinxdoc (>= 7.2.2), sphinx-rtd-theme-common (>= 2.0.0+dfsg) │ │ │ Section: doc │ │ │ Priority: optional │ │ │ Multi-Arch: foreign │ │ │ Homepage: https://github.com/rm-hull/luma.core │ │ │ Description: doc for component library providing a Pillow-compatible drawing canvas │ │ │ other functionality to support drawing primitives and text-rendering │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -60,39 +60,39 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 286 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/file.png │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/fonts/ │ │ │ -rw-r--r-- 0 root (0) root (0) 299 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/graphviz.css │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/js/ │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/minus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/plus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 4929 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/pygments.css │ │ │ --rw-r--r-- 0 root (0) root (0) 14562 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/ansi_color.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13966 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/ansi_color.html │ │ │ -rw-r--r-- 0 root (0) root (0) 11775 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/api-documentation.html │ │ │ --rw-r--r-- 0 root (0) root (0) 55102 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/bitmap_font.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30335 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/cmdline.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15477 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/const.html │ │ │ --rw-r--r-- 0 root (0) root (0) 69693 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/device.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15415 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/error.html │ │ │ --rw-r--r-- 0 root (0) root (0) 18588 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/framebuffer.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 49418 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/bitmap_font.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 28875 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/cmdline.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15354 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/const.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 64270 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/device.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15288 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/error.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16614 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/framebuffer.html │ │ │ -rw-r--r-- 0 root (0) root (0) 40674 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/genindex.html │ │ │ --rw-r--r-- 0 root (0) root (0) 22415 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/image_composition.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 20918 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/image_composition.html │ │ │ -rw-r--r-- 0 root (0) root (0) 34362 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 4797 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/install.html │ │ │ --rw-r--r-- 0 root (0) root (0) 70943 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/interface.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 64177 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/interface.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6360 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/intro.html │ │ │ --rw-r--r-- 0 root (0) root (0) 121706 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/legacy.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17171 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/mixin.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 120740 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/legacy.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15946 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/mixin.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2667 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/objects.inv │ │ │ -rw-r--r-- 0 root (0) root (0) 8089 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/py-modindex.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11265 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/render.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10971 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/render.html │ │ │ -rw-r--r-- 0 root (0) root (0) 4098 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/search.html │ │ │ -rw-r--r-- 0 root (0) root (0) 63669 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/searchindex.js │ │ │ --rw-r--r-- 0 root (0) root (0) 21891 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/sprite_system.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14112 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/threadpool.html │ │ │ --rw-r--r-- 0 root (0) root (0) 19862 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/util.html │ │ │ --rw-r--r-- 0 root (0) root (0) 60198 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/virtual.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 20546 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/sprite_system.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13856 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/threadpool.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 18402 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/util.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 57742 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/virtual.html │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/css/badge_only.css -> ../../../../../sphinx_rtd_theme/static/css/badge_only.css │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/css/theme.css -> ../../../../../sphinx_rtd_theme/static/css/theme.css │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/doctools.js -> ../../../../javascript/sphinxdoc/1.0/doctools.js │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/fonts/Lato-Bold.ttf -> ../../../../../sphinx_rtd_theme/static/fonts/Lato-Bold.ttf │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/fonts/Lato-Bold.woff2 -> ../../../../../sphinx_rtd_theme/static/fonts/Lato-Bold.woff2 │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/fonts/Lato-BoldItalic.ttf -> ../../../../../sphinx_rtd_theme/static/fonts/Lato-BoldItalic.ttf │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2024-05-12 20:46:18.000000 ./usr/share/doc/luma.core-doc/html/_static/fonts/Lato-BoldItalic.woff2 -> ../../../../../sphinx_rtd_theme/static/fonts/Lato-BoldItalic.woff2 │ │ ├── ./usr/share/doc/luma.core-doc/html/ansi_color.html │ │ │ @@ -113,18 +113,18 @@ │ │ │

Find directives on class klass in string text.

│ │ │

Returns list of (method, args) tuples.

│ │ │
│ │ │

New in version 0.9.0.

│ │ │
│ │ │
│ │ │
Parameters:
│ │ │ -

text (str) – String containing directives.

│ │ │ +

text (str) – String containing directives.

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.ansi_color.parse_str(text)[source]
│ │ │ @@ -136,33 +136,33 @@ │ │ │ would emit a directive of ["background_color", "green"].

│ │ │

Note that unrecognised escape sequences are silently ignored: Only reset, │ │ │ reverse colours and 8 foreground and background colours are supported.

│ │ │

It is up to the consumer to interpret the directives and update its state │ │ │ accordingly.

│ │ │
│ │ │
Parameters:
│ │ │ -

text (str) – An ASCII string which may or may not include valid ANSI Color │ │ │ +

text (str) – An ASCII string which may or may not include valid ANSI Color │ │ │ escape codes.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.ansi_color.strip_ansi_codes(text)[source]
│ │ │

Remove ANSI color codes from the string text.

│ │ │
│ │ │

New in version 0.9.0.

│ │ │
│ │ │
│ │ │
Parameters:
│ │ │ -

text (str) – String containing ANSI color codes.

│ │ │ +

text (str) – String containing ANSI color codes.

│ │ │
│ │ │
Return type:
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -34,35 +34,35 @@ │ │ │ │ ANSI Escape-code parser │ │ │ │ New in version 0.5.5. │ │ │ │ luma.core.ansi_color.find_directives(tteexxtt, kkllaassss)_[_s_o_u_r_c_e_]_ │ │ │ │ Find directives on class klass in string text. │ │ │ │ Returns list of (method, args) tuples. │ │ │ │ New in version 0.9.0. │ │ │ │ Parameters: │ │ │ │ - tteexxtt (_ss_tt_rr) – String containing directives. │ │ │ │ + tteexxtt (ssttrr) – String containing directives. │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ luma.core.ansi_color.parse_str(tteexxtt)_[_s_o_u_r_c_e_]_ │ │ │ │ Given a string of characters, for each normal ASCII character, yields a │ │ │ │ directive consisting of a ‘putch’ instruction followed by the character │ │ │ │ itself. │ │ │ │ If a valid ANSI escape sequence is detected within the string, the │ │ │ │ supported codes are translated into directives. For example \033[42m │ │ │ │ would emit a directive of ["background_color", "green"]. │ │ │ │ Note that unrecognised escape sequences are silently ignored: Only reset, │ │ │ │ reverse colours and 8 foreground and background colours are supported. │ │ │ │ It is up to the consumer to interpret the directives and update its state │ │ │ │ accordingly. │ │ │ │ Parameters: │ │ │ │ - tteexxtt (_ss_tt_rr) – An ASCII string which may or may not include valid │ │ │ │ + tteexxtt (ssttrr) – An ASCII string which may or may not include valid │ │ │ │ ANSI Color escape codes. │ │ │ │ luma.core.ansi_color.strip_ansi_codes(tteexxtt)_[_s_o_u_r_c_e_]_ │ │ │ │ Remove ANSI color codes from the string text. │ │ │ │ New in version 0.9.0. │ │ │ │ Parameters: │ │ │ │ - tteexxtt (_ss_tt_rr) – String containing ANSI color codes. │ │ │ │ + tteexxtt (ssttrr) – String containing ANSI color codes. │ │ │ │ Return type: │ │ │ │ - _s_t_r │ │ │ │ + str │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/bitmap_font.html │ │ │ @@ -125,15 +125,15 @@ │ │ │
│ │ │ │ │ │
│ │ │

luma.core.bitmap_font

│ │ │
│ │ │
│ │ │ class luma.core.bitmap_font.bitmap_font[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

An PIL.Imagefont style font.

│ │ │

The structure of this class was modeled after the PIL ImageFont class │ │ │ and is intended to be interchangable for PIL.ImageFont objects.

│ │ │

It has the following additional capabilities:

│ │ │
    │ │ │
  • Allows fonts larger than 256 characters to be created

  • │ │ │
  • Font can be combined with other fonts

  • │ │ │ @@ -152,18 +152,18 @@ │ │ │
    │ │ │ combine(source_font, characters=None, force=False)[source]
    │ │ │

    Combine two luma.core.bitmap_font instances.

    │ │ │
    │ │ │
    Parameters:
    │ │ │
      │ │ │
    • source_font (luma.core.bitmap_font) – a luma.core.bitmap_font to copy from

    • │ │ │ -
    • characters (str) – (optional) A list of the characters to transfer from │ │ │ +

    • characters (str) – (optional) A list of the characters to transfer from │ │ │ the source_font. If not provided, all of the characters within │ │ │ the source_font will be transferred.

    • │ │ │ -
    • force (bool) – If set, the source_font can overwrite values that already │ │ │ +

    • force (bool) – If set, the source_font can overwrite values that already │ │ │ exists within this font. Default is False.

    • │ │ │
    │ │ │
    │ │ │
    │ │ │
│ │ │ │ │ │
│ │ │ @@ -171,15 +171,15 @@ │ │ │ dumps()[source] │ │ │

Serializes the font data for transfer or storage

│ │ │
│ │ │
Returns:
│ │ │

Serialized font data

│ │ │
│ │ │
Return type:
│ │ │ -

bytes

│ │ │ +

bytes

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ getmask(text, mode='1', *args, **kwargs)[source]
│ │ │ @@ -195,15 +195,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ load(filename)[source]
│ │ │

Load font from filename

│ │ │
│ │ │
Parameters:
│ │ │ -

filename (str) – the filename of the file containing the font data

│ │ │ +

filename (str) – the filename of the file containing the font data

│ │ │
│ │ │
Returns:
│ │ │

a font object

│ │ │
│ │ │
Return type:
│ │ │

luma.core.bitmap_font

│ │ │
│ │ │ @@ -213,16 +213,16 @@ │ │ │
│ │ │
│ │ │ load_pillow_font(file, mappings=None)[source]
│ │ │

Create luma.core.bitmap_font from a PIL ImageFont style font.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • file (str) – The filename of the PIL.ImageFont to load

  • │ │ │ -
  • mappings (dict) – a dictionary of unicode to value pairs (optional). │ │ │ +

  • file (str) – The filename of the PIL.ImageFont to load

  • │ │ │ +
  • mappings (dict) – a dictionary of unicode to value pairs (optional). │ │ │ Mappings allow the appropriate unicode values to be provided for │ │ │ each character contained within the font

  • │ │ │
│ │ │
│ │ │
Returns:
│ │ │

a font object

│ │ │
│ │ │ @@ -236,24 +236,24 @@ │ │ │
│ │ │ load_sprite_table(sprite_table, index, xwidth, glyph_size, cell_size, mappings=None)[source]
│ │ │

Load a font from a sprite table

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • sprite_table (PIL.Image) – A PIL.Image representation of every glyph within the font

  • │ │ │ -
  • index (list or other iterable) – The list of character values contained within sprite_table. │ │ │ +

  • index (list or other iterable) – The list of character values contained within sprite_table. │ │ │ This list MUST be in the same order that the glyphs for the characters │ │ │ appear within the sprite_table (in left to right, top to bottom order)

  • │ │ │ -
  • xwidth (int) – number of pixels between placements of each character in a │ │ │ +

  • xwidth (int) – number of pixels between placements of each character in a │ │ │ line of text

  • │ │ │ -
  • glyph_size (tuple(int, int)) – tuple containing the width and height of each character │ │ │ +

  • glyph_size (tuple(int, int)) – tuple containing the width and height of each character │ │ │ in the font

  • │ │ │ -
  • cell_size (tuple(int, int)) – tuple containing the width and height of each cell in the │ │ │ +

  • cell_size (tuple(int, int)) – tuple containing the width and height of each cell in the │ │ │ sprite table. Defaults to the size of the glyphs.

  • │ │ │ -
  • mappings (dict) – a dictionary of unicode to value pairs (optional) │ │ │ +

  • mappings (dict) – a dictionary of unicode to value pairs (optional) │ │ │ Mappings allow the appropriate unicode values to be provided for │ │ │ each character contained within the font

  • │ │ │
│ │ │
│ │ │
Returns:
│ │ │

a font object

│ │ │
│ │ │ @@ -266,15 +266,15 @@ │ │ │
│ │ │
│ │ │ loads(fontdata)[source]
│ │ │

Load luma.core.bitmap_font from a string of serialized data produced │ │ │ by the dumps method

│ │ │
│ │ │
Parameters:
│ │ │ -

fontdata (bytes) – The serialized font data that will be used to initialize │ │ │ +

fontdata (bytes) – The serialized font data that will be used to initialize │ │ │ the font. This data is produced by the luma.core.bitmap_font.dumps() │ │ │ method.

│ │ │
│ │ │
Returns:
│ │ │

a font object

│ │ │
│ │ │
Return type:
│ │ │ @@ -290,22 +290,22 @@ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.bitmap_font.embedded_fonts(data, selected_font=0)[source]
│ │ │ -

Bases: ImageFont

│ │ │ +

Bases: ImageFont

│ │ │

Utility class to manage the set of fonts that are embedded within a │ │ │ compatible device.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • data (dict) – The font data from the device. See note below.

  • │ │ │ -
  • selected_font (str or int) – The font that should be loaded as this device’s │ │ │ +

  • data (dict) – The font data from the device. See note below.

  • │ │ │ +
  • selected_font (str or int) – The font that should be loaded as this device’s │ │ │ default. Will accept the font’s index or its name.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
..note:

The class is used by devices which have embedded fonts and is not intended │ │ │ to be used directly. To initialize it requires providing a dictionary │ │ │ @@ -323,15 +323,15 @@ │ │ │

│ │ │ combine(font, characters=None, force=False)[source]
│ │ │

Combine the current font with a new one

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • font (luma.core.bitmap_font) – The font to combine with the current font

  • │ │ │ -
  • characters (list of unicode characters) – (Optional) A list of characters to move from the new font to the │ │ │ +

  • characters (list of unicode characters) – (Optional) A list of characters to move from the new font to the │ │ │ current font. If not provided all characters from the new font will │ │ │ be transferred.

  • │ │ │
  • force – Determines if conflicting characters should be ignored (default) │ │ │ or overwritten.

  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -394,126 +394,126 @@ │ │ │

New in version 1.1.5.

│ │ │
│ │ │

│ │ │ │ │ │ │ │ │
Returns:
│ │ │

An internal PIL storage memory instance as defined by the │ │ │ -PIL.Image.core interface module.

│ │ │ +PIL.Image.core interface module.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ load(val)[source]
│ │ │

Load a font by its index value or name and return it

│ │ │
│ │ │
Parameters:
│ │ │ -

val (int or str) – The index or the name of the font to return

│ │ │ +

val (int or str) – The index or the name of the font to return

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ luma.core.bitmap_font.load(filename)[source]
│ │ │

Load a luma.core.bitmap_font file. This function creates a │ │ │ luma.core.bitmap_font object from the given luma.core.bitmap_font │ │ │ file, and returns the corresponding font object.

│ │ │
│ │ │
Parameters:
│ │ │ -

filename (str) – Filename of font file.

│ │ │ +

filename (str) – Filename of font file.

│ │ │
│ │ │
Returns:
│ │ │

A luma.core.bitmap_font object.

│ │ │
│ │ │
Raises:
│ │ │
    │ │ │ -
  • OSError – If the file could not be read.

  • │ │ │ -
  • SyntaxError – If the file does not contain the expected data

  • │ │ │ +
  • OSError – If the file could not be read.

  • │ │ │ +
  • SyntaxError – If the file does not contain the expected data

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.bitmap_font.load_pillow_font(filename, mappings=None)[source]
│ │ │

Load a PIL font file. This function creates a luma.core.bitmap_font object │ │ │ from the given PIL bitmap font file, and returns the corresponding font object.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • filename (str) – Filename of font file.

  • │ │ │ -
  • mappings (dict) – a dictionary of unicode to value pairs (optional)

  • │ │ │ +
  • filename (str) – Filename of font file.

  • │ │ │ +
  • mappings (dict) – a dictionary of unicode to value pairs (optional)

  • │ │ │
│ │ │
│ │ │
Returns:
│ │ │

A font object.

│ │ │
│ │ │
Raises:
│ │ │
    │ │ │ -
  • OSError – If the file could not be read.

  • │ │ │ -
  • SyntaxError – If the file does not contain the expected data

  • │ │ │ +
  • OSError – If the file could not be read.

  • │ │ │ +
  • SyntaxError – If the file does not contain the expected data

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.bitmap_font.load_sprite_table(sprite_table, index, xwidth, glyph_size, cell_size=None, mappings=None)[source]
│ │ │

Create a luma.core.bitmap_font from a sprite table.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • sprite_table (str or PIL.Image) – Filename of a sprite_table file or a PIL.Image containing the │ │ │ +

  • sprite_table (str or PIL.Image) – Filename of a sprite_table file or a PIL.Image containing the │ │ │ sprite_table

  • │ │ │ -
  • index (list or other iterable) – The list of character values contained within sprite_table. │ │ │ +

  • index (list or other iterable) – The list of character values contained within sprite_table. │ │ │ This list MUST be in the same order that the glyphs for the characters │ │ │ appear within the sprite_table (in left to right, top to bottom order)

  • │ │ │ -
  • xwidth (int) – number of pixels between placements of each character in a │ │ │ +

  • xwidth (int) – number of pixels between placements of each character in a │ │ │ line of text

  • │ │ │ -
  • glyph_size (tuple(int, int)) – tuple containing the width and height of each character │ │ │ +

  • glyph_size (tuple(int, int)) – tuple containing the width and height of each character │ │ │ in the font

  • │ │ │ -
  • cell_size (tuple(int, int)) – tuple containing the width and height of each cell in the │ │ │ +

  • cell_size (tuple(int, int)) – tuple containing the width and height of each cell in the │ │ │ sprite table. Defaults to the size of the glyphs.

  • │ │ │ -
  • mappings (dict) – a dictionary of unicode to value pairs (optional)

  • │ │ │ +
  • mappings (dict) – a dictionary of unicode to value pairs (optional)

  • │ │ │
│ │ │
│ │ │
Returns:
│ │ │

A font object.

│ │ │
│ │ │
Raises:
│ │ │
    │ │ │ -
  • OSError – If the file could not be read.

  • │ │ │ -
  • SyntaxError – If the file does not contain the expected data

  • │ │ │ +
  • OSError – If the file could not be read.

  • │ │ │ +
  • SyntaxError – If the file does not contain the expected data

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.bitmap_font.loads(data)[source]
│ │ │

Load a luma.core.bitmap_font from a string of serialized data. This function │ │ │ creates a luma.core.bitmap_font object from serialized data produced from the │ │ │ dumps method and returns the corresponding font object.

│ │ │
│ │ │
Parameters:
│ │ │ -

data (str) – Serialized luma.core.bitmap_font data.

│ │ │ +

data (str) – Serialized luma.core.bitmap_font data.

│ │ │
│ │ │
Returns:
│ │ │

A luma.core.bitmap_font object.

│ │ │
│ │ │
Raises:
│ │ │ -

ValueError – If the data does not a valid luma.core.bitmap_font

│ │ │ +

ValueError – If the data does not a valid luma.core.bitmap_font

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -47,15 +47,15 @@ │ │ │ │ _L_u_m_a_._C_o_r_e_:_ _S_B_C_ _d_i_s_p_l_a_y_ _d_r_i_v_e_r_s │ │ │ │ * _A_P_I_ _D_o_c_u_m_e_n_t_a_t_i_o_n │ │ │ │ * luma.core.bitmap_font │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._bb_ii_tt_mm_aa_pp____ff_oo_nn_tt_? ************ │ │ │ │ ccllaassss luma.core.bitmap_font.bitmap_font_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ An PIL.Imagefont style font. │ │ │ │ The structure of this class was modeled after the PIL ImageFont class and │ │ │ │ is intended to be interchangable for PIL.ImageFont objects. │ │ │ │ It has the following additional capabilities: │ │ │ │ * Allows fonts larger than 256 characters to be created │ │ │ │ * Font can be combined with other fonts │ │ │ │ * Font characters can be mapped to their correct unicode codepoints │ │ │ │ @@ -63,99 +63,99 @@ │ │ │ │ New in version 1.16.0. │ │ │ │ PUA_SPACE == 11001155880088_ │ │ │ │ combine(ssoouurrccee__ffoonntt, cchhaarraacctteerrss==NNoonnee, ffoorrccee==FFaallssee)_[_s_o_u_r_c_e_]_ │ │ │ │ Combine two _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t instances. │ │ │ │ Parameters: │ │ │ │ * ssoouurrccee__ffoonntt (_l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t) – a │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t to copy from │ │ │ │ - * cchhaarraacctteerrss (_ss_tt_rr) – (optional) A list of the characters │ │ │ │ + * cchhaarraacctteerrss (ssttrr) – (optional) A list of the characters │ │ │ │ to transfer from the source_font. If not provided, all │ │ │ │ of the characters within the source_font will be │ │ │ │ transferred. │ │ │ │ - * ffoorrccee (_bb_oo_oo_ll) – If set, the source_font can overwrite │ │ │ │ + * ffoorrccee (bbooooll) – If set, the source_font can overwrite │ │ │ │ values that already exists within this font. Default is │ │ │ │ False. │ │ │ │ dumps()_[_s_o_u_r_c_e_]_ │ │ │ │ Serializes the font data for transfer or storage │ │ │ │ Returns: │ │ │ │ Serialized font data │ │ │ │ Return type: │ │ │ │ - _b_y_t_e_s │ │ │ │ + bytes │ │ │ │ getmask(tteexxtt, mmooddee==''11'', **aarrggss, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Implements an PIL.ImageFont compatible method to return the │ │ │ │ rendered image of a line of text │ │ │ │ getsize(tteexxtt, **aarrggss, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Wrapper for _getsize to match the interface of PIL.ImageFont │ │ │ │ load(ffiilleennaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Load font from filename │ │ │ │ Parameters: │ │ │ │ - ffiilleennaammee (_ss_tt_rr) – the filename of the file containing the font │ │ │ │ + ffiilleennaammee (ssttrr) – the filename of the file containing the font │ │ │ │ data │ │ │ │ Returns: │ │ │ │ a font object │ │ │ │ Return type: │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t │ │ │ │ load_pillow_font(ffiillee, mmaappppiinnggss==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Create _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t from a PIL ImageFont style font. │ │ │ │ Parameters: │ │ │ │ - * ffiillee (_ss_tt_rr) – The filename of the PIL.ImageFont to load │ │ │ │ - * mmaappppiinnggss (_dd_ii_cc_tt) – a dictionary of unicode to value │ │ │ │ + * ffiillee (ssttrr) – The filename of the PIL.ImageFont to load │ │ │ │ + * mmaappppiinnggss (ddiicctt) – a dictionary of unicode to value │ │ │ │ pairs (optional). Mappings allow the appropriate │ │ │ │ unicode values to be provided for each character │ │ │ │ contained within the font │ │ │ │ Returns: │ │ │ │ a font object │ │ │ │ Return type: │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t │ │ │ │ load_sprite_table(sspprriittee__ttaabbllee, iinnddeexx, xxwwiiddtthh, ggllyypphh__ssiizzee, cceellll__ssiizzee, │ │ │ │ mmaappppiinnggss==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Load a font from a sprite table │ │ │ │ Parameters: │ │ │ │ * sspprriittee__ttaabbllee (PPIILL..IImmaaggee) – A PIL.Image representation │ │ │ │ of every glyph within the font │ │ │ │ - * iinnddeexx (_ll_ii_ss_tt oorr ootthheerr iitteerraabbllee) – The list of character │ │ │ │ + * iinnddeexx (lliisstt oorr ootthheerr iitteerraabbllee) – The list of character │ │ │ │ values contained within sprite_table. This list MUST be │ │ │ │ in the same order that the glyphs for the characters │ │ │ │ appear within the sprite_table (in left to right, top │ │ │ │ to bottom order) │ │ │ │ - * xxwwiiddtthh (_ii_nn_tt) – number of pixels between placements of │ │ │ │ + * xxwwiiddtthh (iinntt) – number of pixels between placements of │ │ │ │ each character in a line of text │ │ │ │ - * ggllyypphh__ssiizzee (_tt_uu_pp_ll_ee((_ii_nn_tt,, _ii_nn_tt))) – tuple containing the │ │ │ │ + * ggllyypphh__ssiizzee (ttuuppllee((iinntt,, iinntt))) – tuple containing the │ │ │ │ width and height of each character in the font │ │ │ │ - * cceellll__ssiizzee (_tt_uu_pp_ll_ee((_ii_nn_tt,, _ii_nn_tt))) – tuple containing the │ │ │ │ + * cceellll__ssiizzee (ttuuppllee((iinntt,, iinntt))) – tuple containing the │ │ │ │ width and height of each cell in the sprite table. │ │ │ │ Defaults to the size of the glyphs. │ │ │ │ - * mmaappppiinnggss (_dd_ii_cc_tt) – a dictionary of unicode to value │ │ │ │ + * mmaappppiinnggss (ddiicctt) – a dictionary of unicode to value │ │ │ │ pairs (optional) Mappings allow the appropriate unicode │ │ │ │ values to be provided for each character contained │ │ │ │ within the font │ │ │ │ Returns: │ │ │ │ a font object │ │ │ │ Return type: │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t │ │ │ │ loads(ffoonnttddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Load _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t from a string of serialized data │ │ │ │ produced by the dumps method │ │ │ │ Parameters: │ │ │ │ - ffoonnttddaattaa (_bb_yy_tt_ee_ss) – The serialized font data that will be used │ │ │ │ + ffoonnttddaattaa (bbyytteess) – The serialized font data that will be used │ │ │ │ to initialize the font. This data is produced by the │ │ │ │ luma.core.bitmap_font.dumps() method. │ │ │ │ Returns: │ │ │ │ a font object │ │ │ │ Return type: │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t │ │ │ │ save(ffiilleennaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Write _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t data to a file │ │ │ │ ccllaassss luma.core.bitmap_font.embedded_fonts(ddaattaa, sseelleecctteedd__ffoonntt==00)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _I_m_a_g_e_F_o_n_t │ │ │ │ + Bases: ImageFont │ │ │ │ Utility class to manage the set of fonts that are embedded within a │ │ │ │ compatible device. │ │ │ │ Parameters: │ │ │ │ - * ddaattaa (_dd_ii_cc_tt) – The font data from the device. See note below. │ │ │ │ - * sseelleecctteedd__ffoonntt (_ss_tt_rr oorr _ii_nn_tt) – The font that should be loaded │ │ │ │ + * ddaattaa (ddiicctt) – The font data from the device. See note below. │ │ │ │ + * sseelleecctteedd__ffoonntt (ssttrr oorr iinntt) – The font that should be loaded │ │ │ │ as this device’s default. Will accept the font’s index or its │ │ │ │ name. │ │ │ │ ..note: │ │ │ │ The class is used by devices which have embedded fonts and is not │ │ │ │ intended to be used directly. To initialize it requires providing a │ │ │ │ dictionary of font data including aPIL.Image.tobytesrepresentation │ │ │ │ of a sprite_table which contains the glyphs of the font organized │ │ │ │ @@ -164,15 +164,15 @@ │ │ │ │ a mappings dictionary that provides unicode to table mappings. │ │ │ │ New in version 1.16.0. │ │ │ │ combine(ffoonntt, cchhaarraacctteerrss==NNoonnee, ffoorrccee==FFaallssee)_[_s_o_u_r_c_e_]_ │ │ │ │ Combine the current font with a new one │ │ │ │ Parameters: │ │ │ │ * ffoonntt (_l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t) – The font to combine with │ │ │ │ the current font │ │ │ │ - * cchhaarraacctteerrss (_ll_ii_ss_tt ooff uunniiccooddee cchhaarraacctteerrss) – (Optional) A │ │ │ │ + * cchhaarraacctteerrss (lliisstt ooff uunniiccooddee cchhaarraacctteerrss) – (Optional) A │ │ │ │ list of characters to move from the new font to the │ │ │ │ current font. If not provided all characters from the │ │ │ │ new font will be transferred. │ │ │ │ * ffoorrccee – Determines if conflicting characters should be │ │ │ │ ignored (default) or overwritten. │ │ │ │ pprrooppeerrttyy current_ │ │ │ │ Returns the currently selected font │ │ │ │ @@ -193,75 +193,75 @@ │ │ │ │ New in version 9.2.0. │ │ │ │ getmask(tteexxtt, mmooddee=='''', **aarrggss, ****kkwwaarrggss)_ │ │ │ │ Create a bitmap for the text. │ │ │ │ If the font uses antialiasing, the bitmap should have mode L and │ │ │ │ use a maximum value of 255. Otherwise, it should have mode 1. │ │ │ │ Returns: │ │ │ │ An internal PIL storage memory instance as defined by the │ │ │ │ - _P_I_L_._I_m_a_g_e_._c_o_r_e interface module. │ │ │ │ + PIL.Image.core interface module. │ │ │ │ load(vvaall)_[_s_o_u_r_c_e_]_ │ │ │ │ Load a font by its index value or name and return it │ │ │ │ Parameters: │ │ │ │ - vvaall (_ii_nn_tt oorr _ss_tt_rr) – The index or the name of the font to │ │ │ │ + vvaall (iinntt oorr ssttrr) – The index or the name of the font to │ │ │ │ return │ │ │ │ luma.core.bitmap_font.load(ffiilleennaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Load a _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t file. This function creates a │ │ │ │ _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t object from the given _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t file, │ │ │ │ and returns the corresponding font object. │ │ │ │ Parameters: │ │ │ │ - ffiilleennaammee (_ss_tt_rr) – Filename of font file. │ │ │ │ + ffiilleennaammee (ssttrr) – Filename of font file. │ │ │ │ Returns: │ │ │ │ A _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t object. │ │ │ │ Raises: │ │ │ │ - * _OO_SS_EE_rr_rr_oo_rr – If the file could not be read. │ │ │ │ - * _SS_yy_nn_tt_aa_xx_EE_rr_rr_oo_rr – If the file does not contain the expected data │ │ │ │ + * OOSSEErrrroorr – If the file could not be read. │ │ │ │ + * SSyynnttaaxxEErrrroorr – If the file does not contain the expected data │ │ │ │ luma.core.bitmap_font.load_pillow_font(ffiilleennaammee, mmaappppiinnggss==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Load a PIL font file. This function creates a luma.core.bitmap_font │ │ │ │ object from the given PIL bitmap font file, and returns the corresponding │ │ │ │ font object. │ │ │ │ Parameters: │ │ │ │ - * ffiilleennaammee (_ss_tt_rr) – Filename of font file. │ │ │ │ - * mmaappppiinnggss (_dd_ii_cc_tt) – a dictionary of unicode to value pairs │ │ │ │ + * ffiilleennaammee (ssttrr) – Filename of font file. │ │ │ │ + * mmaappppiinnggss (ddiicctt) – a dictionary of unicode to value pairs │ │ │ │ (optional) │ │ │ │ Returns: │ │ │ │ A font object. │ │ │ │ Raises: │ │ │ │ - * _OO_SS_EE_rr_rr_oo_rr – If the file could not be read. │ │ │ │ - * _SS_yy_nn_tt_aa_xx_EE_rr_rr_oo_rr – If the file does not contain the expected data │ │ │ │ + * OOSSEErrrroorr – If the file could not be read. │ │ │ │ + * SSyynnttaaxxEErrrroorr – If the file does not contain the expected data │ │ │ │ luma.core.bitmap_font.load_sprite_table(sspprriittee__ttaabbllee, iinnddeexx, xxwwiiddtthh, │ │ │ │ ggllyypphh__ssiizzee, cceellll__ssiizzee==NNoonnee, mmaappppiinnggss==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Create a _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t from a sprite table. │ │ │ │ Parameters: │ │ │ │ - * sspprriittee__ttaabbllee (_ss_tt_rr oorr PPIILL..IImmaaggee) – Filename of a sprite_table │ │ │ │ + * sspprriittee__ttaabbllee (ssttrr oorr PPIILL..IImmaaggee) – Filename of a sprite_table │ │ │ │ file or a PIL.Image containing the sprite_table │ │ │ │ - * iinnddeexx (_ll_ii_ss_tt oorr ootthheerr iitteerraabbllee) – The list of character values │ │ │ │ + * iinnddeexx (lliisstt oorr ootthheerr iitteerraabbllee) – The list of character values │ │ │ │ contained within sprite_table. This list MUST be in the same │ │ │ │ order that the glyphs for the characters appear within the │ │ │ │ sprite_table (in left to right, top to bottom order) │ │ │ │ - * xxwwiiddtthh (_ii_nn_tt) – number of pixels between placements of each │ │ │ │ + * xxwwiiddtthh (iinntt) – number of pixels between placements of each │ │ │ │ character in a line of text │ │ │ │ - * ggllyypphh__ssiizzee (_tt_uu_pp_ll_ee((_ii_nn_tt,, _ii_nn_tt))) – tuple containing the width and │ │ │ │ + * ggllyypphh__ssiizzee (ttuuppllee((iinntt,, iinntt))) – tuple containing the width and │ │ │ │ height of each character in the font │ │ │ │ - * cceellll__ssiizzee (_tt_uu_pp_ll_ee((_ii_nn_tt,, _ii_nn_tt))) – tuple containing the width and │ │ │ │ + * cceellll__ssiizzee (ttuuppllee((iinntt,, iinntt))) – tuple containing the width and │ │ │ │ height of each cell in the sprite table. Defaults to the size │ │ │ │ of the glyphs. │ │ │ │ - * mmaappppiinnggss (_dd_ii_cc_tt) – a dictionary of unicode to value pairs │ │ │ │ + * mmaappppiinnggss (ddiicctt) – a dictionary of unicode to value pairs │ │ │ │ (optional) │ │ │ │ Returns: │ │ │ │ A font object. │ │ │ │ Raises: │ │ │ │ - * _OO_SS_EE_rr_rr_oo_rr – If the file could not be read. │ │ │ │ - * _SS_yy_nn_tt_aa_xx_EE_rr_rr_oo_rr – If the file does not contain the expected data │ │ │ │ + * OOSSEErrrroorr – If the file could not be read. │ │ │ │ + * SSyynnttaaxxEErrrroorr – If the file does not contain the expected data │ │ │ │ luma.core.bitmap_font.loads(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Load a _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t from a string of serialized data. This │ │ │ │ function creates a _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t object from serialized data │ │ │ │ produced from the dumps method and returns the corresponding font object. │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ss_tt_rr) – Serialized _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t data. │ │ │ │ + ddaattaa (ssttrr) – Serialized _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t data. │ │ │ │ Returns: │ │ │ │ A _l_u_m_a_._c_o_r_e_._b_i_t_m_a_p___f_o_n_t object. │ │ │ │ Raises: │ │ │ │ - _VV_aa_ll_uu_ee_EE_rr_rr_oo_rr – If the data does not a valid luma.core.bitmap_font │ │ │ │ + VVaalluueeEErrrroorr – If the data does not a valid luma.core.bitmap_font │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/cmdline.html │ │ │ @@ -138,116 +138,116 @@ │ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_choices(module_name)[source]
│ │ │

Retrieve members from module_name’s __all__ list.

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_display_types()[source]
│ │ │

Get ordered dict containing available display types from available luma │ │ │ sub-projects.

│ │ │
│ │ │
Return type:
│ │ │ -

collections.OrderedDict

│ │ │ +

collections.OrderedDict

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_interface_types()[source]
│ │ │

Get list of available interface types, e.g. ['spi', 'i2c'].

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_library_for_display_type(display_type)[source]
│ │ │

Get library name for display_type, e.g. ssd1306 should return │ │ │ oled.

│ │ │
│ │ │

New in version 1.2.0.

│ │ │
│ │ │
│ │ │
Parameters:
│ │ │ -

display_type (str) – Display type, e.g. ssd1306.

│ │ │ +

display_type (str) – Display type, e.g. ssd1306.

│ │ │
│ │ │
Return type:
│ │ │ -

str or None

│ │ │ +

str or None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_library_version(module_name)[source]
│ │ │

Get version number from module_name’s __version__ attribute.

│ │ │
│ │ │

New in version 1.2.0.

│ │ │
│ │ │
│ │ │
Parameters:
│ │ │ -

module_name (str) – The module name, e.g. luma.oled.

│ │ │ +

module_name (str) – The module name, e.g. luma.oled.

│ │ │
│ │ │
Return type:
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_supported_libraries()[source]
│ │ │

Get list of supported libraries for the parser.

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.get_transformer_choices()[source]
│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.cmdline.load_config(path)[source]
│ │ │

Load device configuration from file path and return list with parsed lines.

│ │ │
│ │ │
Parameters:
│ │ │ -

path (str) – Location of configuration file.

│ │ │ +

path (str) – Location of configuration file.

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.cmdline.make_interface(opts, gpio=None)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Serial factory.

│ │ │
│ │ │
│ │ │ bitbang()[source]
│ │ │
│ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -51,54 +51,54 @@ │ │ │ │ luma.core.cmdline.create_device(aarrggss, ddiissppllaayy__ttyyppeess==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Create and return device. │ │ │ │ luma.core.cmdline.create_parser(ddeessccrriippttiioonn)_[_s_o_u_r_c_e_]_ │ │ │ │ Create and return command-line argument parser. │ │ │ │ luma.core.cmdline.get_choices(mmoodduullee__nnaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Retrieve members from module_name’s __all__ list. │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ luma.core.cmdline.get_display_types()_[_s_o_u_r_c_e_]_ │ │ │ │ Get ordered dict containing available display types from available luma │ │ │ │ sub-projects. │ │ │ │ Return type: │ │ │ │ - _c_o_l_l_e_c_t_i_o_n_s_._O_r_d_e_r_e_d_D_i_c_t │ │ │ │ + collections.OrderedDict │ │ │ │ luma.core.cmdline.get_interface_types()_[_s_o_u_r_c_e_]_ │ │ │ │ Get list of available interface types, e.g. ['spi', 'i2c']. │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ luma.core.cmdline.get_library_for_display_type(ddiissppllaayy__ttyyppee)_[_s_o_u_r_c_e_]_ │ │ │ │ Get library name for display_type, e.g. ssd1306 should return oled. │ │ │ │ New in version 1.2.0. │ │ │ │ Parameters: │ │ │ │ - ddiissppllaayy__ttyyppee (_ss_tt_rr) – Display type, e.g. ssd1306. │ │ │ │ + ddiissppllaayy__ttyyppee (ssttrr) – Display type, e.g. ssd1306. │ │ │ │ Return type: │ │ │ │ - _s_t_r or None │ │ │ │ + str or None │ │ │ │ luma.core.cmdline.get_library_version(mmoodduullee__nnaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Get version number from module_name’s __version__ attribute. │ │ │ │ New in version 1.2.0. │ │ │ │ Parameters: │ │ │ │ - mmoodduullee__nnaammee (_ss_tt_rr) – The module name, e.g. luma.oled. │ │ │ │ + mmoodduullee__nnaammee (ssttrr) – The module name, e.g. luma.oled. │ │ │ │ Return type: │ │ │ │ - _s_t_r │ │ │ │ + str │ │ │ │ luma.core.cmdline.get_supported_libraries()_[_s_o_u_r_c_e_]_ │ │ │ │ Get list of supported libraries for the parser. │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ luma.core.cmdline.get_transformer_choices()_[_s_o_u_r_c_e_]_ │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ luma.core.cmdline.load_config(ppaatthh)_[_s_o_u_r_c_e_]_ │ │ │ │ Load device configuration from file path and return list with parsed │ │ │ │ lines. │ │ │ │ Parameters: │ │ │ │ - ppaatthh (_ss_tt_rr) – Location of configuration file. │ │ │ │ + ppaatthh (ssttrr) – Location of configuration file. │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ ccllaassss luma.core.cmdline.make_interface(ooppttss, ggppiioo==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Serial factory. │ │ │ │ bitbang()_[_s_o_u_r_c_e_]_ │ │ │ │ bitbang_6800()_[_s_o_u_r_c_e_]_ │ │ │ │ ftdi_i2c()_[_s_o_u_r_c_e_]_ │ │ │ │ ftdi_spi()_[_s_o_u_r_c_e_]_ │ │ │ │ gpio_cs_spi()_[_s_o_u_r_c_e_]_ │ │ │ │ i2c()_[_s_o_u_r_c_e_]_ │ │ ├── ./usr/share/doc/luma.core-doc/html/const.html │ │ │ @@ -111,15 +111,15 @@ │ │ │
│ │ │ │ │ │
│ │ │

luma.core.const

│ │ │
│ │ │
│ │ │ class luma.core.const.common[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │
│ │ │
│ │ │ DISPLAYALLON = 165
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -35,15 +35,15 @@ │ │ │ │ _L_u_m_a_._C_o_r_e_:_ _S_B_C_ _d_i_s_p_l_a_y_ _d_r_i_v_e_r_s │ │ │ │ * _A_P_I_ _D_o_c_u_m_e_n_t_a_t_i_o_n │ │ │ │ * luma.core.const │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._cc_oo_nn_ss_tt_? ************ │ │ │ │ ccllaassss luma.core.const.common_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ DISPLAYALLON == 116655_ │ │ │ │ DISPLAYALLON_RESUME == 116644_ │ │ │ │ DISPLAYOFF == 117744_ │ │ │ │ DISPLAYON == 117755_ │ │ │ │ INVERTDISPLAY == 116677_ │ │ │ │ NORMALDISPLAY == 116666_ │ │ │ │ SETCONTRAST == 112299_ │ │ ├── ./usr/share/doc/luma.core-doc/html/device.html │ │ │ @@ -168,20 +168,20 @@ │ │ │
│ │ │ capabilities(width, height, rotate, mode='1')
│ │ │

Assigns attributes such as width, height, size and │ │ │ bounding_box correctly oriented from the supplied parameters.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • width (int) – The device width.

  • │ │ │ -
  • height (int) – The device height.

  • │ │ │ -
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ +

  • width (int) – The device width.

  • │ │ │ +
  • height (int) – The device height.

  • │ │ │ +
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 │ │ │ represents 270° rotation.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -214,15 +214,15 @@ │ │ │ contrast(level)[source] │ │ │

Switches the display contrast to the desired level, in the range │ │ │ 0-255. Note that setting the level to a low (or zero) value will │ │ │ not necessarily dim the display to nearly off. In other words, │ │ │ this method is NOT suitable for fade-in/out animation.

│ │ │
│ │ │
Parameters:
│ │ │ -

level (int) – Desired contrast level in the range of 0-255.

│ │ │ +

level (int) – Desired contrast level in the range of 0-255.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)[source]
│ │ │ @@ -232,18 +232,18 @@ │ │ │ │ │ │
│ │ │
│ │ │ display(image)
│ │ │

Should be overridden in sub-classed implementations.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to display.

│ │ │ +

image (PIL.Image.Image) – An image to display.

│ │ │
│ │ │
Raises:
│ │ │ -

NotImplementedError

│ │ │ +

NotImplementedError

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ hide()[source]
│ │ │ @@ -255,21 +255,21 @@ │ │ │
│ │ │ preprocess(image)
│ │ │

Provides a preprocessing facility (which may be overridden) whereby the supplied image is │ │ │ rotated according to the device’s rotate capability. If this method is │ │ │ overridden, it is important to call the super method.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to pre-process.

│ │ │ +

image (PIL.Image.Image) – An image to pre-process.

│ │ │
│ │ │
Returns:
│ │ │

A new processed image.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ show()[source]
│ │ │ @@ -290,20 +290,20 @@ │ │ │
│ │ │ capabilities(width, height, rotate, mode='1')
│ │ │

Assigns attributes such as width, height, size and │ │ │ bounding_box correctly oriented from the supplied parameters.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • width (int) – The device width.

  • │ │ │ -
  • height (int) – The device height.

  • │ │ │ -
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ +

  • width (int) – The device width.

  • │ │ │ +
  • height (int) – The device height.

  • │ │ │ +
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 │ │ │ represents 270° rotation.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -336,34 +336,34 @@ │ │ │ contrast(level) │ │ │

Switches the display contrast to the desired level, in the range │ │ │ 0-255. Note that setting the level to a low (or zero) value will │ │ │ not necessarily dim the display to nearly off. In other words, │ │ │ this method is NOT suitable for fade-in/out animation.

│ │ │
│ │ │
Parameters:
│ │ │ -

level (int) – Desired contrast level in the range of 0-255.

│ │ │ +

level (int) – Desired contrast level in the range of 0-255.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)
│ │ │

Sends a data byte or sequence of data bytes through to the delegated │ │ │ serial interface.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ display(image)[source]
│ │ │ -

Takes a PIL.Image and makes a copy of it for later │ │ │ +

Takes a PIL.Image and makes a copy of it for later │ │ │ use/inspection.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – Image to display.

│ │ │ +

image (PIL.Image.Image) – Image to display.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ hide()
│ │ │ @@ -375,21 +375,21 @@ │ │ │
│ │ │ preprocess(image)
│ │ │

Provides a preprocessing facility (which may be overridden) whereby the supplied image is │ │ │ rotated according to the device’s rotate capability. If this method is │ │ │ overridden, it is important to call the super method.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to pre-process.

│ │ │ +

image (PIL.Image.Image) – An image to pre-process.

│ │ │
│ │ │
Returns:
│ │ │

A new processed image.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ show()
│ │ │ @@ -428,20 +428,20 @@ │ │ │
│ │ │ capabilities(width, height, rotate, mode='1')
│ │ │

Assigns attributes such as width, height, size and │ │ │ bounding_box correctly oriented from the supplied parameters.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • width (int) – The device width.

  • │ │ │ -
  • height (int) – The device height.

  • │ │ │ -
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ +

  • width (int) – The device width.

  • │ │ │ +
  • height (int) – The device height.

  • │ │ │ +
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 │ │ │ represents 270° rotation.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -474,34 +474,34 @@ │ │ │ contrast(level) │ │ │

Switches the display contrast to the desired level, in the range │ │ │ 0-255. Note that setting the level to a low (or zero) value will │ │ │ not necessarily dim the display to nearly off. In other words, │ │ │ this method is NOT suitable for fade-in/out animation.

│ │ │
│ │ │
Parameters:
│ │ │ -

level (int) – Desired contrast level in the range of 0-255.

│ │ │ +

level (int) – Desired contrast level in the range of 0-255.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)
│ │ │

Sends a data byte or sequence of data bytes through to the delegated │ │ │ serial interface.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ display(image)[source]
│ │ │ -

Takes a PIL.Image and converts it for consumption on the │ │ │ +

Takes a PIL.Image and converts it for consumption on the │ │ │ given /dev/fbX framebuffer device.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – Image to display.

│ │ │ +

image (PIL.Image.Image) – Image to display.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ hide()
│ │ │ @@ -513,21 +513,21 @@ │ │ │
│ │ │ preprocess(image)
│ │ │

Provides a preprocessing facility (which may be overridden) whereby the supplied image is │ │ │ rotated according to the device’s rotate capability. If this method is │ │ │ overridden, it is important to call the super method.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to pre-process.

│ │ │ +

image (PIL.Image.Image) – An image to pre-process.

│ │ │
│ │ │
Returns:
│ │ │

A new processed image.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ show()
│ │ │ @@ -557,20 +557,20 @@ │ │ │
│ │ │ capabilities(width, height, rotate, mode='1')
│ │ │

Assigns attributes such as width, height, size and │ │ │ bounding_box correctly oriented from the supplied parameters.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • width (int) – The device width.

  • │ │ │ -
  • height (int) – The device height.

  • │ │ │ -
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ +

  • width (int) – The device width.

  • │ │ │ +
  • height (int) – The device height.

  • │ │ │ +
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 │ │ │ represents 270° rotation.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -596,18 +596,18 @@ │ │ │ command(*cmd, exec_time=None, only_low_bits=False)[source] │ │ │

Sends a command or sequence of commands through to the serial interface. │ │ │ If operating in four bit mode, expands each command from one byte │ │ │ values (8 bits) to two nibble values (4 bits each)

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • cmd (int) – A spread of commands.

  • │ │ │ -
  • exec_time (float) – Amount of time to wait for the command to finish │ │ │ +

  • cmd (int) – A spread of commands.

  • │ │ │ +
  • exec_time (float) – Amount of time to wait for the command to finish │ │ │ execution. If not provided, the device default will be used instead

  • │ │ │ -
  • only_low_bits (bool) – If True, only the lowest four bits of the command │ │ │ +

  • only_low_bits (bool) – If True, only the lowest four bits of the command │ │ │ will be sent. This is necessary on some devices during initialization

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -615,42 +615,42 @@ │ │ │ contrast(level) │ │ │

Switches the display contrast to the desired level, in the range │ │ │ 0-255. Note that setting the level to a low (or zero) value will │ │ │ not necessarily dim the display to nearly off. In other words, │ │ │ this method is NOT suitable for fade-in/out animation.

│ │ │
│ │ │
Parameters:
│ │ │ -

level (int) – Desired contrast level in the range of 0-255.

│ │ │ +

level (int) – Desired contrast level in the range of 0-255.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)[source]
│ │ │

Sends a sequence of bytes through to the serial interface. │ │ │ If operating in four bit mode, expands each byte from a single │ │ │ value (8 bits) to two nibble values (4 bits each)

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list) – a sequence of bytes to send to the display

│ │ │ +

data (list) – a sequence of bytes to send to the display

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ display(image)
│ │ │

Should be overridden in sub-classed implementations.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to display.

│ │ │ +

image (PIL.Image.Image) – An image to display.

│ │ │
│ │ │
Raises:
│ │ │ -

NotImplementedError

│ │ │ +

NotImplementedError

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ hide()
│ │ │ @@ -662,21 +662,21 @@ │ │ │
│ │ │ preprocess(image)
│ │ │

Provides a preprocessing facility (which may be overridden) whereby the supplied image is │ │ │ rotated according to the device’s rotate capability. If this method is │ │ │ overridden, it is important to call the super method.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to pre-process.

│ │ │ +

image (PIL.Image.Image) – An image to pre-process.

│ │ │
│ │ │
Returns:
│ │ │

A new processed image.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ show()
│ │ │ ├── html2text {} │ │ │ │ @@ -79,21 +79,21 @@ │ │ │ │ Direct use of the _c_o_m_m_a_n_d_(_) and _d_a_t_a_(_) methods are discouraged: Screen │ │ │ │ updates should be effected through the _d_i_s_p_l_a_y_(_) method, or preferably │ │ │ │ with the _l_u_m_a_._c_o_r_e_._r_e_n_d_e_r_._c_a_n_v_a_s context manager. │ │ │ │ capabilities(wwiiddtthh, hheeiigghhtt, rroottaattee, mmooddee==''11'')_ │ │ │ │ Assigns attributes such as width, height, size and bounding_box │ │ │ │ correctly oriented from the supplied parameters. │ │ │ │ Parameters: │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The device width. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The device height. │ │ │ │ - * rroottaattee (_ii_nn_tt) – An integer value of 0 (default), 1, 2 or │ │ │ │ + * wwiiddtthh (iinntt) – The device width. │ │ │ │ + * hheeiigghhtt (iinntt) – The device height. │ │ │ │ + * rroottaattee (iinntt) – An integer value of 0 (default), 1, 2 or │ │ │ │ 3 only, where 0 is no rotation, 1 is rotate 90° │ │ │ │ clockwise, 2 is 180° rotation and 3 represents 270° │ │ │ │ rotation. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", │ │ │ │ "RGB" or "RGBA" only. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Attempt to switch the device off or put into low power mode (this │ │ │ │ helps prolong the life of the device), clear the screen and close │ │ │ │ resources associated with the underlying serial interface. │ │ │ │ If persist is True, the device will not be switched off. │ │ │ │ This is a managed function, which is called when the python │ │ │ │ @@ -106,58 +106,58 @@ │ │ │ │ serial interface. │ │ │ │ contrast(lleevveell)_[_s_o_u_r_c_e_]_ │ │ │ │ Switches the display contrast to the desired level, in the range 0- │ │ │ │ 255. Note that setting the level to a low (or zero) value will not │ │ │ │ necessarily dim the display to nearly off. In other words, this │ │ │ │ method is NNOOTT suitable for fade-in/out animation. │ │ │ │ Parameters: │ │ │ │ - lleevveell (_ii_nn_tt) – Desired contrast level in the range of 0-255. │ │ │ │ + lleevveell (iinntt) – Desired contrast level in the range of 0-255. │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a data byte or sequence of data bytes through to the │ │ │ │ delegated serial interface. │ │ │ │ display(iimmaaggee)_ │ │ │ │ Should be overridden in sub-classed implementations. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to display. │ │ │ │ Raises: │ │ │ │ - _NN_oo_tt_II_mm_pp_ll_ee_mm_ee_nn_tt_ee_dd_EE_rr_rr_oo_rr – │ │ │ │ + NNoottIImmpplleemmeenntteeddEErrrroorr – │ │ │ │ hide()_[_s_o_u_r_c_e_]_ │ │ │ │ Switches the display mode OFF, putting the device in low-power │ │ │ │ sleep mode. │ │ │ │ preprocess(iimmaaggee)_ │ │ │ │ Provides a preprocessing facility (which may be overridden) whereby │ │ │ │ the supplied image is rotated according to the device’s rotate │ │ │ │ capability. If this method is overridden, it is important to call │ │ │ │ the super method. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to pre-process. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to pre-process. │ │ │ │ Returns: │ │ │ │ A new processed image. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ show()_[_s_o_u_r_c_e_]_ │ │ │ │ Sets the display mode ON, waking the device out of a prior low- │ │ │ │ power sleep mode. │ │ │ │ ccllaassss luma.core.device.dummy(wwiiddtthh==112288, hheeiigghhtt==6644, rroottaattee==00, mmooddee==''RRGGBB'', │ │ │ │ ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _d_e_v_i_c_e │ │ │ │ Pseudo-device that acts like a physical display, except that it does │ │ │ │ nothing other than retain a copy of the displayed image. It is mostly │ │ │ │ useful for testing. Supports 24-bit color depth. │ │ │ │ capabilities(wwiiddtthh, hheeiigghhtt, rroottaattee, mmooddee==''11'')_ │ │ │ │ Assigns attributes such as width, height, size and bounding_box │ │ │ │ correctly oriented from the supplied parameters. │ │ │ │ Parameters: │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The device width. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The device height. │ │ │ │ - * rroottaattee (_ii_nn_tt) – An integer value of 0 (default), 1, 2 or │ │ │ │ + * wwiiddtthh (iinntt) – The device width. │ │ │ │ + * hheeiigghhtt (iinntt) – The device height. │ │ │ │ + * rroottaattee (iinntt) – An integer value of 0 (default), 1, 2 or │ │ │ │ 3 only, where 0 is no rotation, 1 is rotate 90° │ │ │ │ clockwise, 2 is 180° rotation and 3 represents 270° │ │ │ │ rotation. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", │ │ │ │ "RGB" or "RGBA" only. │ │ │ │ cleanup()_ │ │ │ │ Attempt to switch the device off or put into low power mode (this │ │ │ │ helps prolong the life of the device), clear the screen and close │ │ │ │ resources associated with the underlying serial interface. │ │ │ │ If persist is True, the device will not be switched off. │ │ │ │ This is a managed function, which is called when the python │ │ │ │ @@ -170,36 +170,36 @@ │ │ │ │ serial interface. │ │ │ │ contrast(lleevveell)_ │ │ │ │ Switches the display contrast to the desired level, in the range 0- │ │ │ │ 255. Note that setting the level to a low (or zero) value will not │ │ │ │ necessarily dim the display to nearly off. In other words, this │ │ │ │ method is NNOOTT suitable for fade-in/out animation. │ │ │ │ Parameters: │ │ │ │ - lleevveell (_ii_nn_tt) – Desired contrast level in the range of 0-255. │ │ │ │ + lleevveell (iinntt) – Desired contrast level in the range of 0-255. │ │ │ │ data(ddaattaa)_ │ │ │ │ Sends a data byte or sequence of data bytes through to the │ │ │ │ delegated serial interface. │ │ │ │ display(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Takes a _P_I_L_._I_m_a_g_e and makes a copy of it for later use/inspection. │ │ │ │ + Takes a PIL.Image and makes a copy of it for later use/inspection. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – Image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – Image to display. │ │ │ │ hide()_ │ │ │ │ Switches the display mode OFF, putting the device in low-power │ │ │ │ sleep mode. │ │ │ │ preprocess(iimmaaggee)_ │ │ │ │ Provides a preprocessing facility (which may be overridden) whereby │ │ │ │ the supplied image is rotated according to the device’s rotate │ │ │ │ capability. If this method is overridden, it is important to call │ │ │ │ the super method. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to pre-process. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to pre-process. │ │ │ │ Returns: │ │ │ │ A new processed image. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ show()_ │ │ │ │ Sets the display mode ON, waking the device out of a prior low- │ │ │ │ power sleep mode. │ │ │ │ ccllaassss luma.core.device.linux_framebuffer(ddeevviiccee==NNoonnee, ffrraammeebbuuffffeerr==NNoonnee, │ │ │ │ bbggrr==FFaallssee, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _d_e_v_i_c_e │ │ │ │ Pseudo-device that acts like a physical display, except that it renders │ │ │ │ @@ -219,21 +219,21 @@ │ │ │ │ RGB). Note: this flag is currently supported on 24 and 32-bit │ │ │ │ color depth devices only. │ │ │ │ New in version 2.0.0. │ │ │ │ capabilities(wwiiddtthh, hheeiigghhtt, rroottaattee, mmooddee==''11'')_ │ │ │ │ Assigns attributes such as width, height, size and bounding_box │ │ │ │ correctly oriented from the supplied parameters. │ │ │ │ Parameters: │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The device width. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The device height. │ │ │ │ - * rroottaattee (_ii_nn_tt) – An integer value of 0 (default), 1, 2 or │ │ │ │ + * wwiiddtthh (iinntt) – The device width. │ │ │ │ + * hheeiigghhtt (iinntt) – The device height. │ │ │ │ + * rroottaattee (iinntt) – An integer value of 0 (default), 1, 2 or │ │ │ │ 3 only, where 0 is no rotation, 1 is rotate 90° │ │ │ │ clockwise, 2 is 180° rotation and 3 represents 270° │ │ │ │ rotation. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", │ │ │ │ "RGB" or "RGBA" only. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Attempt to switch the device off or put into low power mode (this │ │ │ │ helps prolong the life of the device), clear the screen and close │ │ │ │ resources associated with the underlying serial interface. │ │ │ │ If persist is True, the device will not be switched off. │ │ │ │ This is a managed function, which is called when the python │ │ │ │ @@ -246,37 +246,37 @@ │ │ │ │ serial interface. │ │ │ │ contrast(lleevveell)_ │ │ │ │ Switches the display contrast to the desired level, in the range 0- │ │ │ │ 255. Note that setting the level to a low (or zero) value will not │ │ │ │ necessarily dim the display to nearly off. In other words, this │ │ │ │ method is NNOOTT suitable for fade-in/out animation. │ │ │ │ Parameters: │ │ │ │ - lleevveell (_ii_nn_tt) – Desired contrast level in the range of 0-255. │ │ │ │ + lleevveell (iinntt) – Desired contrast level in the range of 0-255. │ │ │ │ data(ddaattaa)_ │ │ │ │ Sends a data byte or sequence of data bytes through to the │ │ │ │ delegated serial interface. │ │ │ │ display(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Takes a _P_I_L_._I_m_a_g_e and converts it for consumption on the given / │ │ │ │ + Takes a PIL.Image and converts it for consumption on the given / │ │ │ │ dev/fbX framebuffer device. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – Image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – Image to display. │ │ │ │ hide()_ │ │ │ │ Switches the display mode OFF, putting the device in low-power │ │ │ │ sleep mode. │ │ │ │ preprocess(iimmaaggee)_ │ │ │ │ Provides a preprocessing facility (which may be overridden) whereby │ │ │ │ the supplied image is rotated according to the device’s rotate │ │ │ │ capability. If this method is overridden, it is important to call │ │ │ │ the super method. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to pre-process. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to pre-process. │ │ │ │ Returns: │ │ │ │ A new processed image. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ show()_ │ │ │ │ Sets the display mode ON, waking the device out of a prior low- │ │ │ │ power sleep mode. │ │ │ │ ccllaassss luma.core.device.parallel_device(ccoonnsstt==NNoonnee, sseerriiaall__iinntteerrffaaccee==NNoonnee, │ │ │ │ eexxeecc__ttiimmee==NNoonnee, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _d_e_v_i_c_e │ │ │ │ Wrapper class to manage communications with devices that can operate in │ │ │ │ @@ -287,21 +287,21 @@ │ │ │ │ your application is especially time sensitive, consider running the │ │ │ │ drivers in a separate thread. │ │ │ │ New in version 1.16.0. │ │ │ │ capabilities(wwiiddtthh, hheeiigghhtt, rroottaattee, mmooddee==''11'')_ │ │ │ │ Assigns attributes such as width, height, size and bounding_box │ │ │ │ correctly oriented from the supplied parameters. │ │ │ │ Parameters: │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The device width. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The device height. │ │ │ │ - * rroottaattee (_ii_nn_tt) – An integer value of 0 (default), 1, 2 or │ │ │ │ + * wwiiddtthh (iinntt) – The device width. │ │ │ │ + * hheeiigghhtt (iinntt) – The device height. │ │ │ │ + * rroottaattee (iinntt) – An integer value of 0 (default), 1, 2 or │ │ │ │ 3 only, where 0 is no rotation, 1 is rotate 90° │ │ │ │ clockwise, 2 is 180° rotation and 3 represents 270° │ │ │ │ rotation. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", │ │ │ │ "RGB" or "RGBA" only. │ │ │ │ cleanup()_ │ │ │ │ Attempt to switch the device off or put into low power mode (this │ │ │ │ helps prolong the life of the device), clear the screen and close │ │ │ │ resources associated with the underlying serial interface. │ │ │ │ If persist is True, the device will not be switched off. │ │ │ │ This is a managed function, which is called when the python │ │ │ │ @@ -310,54 +310,54 @@ │ │ │ │ clear()_ │ │ │ │ Initializes the device memory with an empty (blank) image. │ │ │ │ command(**ccmmdd, eexxeecc__ttiimmee==NNoonnee, oonnllyy__llooww__bbiittss==FFaallssee)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a command or sequence of commands through to the serial │ │ │ │ interface. If operating in four bit mode, expands each command from │ │ │ │ one byte values (8 bits) to two nibble values (4 bits each) │ │ │ │ Parameters: │ │ │ │ - * ccmmdd (_ii_nn_tt) – A spread of commands. │ │ │ │ - * eexxeecc__ttiimmee (_ff_ll_oo_aa_tt) – Amount of time to wait for the │ │ │ │ + * ccmmdd (iinntt) – A spread of commands. │ │ │ │ + * eexxeecc__ttiimmee (ffllooaatt) – Amount of time to wait for the │ │ │ │ command to finish execution. If not provided, the │ │ │ │ device default will be used instead │ │ │ │ - * oonnllyy__llooww__bbiittss (_bb_oo_oo_ll) – If True, only the lowest four │ │ │ │ + * oonnllyy__llooww__bbiittss (bbooooll) – If True, only the lowest four │ │ │ │ bits of the command will be sent. This is necessary on │ │ │ │ some devices during initialization │ │ │ │ contrast(lleevveell)_ │ │ │ │ Switches the display contrast to the desired level, in the range 0- │ │ │ │ 255. Note that setting the level to a low (or zero) value will not │ │ │ │ necessarily dim the display to nearly off. In other words, this │ │ │ │ method is NNOOTT suitable for fade-in/out animation. │ │ │ │ Parameters: │ │ │ │ - lleevveell (_ii_nn_tt) – Desired contrast level in the range of 0-255. │ │ │ │ + lleevveell (iinntt) – Desired contrast level in the range of 0-255. │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a sequence of bytes through to the serial interface. If │ │ │ │ operating in four bit mode, expands each byte from a single value │ │ │ │ (8 bits) to two nibble values (4 bits each) │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt) – a sequence of bytes to send to the display │ │ │ │ + ddaattaa (lliisstt) – a sequence of bytes to send to the display │ │ │ │ display(iimmaaggee)_ │ │ │ │ Should be overridden in sub-classed implementations. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to display. │ │ │ │ Raises: │ │ │ │ - _NN_oo_tt_II_mm_pp_ll_ee_mm_ee_nn_tt_ee_dd_EE_rr_rr_oo_rr – │ │ │ │ + NNoottIImmpplleemmeenntteeddEErrrroorr – │ │ │ │ hide()_ │ │ │ │ Switches the display mode OFF, putting the device in low-power │ │ │ │ sleep mode. │ │ │ │ preprocess(iimmaaggee)_ │ │ │ │ Provides a preprocessing facility (which may be overridden) whereby │ │ │ │ the supplied image is rotated according to the device’s rotate │ │ │ │ capability. If this method is overridden, it is important to call │ │ │ │ the super method. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to pre-process. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to pre-process. │ │ │ │ Returns: │ │ │ │ A new processed image. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ show()_ │ │ │ │ Sets the display mode ON, waking the device out of a prior low- │ │ │ │ power sleep mode. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/error.html │ │ │ @@ -134,15 +134,15 @@ │ │ │

Bases: Error

│ │ │

Exception raised when permission to access the device is denied.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception luma.core.error.Error[source]
│ │ │ -

Bases: Exception

│ │ │ +

Bases: Exception

│ │ │

Base class for exceptions in this library.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception luma.core.error.UnsupportedPlatform[source]
│ │ │

Bases: Error

│ │ │ ├── html2text {} │ │ │ │ @@ -44,15 +44,15 @@ │ │ │ │ eexxcceeppttiioonn luma.core.error.DeviceNotFoundError_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _E_r_r_o_r │ │ │ │ Exception raised when a device cannot be found. │ │ │ │ eexxcceeppttiioonn luma.core.error.DevicePermissionError_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _E_r_r_o_r │ │ │ │ Exception raised when permission to access the device is denied. │ │ │ │ eexxcceeppttiioonn luma.core.error.Error_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _E_x_c_e_p_t_i_o_n │ │ │ │ + Bases: Exception │ │ │ │ Base class for exceptions in this library. │ │ │ │ eexxcceeppttiioonn luma.core.error.UnsupportedPlatform_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _E_r_r_o_r │ │ │ │ Exception raised when trying to use the library on an incompatible │ │ │ │ system. │ │ │ │ New in version 0.5.2. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ ├── ./usr/share/doc/luma.core-doc/html/framebuffer.html │ │ │ @@ -108,29 +108,29 @@ │ │ │ │ │ │
│ │ │

luma.core.framebuffer

│ │ │

Different implementation strategies for framebuffering

│ │ │
│ │ │
│ │ │ class luma.core.framebuffer.diff_to_previous(num_segments=4, debug=False)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Compare the current frame to the previous frame and tries to calculate the │ │ │ differences: this will either yield nothing for a perfect match or else │ │ │ the iterator will yield one or more tuples comprising of the image part that │ │ │ changed along with the bounding box that describes the areas that are different, │ │ │ up to the size of the entire image.

│ │ │

The image data for the difference is then be passed to a device for │ │ │ rendering just those small changes. This can be very quick for small screen │ │ │ updates, but suffers from variable render times, depending on the changes │ │ │ applied. The luma.core.sprite_system.framerate_regulator may be │ │ │ used to counteract this behavior however.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • num_segments (int) – The number of segments to partition the image into. This │ │ │ +

  • num_segments (int) – The number of segments to partition the image into. This │ │ │ generally must be a square number (1, 4, 9, 16, …) and must be able to │ │ │ segment the image entirely in both width and height. i.e setting to 9 will │ │ │ subdivide the image into a 3x3 grid when comparing to the previous image.

  • │ │ │
  • debug (boolean) – When set, draws a red box around each changed image segment to │ │ │ show the area that changed. This is obviously destructive for displaying │ │ │ the actual image, but intends to show where the tracked changes are.

  • │ │ │
│ │ │ @@ -143,49 +143,49 @@ │ │ │ image sections and bounding boxes that changed since the previous image.

│ │ │
│ │ │

Note

│ │ │

the first redraw will always render the full frame.

│ │ │
│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – The image to render.

│ │ │ +

image (PIL.Image.Image) – The image to render.

│ │ │
│ │ │
Returns:
│ │ │

Yields a sequence of images and the bounding box for each segment difference

│ │ │
│ │ │
Return type:
│ │ │ -

Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]]

│ │ │ +

Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.framebuffer.full_frame(**kwargs)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Always renders the full frame every time. This is slower than │ │ │ diff_to_previous as there are generally more │ │ │ pixels to update on every render, but it has a more consistent render time. │ │ │ Not all display drivers may be able to use the differencing framebuffer, so │ │ │ this is provided as a drop-in replacement.

│ │ │
│ │ │
│ │ │ redraw(image)[source]
│ │ │

Yields the full image for every redraw.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – The image to render.

│ │ │ +

image (PIL.Image.Image) – The image to render.

│ │ │
│ │ │
Returns:
│ │ │

Yields a single tuple of an image and the bounding box for that image

│ │ │
│ │ │
Return type:
│ │ │ -

Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]]

│ │ │ +

Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -31,27 +31,27 @@ │ │ │ │ * luma.core.framebuffer │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ff_rr_aa_mm_ee_bb_uu_ff_ff_ee_rr_? ************ │ │ │ │ Different implementation strategies for framebuffering │ │ │ │ ccllaassss luma.core.framebuffer.diff_to_previous(nnuumm__sseeggmmeennttss==44, ddeebbuugg==FFaallssee) │ │ │ │ _[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Compare the current frame to the previous frame and tries to calculate │ │ │ │ the differences: this will either yield nothing for a perfect match or │ │ │ │ else the iterator will yield one or more tuples comprising of the image │ │ │ │ part that changed along with the bounding box that describes the areas │ │ │ │ that are different, up to the size of the entire image. │ │ │ │ The image data for the difference is then be passed to a device for │ │ │ │ rendering just those small changes. This can be very quick for small │ │ │ │ screen updates, but suffers from variable render times, depending on the │ │ │ │ changes applied. The _l_u_m_a_._c_o_r_e_._s_p_r_i_t_e___s_y_s_t_e_m_._f_r_a_m_e_r_a_t_e___r_e_g_u_l_a_t_o_r may be │ │ │ │ used to counteract this behavior however. │ │ │ │ Parameters: │ │ │ │ - * nnuumm__sseeggmmeennttss (_ii_nn_tt) – The number of segments to partition the │ │ │ │ + * nnuumm__sseeggmmeennttss (iinntt) – The number of segments to partition the │ │ │ │ image into. This generally must be a square number (1, 4, 9, │ │ │ │ 16, …) and must be able to segment the image entirely in both │ │ │ │ width and height. i.e setting to 9 will subdivide the image │ │ │ │ into a 3x3 grid when comparing to the previous image. │ │ │ │ * ddeebbuugg (bboooolleeaann) – When set, draws a red box around each │ │ │ │ changed image segment to show the area that changed. This is │ │ │ │ obviously destructive for displaying the actual image, but │ │ │ │ @@ -59,33 +59,33 @@ │ │ │ │ redraw(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Calculates the difference from the previous image, returning a │ │ │ │ sequence of image sections and bounding boxes that changed since │ │ │ │ the previous image. │ │ │ │ Note │ │ │ │ the first redraw will always render the full frame. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – The image to render. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – The image to render. │ │ │ │ Returns: │ │ │ │ Yields a sequence of images and the bounding box for each │ │ │ │ segment difference │ │ │ │ Return type: │ │ │ │ - Generator[Tuple[_P_I_L_._I_m_a_g_e_._I_m_a_g_e, Tuple[_i_n_t, _i_n_t, _i_n_t, _i_n_t]]] │ │ │ │ + Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]] │ │ │ │ ccllaassss luma.core.framebuffer.full_frame(****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Always renders the full frame every time. This is slower than │ │ │ │ _d_i_f_f___t_o___p_r_e_v_i_o_u_s as there are generally more pixels to update on every │ │ │ │ render, but it has a more consistent render time. Not all display drivers │ │ │ │ may be able to use the differencing framebuffer, so this is provided as a │ │ │ │ drop-in replacement. │ │ │ │ redraw(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Yields the full image for every redraw. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – The image to render. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – The image to render. │ │ │ │ Returns: │ │ │ │ Yields a single tuple of an image and the bounding box for │ │ │ │ that image │ │ │ │ Return type: │ │ │ │ - Generator[Tuple[_P_I_L_._I_m_a_g_e_._I_m_a_g_e, Tuple[_i_n_t, _i_n_t, _i_n_t, _i_n_t]]] │ │ │ │ + Generator[Tuple[PIL.Image.Image, Tuple[int, int, int, int]]] │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/image_composition.html │ │ │ @@ -118,105 +118,105 @@ │ │ │ Image

│ │ │
│ │ │

New in version 1.1.0.

│ │ │
│ │ │
│ │ │
│ │ │ class luma.core.image_composition.ComposableImage(image, position=(0, 0), offset=(0, 0))[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

This class encapsulates an image and its attributes │ │ │ that can be rendered onto an ImageComposition.

│ │ │
│ │ │
│ │ │ property height
│ │ │
│ │ │
Returns:
│ │ │

The actual height of the image, regardless │ │ │ its position or offset within the image composition.

│ │ │
│ │ │
Return type:
│ │ │ -

int

│ │ │ +

int

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ image(size)[source]
│ │ │
│ │ │
Parameters:
│ │ │ -

size (tuple) – The width, height of the image composition.

│ │ │ +

size (tuple) – The width, height of the image composition.

│ │ │
│ │ │
Returns:
│ │ │

An image, cropped to the boundaries specified │ │ │ by size.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ property offset
│ │ │

Getter for offset.

│ │ │
│ │ │
Returns:
│ │ │

A tuple containing the top,left position.

│ │ │
│ │ │
Return type:
│ │ │ -

tuple

│ │ │ +

tuple

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ property position
│ │ │

Getter for position

│ │ │
│ │ │
Returns:
│ │ │

A tuple containing the x,y position.

│ │ │
│ │ │
Return type:
│ │ │ -

tuple

│ │ │ +

tuple

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ property width
│ │ │
│ │ │
Returns:
│ │ │

The actual width of the image, regardless │ │ │ its position or offset within the image composition.

│ │ │
│ │ │
Return type:
│ │ │ -

int

│ │ │ +

int

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.image_composition.ImageComposition(device)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Manages a composition of ComposableImage instances that │ │ │ -can be rendered onto a single PIL.Image.Image.

│ │ │ +can be rendered onto a single PIL.Image.Image.

│ │ │
│ │ │
│ │ │ add_image(image)[source]
│ │ │

Adds an image to the composition.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – The image to add.

│ │ │ +

image (PIL.Image.Image) – The image to add.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ refresh()[source]
│ │ │ @@ -226,15 +226,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ remove_image(image)[source]
│ │ │

Removes an image from the composition.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – The image to be removed.

│ │ │ +

image (PIL.Image.Image) – The image to be removed.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -38,60 +38,60 @@ │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ii_mm_aa_gg_ee____cc_oo_mm_pp_oo_ss_ii_tt_ii_oo_nn_? ************ │ │ │ │ Composes scrollable, positionable images into another Image │ │ │ │ New in version 1.1.0. │ │ │ │ ccllaassss luma.core.image_composition.ComposableImage(iimmaaggee, ppoossiittiioonn==((00,, 00)), │ │ │ │ ooffffsseett==((00,, 00)))_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ This class encapsulates an image and its attributes that can be rendered │ │ │ │ onto an _I_m_a_g_e_C_o_m_p_o_s_i_t_i_o_n. │ │ │ │ pprrooppeerrttyy height_ │ │ │ │ Returns: │ │ │ │ The actual height of the image, regardless its position or │ │ │ │ offset within the image composition. │ │ │ │ Return type: │ │ │ │ - _i_n_t │ │ │ │ + int │ │ │ │ image(ssiizzee)_[_s_o_u_r_c_e_]_ │ │ │ │ Parameters: │ │ │ │ - ssiizzee (_tt_uu_pp_ll_ee) – The width, height of the image composition. │ │ │ │ + ssiizzee (ttuuppllee) – The width, height of the image composition. │ │ │ │ Returns: │ │ │ │ An image, cropped to the boundaries specified by size. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ pprrooppeerrttyy offset_ │ │ │ │ Getter for offset. │ │ │ │ Returns: │ │ │ │ A tuple containing the top,left position. │ │ │ │ Return type: │ │ │ │ - _t_u_p_l_e │ │ │ │ + tuple │ │ │ │ pprrooppeerrttyy position_ │ │ │ │ Getter for position │ │ │ │ Returns: │ │ │ │ A tuple containing the x,y position. │ │ │ │ Return type: │ │ │ │ - _t_u_p_l_e │ │ │ │ + tuple │ │ │ │ pprrooppeerrttyy width_ │ │ │ │ Returns: │ │ │ │ The actual width of the image, regardless its position or │ │ │ │ offset within the image composition. │ │ │ │ Return type: │ │ │ │ - _i_n_t │ │ │ │ + int │ │ │ │ ccllaassss luma.core.image_composition.ImageComposition(ddeevviiccee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Manages a composition of _C_o_m_p_o_s_a_b_l_e_I_m_a_g_e instances that can be rendered │ │ │ │ - onto a single _P_I_L_._I_m_a_g_e_._I_m_a_g_e. │ │ │ │ + onto a single PIL.Image.Image. │ │ │ │ add_image(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Adds an image to the composition. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – The image to add. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – The image to add. │ │ │ │ refresh()_[_s_o_u_r_c_e_]_ │ │ │ │ Clears the composition and renders all the images taking into │ │ │ │ account their position and offset. │ │ │ │ remove_image(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Removes an image from the composition. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – The image to be removed. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – The image to be removed. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/interface.html │ │ │ @@ -137,39 +137,39 @@ │ │ │
│ │ │

luma.core.interface.serial

│ │ │

Encapsulates sending commands and data over a serial interface, whether that │ │ │ is I²C, SPI or bit-banging GPIO.

│ │ │
│ │ │
│ │ │ class luma.core.interface.serial.bitbang(gpio=None, transfer_size=4096, reset_hold_time=0, reset_release_time=0, **kwargs)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Wraps an SPI │ │ │ (Serial Peripheral Interface) bus to provide data() and │ │ │ command() methods. This is a software implementation and is thus │ │ │ a lot slower than the default SPI interface. Don’t use this class directly │ │ │ unless there is a good reason!

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • gpio – GPIO interface (must be compatible with RPi.GPIO). │ │ │ For slaves that don’t need reset or D/C functionality, supply a │ │ │ noop implementation instead.

  • │ │ │ -
  • transfer_size (int) – Max bytes to transfer in one go. Some implementations │ │ │ +

  • transfer_size (int) – Max bytes to transfer in one go. Some implementations │ │ │ only support maximum of 64 or 128 bytes, whereas RPi/py-spidev supports │ │ │ 4096 (default).

  • │ │ │ -
  • reset_hold_time (float) – The number of seconds to hold reset active. Some devices may require │ │ │ +

  • reset_hold_time (float) – The number of seconds to hold reset active. Some devices may require │ │ │ a duration of 100ms or more to fully reset the display (default: 0)

  • │ │ │ -
  • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ +

  • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ a duration of 150ms or more after reset was triggered before the device can accept the │ │ │ initialization sequence (default: 0)

  • │ │ │ -
  • SCLK (int) – The GPIO pin to connect the SPI clock to.

  • │ │ │ -
  • SDA (int) – The GPIO pin to connect the SPI data (MOSI) line to.

  • │ │ │ -
  • CE (int) – The GPIO pin to connect the SPI chip enable (CE) line to.

  • │ │ │ -
  • DC (int) – The GPIO pin to connect data/command select (DC) to.

  • │ │ │ -
  • RST (int) – The GPIO pin to connect reset (RES / RST) to.

  • │ │ │ +
  • SCLK (int) – The GPIO pin to connect the SPI clock to.

  • │ │ │ +
  • SDA (int) – The GPIO pin to connect the SPI data (MOSI) line to.

  • │ │ │ +
  • CE (int) – The GPIO pin to connect the SPI chip enable (CE) line to.

  • │ │ │ +
  • DC (int) – The GPIO pin to connect data/command select (DC) to.

  • │ │ │ +
  • RST (int) – The GPIO pin to connect reset (RES / RST) to.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ cleanup()[source]
│ │ │

Clean up GPIO resources if managed.

│ │ │ @@ -177,27 +177,27 @@ │ │ │ │ │ │
│ │ │
│ │ │ command(*cmd)[source]
│ │ │

Sends a command or sequence of commands through to the SPI device.

│ │ │
│ │ │
Parameters:
│ │ │ -

cmd (int) – A spread of commands.

│ │ │ +

cmd (int) – A spread of commands.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)[source]
│ │ │

Sends a data byte or sequence of data bytes through to the SPI device. │ │ │ If the data is more than transfer_size bytes, it is sent in chunks.

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list, bytearray) – A data sequence.

│ │ │ +

data (list, bytearray) – A data sequence.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ @@ -208,15 +208,15 @@ │ │ │ command() methods.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • device (string) – A URI describing the location of the FTDI device. If None is │ │ │ supplied (default), ftdi://::/1 is used. See pyftdi │ │ │ for further details of the naming scheme used.

  • │ │ │ -
  • address (int) – I²C address, default: 0x3C.

  • │ │ │ +
  • address (int) – I²C address, default: 0x3C.

  • │ │ │
│ │ │
│ │ │
Raises:
│ │ │

luma.core.error.DeviceAddressError – I2C device address is invalid.

│ │ │
│ │ │
│ │ │
│ │ │ @@ -233,21 +233,21 @@ │ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • device (string) –

    A URI describing the location of the FTDI device. If None is │ │ │ supplied (default), ftdi://::/1 is used. See pyftdi │ │ │ for further details of the naming scheme used.

    │ │ │

  • │ │ │ -
  • bus_speed_hz (int) – SPI bus speed, defaults to 12MHz.

  • │ │ │ -
  • gpio_CS (int) – The ADx pin to connect chip select (CS) to (defaults to 3).

  • │ │ │ -
  • gpio_DC (int) – The ADx pin to connect data/command select (DC) to (defaults to 5).

  • │ │ │ +
  • bus_speed_hz (int) – SPI bus speed, defaults to 12MHz.

  • │ │ │ +
  • gpio_CS (int) – The ADx pin to connect chip select (CS) to (defaults to 3).

  • │ │ │ +
  • gpio_DC (int) – The ADx pin to connect data/command select (DC) to (defaults to 5).

  • │ │ │
  • gpio_RST (int │ │ │ :param reset_hold_time: The number of seconds to hold reset active. Some devices may require │ │ │ a duration of 100ms or more to fully reset the display (default: 0)) – The ADx pin to connect reset (RES / RST) to (defaults to 6).

  • │ │ │ -
  • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ +

  • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ a duration of 150ms or more after reset was triggered before the device can accept the │ │ │ initialization sequence (default: 0)

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.9.0.

│ │ │ @@ -258,38 +258,38 @@ │ │ │
│ │ │ class luma.core.interface.serial.gpio_cs_spi(*args, **kwargs)[source]
│ │ │

Bases: spi

│ │ │

Allows the Chip Select to be used with any GPIO pin.

│ │ │

The gpio pin to use is defined during instantiation with the keyword argument gpio_CS.

│ │ │
│ │ │
Parameters:
│ │ │ -

gpio_CS (int) – The GPIO pin to connect chip select (CS / CE) to (defaults to None).

│ │ │ +

gpio_CS (int) – The GPIO pin to connect chip select (CS / CE) to (defaults to None).

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ cleanup()[source]
│ │ │

Close pin if it was set up.

│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.interface.serial.i2c(bus=None, port=1, address=60)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Wrap an I²C (Inter-Integrated │ │ │ Circuit) interface to provide data() and command() methods.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • bus – A smbus implementation, if None is supplied (default), │ │ │ smbus2 is used

  • │ │ │ -
  • port (int) – I²C port number, usually 0 or 1 (default).

  • │ │ │ -
  • address (int) – I²C address, default: 0x3C.

  • │ │ │ +
  • port (int) – I²C port number, usually 0 or 1 (default).

  • │ │ │ +
  • address (int) – I²C address, default: 0x3C.

  • │ │ │
│ │ │
│ │ │
Raises:
│ │ │
    │ │ │
  • luma.core.error.DeviceAddressError – I2C device address is invalid.

  • │ │ │
  • luma.core.error.DeviceNotFoundError – I2C device could not be found.

  • │ │ │
  • luma.core.error.DevicePermissionError – Permission to access I2C device │ │ │ @@ -315,15 +315,15 @@ │ │ │

    │ │ │
    │ │ │ command(*cmd)[source]
    │ │ │

    Sends a command or sequence of commands through to the I²C address │ │ │ - maximum allowed is 32 bytes in one go.

    │ │ │
    │ │ │
    Parameters:
    │ │ │ -

    cmd (int) – A spread of commands.

    │ │ │ +

    cmd (int) – A spread of commands.

    │ │ │
    │ │ │
    Raises:
    │ │ │

    luma.core.error.DeviceNotFoundError – I2C device could not be found.

    │ │ │
    │ │ │
    │ │ │
    │ │ │ │ │ │ @@ -333,25 +333,25 @@ │ │ │

    Sends a data byte or sequence of data bytes to the I²C address. │ │ │ If the bus is in managed mode backed by smbus2, the i2c_rdwr │ │ │ method will be used to avoid having to send in chunks. │ │ │ For SMBus devices the maximum allowed in one transaction is │ │ │ 32 bytes, so if data is larger than this, it is sent in chunks.

    │ │ │
    │ │ │
    Parameters:
    │ │ │ -

    data (list, bytearray) – A data sequence.

    │ │ │ +

    data (list, bytearray) – A data sequence.

    │ │ │
    │ │ │
    │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.interface.serial.noop[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Does nothing, used for pseudo-devices / emulators / anything really.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.interface.serial.pcf8574(pulse_time=4.9999999999999996e-05, backlight_enabled=True, *args, **kwargs)[source]
│ │ │

Bases: i2c

│ │ │ @@ -359,25 +359,25 @@ │ │ │ for a device using a pcf8574 backpack.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • bus

    A smbus implementation, if None is supplied (default), │ │ │ smbus2 is used.

    │ │ │

  • │ │ │ -
  • port (int) – I²C port number, usually 0 or 1 (default).

  • │ │ │ -
  • address (int) – I²C address, default: 0x3C.

  • │ │ │ -
  • pulse_time (float) – length of time in seconds that the enable line should be │ │ │ +

  • port (int) – I²C port number, usually 0 or 1 (default).

  • │ │ │ +
  • address (int) – I²C address, default: 0x3C.

  • │ │ │ +
  • pulse_time (float) – length of time in seconds that the enable line should be │ │ │ held high during a data or command transfer (default: 50μs)

  • │ │ │ -
  • backlight_enabled (bool) – Determines whether to activate the display’s backlight

  • │ │ │ -
  • RS (int) – where register/select is connected to the backpack (default: 0)

  • │ │ │ -
  • E (int) – where enable pin is connected to the backpack (default: 2)

  • │ │ │ -
  • PINS (list[int]) – The PCF8574 pins that form the data bus in LSD to MSD order

  • │ │ │ -
  • BACKLIGHT (int) – Pin number of the pcf8574 (counting from zero) that the │ │ │ +

  • backlight_enabled (bool) – Determines whether to activate the display’s backlight

  • │ │ │ +
  • RS (int) – where register/select is connected to the backpack (default: 0)

  • │ │ │ +
  • E (int) – where enable pin is connected to the backpack (default: 2)

  • │ │ │ +
  • PINS (list[int]) – The PCF8574 pins that form the data bus in LSD to MSD order

  • │ │ │ +
  • BACKLIGHT (int) – Pin number of the pcf8574 (counting from zero) that the │ │ │ backlight is controlled from (default: 3)

  • │ │ │ -
  • COMMAND (str) – determines whether RS high sets device to expect a command │ │ │ +

  • COMMAND (str) – determines whether RS high sets device to expect a command │ │ │ byte or a data byte. Must be either high (default) or low

  • │ │ │
│ │ │
│ │ │
Raises:
│ │ │
    │ │ │
  • luma.core.error.DeviceAddressError – I2C device address is invalid.

  • │ │ │
  • luma.core.error.DeviceNotFoundError – I2C device could not be found.

  • │ │ │ @@ -466,15 +466,15 @@ │ │ │
    │ │ │
    │ │ │ command(*cmd)[source]
    │ │ │

    Sends a command or sequence of commands through to the I²C address │ │ │ - maximum allowed is 32 bytes in one go.

    │ │ │
    │ │ │
    Parameters:
    │ │ │ -

    cmd (int) – A spread of commands in high_bits, low_bits order.

    │ │ │ +

    cmd (int) – A spread of commands in high_bits, low_bits order.

    │ │ │
    │ │ │
    Raises:
    │ │ │

    luma.core.error.DeviceNotFoundError – I2C device could not be found.

    │ │ │
    │ │ │
    │ │ │

    IMPORTANT: the PCF8574 only supports four bit transfers. It is the │ │ │ devices responsibility to break each byte sent into a high bit │ │ │ @@ -494,15 +494,15 @@ │ │ │ │ │ │

    │ │ │
    │ │ │ data(data)[source]
    │ │ │

    Sends a data byte or sequence of data bytes to the I²C address.

    │ │ │
    │ │ │
    Parameters:
    │ │ │ -

    data (list, bytearray) – A data sequence.

    │ │ │ +

    data (list, bytearray) – A data sequence.

    │ │ │
    │ │ │
    │ │ │

    IMPORTANT: the PCF8574 only supports four bit transfers. It is the │ │ │ devices responsibility to break each byte sent into a high bit │ │ │ and a low bit transfer.

    │ │ │
    │ │ │
    Example:

    To send an ascii ‘A’ (0x41) to the display you need to send binary │ │ │ @@ -529,26 +529,26 @@ │ │ │

    │ │ │
    Parameters:
    │ │ │
      │ │ │
    • spi – SPI implementation (must be compatible with spidev)

    • │ │ │
    • gpio – GPIO interface (must be compatible with RPi.GPIO). │ │ │ For slaves that don’t need reset or D/C functionality, supply a │ │ │ noop implementation instead.

    • │ │ │ -
    • port (int) – SPI port, usually 0 (default) or 1.

    • │ │ │ -
    • device (int) – SPI device, usually 0 (default) or 1.

    • │ │ │ -
    • bus_speed_hz (int) – SPI bus speed, defaults to 8MHz.

    • │ │ │ -
    • transfer_size (int) – Maximum amount of bytes to transfer in one go. Some implementations │ │ │ +

    • port (int) – SPI port, usually 0 (default) or 1.

    • │ │ │ +
    • device (int) – SPI device, usually 0 (default) or 1.

    • │ │ │ +
    • bus_speed_hz (int) – SPI bus speed, defaults to 8MHz.

    • │ │ │ +
    • transfer_size (int) – Maximum amount of bytes to transfer in one go. Some implementations │ │ │ only support a maximum of 64 or 128 bytes, whereas RPi/py-spidev supports │ │ │ 4096 (default).

    • │ │ │ -
    • gpio_DC (int) – The GPIO pin to connect data/command select (DC) to (defaults to 24).

    • │ │ │ -
    • gpio_RST (int) – The GPIO pin to connect reset (RES / RST) to (defaults to 25).

    • │ │ │ -
    • spi_mode (int) – SPI mode as two bit pattern of clock polarity and phase [CPOL|CPHA], 0-3 (default:None)

    • │ │ │ -
    • reset_hold_time (float) – The number of seconds to hold reset active. Some devices may require │ │ │ +

    • gpio_DC (int) – The GPIO pin to connect data/command select (DC) to (defaults to 24).

    • │ │ │ +
    • gpio_RST (int) – The GPIO pin to connect reset (RES / RST) to (defaults to 25).

    • │ │ │ +
    • spi_mode (int) – SPI mode as two bit pattern of clock polarity and phase [CPOL|CPHA], 0-3 (default:None)

    • │ │ │ +
    • reset_hold_time (float) – The number of seconds to hold reset active. Some devices may require │ │ │ a duration of 100ms or more to fully reset the display (default: 0)

    • │ │ │ -
    • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ +

    • reset_release_time (float) – The number of seconds to delay afer reset. Some devices may require │ │ │ a duration of 150ms or more after reset was triggered before the device can accept the │ │ │ initialization sequence (default: 0)

    • │ │ │
    │ │ │
    │ │ │
    Raises:
    │ │ │
│ │ │
│ │ │

luma.core.interface.parallel

│ │ │

Encapsulates sending commands and data over a parallel-bus interface.

│ │ │
│ │ │
│ │ │ class luma.core.interface.parallel.bitbang_6800(gpio=None, pulse_time=4.9999999999999996e-05, **kwargs)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Implements a 6800 style parallel-bus interface that provides data() │ │ │ and command() methods. The default pin assignments provided are │ │ │ from Adafruit.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • gpio – GPIO interface (must be compatible with │ │ │ RPi.GPIO)

  • │ │ │ -
  • pulse_time (float) – length of time in seconds that the enable line should be │ │ │ +

  • pulse_time (float) – length of time in seconds that the enable line should be │ │ │ held high during a data or command transfer

  • │ │ │ -
  • RS (int) – The GPIO pin register select (RS) line (low for command, high │ │ │ +

  • RS (int) – The GPIO pin register select (RS) line (low for command, high │ │ │ for data). Default: 22

  • │ │ │ -
  • E (int) – The GPIO pin to connect the enable (E) line to. Default: 17

  • │ │ │ -
  • PINS (list[int]) – The GPIO pins that form the data bus (a list of 4 or 8 pins │ │ │ +

  • E (int) – The GPIO pin to connect the enable (E) line to. Default: 17

  • │ │ │ +
  • PINS (list[int]) – The GPIO pins that form the data bus (a list of 4 or 8 pins │ │ │ depending upon implementation ordered from LSD to MSD). Default: [25, 24, 23, 18]

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.16.2.

│ │ │
│ │ │ @@ -606,15 +606,15 @@ │ │ │

If the bus is in 4-bit mode, only the lowest 4 bits of the data │ │ │ value will be sent.

│ │ │

This means that the device needs to send high and low bits separately │ │ │ if the device is operating using a 4-bit bus; to send a 0x32 in │ │ │ 4-bit mode the device would use: command(0x03, 0x02)

│ │ │
│ │ │
Parameters:
│ │ │ -

cmd (int) – A spread of commands.

│ │ │ +

cmd (int) – A spread of commands.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ data(data)[source]
│ │ │ @@ -622,15 +622,15 @@ │ │ │

If the bus is in 4-bit mode, only the lowest 4 bits of the data │ │ │ value will be sent.

│ │ │

This means that the device needs to send high and low bits separately │ │ │ if the device is operating using a 4-bit bus; to send a 0x32 in │ │ │ 4-bit mode the device would use: data([0x03, 0x02])

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list, bytearray) – A data sequence.

│ │ │ +

data (list, bytearray) – A data sequence.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -50,62 +50,62 @@ │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ii_nn_tt_ee_rr_ff_aa_cc_ee_.._ss_ee_rr_ii_aa_ll_? ************ │ │ │ │ Encapsulates sending commands and data over a serial interface, whether that is │ │ │ │ I²C, SPI or bit-banging GPIO. │ │ │ │ ccllaassss luma.core.interface.serial.bitbang(ggppiioo==NNoonnee, ttrraannssffeerr__ssiizzee==44009966, │ │ │ │ rreesseett__hhoolldd__ttiimmee==00, rreesseett__rreelleeaassee__ttiimmee==00, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Wraps an _S_P_I (Serial Peripheral Interface) bus to provide _d_a_t_a_(_) and │ │ │ │ _c_o_m_m_a_n_d_(_) methods. This is a software implementation and is thus a lot │ │ │ │ slower than the default SPI interface. Don’t use this class directly │ │ │ │ unless there is a good reason! │ │ │ │ Parameters: │ │ │ │ * ggppiioo – GPIO interface (must be compatible with _R_P_i_._G_P_I_O). For │ │ │ │ slaves that don’t need reset or D/C functionality, supply a │ │ │ │ _n_o_o_p implementation instead. │ │ │ │ - * ttrraannssffeerr__ssiizzee (_ii_nn_tt) – Max bytes to transfer in one go. Some │ │ │ │ + * ttrraannssffeerr__ssiizzee (iinntt) – Max bytes to transfer in one go. Some │ │ │ │ implementations only support maximum of 64 or 128 bytes, │ │ │ │ whereas RPi/py-spidev supports 4096 (default). │ │ │ │ - * rreesseett__hhoolldd__ttiimmee (_ff_ll_oo_aa_tt) – The number of seconds to hold reset │ │ │ │ + * rreesseett__hhoolldd__ttiimmee (ffllooaatt) – The number of seconds to hold reset │ │ │ │ active. Some devices may require a duration of 100ms or more │ │ │ │ to fully reset the display (default: 0) │ │ │ │ - * rreesseett__rreelleeaassee__ttiimmee (_ff_ll_oo_aa_tt) – The number of seconds to delay │ │ │ │ + * rreesseett__rreelleeaassee__ttiimmee (ffllooaatt) – The number of seconds to delay │ │ │ │ afer reset. Some devices may require a duration of 150ms or │ │ │ │ more after reset was triggered before the device can accept │ │ │ │ the initialization sequence (default: 0) │ │ │ │ - * SSCCLLKK (_ii_nn_tt) – The GPIO pin to connect the SPI clock to. │ │ │ │ - * SSDDAA (_ii_nn_tt) – The GPIO pin to connect the SPI data (MOSI) line │ │ │ │ + * SSCCLLKK (iinntt) – The GPIO pin to connect the SPI clock to. │ │ │ │ + * SSDDAA (iinntt) – The GPIO pin to connect the SPI data (MOSI) line │ │ │ │ to. │ │ │ │ - * CCEE (_ii_nn_tt) – The GPIO pin to connect the SPI chip enable (CE) │ │ │ │ + * CCEE (iinntt) – The GPIO pin to connect the SPI chip enable (CE) │ │ │ │ line to. │ │ │ │ - * DDCC (_ii_nn_tt) – The GPIO pin to connect data/command select (DC) │ │ │ │ + * DDCC (iinntt) – The GPIO pin to connect data/command select (DC) │ │ │ │ to. │ │ │ │ - * RRSSTT (_ii_nn_tt) – The GPIO pin to connect reset (RES / RST) to. │ │ │ │ + * RRSSTT (iinntt) – The GPIO pin to connect reset (RES / RST) to. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Clean up GPIO resources if managed. │ │ │ │ command(**ccmmdd)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a command or sequence of commands through to the SPI device. │ │ │ │ Parameters: │ │ │ │ - ccmmdd (_ii_nn_tt) – A spread of commands. │ │ │ │ + ccmmdd (iinntt) – A spread of commands. │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a data byte or sequence of data bytes through to the SPI │ │ │ │ device. If the data is more than transfer_size bytes, it is sent in │ │ │ │ chunks. │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt,, _bb_yy_tt_ee_aa_rr_rr_aa_yy) – A data sequence. │ │ │ │ + ddaattaa (lliisstt,, bbyytteeaarrrraayy) – A data sequence. │ │ │ │ luma.core.interface.serial.ftdi_i2c(ddeevviiccee==''ffttddii::////:::://11'', aaddddrreessss==6600) │ │ │ │ _[_s_o_u_r_c_e_]_ │ │ │ │ Bridges an _I_²_C (Inter-Integrated Circuit) interface over an FTDI USB │ │ │ │ device to provide data() and command() methods. │ │ │ │ Parameters: │ │ │ │ * ddeevviiccee (ssttrriinngg) – A URI describing the location of the FTDI │ │ │ │ device. If None is supplied (default), ftdi://::/1 is used. │ │ │ │ See _p_y_f_t_d_i for further details of the naming scheme used. │ │ │ │ - * aaddddrreessss (_ii_nn_tt) – I²C address, default: 0x3C. │ │ │ │ + * aaddddrreessss (iinntt) – I²C address, default: 0x3C. │ │ │ │ Raises: │ │ │ │ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_AA_dd_dd_rr_ee_ss_ss_EE_rr_rr_oo_rr – I2C device address is invalid. │ │ │ │ New in version 1.9.0. │ │ │ │ luma.core.interface.serial.ftdi_spi(ddeevviiccee==''ffttddii::////:::://11'', │ │ │ │ bbuuss__ssppeeeedd__hhzz==1122000000000000, ggppiioo__CCSS==33, ggppiioo__DDCC==55, ggppiioo__RRSSTT==66, rreesseett__hhoolldd__ttiimmee==00, │ │ │ │ rreesseett__rreelleeaassee__ttiimmee==00)_[_s_o_u_r_c_e_]_ │ │ │ │ Bridges an _S_P_I (Serial Peripheral Interface) bus over an FTDI USB device │ │ │ │ @@ -113,27 +113,27 @@ │ │ │ │ New in version 1.9.0. │ │ │ │ ccllaassss luma.core.interface.serial.gpio_cs_spi(**aarrggss, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _s_p_i │ │ │ │ Allows the Chip Select to be used with any GPIO pin. │ │ │ │ The gpio pin to use is defined during instantiation with the keyword │ │ │ │ argumentgpio_CS. │ │ │ │ Parameters: │ │ │ │ - ggppiioo__CCSS (_ii_nn_tt) – The GPIO pin to connect chip select (CS / CE) to │ │ │ │ + ggppiioo__CCSS (iinntt) – The GPIO pin to connect chip select (CS / CE) to │ │ │ │ (defaults to None). │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Close pin if it was set up. │ │ │ │ ccllaassss luma.core.interface.serial.i2c(bbuuss==NNoonnee, ppoorrtt==11, aaddddrreessss==6600)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Wrap an _I_²_C (Inter-Integrated Circuit) interface to provide _d_a_t_a_(_) and │ │ │ │ _c_o_m_m_a_n_d_(_) methods. │ │ │ │ Parameters: │ │ │ │ * bbuuss – A ssmmbbuuss implementation, if None is supplied (default), │ │ │ │ _s_m_b_u_s_2 is used │ │ │ │ - * ppoorrtt (_ii_nn_tt) – I²C port number, usually 0 or 1 (default). │ │ │ │ - * aaddddrreessss (_ii_nn_tt) – I²C address, default: 0x3C. │ │ │ │ + * ppoorrtt (iinntt) – I²C port number, usually 0 or 1 (default). │ │ │ │ + * aaddddrreessss (iinntt) – I²C address, default: 0x3C. │ │ │ │ Raises: │ │ │ │ * _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_AA_dd_dd_rr_ee_ss_ss_EE_rr_rr_oo_rr – I2C device address is │ │ │ │ invalid. │ │ │ │ * _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_NN_oo_tt_FF_oo_uu_nn_dd_EE_rr_rr_oo_rr – I2C device could not be │ │ │ │ found. │ │ │ │ * _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_PP_ee_rr_mm_ii_ss_ss_ii_oo_nn_EE_rr_rr_oo_rr – Permission to access │ │ │ │ I2C device denied. │ │ │ │ @@ -144,28 +144,28 @@ │ │ │ │ already been opened. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Clean up I²C resources │ │ │ │ command(**ccmmdd)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a command or sequence of commands through to the I²C address │ │ │ │ - maximum allowed is 32 bytes in one go. │ │ │ │ Parameters: │ │ │ │ - ccmmdd (_ii_nn_tt) – A spread of commands. │ │ │ │ + ccmmdd (iinntt) – A spread of commands. │ │ │ │ Raises: │ │ │ │ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_NN_oo_tt_FF_oo_uu_nn_dd_EE_rr_rr_oo_rr – I2C device could not be │ │ │ │ found. │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a data byte or sequence of data bytes to the I²C address. If │ │ │ │ the bus is in managed mode backed by smbus2, the i2c_rdwr method │ │ │ │ will be used to avoid having to send in chunks. For SMBus devices │ │ │ │ the maximum allowed in one transaction is 32 bytes, so if data is │ │ │ │ larger than this, it is sent in chunks. │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt,, _bb_yy_tt_ee_aa_rr_rr_aa_yy) – A data sequence. │ │ │ │ + ddaattaa (lliisstt,, bbyytteeaarrrraayy) – A data sequence. │ │ │ │ ccllaassss luma.core.interface.serial.noop_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Does nothing, used for pseudo-devices / emulators / anything really. │ │ │ │ ccllaassss luma.core.interface.serial.pcf8574(ppuullssee__ttiimmee==44..99999999999999999999999999999966ee--0055, │ │ │ │ bbaacckklliigghhtt__eennaabblleedd==TTrruuee, **aarrggss, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _i_2_c │ │ │ │ I²C interface to provide _d_a_t_a_(_) and _c_o_m_m_a_n_d_(_) methods for a device using │ │ │ │ a pcf8574 backpack. │ │ │ │ Raises: │ │ │ │ @@ -212,15 +212,15 @@ │ │ │ │ connects it to pin P7 of the backpack. COMMAND is set to low so that RS │ │ │ │ will be set to low when a command is sent and high when data is sent. │ │ │ │ New in version 1.15.0. │ │ │ │ command(**ccmmdd)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a command or sequence of commands through to the I²C address │ │ │ │ - maximum allowed is 32 bytes in one go. │ │ │ │ Parameters: │ │ │ │ - ccmmdd (_ii_nn_tt) – A spread of commands in high_bits, low_bits │ │ │ │ + ccmmdd (iinntt) – A spread of commands in high_bits, low_bits │ │ │ │ order. │ │ │ │ Raises: │ │ │ │ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_NN_oo_tt_FF_oo_uu_nn_dd_EE_rr_rr_oo_rr – I2C device could not be │ │ │ │ found. │ │ │ │ IMPORTANT: the PCF8574 only supports four bit transfers. It is the │ │ │ │ devices responsibility to break each byte sent into a high bit and │ │ │ │ a low bit transfer. │ │ │ │ @@ -231,15 +231,15 @@ │ │ │ │ of the byte. │ │ │ │ For example, to send this using the pcf8574 interface: │ │ │ │ d = pcf8574(bus=1, address=0x27) │ │ │ │ d.command([0x08, 0x00]) │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a data byte or sequence of data bytes to the I²C address. │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt,, _bb_yy_tt_ee_aa_rr_rr_aa_yy) – A data sequence. │ │ │ │ + ddaattaa (lliisstt,, bbyytteeaarrrraayy) – A data sequence. │ │ │ │ IMPORTANT: the PCF8574 only supports four bit transfers. It is the │ │ │ │ devices responsibility to break each byte sent into a high bit and │ │ │ │ a low bit transfer. │ │ │ │ Example: │ │ │ │ To send an ascii ‘A’ (0x41) to the display you need to send │ │ │ │ binary 01000001. This is 0100 (0x40) at the high side of the │ │ │ │ byte and 0001 (0x01) on the low side of the byte. │ │ │ │ @@ -253,78 +253,78 @@ │ │ │ │ Wraps an _S_P_I (Serial Peripheral Interface) bus to provide data() and │ │ │ │ command() methods. │ │ │ │ Parameters: │ │ │ │ * ssppii – SPI implementation (must be compatible with _s_p_i_d_e_v) │ │ │ │ * ggppiioo – GPIO interface (must be compatible with _R_P_i_._G_P_I_O). For │ │ │ │ slaves that don’t need reset or D/C functionality, supply a │ │ │ │ _n_o_o_p implementation instead. │ │ │ │ - * ppoorrtt (_ii_nn_tt) – SPI port, usually 0 (default) or 1. │ │ │ │ - * ddeevviiccee (_ii_nn_tt) – SPI device, usually 0 (default) or 1. │ │ │ │ - * bbuuss__ssppeeeedd__hhzz (_ii_nn_tt) – SPI bus speed, defaults to 8MHz. │ │ │ │ - * ttrraannssffeerr__ssiizzee (_ii_nn_tt) – Maximum amount of bytes to transfer in │ │ │ │ + * ppoorrtt (iinntt) – SPI port, usually 0 (default) or 1. │ │ │ │ + * ddeevviiccee (iinntt) – SPI device, usually 0 (default) or 1. │ │ │ │ + * bbuuss__ssppeeeedd__hhzz (iinntt) – SPI bus speed, defaults to 8MHz. │ │ │ │ + * ttrraannssffeerr__ssiizzee (iinntt) – Maximum amount of bytes to transfer in │ │ │ │ one go. Some implementations only support a maximum of 64 or │ │ │ │ 128 bytes, whereas RPi/py-spidev supports 4096 (default). │ │ │ │ - * ggppiioo__DDCC (_ii_nn_tt) – The GPIO pin to connect data/command select │ │ │ │ + * ggppiioo__DDCC (iinntt) – The GPIO pin to connect data/command select │ │ │ │ (DC) to (defaults to 24). │ │ │ │ - * ggppiioo__RRSSTT (_ii_nn_tt) – The GPIO pin to connect reset (RES / RST) to │ │ │ │ + * ggppiioo__RRSSTT (iinntt) – The GPIO pin to connect reset (RES / RST) to │ │ │ │ (defaults to 25). │ │ │ │ - * ssppii__mmooddee (_ii_nn_tt) – SPI mode as two bit pattern of clock │ │ │ │ + * ssppii__mmooddee (iinntt) – SPI mode as two bit pattern of clock │ │ │ │ polarity and phase [CPOL|CPHA], 0-3 (default:None) │ │ │ │ - * rreesseett__hhoolldd__ttiimmee (_ff_ll_oo_aa_tt) – The number of seconds to hold reset │ │ │ │ + * rreesseett__hhoolldd__ttiimmee (ffllooaatt) – The number of seconds to hold reset │ │ │ │ active. Some devices may require a duration of 100ms or more │ │ │ │ to fully reset the display (default: 0) │ │ │ │ - * rreesseett__rreelleeaassee__ttiimmee (_ff_ll_oo_aa_tt) – The number of seconds to delay │ │ │ │ + * rreesseett__rreelleeaassee__ttiimmee (ffllooaatt) – The number of seconds to delay │ │ │ │ afer reset. Some devices may require a duration of 150ms or │ │ │ │ more after reset was triggered before the device can accept │ │ │ │ the initialization sequence (default: 0) │ │ │ │ Raises: │ │ │ │ * _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._DD_ee_vv_ii_cc_ee_NN_oo_tt_FF_oo_uu_nn_dd_EE_rr_rr_oo_rr – SPI device could not be │ │ │ │ found. │ │ │ │ * _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ee_rr_rr_oo_rr_.._UU_nn_ss_uu_pp_pp_oo_rr_tt_ee_dd_PP_ll_aa_tt_ff_oo_rr_mm – GPIO access not │ │ │ │ available. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Clean up SPI & GPIO resources. │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ii_nn_tt_ee_rr_ff_aa_cc_ee_.._pp_aa_rr_aa_ll_ll_ee_ll_? ************ │ │ │ │ Encapsulates sending commands and data over a parallel-bus interface. │ │ │ │ ccllaassss luma.core.interface.parallel.bitbang_6800(ggppiioo==NNoonnee, │ │ │ │ ppuullssee__ttiimmee==44..99999999999999999999999999999966ee--0055, ****kkwwaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Implements a 6800 style parallel-bus interface that provides _d_a_t_a_(_) and │ │ │ │ _c_o_m_m_a_n_d_(_) methods. The default pin assignments provided are from │ │ │ │ _A_d_a_f_r_u_i_t. │ │ │ │ Parameters: │ │ │ │ * ggppiioo – GPIO interface (must be compatible with _R_P_i_._G_P_I_O) │ │ │ │ - * ppuullssee__ttiimmee (_ff_ll_oo_aa_tt) – length of time in seconds that the │ │ │ │ + * ppuullssee__ttiimmee (ffllooaatt) – length of time in seconds that the │ │ │ │ enable line should be held high during a data or command │ │ │ │ transfer │ │ │ │ - * RRSS (_ii_nn_tt) – The GPIO pin register select (RS) line (low for │ │ │ │ + * RRSS (iinntt) – The GPIO pin register select (RS) line (low for │ │ │ │ command, high for data). Default: 22 │ │ │ │ - * EE (_ii_nn_tt) – The GPIO pin to connect the enable (E) line to. │ │ │ │ + * EE (iinntt) – The GPIO pin to connect the enable (E) line to. │ │ │ │ Default: 17 │ │ │ │ - * PPIINNSS (_ll_ii_ss_tt[[_ii_nn_tt]]) – The GPIO pins that form the data bus (a │ │ │ │ + * PPIINNSS (lliisstt[[iinntt]]) – The GPIO pins that form the data bus (a │ │ │ │ list of 4 or 8 pins depending upon implementation ordered │ │ │ │ from LSD to MSD). Default: [25, 24, 23, 18] │ │ │ │ New in version 1.16.2. │ │ │ │ cleanup()_[_s_o_u_r_c_e_]_ │ │ │ │ Clean up GPIO resources. │ │ │ │ command(**ccmmdd)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a command or sequence of commands through the bus. │ │ │ │ If the bus is in 4-bit mode, only the lowest 4 bits of the data │ │ │ │ value will be sent. │ │ │ │ This means that the device needs to send high and low bits │ │ │ │ separately if the device is operating using a 4-bit bus; to send a │ │ │ │ 0x32 in 4-bit mode the device would use: command(0x03, 0x02) │ │ │ │ Parameters: │ │ │ │ - ccmmdd (_ii_nn_tt) – A spread of commands. │ │ │ │ + ccmmdd (iinntt) – A spread of commands. │ │ │ │ data(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Sends a data byte or sequence of data bytes through to the bus. │ │ │ │ If the bus is in 4-bit mode, only the lowest 4 bits of the data │ │ │ │ value will be sent. │ │ │ │ This means that the device needs to send high and low bits │ │ │ │ separately if the device is operating using a 4-bit bus; to send a │ │ │ │ 0x32 in 4-bit mode the device would use: data([0x03, 0x02]) │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt,, _bb_yy_tt_ee_aa_rr_rr_aa_yy) – A data sequence. │ │ │ │ + ddaattaa (lliisstt,, bbyytteeaarrrraayy) – A data sequence. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/legacy.html │ │ │ @@ -117,36 +117,36 @@ │ │ │
│ │ │ luma.core.legacy.show_message(device, msg, y_offset=0, fill=None, font=None, scroll_delay=0.03)[source]
│ │ │

Scrolls a message right-to-left across the devices display.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • device – The device to scroll across.

  • │ │ │ -
  • msg (str) – The text message to display (must be ASCII only).

  • │ │ │ -
  • y_offset (int) – The row to use to display the text.

  • │ │ │ +
  • msg (str) – The text message to display (must be ASCII only).

  • │ │ │ +
  • y_offset (int) – The row to use to display the text.

  • │ │ │
  • fill – The fill color to use (standard Pillow color name or RGB │ │ │ tuple).

  • │ │ │
  • font – The font (from luma.core.legacy.font) to use.

  • │ │ │ -
  • scroll_delay (float) – The number of seconds to delay between scrolling.

  • │ │ │ +
  • scroll_delay (float) – The number of seconds to delay between scrolling.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.legacy.text(draw, xy, txt, fill=None, font=None)[source]
│ │ │

Draw a legacy font starting at x, y using the │ │ │ prescribed fill and font.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • draw (PIL.ImageDraw) – A valid canvas to draw the text onto.

  • │ │ │ -
  • txt (str) – The text string to display (must be ASCII only).

  • │ │ │ -
  • xy (tuple) – An (x, y) tuple denoting the top-left corner to draw the │ │ │ +

  • txt (str) – The text string to display (must be ASCII only).

  • │ │ │ +
  • xy (tuple) – An (x, y) tuple denoting the top-left corner to draw the │ │ │ text.

  • │ │ │
  • fill – The fill color to use (standard Pillow color name or RGB │ │ │ tuple).

  • │ │ │
  • font – The font (from luma.core.legacy.font) to use.

  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -157,15 +157,15 @@ │ │ │ luma.core.legacy.textsize(txt, font=None)[source] │ │ │

Calculates the bounding box of the text, as drawn in the specified font. │ │ │ This method is most useful for when the │ │ │ proportional wrapper is used.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • txt (str) – The text string to calculate the bounds for

  • │ │ │ +
  • txt (str) – The text string to calculate the bounds for

  • │ │ │
  • font – The font (from luma.core.legacy.font) to use.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ @@ -241,25 +241,25 @@ │ │ │ Source: https://www.kreativekorp.com/software/fonts/index.shtml, │ │ │ transposed by Tiago F. Pimentel (antropoiese).

│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class luma.core.legacy.font.proportional(font)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Wraps an existing font array, and on on indexing, trims any leading │ │ │ or trailing zero column definitions. This works especially well │ │ │ with scrolling messages, as interspace columns are squeezed to a │ │ │ single pixel.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.legacy.font.tolerant(font, missing='_')[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Wraps an existing font array, and on indexing, if the supplied │ │ │ ascii_code does not exist, will return the column definitions │ │ │ for the given missing parameter.

│ │ │
│ │ │
│ │ │
│ │ │

New in version 0.9.4.

│ │ │ ├── html2text {} │ │ │ │ @@ -40,36 +40,36 @@ │ │ │ │ denoted ‘legacy’ to discourage use - you are encouraged to use the various │ │ │ │ drawing capabilities in the Pillow library instead. │ │ │ │ luma.core.legacy.show_message(ddeevviiccee, mmssgg, yy__ooffffsseett==00, ffiillll==NNoonnee, ffoonntt==NNoonnee, │ │ │ │ ssccrroollll__ddeellaayy==00..0033)_[_s_o_u_r_c_e_]_ │ │ │ │ Scrolls a message right-to-left across the devices display. │ │ │ │ Parameters: │ │ │ │ * ddeevviiccee – The device to scroll across. │ │ │ │ - * mmssgg (_ss_tt_rr) – The text message to display (must be ASCII only). │ │ │ │ - * yy__ooffffsseett (_ii_nn_tt) – The row to use to display the text. │ │ │ │ + * mmssgg (ssttrr) – The text message to display (must be ASCII only). │ │ │ │ + * yy__ooffffsseett (iinntt) – The row to use to display the text. │ │ │ │ * ffiillll – The fill color to use (standard Pillow color name or │ │ │ │ RGB tuple). │ │ │ │ * ffoonntt – The font (from _l_u_m_a_._c_o_r_e_._l_e_g_a_c_y_._f_o_n_t) to use. │ │ │ │ - * ssccrroollll__ddeellaayy (_ff_ll_oo_aa_tt) – The number of seconds to delay between │ │ │ │ + * ssccrroollll__ddeellaayy (ffllooaatt) – The number of seconds to delay between │ │ │ │ scrolling. │ │ │ │ luma.core.legacy.text(ddrraaww, xxyy, ttxxtt, ffiillll==NNoonnee, ffoonntt==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Draw a legacy font starting at x, y using the prescribed fill and font. │ │ │ │ Parameters: │ │ │ │ * ddrraaww (PPIILL..IImmaaggeeDDrraaww) – A valid canvas to draw the text onto. │ │ │ │ - * ttxxtt (_ss_tt_rr) – The text string to display (must be ASCII only). │ │ │ │ - * xxyy (_tt_uu_pp_ll_ee) – An (x, y) tuple denoting the top-left corner to │ │ │ │ + * ttxxtt (ssttrr) – The text string to display (must be ASCII only). │ │ │ │ + * xxyy (ttuuppllee) – An (x, y) tuple denoting the top-left corner to │ │ │ │ draw the text. │ │ │ │ * ffiillll – The fill color to use (standard Pillow color name or │ │ │ │ RGB tuple). │ │ │ │ * ffoonntt – The font (from _l_u_m_a_._c_o_r_e_._l_e_g_a_c_y_._f_o_n_t) to use. │ │ │ │ luma.core.legacy.textsize(ttxxtt, ffoonntt==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Calculates the bounding box of the text, as drawn in the specified font. │ │ │ │ This method is most useful for when the _p_r_o_p_o_r_t_i_o_n_a_l wrapper is used. │ │ │ │ Parameters: │ │ │ │ - * ttxxtt (_ss_tt_rr) – The text string to calculate the bounds for │ │ │ │ + * ttxxtt (ssttrr) – The text string to calculate the bounds for │ │ │ │ * ffoonntt – The font (from _l_u_m_a_._c_o_r_e_._l_e_g_a_c_y_._f_o_n_t) to use. │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ll_ee_gg_aa_cc_yy_.._ff_oo_nn_tt_? ************ │ │ │ │ Fixed-width font definitions. The following fonts are available: │ │ │ │ FFoonntt nnaammee NNootteess SSoouurrccee │ │ │ │ Designed for a │ │ │ │ ATARI_FONT terminal emulator _h_t_t_p_:_/_/_g_n_u_._e_t_h_z_._c_h_/_l_i_n_u_k_s_._m_i_n_e_._n_u_/_a_t_a_r_i_/ │ │ │ │ written for an Atari │ │ │ │ @@ -277,20 +277,20 @@ │ │ │ │ 6655,, 6666,, 6644,, 5566,, 00,, 00]],, [[00,, 5566,, 6644,, 6666,, 6655,, 5566,, 00,, 00]],, [[00,, 5566,, 6666,, 6655,, 6666,, 5566,, │ │ │ │ 00,, 00]],, [[00,, 5588,, 6644,, 6644,, 6644,, 5588,, 00,, 00]],, [[00,, 2244,, 116600,, 116622,, 116611,, 112200,, 00,, 00]],, [[00,, │ │ │ │ 225544,, 4400,, 4400,, 4400,, 1166,, 00,, 00]],, [[00,, 00,, 00,, 00,, 00,, 00,, 00,, 00]]]]_ │ │ │ │ Bit patterns for SPECCY_FONT (another font based on the character set │ │ │ │ from the ZX Spectrum). Source: _h_t_t_p_s_:_/_/_w_w_w_._k_r_e_a_t_i_v_e_k_o_r_p_._c_o_m_/_s_o_f_t_w_a_r_e_/ │ │ │ │ _f_o_n_t_s_/_i_n_d_e_x_._s_h_t_m_l, transposed by Tiago F. Pimentel (antropoiese). │ │ │ │ ccllaassss luma.core.legacy.font.proportional(ffoonntt)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Wraps an existing font array, and on on indexing, trims any leading or │ │ │ │ trailing zero column definitions. This works especially well with │ │ │ │ scrolling messages, as interspace columns are squeezed to a single pixel. │ │ │ │ ccllaassss luma.core.legacy.font.tolerant(ffoonntt, mmiissssiinngg==''__'')_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Wraps an existing font array, and on indexing, if the supplied ascii_code │ │ │ │ does not exist, will return the column definitions for the given missing │ │ │ │ parameter. │ │ │ │ New in version 0.9.4. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ ├── ./usr/share/doc/luma.core-doc/html/mixin.html │ │ │ @@ -106,31 +106,31 @@ │ │ │
│ │ │ │ │ │
│ │ │

luma.core.mixin

│ │ │
│ │ │
│ │ │ class luma.core.mixin.capabilities[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

This class should be ‘mixed-in’ to any luma.core.device.device │ │ │ display implementation that should have “device-like” capabilities.

│ │ │
│ │ │
│ │ │ capabilities(width, height, rotate, mode='1')[source]
│ │ │

Assigns attributes such as width, height, size and │ │ │ bounding_box correctly oriented from the supplied parameters.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • width (int) – The device width.

  • │ │ │ -
  • height (int) – The device height.

  • │ │ │ -
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ +

  • width (int) – The device width.

  • │ │ │ +
  • height (int) – The device height.

  • │ │ │ +
  • rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is │ │ │ no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 │ │ │ represents 270° rotation.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -141,37 +141,37 @@ │ │ │ │ │ │
│ │ │
│ │ │ display(image)[source]
│ │ │

Should be overridden in sub-classed implementations.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to display.

│ │ │ +

image (PIL.Image.Image) – An image to display.

│ │ │
│ │ │
Raises:
│ │ │ -

NotImplementedError

│ │ │ +

NotImplementedError

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ preprocess(image)[source]
│ │ │

Provides a preprocessing facility (which may be overridden) whereby the supplied image is │ │ │ rotated according to the device’s rotate capability. If this method is │ │ │ overridden, it is important to call the super method.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to pre-process.

│ │ │ +

image (PIL.Image.Image) – An image to pre-process.

│ │ │
│ │ │
Returns:
│ │ │

A new processed image.

│ │ │
│ │ │
Return type:
│ │ │ -

PIL.Image.Image

│ │ │ +

PIL.Image.Image

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -30,45 +30,45 @@ │ │ │ │ _L_u_m_a_._C_o_r_e_:_ _S_B_C_ _d_i_s_p_l_a_y_ _d_r_i_v_e_r_s │ │ │ │ * _A_P_I_ _D_o_c_u_m_e_n_t_a_t_i_o_n │ │ │ │ * luma.core.mixin │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._mm_ii_xx_ii_nn_? ************ │ │ │ │ ccllaassss luma.core.mixin.capabilities_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ This class should be ‘mixed-in’ to any _l_u_m_a_._c_o_r_e_._d_e_v_i_c_e_._d_e_v_i_c_e display │ │ │ │ implementation that should have “device-like” capabilities. │ │ │ │ capabilities(wwiiddtthh, hheeiigghhtt, rroottaattee, mmooddee==''11'')_[_s_o_u_r_c_e_]_ │ │ │ │ Assigns attributes such as width, height, size and bounding_box │ │ │ │ correctly oriented from the supplied parameters. │ │ │ │ Parameters: │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The device width. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The device height. │ │ │ │ - * rroottaattee (_ii_nn_tt) – An integer value of 0 (default), 1, 2 or │ │ │ │ + * wwiiddtthh (iinntt) – The device width. │ │ │ │ + * hheeiigghhtt (iinntt) – The device height. │ │ │ │ + * rroottaattee (iinntt) – An integer value of 0 (default), 1, 2 or │ │ │ │ 3 only, where 0 is no rotation, 1 is rotate 90° │ │ │ │ clockwise, 2 is 180° rotation and 3 represents 270° │ │ │ │ rotation. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", │ │ │ │ "RGB" or "RGBA" only. │ │ │ │ clear()_[_s_o_u_r_c_e_]_ │ │ │ │ Initializes the device memory with an empty (blank) image. │ │ │ │ display(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Should be overridden in sub-classed implementations. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to display. │ │ │ │ Raises: │ │ │ │ - _NN_oo_tt_II_mm_pp_ll_ee_mm_ee_nn_tt_ee_dd_EE_rr_rr_oo_rr – │ │ │ │ + NNoottIImmpplleemmeenntteeddEErrrroorr – │ │ │ │ preprocess(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Provides a preprocessing facility (which may be overridden) whereby │ │ │ │ the supplied image is rotated according to the device’s rotate │ │ │ │ capability. If this method is overridden, it is important to call │ │ │ │ the super method. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to pre-process. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to pre-process. │ │ │ │ Returns: │ │ │ │ A new processed image. │ │ │ │ Return type: │ │ │ │ - _P_I_L_._I_m_a_g_e_._I_m_a_g_e │ │ │ │ + PIL.Image.Image │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/render.html │ │ │ @@ -100,16 +100,16 @@ │ │ │
│ │ │ │ │ │
│ │ │

luma.core.render

│ │ │
│ │ │
│ │ │ class luma.core.render.canvas(device, background=None, dither=False)[source]
│ │ │ -

Bases: object

│ │ │ -

A canvas returns a properly-sized PIL.ImageDraw object onto │ │ │ +

Bases: object

│ │ │ +

A canvas returns a properly-sized PIL.ImageDraw object onto │ │ │ which the caller can draw upon. As soon as the with-block completes, the │ │ │ resultant image is flushed onto the device.

│ │ │

By default, any color (other than black) will be generally treated as │ │ │ white when displayed on monochrome devices. However, this behaviour can be │ │ │ changed by adding dither=True and the image will be converted from RGB │ │ │ space into a 1-bit monochrome image where dithering is employed to │ │ │ differentiate colors at the expense of resolution. │ │ │ ├── html2text {} │ │ │ │ @@ -26,16 +26,16 @@ │ │ │ │ _L_u_m_a_._C_o_r_e_:_ _S_B_C_ _d_i_s_p_l_a_y_ _d_r_i_v_e_r_s │ │ │ │ * _A_P_I_ _D_o_c_u_m_e_n_t_a_t_i_o_n │ │ │ │ * luma.core.render │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._rr_ee_nn_dd_ee_rr_? ************ │ │ │ │ ccllaassss luma.core.render.canvas(ddeevviiccee, bbaacckkggrroouunndd==NNoonnee, ddiitthheerr==FFaallssee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ - A canvas returns a properly-sized _P_I_L_._I_m_a_g_e_D_r_a_w object onto which the │ │ │ │ + Bases: object │ │ │ │ + A canvas returns a properly-sized PIL.ImageDraw object onto which the │ │ │ │ caller can draw upon. As soon as the with-block completes, the resultant │ │ │ │ image is flushed onto the device. │ │ │ │ By default, any color (other than black) will begenerallytreated as white │ │ │ │ when displayed on monochrome devices. However, this behaviour can be │ │ │ │ changed by adding dither=True and the image will be converted from RGB │ │ │ │ space into a 1-bit monochrome image where dithering is employed to │ │ │ │ differentiate colors at the expense of resolution. If a background │ │ ├── ./usr/share/doc/luma.core-doc/html/sprite_system.html │ │ │ @@ -115,31 +115,31 @@ │ │ │

Note

│ │ │

This module is an evolving “work-in-progress” and should be treated │ │ │ as such until such time as this notice disappears.

│ │ │
│ │ │
│ │ │
│ │ │ class luma.core.sprite_system.dict_wrapper(d)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Helper class to turn dictionaries into objects.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.sprite_system.framerate_regulator(fps=16.67)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Implements a variable sleep mechanism to give the appearance of a consistent │ │ │ frame rate. Using a fixed-time sleep will cause animations to be jittery │ │ │ (looking like they are speeding up or slowing down, depending on what other │ │ │ work is occurring), whereas this class keeps track of when the last time the │ │ │ sleep() method was called, and calculates a sleep period to smooth out │ │ │ the jitter.

│ │ │
│ │ │
Parameters:
│ │ │ -

fps (float) – The desired frame rate, expressed numerically in │ │ │ +

fps (float) – The desired frame rate, expressed numerically in │ │ │ frames-per-second. By default, this is set at 16.67, to give a frame │ │ │ render time of approximately 60ms. This can be overridden as necessary, │ │ │ and if no FPS limiting is required, the fps can be set to zero.

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -147,15 +147,15 @@ │ │ │

Calculates the average transit time between the enter and exit methods, │ │ │ and return the time in milliseconds.

│ │ │
│ │ │
Returns:
│ │ │

The average transit in milliseconds.

│ │ │
│ │ │
Return type:
│ │ │ -

float

│ │ │ +

float

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ effective_FPS()[source]
│ │ │ @@ -163,47 +163,47 @@ │ │ │ correlate to the desired FPS supplied in the constructor, but no │ │ │ guarantees are given.

│ │ │
│ │ │
Returns:
│ │ │

The effective frame rate.

│ │ │
│ │ │
Return type:
│ │ │ -

float

│ │ │ +

float

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.sprite_system.spritesheet(image, frames, animations)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

A sprite sheet is a series of images (usually animation frames) combined │ │ │ into a larger image. A dictionary is usually spread into the object │ │ │ constructor parameters with the following top-level attributes:

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ -
  • image (str) – A path to a sprite map image.

  • │ │ │ -
  • frames (dict) –

    A dictionary of settings that defines how to extract │ │ │ +

  • image (str) – A path to a sprite map image.

  • │ │ │ +
  • frames (dict) –

    A dictionary of settings that defines how to extract │ │ │ individual frames from the supplied image, as follows

    │ │ │
      │ │ │
    • width & height are required and specify the dimensions of │ │ │ the frames

    • │ │ │
    • regX & regY indicate the registration point or “origin” of │ │ │ the frames

    • │ │ │
    • count allows you to specify the total number of frames in the │ │ │ spritesheet; if omitted, this will be calculated based on the │ │ │ dimensions of the source images and the frames. Frames will be │ │ │ assigned indexes based on their position in the source images │ │ │ (left to right, top to bottom).

    • │ │ │
    │ │ │

  • │ │ │ -
  • animations (dict) –

    A dictionary of key/value pairs where the key is the │ │ │ +

  • animations (dict) –

    A dictionary of key/value pairs where the key is the │ │ │ name of of the animation sequence, and the value are settings that │ │ │ defines an animation sequence as follows:

    │ │ │
      │ │ │
    • frames is a list of frame to show in sequence. Usually this │ │ │ comprises of frame numbers, but can refer to other animation │ │ │ sequences (which are handled much like a subroutine call).

    • │ │ │
    • speed determines how quickly the animation frames are cycled │ │ │ @@ -222,22 +222,22 @@ │ │ │

      │ │ │ animate(seq_name)[source]
      │ │ │

      Returns a generator which “executes” an animation sequence for the given │ │ │ seq_name, inasmuch as the next frame for the given animation is │ │ │ yielded when requested.

      │ │ │
      │ │ │
      Parameters:
      │ │ │ -

      seq_name (str) – The name of a previously defined animation sequence.

      │ │ │ +

      seq_name (str) – The name of a previously defined animation sequence.

      │ │ │
      │ │ │
      Returns:
      │ │ │

      A generator that yields all frames from the animation │ │ │ sequence.

      │ │ │
      │ │ │
      Raises:
      │ │ │ -

      AttributeError – If the seq_name is unknown.

      │ │ │ +

      AttributeError – If the seq_name is unknown.

      │ │ │
      │ │ │
      │ │ │
│ │ │ │ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -35,61 +35,61 @@ │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._ss_pp_rr_ii_tt_ee____ss_yy_ss_tt_ee_mm_? ************ │ │ │ │ Simplified sprite animation framework. │ │ │ │ Note │ │ │ │ This module is an evolving “work-in-progress” and should be treated as such │ │ │ │ until such time as this notice disappears. │ │ │ │ ccllaassss luma.core.sprite_system.dict_wrapper(dd)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Helper class to turn dictionaries into objects. │ │ │ │ ccllaassss luma.core.sprite_system.framerate_regulator(ffppss==1166..6677)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Implements a variable sleep mechanism to give the appearance of a │ │ │ │ consistent frame rate. Using a fixed-time sleep will cause animations to │ │ │ │ be jittery (looking like they are speeding up or slowing down, depending │ │ │ │ on what other work is occurring), whereas this class keeps track of when │ │ │ │ the last time the sleep() method was called, and calculates a sleep │ │ │ │ period to smooth out the jitter. │ │ │ │ Parameters: │ │ │ │ - ffppss (_ff_ll_oo_aa_tt) – The desired frame rate, expressed numerically in │ │ │ │ + ffppss (ffllooaatt) – The desired frame rate, expressed numerically in │ │ │ │ frames-per-second. By default, this is set at 16.67, to give a │ │ │ │ frame render time of approximately 60ms. This can be overridden as │ │ │ │ necessary, and if no FPS limiting is required, the fps can be set │ │ │ │ to zero. │ │ │ │ average_transit_time()_[_s_o_u_r_c_e_]_ │ │ │ │ Calculates the average transit time between the enter and exit │ │ │ │ methods, and return the time in milliseconds. │ │ │ │ Returns: │ │ │ │ The average transit in milliseconds. │ │ │ │ Return type: │ │ │ │ - _f_l_o_a_t │ │ │ │ + float │ │ │ │ effective_FPS()_[_s_o_u_r_c_e_]_ │ │ │ │ Calculates the effective frames-per-second - this should largely │ │ │ │ correlate to the desired FPS supplied in the constructor, but no │ │ │ │ guarantees are given. │ │ │ │ Returns: │ │ │ │ The effective frame rate. │ │ │ │ Return type: │ │ │ │ - _f_l_o_a_t │ │ │ │ + float │ │ │ │ ccllaassss luma.core.sprite_system.spritesheet(iimmaaggee, ffrraammeess, aanniimmaattiioonnss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ A sprite sheet is a series of images (usually animation frames) combined │ │ │ │ into a larger image. A dictionary is usually spread into the object │ │ │ │ constructor parameters with the following top-level attributes: │ │ │ │ Loosely based on _h_t_t_p_s_:_/_/_w_w_w_._c_r_e_a_t_e_j_s_._c_o_m_/_d_o_c_s_/_e_a_s_e_l_j_s_/_c_l_a_s_s_e_s_/ │ │ │ │ _S_p_r_i_t_e_S_h_e_e_t_._h_t_m_l │ │ │ │ animate(sseeqq__nnaammee)_[_s_o_u_r_c_e_]_ │ │ │ │ Returns a generator which “executes” an animation sequence for the │ │ │ │ given seq_name, inasmuch as the next frame for the given animation │ │ │ │ is yielded when requested. │ │ │ │ Parameters: │ │ │ │ - sseeqq__nnaammee (_ss_tt_rr) – The name of a previously defined animation │ │ │ │ + sseeqq__nnaammee (ssttrr) – The name of a previously defined animation │ │ │ │ sequence. │ │ │ │ Returns: │ │ │ │ A generator that yields all frames from the animation │ │ │ │ sequence. │ │ │ │ Raises: │ │ │ │ - _AA_tt_tt_rr_ii_bb_uu_tt_ee_EE_rr_rr_oo_rr – If the seq_name is unknown. │ │ │ │ + AAttttrriibbuutteeEErrrroorr – If the seq_name is unknown. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/threadpool.html │ │ │ @@ -108,15 +108,15 @@ │ │ │
│ │ │ │ │ │
│ │ │

luma.core.threadpool

│ │ │
│ │ │
│ │ │ class luma.core.threadpool.threadpool(num_threads)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Pool of threads consuming tasks from a queue.

│ │ │
│ │ │
│ │ │ add_task(func, *args, **kargs)[source]
│ │ │

Add a task to the queue.

│ │ │
│ │ │ │ │ │ @@ -127,15 +127,15 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class luma.core.threadpool.worker(tasks)[source]
│ │ │ -

Bases: Thread

│ │ │ +

Bases: Thread

│ │ │

Thread executing tasks from a given tasks queue.

│ │ │
│ │ │
│ │ │ run()[source]
│ │ │

Method representing the thread’s activity.

│ │ │

You may override this method in a subclass. The standard run() method │ │ │ invokes the callable object passed to the object’s constructor as the │ │ │ ├── html2text {} │ │ │ │ @@ -30,22 +30,22 @@ │ │ │ │ _L_u_m_a_._C_o_r_e_:_ _S_B_C_ _d_i_s_p_l_a_y_ _d_r_i_v_e_r_s │ │ │ │ * _A_P_I_ _D_o_c_u_m_e_n_t_a_t_i_o_n │ │ │ │ * luma.core.threadpool │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._tt_hh_rr_ee_aa_dd_pp_oo_oo_ll_? ************ │ │ │ │ ccllaassss luma.core.threadpool.threadpool(nnuumm__tthhrreeaaddss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Pool of threads consuming tasks from a queue. │ │ │ │ add_task(ffuunncc, **aarrggss, ****kkaarrggss)_[_s_o_u_r_c_e_]_ │ │ │ │ Add a task to the queue. │ │ │ │ wait_completion()_[_s_o_u_r_c_e_]_ │ │ │ │ Wait for completion of all the tasks in the queue. │ │ │ │ ccllaassss luma.core.threadpool.worker(ttaasskkss)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _T_h_r_e_a_d │ │ │ │ + Bases: Thread │ │ │ │ Thread executing tasks from a given tasks queue. │ │ │ │ run()_[_s_o_u_r_c_e_]_ │ │ │ │ Method representing the thread’s activity. │ │ │ │ You may override this method in a subclass. The standard run() │ │ │ │ method invokes the callable object passed to the object’s │ │ │ │ constructor as the target argument, if any, with sequential and │ │ │ │ keyword arguments taken from the args and kwargs arguments, │ │ ├── ./usr/share/doc/luma.core-doc/html/util.html │ │ │ @@ -110,115 +110,115 @@ │ │ │

│ │ │
│ │ │ luma.core.util.bytes_to_nibbles(data)[source]
│ │ │

Utility function to take a list of bytes (8 bit values) and turn it into │ │ │ a list of nibbles (4 bit values)

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list) – a list of 8 bit values that will be converted

│ │ │ +

data (list) – a list of 8 bit values that will be converted

│ │ │
│ │ │
Returns:
│ │ │

a list of 4 bit values

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.16.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.util.from_16_to_8(data)[source]
│ │ │

Utility function to take a list of 16 bit values and turn it into │ │ │ a list of 8 bit values

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list) – list of 16 bit values to convert

│ │ │ +

data (list) – list of 16 bit values to convert

│ │ │
│ │ │
Returns:
│ │ │

a list of 8 bit values

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.16.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.util.from_8_to_16(data)[source]
│ │ │

Utility function to take a list of 8 bit values and turn it into a list │ │ │ of signed 16 bit integers

│ │ │
│ │ │
Parameters:
│ │ │ -

data (list) – list of 8 bit values to convert

│ │ │ +

data (list) – list of 8 bit values to convert

│ │ │
│ │ │
Returns:
│ │ │

a list of 16 bit values

│ │ │
│ │ │
Return type:
│ │ │ -

list

│ │ │ +

list

│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.16.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.util.mutable_string(value)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.util.observable(target, observer)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Wraps any container object such that on inserting, updating or deleting, │ │ │ an observer is notified with a payload of the target. All other special │ │ │ name methods are passed through parameters unhindered.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.util.perf_counter()[source]
│ │ │ -

time.perf_counter_ns() in seconds

│ │ │ +

time.perf_counter_ns() in seconds

│ │ │
│ │ │
Returns:
│ │ │

the value (in fractional seconds) of a performance counter

│ │ │
│ │ │
Return type:
│ │ │ -

float

│ │ │ +

float

│ │ │
│ │ │
│ │ │
│ │ │

New in version 2.4.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ luma.core.util.unsigned_16_to_signed(value)[source]
│ │ │

Utility function to convert unsigned 16 bit value to a signed value

│ │ │
│ │ │
Parameters:
│ │ │ -

value (int) – the 16 bit value that needs to be converted

│ │ │ +

value (int) – the 16 bit value that needs to be converted

│ │ │
│ │ │
Returns:
│ │ │

a signed integer

│ │ │
│ │ │
Return type:
│ │ │ -

int

│ │ │ +

int

│ │ │
│ │ │
│ │ │
│ │ │

New in version 1.16.0.

│ │ │
│ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -35,60 +35,60 @@ │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._uu_tt_ii_ll_? ************ │ │ │ │ luma.core.util.bytes_to_nibbles(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Utility function to take a list of bytes (8 bit values) and turn it into │ │ │ │ a list of nibbles (4 bit values) │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt) – a list of 8 bit values that will be converted │ │ │ │ + ddaattaa (lliisstt) – a list of 8 bit values that will be converted │ │ │ │ Returns: │ │ │ │ a list of 4 bit values │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ New in version 1.16.0. │ │ │ │ luma.core.util.from_16_to_8(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Utility function to take a list of 16 bit values and turn it into a list │ │ │ │ of 8 bit values │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt) – list of 16 bit values to convert │ │ │ │ + ddaattaa (lliisstt) – list of 16 bit values to convert │ │ │ │ Returns: │ │ │ │ a list of 8 bit values │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ New in version 1.16.0. │ │ │ │ luma.core.util.from_8_to_16(ddaattaa)_[_s_o_u_r_c_e_]_ │ │ │ │ Utility function to take a list of 8 bit values and turn it into a list │ │ │ │ of signed 16 bit integers │ │ │ │ Parameters: │ │ │ │ - ddaattaa (_ll_ii_ss_tt) – list of 8 bit values to convert │ │ │ │ + ddaattaa (lliisstt) – list of 8 bit values to convert │ │ │ │ Returns: │ │ │ │ a list of 16 bit values │ │ │ │ Return type: │ │ │ │ - _l_i_s_t │ │ │ │ + list │ │ │ │ New in version 1.16.0. │ │ │ │ ccllaassss luma.core.util.mutable_string(vvaalluuee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ ccllaassss luma.core.util.observable(ttaarrggeett, oobbsseerrvveerr)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Wraps any container object such that on inserting, updating or deleting, │ │ │ │ an observer is notified with a payload of the target. All other special │ │ │ │ name methods are passed through parameters unhindered. │ │ │ │ luma.core.util.perf_counter()_[_s_o_u_r_c_e_]_ │ │ │ │ - _t_i_m_e_._p_e_r_f___c_o_u_n_t_e_r___n_s_(_) in seconds │ │ │ │ + time.perf_counter_ns() in seconds │ │ │ │ Returns: │ │ │ │ the value (in fractional seconds) of a performance counter │ │ │ │ Return type: │ │ │ │ - _f_l_o_a_t │ │ │ │ + float │ │ │ │ New in version 2.4.0. │ │ │ │ luma.core.util.unsigned_16_to_signed(vvaalluuee)_[_s_o_u_r_c_e_]_ │ │ │ │ Utility function to convert unsigned 16 bit value to a signed value │ │ │ │ Parameters: │ │ │ │ - vvaalluuee (_ii_nn_tt) – the 16 bit value that needs to be converted │ │ │ │ + vvaalluuee (iinntt) – the 16 bit value that needs to be converted │ │ │ │ Returns: │ │ │ │ a signed integer │ │ │ │ Return type: │ │ │ │ - _i_n_t │ │ │ │ + int │ │ │ │ New in version 1.16.0. │ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t │ │ │ │ =============================================================================== │ │ │ │ © Copyright 2024, Richard Hull and contributors. │ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by Read the Docs. │ │ ├── ./usr/share/doc/luma.core-doc/html/virtual.html │ │ │ @@ -158,15 +158,15 @@ │ │ │

For an entity with width and height attributes, determine │ │ │ the bounding box if were positioned at (x, y).

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.virtual.character(device, font=None, undefined='_')[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Abstraction that wraps a device, this class provides a text property │ │ │ which can be used to set and get a text value allowing the device to be │ │ │ treated as a character style display such as the HD44780 LCD

│ │ │

If the device is actually a character style device, be careful to provide │ │ │ a font that adheres to the pixel dimensions of the display.

│ │ │
│ │ │
Parameters:
│ │ │ @@ -204,31 +204,31 @@ │ │ │ display.

│ │ │
│ │ │
│ │ │ display(image)[source]
│ │ │

Should be overridden in sub-classed implementations.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to display.

│ │ │ +

image (PIL.Image.Image) – An image to display.

│ │ │
│ │ │
Raises:
│ │ │ -

NotImplementedError

│ │ │ +

NotImplementedError

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ restore(drop=0)[source]
│ │ │

Restores the last savepoint. If drop is supplied and greater than │ │ │ zero, then that many savepoints are dropped, and the next savepoint is │ │ │ restored.

│ │ │
│ │ │
Parameters:
│ │ │ -

drop (int) –

│ │ │ +

drop (int) –

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ savepoint()[source]
│ │ │ @@ -246,15 +246,15 @@ │ │ │ and the viewport are overlapping, then the update() method will be │ │ │ automatically invoked when the viewport is being refreshed or its position │ │ │ moved (such that an overlap occurs).

│ │ │

You would either:

│ │ │
│ │ │
    │ │ │
  • create a hotspot instance, suppling a render function (taking an │ │ │ -PIL.ImageDraw object, width & height dimensions. │ │ │ +PIL.ImageDraw object, width & height dimensions. │ │ │ The render function should draw within a bounding box of (0, 0, │ │ │ width, height), and render a full frame.

  • │ │ │
  • sub-class hotspot and override the should_redraw() and │ │ │ update() methods. This might be more useful for slow-changing │ │ │ values where it is not necessary to update every refresh cycle, or │ │ │ your implementation is stateful.

  • │ │ │
│ │ │ @@ -284,15 +284,15 @@ │ │ │ luma.core.virtual.range_overlap(a_min, a_max, b_min, b_max)[source] │ │ │

Neither range is completely greater than the other.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.virtual.sevensegment(device, undefined='_', segment_mapper=None)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Abstraction that wraps a device, this class provides a text property │ │ │ which can be used to set and get a text value, which when combined with a │ │ │ segment_mapper sets the correct bit representation for seven-segment │ │ │ displays and propagates that onto the underlying device.

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │ @@ -335,24 +335,24 @@ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class luma.core.virtual.terminal(device, font=None, color='white', bgcolor='black', tabstop=4, line_height=None, animate=True, word_wrap=False)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Provides a terminal-like interface to a device (or a device-like object │ │ │ that has mixin.capabilities characteristics).

│ │ │
│ │ │
│ │ │ background_color(value)[source]
│ │ │

Sets the background color.

│ │ │
│ │ │
Parameters:
│ │ │ -

value (str or tuple) – The new color value, either string name or RGB tuple.

│ │ │ +

value (str or tuple) – The new color value, either string name or RGB tuple.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ backspace()[source]
│ │ │ @@ -389,15 +389,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ foreground_color(value)[source]
│ │ │

Sets the foreground color.

│ │ │
│ │ │
Parameters:
│ │ │ -

value (str or tuple) – The new color value, either string name or RGB tuple.

│ │ │ +

value (str or tuple) – The new color value, either string name or RGB tuple.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ newline()[source]
│ │ │ @@ -409,15 +409,15 @@ │ │ │
│ │ │
│ │ │ println(text='')[source]
│ │ │

Prints the supplied text to the device, scrolling where necessary. │ │ │ The text is always followed by a newline.

│ │ │
│ │ │
Parameters:
│ │ │ -

text (str) – The text to print.

│ │ │ +

text (str) – The text to print.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ putch(char)[source]
│ │ │ @@ -437,15 +437,15 @@ │ │ │

Prints the supplied text, handling special character codes for carriage │ │ │ return (r), newline (n), backspace (b) and tab (t). ANSI color │ │ │ codes are also supported.

│ │ │

If the animate flag was set to True (default), then each character │ │ │ is flushed to the device, giving the effect of 1970’s teletype device.

│ │ │
│ │ │
Parameters:
│ │ │ -

text (str) – The text to print.

│ │ │ +

text (str) – The text to print.

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ reset()[source]
│ │ │ @@ -473,19 +473,19 @@ │ │ │

Bases: capabilities

│ │ │

The viewport offers a positionable window into a larger resolution pseudo-display, │ │ │ that also supports the concept of hotspots (which act like live displays).

│ │ │
│ │ │
Parameters:
│ │ │
    │ │ │
  • device – The device to project the enlarged pseudo-display viewport onto.

  • │ │ │ -
  • width (int) – The number of horizontal pixels.

  • │ │ │ -
  • height (int) – The number of vertical pixels.

  • │ │ │ -
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ +

  • width (int) – The number of horizontal pixels.

  • │ │ │ +
  • height (int) – The number of vertical pixels.

  • │ │ │ +
  • mode (str) – The supported color model, one of "1", "RGB" or │ │ │ "RGBA" only.

  • │ │ │ -
  • dither (bool) – By default, any color (other than black) will be generally │ │ │ +

  • dither (bool) – By default, any color (other than black) will be generally │ │ │ treated as white when displayed on monochrome devices. However, this behaviour │ │ │ can be changed by adding dither=True and the image will be converted from RGB │ │ │ space into a 1-bit monochrome image where dithering is employed to differentiate │ │ │ colors at the expense of resolution.

  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -499,18 +499,18 @@ │ │ │ │ │ │
│ │ │
│ │ │ display(image)[source]
│ │ │

Should be overridden in sub-classed implementations.

│ │ │
│ │ │
Parameters:
│ │ │ -

image (PIL.Image.Image) – An image to display.

│ │ │ +

image (PIL.Image.Image) – An image to display.

│ │ │
│ │ │
Raises:
│ │ │ -

NotImplementedError

│ │ │ +

NotImplementedError

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ is_overlapping_viewport(hotspot, xy)[source]
│ │ │ ├── html2text {} │ │ │ │ @@ -67,15 +67,15 @@ │ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e │ │ │ │ =============================================================================== │ │ │ │ ************ _ll_uu_mm_aa_.._cc_oo_rr_ee_.._vv_ii_rr_tt_uu_aa_ll_? ************ │ │ │ │ luma.core.virtual.calc_bounds(xxyy, eennttiittyy)_[_s_o_u_r_c_e_]_ │ │ │ │ For an entity with width and height attributes, determine the bounding │ │ │ │ box if were positioned at (x, y). │ │ │ │ ccllaassss luma.core.virtual.character(ddeevviiccee, ffoonntt==NNoonnee, uunnddeeffiinneedd==''__'')_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Abstraction that wraps a device, this class provides a text property │ │ │ │ which can be used to set and get a text value allowing the device to be │ │ │ │ treated as a character style display such as the HD44780 LCD │ │ │ │ If the device is actually a character style device, be careful to provide │ │ │ │ a font that adheres to the pixel dimensions of the display. │ │ │ │ Parameters: │ │ │ │ * ddeevviiccee – A device instance. │ │ │ │ @@ -96,35 +96,35 @@ │ │ │ │ savepoint (a point at which the screen display can be “rolled-back” to). │ │ │ │ This is mostly useful for displaying transient error/dialog messages │ │ │ │ which could be subsequently dismissed, reverting back to the previous │ │ │ │ display. │ │ │ │ display(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Should be overridden in sub-classed implementations. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to display. │ │ │ │ Raises: │ │ │ │ - _NN_oo_tt_II_mm_pp_ll_ee_mm_ee_nn_tt_ee_dd_EE_rr_rr_oo_rr – │ │ │ │ + NNoottIImmpplleemmeenntteeddEErrrroorr – │ │ │ │ restore(ddrroopp==00)_[_s_o_u_r_c_e_]_ │ │ │ │ Restores the last savepoint. If drop is supplied and greater than │ │ │ │ zero, then that many savepoints are dropped, and the next savepoint │ │ │ │ is restored. │ │ │ │ Parameters: │ │ │ │ - ddrroopp (_ii_nn_tt) – │ │ │ │ + ddrroopp (iinntt) – │ │ │ │ savepoint()_[_s_o_u_r_c_e_]_ │ │ │ │ Copies the last displayed image. │ │ │ │ ccllaassss luma.core.virtual.hotspot(wwiiddtthh, hheeiigghhtt, ddrraaww__ffnn==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ Bases: _c_a_p_a_b_i_l_i_t_i_e_s │ │ │ │ A hotspot (a place of more than usual interest, activity, or popularity) │ │ │ │ is a live display which may be added to a virtual viewport - if the │ │ │ │ hotspot and the viewport are overlapping, then the _u_p_d_a_t_e_(_) method will │ │ │ │ be automatically invoked when the viewport is being refreshed or its │ │ │ │ position moved (such that an overlap occurs). │ │ │ │ You would either: │ │ │ │ * create a hotspot instance, suppling a render function │ │ │ │ - (taking an _P_I_L_._I_m_a_g_e_D_r_a_w object, width & height │ │ │ │ + (taking an PIL.ImageDraw object, width & height │ │ │ │ dimensions. The render function should draw within a │ │ │ │ bounding box of (0, 0, width, height), and render a full │ │ │ │ frame. │ │ │ │ * sub-class hotspot and override the _s_h_o_u_l_d___r_e_d_r_a_w_(_) and │ │ │ │ _u_p_d_a_t_e_(_) methods. This might be more useful for slow- │ │ │ │ changing values where it is not necessary to update every │ │ │ │ refresh cycle, or your implementation is stateful. │ │ │ │ @@ -134,15 +134,15 @@ │ │ │ │ (possibly on last updated member variable) so that for slow │ │ │ │ changing hotspots they are not updated too frequently. │ │ │ │ update(ddrraaww)_[_s_o_u_r_c_e_]_ │ │ │ │ luma.core.virtual.range_overlap(aa__mmiinn, aa__mmaaxx, bb__mmiinn, bb__mmaaxx)_[_s_o_u_r_c_e_]_ │ │ │ │ Neither range is completely greater than the other. │ │ │ │ ccllaassss luma.core.virtual.sevensegment(ddeevviiccee, uunnddeeffiinneedd==''__'', │ │ │ │ sseeggmmeenntt__mmaappppeerr==NNoonnee)_[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Abstraction that wraps a device, this class provides a text property │ │ │ │ which can be used to set and get a text value, which when combined with a │ │ │ │ segment_mapper sets the correct bit representation for seven-segment │ │ │ │ displays and propagates that onto the underlying device. │ │ │ │ Parameters: │ │ │ │ * ddeevviiccee – A device instance. │ │ │ │ * sseeggmmeenntt__mmaappppeerr – An optional function that maps strings into │ │ │ │ @@ -163,21 +163,21 @@ │ │ │ │ usually much less frequently than the viewport requests refresh updates. │ │ │ │ paste_into(iimmaaggee, xxyy)_[_s_o_u_r_c_e_]_ │ │ │ │ should_redraw()_[_s_o_u_r_c_e_]_ │ │ │ │ Only requests a redraw after interval seconds have elapsed. │ │ │ │ ccllaassss luma.core.virtual.terminal(ddeevviiccee, ffoonntt==NNoonnee, ccoolloorr==''wwhhiittee'', │ │ │ │ bbggccoolloorr==''bbllaacckk'', ttaabbssttoopp==44, lliinnee__hheeiigghhtt==NNoonnee, aanniimmaattee==TTrruuee, wwoorrdd__wwrraapp==FFaallssee) │ │ │ │ _[_s_o_u_r_c_e_]_ │ │ │ │ - Bases: _o_b_j_e_c_t │ │ │ │ + Bases: object │ │ │ │ Provides a terminal-like interface to a device (or a device-like object │ │ │ │ that has mixin.capabilities characteristics). │ │ │ │ background_color(vvaalluuee)_[_s_o_u_r_c_e_]_ │ │ │ │ Sets the background color. │ │ │ │ Parameters: │ │ │ │ - vvaalluuee (_ss_tt_rr oorr _tt_uu_pp_ll_ee) – The new color value, either string │ │ │ │ + vvaalluuee (ssttrr oorr ttuuppllee) – The new color value, either string │ │ │ │ name or RGB tuple. │ │ │ │ backspace()_[_s_o_u_r_c_e_]_ │ │ │ │ Moves the cursor one place to the left, erasing the character at │ │ │ │ the current position. Cannot move beyond column zero, nor onto the │ │ │ │ previous line. │ │ │ │ carriage_return()_[_s_o_u_r_c_e_]_ │ │ │ │ Returns the cursor position to the left-hand side without advancing │ │ │ │ @@ -189,40 +189,40 @@ │ │ │ │ the cursor’s position. │ │ │ │ flush()_[_s_o_u_r_c_e_]_ │ │ │ │ Cause the current backing store to be rendered on the nominated │ │ │ │ device. │ │ │ │ foreground_color(vvaalluuee)_[_s_o_u_r_c_e_]_ │ │ │ │ Sets the foreground color. │ │ │ │ Parameters: │ │ │ │ - vvaalluuee (_ss_tt_rr oorr _tt_uu_pp_ll_ee) – The new color value, either string │ │ │ │ + vvaalluuee (ssttrr oorr ttuuppllee) – The new color value, either string │ │ │ │ name or RGB tuple. │ │ │ │ newline()_[_s_o_u_r_c_e_]_ │ │ │ │ Advances the cursor position ot the left hand side, and to the next │ │ │ │ line. If the cursor is on the lowest line, the displayed contents │ │ │ │ are scrolled, causing the top line to be lost. │ │ │ │ println(tteexxtt=='''')_[_s_o_u_r_c_e_]_ │ │ │ │ Prints the supplied text to the device, scrolling where necessary. │ │ │ │ The text is always followed by a newline. │ │ │ │ Parameters: │ │ │ │ - tteexxtt (_ss_tt_rr) – The text to print. │ │ │ │ + tteexxtt (ssttrr) – The text to print. │ │ │ │ putch(cchhaarr)_[_s_o_u_r_c_e_]_ │ │ │ │ Prints the specific character, which must be a valid printable │ │ │ │ ASCII value in the range 32..127 only, or one of carriage return │ │ │ │ (r), newline (n), backspace (b) or tab (t). │ │ │ │ Parameters: │ │ │ │ cchhaarr – The character to print. │ │ │ │ puts(tteexxtt)_[_s_o_u_r_c_e_]_ │ │ │ │ Prints the supplied text, handling special character codes for │ │ │ │ carriage return (r), newline (n), backspace (b) and tab (t). ANSI │ │ │ │ color codes are also supported. │ │ │ │ If the animate flag was set to True (default), then each character │ │ │ │ is flushed to the device, giving the effect of 1970’s teletype │ │ │ │ device. │ │ │ │ Parameters: │ │ │ │ - tteexxtt (_ss_tt_rr) – The text to print. │ │ │ │ + tteexxtt (ssttrr) – The text to print. │ │ │ │ reset()_[_s_o_u_r_c_e_]_ │ │ │ │ Resets the foreground and background color value back to the │ │ │ │ original when initialised. │ │ │ │ reverse_colors()_[_s_o_u_r_c_e_]_ │ │ │ │ Flips the foreground and background colors. │ │ │ │ tab()_[_s_o_u_r_c_e_]_ │ │ │ │ Advances the cursor position to the next (soft) tabstop. │ │ │ │ @@ -231,34 +231,34 @@ │ │ │ │ Bases: _c_a_p_a_b_i_l_i_t_i_e_s │ │ │ │ The viewport offers a positionable window into a larger resolution │ │ │ │ pseudo-display, that also supports the concept of hotspots (which act │ │ │ │ like live displays). │ │ │ │ Parameters: │ │ │ │ * ddeevviiccee – The device to project the enlarged pseudo-display │ │ │ │ viewport onto. │ │ │ │ - * wwiiddtthh (_ii_nn_tt) – The number of horizontal pixels. │ │ │ │ - * hheeiigghhtt (_ii_nn_tt) – The number of vertical pixels. │ │ │ │ - * mmooddee (_ss_tt_rr) – The supported color model, one of "1", "RGB" or │ │ │ │ + * wwiiddtthh (iinntt) – The number of horizontal pixels. │ │ │ │ + * hheeiigghhtt (iinntt) – The number of vertical pixels. │ │ │ │ + * mmooddee (ssttrr) – The supported color model, one of "1", "RGB" or │ │ │ │ "RGBA" only. │ │ │ │ - * ddiitthheerr (_bb_oo_oo_ll) – By default, any color (other than black) will │ │ │ │ + * ddiitthheerr (bbooooll) – By default, any color (other than black) will │ │ │ │ begenerallytreated as white when displayed on monochrome │ │ │ │ devices. However, this behaviour can be changed by adding │ │ │ │ dither=True and the image will be converted from RGB space │ │ │ │ into a 1-bit monochrome image where dithering is employed to │ │ │ │ differentiate colors at the expense of resolution. │ │ │ │ add_hotspot(hhoottssppoott, xxyy)_[_s_o_u_r_c_e_]_ │ │ │ │ Add the hotspot at (x, y). The hotspot must fit inside the bounds │ │ │ │ of the virtual device. If it does not then an AssertError is │ │ │ │ raised. │ │ │ │ display(iimmaaggee)_[_s_o_u_r_c_e_]_ │ │ │ │ Should be overridden in sub-classed implementations. │ │ │ │ Parameters: │ │ │ │ - iimmaaggee (_PP_II_LL_.._II_mm_aa_gg_ee_.._II_mm_aa_gg_ee) – An image to display. │ │ │ │ + iimmaaggee (PPIILL..IImmaaggee..IImmaaggee) – An image to display. │ │ │ │ Raises: │ │ │ │ - _NN_oo_tt_II_mm_pp_ll_ee_mm_ee_nn_tt_ee_dd_EE_rr_rr_oo_rr – │ │ │ │ + NNoottIImmpplleemmeenntteeddEErrrroorr – │ │ │ │ is_overlapping_viewport(hhoottssppoott, xxyy)_[_s_o_u_r_c_e_]_ │ │ │ │ Checks to see if the hotspot at position (x, y) is (at least │ │ │ │ partially) visible according to the position of the viewport. │ │ │ │ refresh()_[_s_o_u_r_c_e_]_ │ │ │ │ remove_hotspot(hhoottssppoott, xxyy)_[_s_o_u_r_c_e_]_ │ │ │ │ Remove the hotspot at (x, y): Any previously rendered image where │ │ │ │ the hotspot was placed is erased from the backing image, and will