UISelector
Preview notice
The MatrixOS Python API is in preview and is subject to change; it may contain errors.
Overview
The UISelector component provides a versatile selection interface with multiple lighting modes and layout directions. It's ideal for creating value selectors, level indicators, and interactive controls.
The UISelector component is implemented in Applications/Python/PikaPython/MatrixOS_UISelector.py with type hints in Applications/Python/PikaPython/_MatrixOS_UISelector.pyi.
Constructor
MatrixOS.UISelector()
class UISelector(UIComponent):
def __init__(self) -> None
Creates a new selector component.
Enumerations
UISelectorDirection
class UISelectorDirection:
RIGHT_THEN_DOWN: int = 0
DOWN_THEN_RIGHT: int = 1
LEFT_THEN_DOWN: int = 2
DOWN_THEN_LEFT: int = 3
UP_THEN_RIGHT: int = 4
RIGHT_THEN_UP: int = 5
UP_THEN_LEFT: int = 6
LEFT_THEN_UP: int = 7
UISelectorLitMode
class UISelectorLitMode:
LIT_EQUAL: int = 0 # Light only the selected value
LIT_LESS_EQUAL_THAN: int = 1 # Light all values <= selected
LIT_GREATER_EQUAL_THAN: int = 2 # Light all values >= selected
LIT_ALWAYS: int = 3 # Always light all positions
Behavior Functions
SetValueFunc
def SetValueFunc(self, getValueFunc: any) -> bool
Sets a function to get the current selector value.
Parameters:
getValueFunc(function): Function returning current value
Returns:
bool: True if successful
SetColorFunc
def SetColorFunc(self, colorFunc: any) -> bool
Sets a function to determine the selector color.
Parameters:
colorFunc(function): Function returning current color
Returns:
bool: True if successful
SetIndividualColorFunc
def SetIndividualColorFunc(self, individualColorFunc: any) -> bool
Sets a function to determine individual position colors.
Parameters:
individualColorFunc(function): Function returning color for each position
Returns:
bool: True if successful
SetNameFunc
def SetNameFunc(self, nameFunc: any) -> bool
Sets a function to determine the selector name.
Parameters:
nameFunc(function): Function returning current name
Returns:
bool: True if successful
Configuration Methods
SetLitMode
def SetLitMode(self, litMode: int) -> bool
Sets the lighting mode for the selector.
Parameters:
litMode(int): Lighting mode fromUISelectorLitMode
Returns:
bool: True if successful
SetDimension
def SetDimension(self, dimension: Dimension) -> bool
Sets the size of the selector.
Parameters:
dimension(Dimension): Selector dimensions
Returns:
bool: True if successful
SetName
def SetName(self, name: str) -> bool
Sets the selector name.
Parameters:
name(str): Selector name
Returns:
bool: True if successful
SetCount
def SetCount(self, count: int) -> bool
Sets the number of selectable positions.
Parameters:
count(int): Number of positions
Returns:
bool: True if successful
SetDirection
def SetDirection(self, direction: int) -> bool
Sets the layout direction for the selector.
Parameters:
direction(int): Direction fromUISelectorDirection
Returns:
bool: True if successful
SetColor
def SetColor(self, color: Color) -> bool
Sets the base color for the selector.
Parameters:
color(Color): Base color
Returns:
bool: True if successful
Callback Functions
OnChange
def OnChange(self, changeCallback: any) -> bool
Sets a callback function for when the selection changes.
Parameters:
changeCallback(function): Function called on value change
Returns:
bool: True if successful
Comments