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