shellui.common package¶
shellui.common.debug module¶
- shellui.common.debug.create_level(level: int, name: str)¶
- shellui.common.debug.debug_start(logging_filename: str = 'shellui.log', logging_level: int = 7, logging_format: str = '%(asctime)s - %(levelname)s - %(filename)s : %(message)s\n', save_traceback: bool = True) None¶
shellui.common.interfaces module¶
- class shellui.common.interfaces.AbstractLayoutInterface(*args, **kwargs)¶
Bases:
BaseElementInterface,Protocol- add_elements(*args, **kwargs) BaseElementInterface | Collection¶
- elements: Collection¶
- search_elements_by_tag(tag: str) Collection¶
- class shellui.common.interfaces.BaseElementInterface(*args, **kwargs)¶
Bases:
Protocol- deselect() None¶
- event: EventManagerInterface¶
- flags: FlagsManagerInterface¶
- keyboard: KeyboardManagerInterface¶
- select() None¶
- set_floating_size() None¶
- state: ElementState¶
- tag: str¶
- update() Any¶
- class shellui.common.interfaces.CallInterface(*args, **kwargs)¶
Bases:
Protocol
- class shellui.common.interfaces.CreateInterface(cls: EventManagerInterface)¶
Bases:
Protocol
- class shellui.common.interfaces.EventManagerInterface(parent: object)¶
Bases:
Protocol- call: CallInterface¶
- call_event(event_name: str) Any¶
- set: CreateInterface¶
- set_events(*args, **kwargs)¶
- class shellui.common.interfaces.FlagsManagerInterface(*args, **kwargs)¶
Bases:
Protocol- flags: dict¶
- parent: BaseElementInterface¶
- class shellui.common.interfaces.KeyboardManagerInterface(*args, **kwargs)¶
Bases:
Protocol- add_keyboard_event(function: ~typing.Callable, _lambda: ~typing.Callable = <function KeyboardManagerInterface.<lambda>>) KeyboardEvent¶
- key_pressed(key_char) List[Any]¶
- keyboard_events: List[KeyboardEvent]¶
- parent: BaseElementInterface¶
shellui.common.types module¶
- class shellui.common.types.Buffer(function: Callable[[], str | List[Self]] = None, position: Position = None, size: Size = None)¶
Bases:
objectRepresents a container for storing method and position used in text interface.
- Parameters:
- function: Callable[[], str | List[Self]] = None¶
- class shellui.common.types.Collection(elements: List[BaseElementInterface] = None)¶
Bases:
listRepresents an extended list and provides type safety for elements that must implement BaseElementInterface interface
- Parameters:
interface_level (Type) – Specifies the elements type that the collection can hold
- append(element: BaseElementInterface)¶
Append object to the end of the list.
- call_elements_event(event: str, rule: ~typing.Callable[[~shellui.common.interfaces.BaseElementInterface], bool] = <function Collection.<lambda>>, args: ~typing.List = None, kwargs: ~typing.Dict = None) List[Any]¶
Calls event with args and kwargs arguments on elements that satisfy rule condition.
- Parameters:
event (Text) – Event name
rule (Callable[[BaseElementInterface], bool]) – Condition function for filtering elements
args (List) – Positional arguments that will be passed to event
kwargs (Dict) – Named arguments that will be passed to event
- Returns:
Returned values of filtered collection elements
- Return type:
List[Any]
- get_elements_collection(rule: ~typing.Callable[[~shellui.common.interfaces.BaseElementInterface], bool] = <function Collection.<lambda>>) Self¶
Returns filtered collection of elements that satisfy rule condition.
- Parameters:
rule (Callable[[BaseElementInterface], bool]) – Condition function for filtering elements
- Returns:
Filtered collection of elements
- Return type:
- insert(index: int, element: BaseElementInterface)¶
Insert object before index.
- interface_level¶
Specifies the elements type that the collection can hold
alias of
BaseElementInterface
- set_elements_attribute(attribute: str, value: ~typing.Any, rule: ~typing.Callable[[~shellui.common.interfaces.BaseElementInterface], bool] = <function Collection.<lambda>>) Self¶
Sets attribute value for elements that satisfy rule condition.
- Parameters:
attribute (Text) – Attribute name to be set
value (Any) – Value to set for attribute
rule (Callable[[BaseElementInterface], bool]) – Condition function for filtering elements
- Returns:
Filtered collection of elements
- Return type:
- class shellui.common.types.Dimensions¶
Bases:
ABCRepresent abstract base class of dimensions with basic arithmetic operations.
- class shellui.common.types.ElementState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
EnumEnum representing the state of an element.
- Parameters:
MISSED (int) – Indicates that the element was missed
SELECTED (int) – Indicates that the element was selected
- MISSED = 0¶
- SELECTED = 1¶
- class shellui.common.types.EventUnit(event_name: str, parent: BaseElementInterface)¶
Bases:
objectRepresents event unit that associated function with EventManager class
- event_name: str¶
- parent: BaseElementInterface¶
Parent class object
- class shellui.common.types.KeyboardEvent(function: Callable[[], Any], rule: Callable[[int], bool])¶
Bases:
objectRepresents a keyboard event.
- Parameters:
function (Callable[[], Any]) – The function to be executed on the event.
rule (Callable[[int], bool]) – Condition function for filtering elements
- function: Callable[[], Any]¶
- rule: Callable[[int], bool]¶
- class shellui.common.types.Position(x: int, y: int)¶
Bases:
DimensionsRepresents a position in a 2D space.
- Parameters:
x (int) – X-coordinate of the position.
y (int) – Y-coordinate of the position.
- x: int¶
- y: int¶
- class shellui.common.types.Size(width: int, height: int)¶
Bases:
DimensionsRepresents the size with width and height.
- Parameters:
width (int) – Width dimension.
height (int) – Height dimension.
- height: int¶
- width: int¶