polychron.interfaces
Module
Mediator
Bases: Protocol
Interface for classes which provide methods to swtich the active view/presenter, as expected by Presenters
This avoids a circular dependency between the GUIApp and presenters.
switch_presenter
switch_presenter(key: str | None) -> None
Switch the active presenter & view by string key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str | None
|
The key of the presenter to switch to |
required |
get_presenter
get_presenter(key: str | None) -> Union['FramePresenter', 'PopupPresenter'] | None
Get a presenter by it's Key, if it valid
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str | None
|
The key of the presenter to fetch |
required |
Returns:
Type | Description |
---|---|
Union['FramePresenter', 'PopupPresenter'] | None
|
The FramePresenter or PopupPresenter to be switchted to, or None |
close_window
close_window(reason: str | None = None) -> None
Gracefully close any windows this meadiator is in charge of.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reason
|
str
|
A string to pass to the presenter, enabling follow on actions. |
None
|
Writable
Bases: Protocol
A protocol for objects which implement write(str)