Balíček brian.uicontrol¶
Modul brian.uicontrol.UiEventsListener¶
- class brian.uicontrol.UiEventsListener.UiEventsListener¶
Základy:
object
- class KnobEvent¶
Základy:
object
- turn_delta: int¶
- turned_to: int¶
- is_pressed: bool¶
- just_pressed: bool¶
- just_released: bool¶
- class ButtonsEvent¶
Základy:
object
- top_left: ButtonEvent¶
- top_right: ButtonEvent¶
- bottom_left: ButtonEvent¶
- bottom_right: ButtonEvent¶
- any_button: ButtonEvent¶
- any_button_incl_knob: ButtonEvent¶
- class Button¶
Základy:
object
- last_button_event: ButtonEvent¶
- wait_for_press(timeout_ms: int = -1) bool ¶
Čeká na další událost stisknutí tlačítka. Tato funkce je blokující.
- Parametry:
timeout_ms – Maximální počet milisekund čekání. - Pokud je časový limit záporný, funkce bude čekat neomezeně.
- vrátit úspěch:
True: Pokud dojde k zachycení požadované události tlačítka.
False: Pokud vypršel časový limit.
- wait_for_release(timeout_ms: int = -1) bool ¶
Čeká na další událost uvolnění tlačítka. Tato funkce je blokující.
- Parametry:
timeout_ms – Maximální počet milisekund čekání. - Pokud je časový limit záporný, funkce bude čekat neomezeně.
- vrátit úspěch:
True: Pokud dojde k zachycení požadované události tlačítka.
False: Pokud vypršel časový limit.
- wait_for_press_and_release(timeout_ms: int = -1) bool ¶
Čeká na další událost stisknutí a uvolnění tlačítka. Tato funkce je blokující.
- Parametry:
timeout_ms – Maximální počet milisekund čekání. - Pokud je časový limit záporný, funkce bude čekat neomezeně.
- vrátit úspěch:
True: Pokud dojde k zachycení požadované události tlačítka.
False: Pokud vypršel časový limit.
- class Knob¶
Bases:
Button
- wait_for_directional_turn(clockwise: bool, timeout_ms: int = -1) bool ¶
Čeká na další otočku knoflíku. Tato funkce je blokující.
- Parametry:
clockwise – Zda čekat na otáčení ve směru hodinových ručiček nebo proti nim.
timeout_ms – Maximální počet milisekund čekání. - Pokud je časový limit záporný, funkce bude čekat neomezeně.
- vrátit úspěch:
True: Pokud dojde k zachycení požadované události tlačítka.
False: Pokud vypršel časový limit.
- wait_for_any_turn(timeout_ms: int = -1) bool ¶
Waits for next any turn of the knob. This function is blocking.
- Parametry:
timeout_ms – Maximální počet milisekund čekání. - Pokud je časový limit záporný, funkce bude čekat neomezeně.
- vrátit úspěch:
True: Pokud dojde k zachycení požadované události tlačítka.
False: Pokud vypršel časový limit.
- __init__()¶
Inicializuje novou instanci třídy UiEventsListener.
- knob_event_since_last() KnobEvent ¶
This function will reset just_pressed, just_released fields and turn_delta fields.
- Vrací:
Třída KnobEvent obsahující události od posledního volání.
- buttons_event_since_last() ButtonsEvent ¶
This function will reset just_pressed and just_released fields.
- Vrací:
Třída ButtonsEvent obsahující události od posledního volání.
Obsah modulu¶
- exception brian.uicontrol.UiEventsListenerAlreadyClosedError¶
Bases:
Exception
Vyvoláno při pokusu o přístup k uzavřenému UiEventsListener
- class brian.uicontrol.LedColor(red: int, green: int, blue: int)¶
Základy:
object
- __init__(red: int, green: int, blue: int)¶
Holds color definition for UI LEDs. Color values range from 0 to 255. When outside of this range, the values are clamped
- red: int¶
Red component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
- green: int¶
Green component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
- blue: int¶
Blue component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
- class brian.uicontrol.ButtonId(*values)¶
Bases:
Enum
- TOP_LEFT = 0¶
- TOP_RIGHT = 1¶
- BOTTOM_LEFT = 2¶
- BOTTOM_RIGHT = 3¶
- KNOB = 4¶
- class brian.uicontrol.LedButtonAnimation(*values)¶
Bases:
Enum
Constants for selecting behavior of button LEDs. Only in use when LED animations are handled by Brian OS.
- OFF = 0¶
LED is fully off
- STANDBY = 1¶
LED is pulsing at low brightness level
- SELECTABLE = 2¶
LED is pulsing at medium brightness level
- SELECTED = 3¶
LED is pulsing at high brightness level
- inherit = 4¶
LED behavior is not set at this level; Behavior of a previous (system) level is used.
- brian.uicontrol.set_button_led(target: ButtonId | Button | Knob, animation: LedButtonAnimation, color: LedColor = 'DEFAULT_COLOR_FROM_SETTINGS') None ¶
Set desired animation and color for a specific button (target). These settings override the animation requested by the
PhysButtonOverlay
and the default os button effect, unlessLedButtonAnimation.inherit
is used.- Parametry:
target – Target button to change color. When Using
UiEventsListener.any_button
andUiEventsListener.any_button_incl_knob
, all respective buttons change color/animation.animation – Target animation.
color – Target color. When unfilled default color from settings is used.
- brian.uicontrol.enable_knob_rotation_animation(enabled: bool) None ¶
If enabled, OS automatically animates the LEDs under the knob when it rotates. The user program starts in the enabled state.
- Parametry:
enabled – Whether to animate knob rotation.