composeui.core.signal

The signals, which carry events between the views, the model and the app’s code.

class composeui.core.signal.Signal[source]

Bases: Generic[Unpack[Ts]]

An event that a view, a model or the app emits, with the callbacks connected to it.

connect adds a callback, and emit calls each callback with the signal’s arguments. A callback with a main_view or model parameter gets it by name (see connect).

__init__()[source]
Return type:

None

set_name(name)[source]
Parameters:

name (str)

Return type:

None

set_main_view(main_view)[source]
Parameters:

main_view (MainView)

Return type:

None

set_model(model)[source]
Parameters:

model (Model)

Return type:

None

add_qt_signal(signal)[source]

Call this signal’s callbacks when the Qt signal signal emits too.

Parameters:

signal (SignalInstance)

Return type:

None

connect(callback: Callable[[Unpack[Ts]], None], *, now: bool = False) → None[source]
connect(callback: _MainViewCallback[_MainViewT, Unpack[Ts]], *, now: bool = False) → None
connect(callback: _ModelCallback[Any, Unpack[Ts]], *, now: bool = False) → None
connect(callback: _BoundCallback[_MainViewT, Any, Unpack[Ts]], *, now: bool = False) → None
connect(callback: Callable[[], None], *, now: bool = False) → None
connect(callback: _MainViewOnlyCallback[_MainViewT], *, now: bool = False) → None
connect(callback: _ModelCallback[Any], *, now: bool = False) → None
connect(callback: _BoundCallback[_MainViewT, Any], *, now: bool = False) → None
connect(callback: Callable[[_FirstT], None], *, now: bool = False) → None

Call callback on each emit, and once right away too if now.

The callback gets the main_view and the model it asks for by name. It gets only as many of the signal’s arguments as it takes, the first ones, and none when called now.

Parameters:
Return type:

None

disconnect()[source]
Return type:

None

emit(*args)[source]
Parameters:

args (Unpack[Ts])

Return type:

None

static get_function_name(callback)[source]
Parameters:

callback (CallbackT[Any])

Return type:

str

static get_function_file(callback)[source]
Parameters:

callback (CallbackT[Any])

Return type:

str