Skip to content

Deck

Entities

deck

Classes:

  • Deck

    A Deck represents a physical device or a virtual web deck.

  • DeckWithIcons

    This type of deck is a variant of the above for decks with LCD capabilites,

Deck

Deck(name: str, config: dict, cockpit: Cockpit, device=None)

A Deck represents a physical device or a virtual web deck.
A Deck has a collection of Pages, and knows which one is currently being displayed.
It maintains a link to the physical device driver and dispatches instruction to the driver
to make representation work.

Methods:

  • change_page

    Change the deck's page to the one supplied as argument.

  • clean_empty

    Procedure to clean (remove previous) keys that do not contain any feedback rendering.

  • fill_empty

    Procedure to fill keys that do not contain any feedback rendering.

  • get_attribute

    Returns the default attribute value

  • get_button_value

    Get the value of a button from its internal identifier name

  • get_deck_button_definition

    Returns a deck's button definition from the deck type.

  • get_id

    Returns deck identifier

  • get_index_numeric

    Returns the numeric part of the index of a button index for this deck.

  • get_index_prefix

    Returns the prefix of a button index for this deck.

  • init

    Initialisation procedure

  • inspect

    Triggered by the Inspect activation.

  • load

    Loads pages during configuration. If none is found, create a simple,

  • load_home_page

    Loads the home page, if any.

  • make_default_page

    Generates a default home page for the deck,

  • print_page

    Produces an image of the deck's layout in the current directory.

  • reload_page

    Reloads page to take into account changes in definition

  • render

    Main procedure to render a button on the deck

  • set_deck_type

    Installs the reference to the deck type.

  • set_home_page

    Finds and install the home page, if any.

  • start

    Called at end of initialisation to start the deck interaction,

  • terminate

    Called at end of use of deck to cleanly reset all buttons to a default, neutral state

  • valid_activations

    Returns the valid activations for the button pointed by the index.

  • valid_indices

    Returns the valid indices for this deck.

  • valid_representations

    Returns the valid representations for the button pointed by the index.

change_page

change_page(page: str | None = None) -> str | None

Change the deck's page to the one supplied as argument.
If none supplied, load the default page.

Parameters:

  • page

    ([str | None], default: None ) –

    Name of page to load (default: None)

Returns:

  • str | None

    [str | None]: Name of page loaded or None.

clean_empty

clean_empty(key)

Procedure to clean (remove previous) keys that do not contain any feedback rendering.
key ([str]): Key index to clean with empty/void feedback.

fill_empty

fill_empty(key)

Procedure to fill keys that do not contain any feedback rendering.
key ([str]): Key index to fill with empty/void feedback.

get_attribute

get_attribute(attribute: str, default=None, propagate: bool = True, silence: bool = True) -> Any or None

Returns the default attribute value

..if avaialble at the deck level.
If not, returns the parent's default attribute value (cockpit).

Parameters:

  • attribute

    (str) –

    Attribute name

  • silence

    (bool, default: True ) –

    Whether to complain if defalut value is not found (default: False)

Returns:

  • Any or None

    [Any or None]: Value of attribute

get_button_value

get_button_value(name) -> Any

Get the value of a button from its internal identifier name

[description]

Parameters:

  • name

    ([type]) –

    [description]

Returns:

  • Any

get_deck_button_definition

get_deck_button_definition(idx) -> ButtonType

Returns a deck's button definition from the deck type.

Parameters:

  • idx

    ([strıint]) –

    Button index on deck

Returns:

  • ButtonType

    [ButtonType | None]: The button type at index.

get_id

get_id() -> str

Returns deck identifier

Returns:

  • str

    [str]: Deck identifier string

get_index_numeric

get_index_numeric(index)

Returns the numeric part of the index of a button index for this deck.

get_index_prefix

get_index_prefix(index)

Returns the prefix of a button index for this deck.

init

init()

Initialisation procedure

Load deck type definition, load deck parameters, load layout, pages,
and install and start deck software.

inspect

inspect(what: str | None = None)

Triggered by the Inspect activation.

This function is called on all pages of this Deck.

load

load()

Loads pages during configuration. If none is found, create a simple,
static page with one activatio.

load_home_page

load_home_page()

Loads the home page, if any.

make_default_page abstractmethod

make_default_page(b: str | None = None)

Generates a default home page for the deck,
in accordance with its capabilities.

print_page

print_page(page: Page)

Produces an image of the deck's layout in the current directory.
For testing and development purpose.

reload_page

reload_page()

Reloads page to take into account changes in definition

Please note that this may loead to unexpected results if page was
too heavily modified or interaction with other pages occurred.

render abstractmethod

render(button: Button)

Main procedure to render a button on the deck

The procedure mainly fetches information from the button, for example,
gets an image for display in a neutral, generic format (PNG, JPEG…),
then format the image to the deck specific format (B646 format for example)
and send it to the deck for display using the deck drive APIs.
It also convert the button index to the specific index required by the deck.

Args;
button ([Button]): Button to render on the deck.

set_deck_type

set_deck_type()

Installs the reference to the deck type.

set_home_page

set_home_page()

Finds and install the home page, if any.

start abstractmethod

start()

Called at end of initialisation to start the deck interaction,
both ways.

terminate

terminate(disconnected: bool = False)

Called at end of use of deck to cleanly reset all buttons to a default, neutral state
and stop deck interaction,

valid_activations

valid_activations(index=None)

Returns the valid activations for the button pointed by the index.
If None is given, returns all valid activations.

valid_indices

valid_indices(with_icon: bool = False)

Returns the valid indices for this deck.

valid_representations

valid_representations(index=None)

Returns the valid representations for the button pointed by the index.
If None is given, returns all valid representations.

DeckWithIcons

DeckWithIcons(name: str, config: dict, cockpit: Cockpit, device=None)

This type of deck is a variant of the above for decks with LCD capabilites,
LCD being individual key display (like streamdecks) or a larger LCD with areas
of interaction, like LoupedeckLive.
This class complement the generic deck with image display function
and utilities for image transformation.

Methods:

  • change_page

    Change the deck's page to the one supplied as argument.

  • clean_empty

    Fills a button pointed by index with an empty representation.

  • create_icon_for_key

    Create a default icon for supplied key with proper texture or color

  • fill_empty

    Fills all empty buttons with a default representation.

  • get_attribute

    Returns the default attribute value

  • get_button_value

    Get the value of a button from its internal identifier name

  • get_deck_button_definition

    Returns a deck's button definition from the deck type.

  • get_icon_background

    Returns a Pillow Image of size width x height with either the file specified by texture or a uniform color

  • get_id

    Returns deck identifier

  • get_image_size

    Gets image size for deck button index

  • get_index_numeric

    Returns the numeric part of the index of a button index for this deck.

  • get_index_prefix

    Returns the prefix of a button index for this deck.

  • get_wallpaper

    Gets image size for deck button index

  • init

    Initialisation procedure

  • inspect

    Triggered by the Inspect activation.

  • load

    Loads pages during configuration. If none is found, create a simple,

  • load_home_page

    Loads the home page, if any.

  • make_default_page

    Generates a default home page for the deck,

  • print_page

    Produces an image of the deck's layout in the current directory.

  • reload_page

    Reloads page to take into account changes in definition

  • render

    Main procedure to render a button on the deck

  • set_deck_type

    Installs the reference to the deck type.

  • set_home_page

    Finds and install the home page, if any.

  • set_key_icon

    Access to lower level, raw function to install an image on a deck display

  • start

    Called at end of initialisation to start the deck interaction,

  • terminate

    Called at end of use of deck to cleanly reset all buttons to a default, neutral state

  • valid_activations

    Returns the valid activations for the button pointed by the index.

  • valid_indices

    Returns the valid indices for this deck.

  • valid_representations

    Returns the valid representations for the button pointed by the index.

change_page

change_page(page: str | None = None) -> str | None

Change the deck's page to the one supplied as argument.
If none supplied, load the default page.

Parameters:

  • page

    ([str | None], default: None ) –

    Name of page to load (default: None)

Returns:

  • str | None

    [str | None]: Name of page loaded or None.

clean_empty

clean_empty(key)

Fills a button pointed by index with an empty representation.

create_icon_for_key

create_icon_for_key(index, colors, texture)

Create a default icon for supplied key with proper texture or color

fill_empty

fill_empty(key)

Fills all empty buttons with a default representation.

If clean is True, removes the reprensetation rather than install a default one.
Removing a representation often means installing a default, neutral one.

get_attribute

get_attribute(attribute: str, default=None, propagate: bool = True, silence: bool = True) -> Any or None

Returns the default attribute value

..if avaialble at the deck level.
If not, returns the parent's default attribute value (cockpit).

Parameters:

  • attribute

    (str) –

    Attribute name

  • silence

    (bool, default: True ) –

    Whether to complain if defalut value is not found (default: False)

Returns:

  • Any or None

    [Any or None]: Value of attribute

get_button_value

get_button_value(name) -> Any

Get the value of a button from its internal identifier name

[description]

Parameters:

  • name

    ([type]) –

    [description]

Returns:

  • Any

get_deck_button_definition

get_deck_button_definition(idx) -> ButtonType

Returns a deck's button definition from the deck type.

Parameters:

  • idx

    ([strıint]) –

    Button index on deck

Returns:

  • ButtonType

    [ButtonType | None]: The button type at index.

get_icon_background

get_icon_background(name: str, width: int, height: int, texture_in, color_in, use_texture=True, who: str = 'Deck')

Returns a Pillow Image of size width x height with either the file specified by texture or a uniform color

get_id

get_id() -> str

Returns deck identifier

Returns:

  • str

    [str]: Deck identifier string

get_image_size

get_image_size(index)

Gets image size for deck button index

get_index_numeric

get_index_numeric(index)

Returns the numeric part of the index of a button index for this deck.

get_index_prefix

get_index_prefix(index)

Returns the prefix of a button index for this deck.

get_wallpaper

get_wallpaper(index)

Gets image size for deck button index

init

init()

Initialisation procedure

Load deck type definition, load deck parameters, load layout, pages,
and install and start deck software.

inspect

inspect(what: str | None = None)

Triggered by the Inspect activation.

This function is called on all pages of this Deck.

load

load()

Loads pages during configuration. If none is found, create a simple,
static page with one activatio.

load_home_page

load_home_page()

Loads the home page, if any.

make_default_page abstractmethod

make_default_page(b: str | None = None)

Generates a default home page for the deck,
in accordance with its capabilities.

print_page

print_page(page: Page)

Produces an image of the deck's layout in the current directory.
For testing and development purpose.

reload_page

reload_page()

Reloads page to take into account changes in definition

Please note that this may loead to unexpected results if page was
too heavily modified or interaction with other pages occurred.

render abstractmethod

render(button: Button)

Main procedure to render a button on the deck

The procedure mainly fetches information from the button, for example,
gets an image for display in a neutral, generic format (PNG, JPEG…),
then format the image to the deck specific format (B646 format for example)
and send it to the deck for display using the deck drive APIs.
It also convert the button index to the specific index required by the deck.

Args;
button ([Button]): Button to render on the deck.

set_deck_type

set_deck_type()

Installs the reference to the deck type.

set_home_page

set_home_page()

Finds and install the home page, if any.

set_key_icon

set_key_icon(key, image)

Access to lower level, raw function to install an image on a deck display
pointed by th index key.

Parameters:

  • key

    ([type]) –

    [description]

  • image

    ([type]) –

    [description]

start abstractmethod

start()

Called at end of initialisation to start the deck interaction,
both ways.

terminate

terminate(disconnected: bool = False)

Called at end of use of deck to cleanly reset all buttons to a default, neutral state
and stop deck interaction,

valid_activations

valid_activations(index=None)

Returns the valid activations for the button pointed by the index.
If None is given, returns all valid activations.

valid_indices

valid_indices(with_icon: bool = False)

Returns the valid indices for this deck.

valid_representations

valid_representations(index=None)

Returns the valid representations for the button pointed by the index.
If None is given, returns all valid representations.