Skip to content

Snapshot

LEDColor ¤

Bases: Enum

Available LED colors for Helix snapshots.

Source code in helixapi\snapshot.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class LEDColor(Enum):
    """Available LED colors for Helix snapshots."""
    AUTO = 0
    WHITE = 1
    RED = 2
    DARK_ORANGE = 3
    LIGHT_ORANGE = 4
    YELLOW = 5
    GREEN = 6
    TURQUOISE = 7
    BLUE = 8
    VIOLET = 9
    PINK = 10
    OFF = 11

AUTO = 0 class-attribute instance-attribute ¤

BLUE = 8 class-attribute instance-attribute ¤

DARK_ORANGE = 3 class-attribute instance-attribute ¤

GREEN = 6 class-attribute instance-attribute ¤

LIGHT_ORANGE = 4 class-attribute instance-attribute ¤

OFF = 11 class-attribute instance-attribute ¤

PINK = 10 class-attribute instance-attribute ¤

RED = 2 class-attribute instance-attribute ¤

TURQUOISE = 7 class-attribute instance-attribute ¤

VIOLET = 9 class-attribute instance-attribute ¤

WHITE = 1 class-attribute instance-attribute ¤

YELLOW = 5 class-attribute instance-attribute ¤

Snapshot ¤

Bases: ItemBase

Represents a Helix snapshot for a given preset. This contains specific metadata (index, name).

Source code in helixapi\snapshot.py
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
class Snapshot(ItemBase):
    """
    Represents a Helix snapshot for a given preset. This contains specific metadata (index, name).
    """

    def __init__(self, data: dict, setlist_index: int, preset_index: int, index: int, get_active_callback=None, set_active_callback=None, metadata: dict = {}) -> None:
        """
        Initialize the Snapshot class.

        Args:
            data (dict): The data structure representing the snapshot.
            setlist_index (int): Index of the setlist containing this snapshot.
            preset_index (int): Index of the preset containing this snapshot.
            index (int): Index of this snapshot within its preset.
            get_active_callback (callable): Callback function to get the active snapshot.
            set_active_callback (callable): Callback function to set the active snapshot.
            metadata (dict, optional): Additional metadata for the snapshot. Defaults to {}.

        Examples:
        ``` py
        snapshot = Snapshot(data, setlist_index=0, preset_index=1, index=2)
        ```
        """
        super().__init__(cls=Snapshot, data=data, metadata=metadata, setlist_index=setlist_index, preset_index=preset_index, snapshot_index=index)
        self.index = index
        self._get_active_callback = get_active_callback
        self._set_active_callback = set_active_callback

    @property
    def name(self) -> str:
        """
        Get the name of the snapshot.

        Returns:
            str: The name of the snapshot.

        Examples:
        ``` py
        snapshot.name
        ```
        """
        return self._get_data("name")

    @name.setter
    def name(self, value: str) -> None:
        """
        Set the name of the snapshot.

        Args:
            value (str): The name to set for the snapshot.

        Raises:
            ValueError: If the name length exceeds the maximum allowed length.

        Examples:
        ``` py
        snapshot.name = "Clean Tone"
        ```
        """
        if len(value) > 16:
            raise ValueError("Name must be 16 characters or fewer.")
        self._set_data("name", value)

    @property
    def ledcolor(self) -> LEDColor:
        """
        Get the LED color of the snapshot.

        Returns:
            LEDColor: The LED color of the snapshot.

        Examples:
        ``` py
        prnit(snapshot.ledcolor)
        ```
        """
        return self._get_data("ledcolor")

    @ledcolor.setter
    def ledcolor(self, value: LEDColor) -> None:
        """
        Set the LED color of the snapshot.

        Args:
            value (LEDColor): The LED color to set for the snapshot.

        Raises:
            ValueError: If the value is not a valid LEDColor enum.

        Examples:
        ``` py
        snapshot.ledcolor = LEDColor.RED
        ```
        """
        if not isinstance(value, LEDColor):
            raise ValueError("Invalid LED color value.")
        self._set_data("ledcolor", value)

    @property
    def active(self) -> bool:
        """
        Check if the snapshot is active.

        Returns:
            bool: True if the snapshot is active, False otherwise.
        """
        if self._get_active_callback:
            return self._get_active_callback() == self.index
        return False

    @active.setter
    def active(self, value: bool) -> None:
        """
        Set the snapshot as active.

        Args:
            value (bool): True to set the snapshot as active, False otherwise.
        """
        if value and self._set_active_callback:
            self._set_active_callback(self.index)

active: bool property writable ¤

Check if the snapshot is active.

Returns:

Name Type Description
bool bool

True if the snapshot is active, False otherwise.

index = index instance-attribute ¤

ledcolor: LEDColor property writable ¤

Get the LED color of the snapshot.

Returns:

Name Type Description
LEDColor LEDColor

The LED color of the snapshot.

Examples:

prnit(snapshot.ledcolor)

name: str property writable ¤

Get the name of the snapshot.

Returns:

Name Type Description
str str

The name of the snapshot.

Examples:

snapshot.name