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 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ 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 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ 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 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ 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