Session
- class compas_ui.session.Session(*args, **kwargs)[source]
Bases:
Singleton
The session singleton tracks data stored in an app.
- Parameters:
name (str, optional) – Name of the session. Defaults to the name of the session class.
directory (str, optional) – The directory where the session should be saved. Defaults to the directory containing the script running the session.
extension (str, optional) – The extension used for saving the session to disk. Defaults to ‘json’.
autosave (bool, optional) – If True, automatically save the session to file at interpreter shutdown. Defaults to False.
- Attributes:
name (str) – Name of the session.
directory (str) – The directory where the session should be saved.
extension (str) – The extension used for saving the session to disk.
autosave (bool) – If True, automatically save the session to file at interpreter shutdown.
filename (str) – Name of the session file used for persistent storage.
filepath (str) – Full path to the session file used for persistent storage.
Methods
Load session data from a session file.
Add the current data to recorded history making it available for undo/redo.
Redo recent changes by reverting the data to the version recorded after the current one.
Reset the session to a blank state.
Save the session data to the current file.
Save the session to a new file.
Undo recent changes by reverting the data to the version recorded before the current one.