polychron.GUIApp
Module
The main GUI App class, which initialises the GUI application and can be used to run the main render loop
GUIApp
Bases: Mediator
Main GUIApp which is provides the main entry point, initialises the Models, Views and Presenters and opens the main window.
This includes code which used to belong to MainFrame
This is the only class/file which should import tkinter / ThemedTK other than View classes (unless needed for typehinting?)
set_window_title
set_window_title(suffix: str | None = None) -> None
Update the window title to include Polychron, the version of polychron, and the optional suffix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
suffix
|
str | None
|
an optional suffix which will be appended to the default window title |
None
|
get_presenter
get_presenter(key: str | None) -> FramePresenter | None
Get a main frame presenter by it's name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str | None
|
The string key used for the presenter |
required |
Returns:
Type | Description |
---|---|
FramePresenter | None
|
The FramePresenter if the key is valid, else None. |
switch_presenter
switch_presenter(key: str | None) -> None
Switch the current presenter using the provided key
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str | None
|
The key for the presenter to switch to (if not None) |
required |
register_global_keybinds
register_global_keybinds() -> None
Register application-wide key bindings
register_protocols
register_protocols() -> None
Register protocols with the root window - i.e. what to do on (graceful) application exit
save_current_model
save_current_model(event: Any | None = None) -> None
If a model is currently open, save it
exit_application
exit_application(event: Any | None = None) -> None
Callback function for graceful application exit via keybind or window manager close.
resize_window
resize_window(geometry: str) -> None
resize the root window geometry to be the maximum of the configured size and the screen size reported by tkinter.
Note for multi-monitor setups this may/will be incorrect.
launch
launch(project_name: str | None = None, model_name: str | None = None) -> None
Method to launch the GUIApp, i.e. start the render loop
If an invalid project or model name is provided (i.e '.'), a warning is printed to console and the model selector is started.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name
|
str | None
|
An optional project to start with |
None
|
model_name
|
str | None
|
An optional model, within the optional project, to start with |
None
|