API Reference

Bindings

class nova.mvvm.trame_binding.TrameBinding(state: State)

Binding Interface implementation for Trame.

new_bind(linked_object: Any | None = None, linked_object_arguments: list[str] | None = None, callback_after_update: None | Callable[[dict[str, Any]], None] | Callable[[dict[str, Any]], Coroutine[Any, Any, None]] = None) TrameCommunicator

Bind a ViewModel or Model variable to a GUI framework element, allowing for synchronized updates.

This method creates a binding between a variable in a ViewModel/Model and a corresponding element in the GUI.

Parameters:
  • linked_object (object, dictionary or function, optional) – Instance to link with the ViewModel/Model variable. When specified, changes in View trigger update for this instance. We recommend to use a Pydantic model as an object since it provides the means to validate data and use model metadate in GUI (like title, tips, …)

  • linked_object_arguments (list of str, optional, ignored with Pydantic model) – If the linked_object is a class instance(object) one can provide a list of argument names associated with linked_object that define specific attributes to bind. If not provided, the default behavior is to bind all attributes.

  • callback_after_update (Callable, optional) – A function to be called after each update to linked_object. Useful for additional actions or processing post-update.

Returns:

An object that manages the binding, allowing updates to propagate between the ViewModel/Model variable and the GUI framework element.

Return type:

Communicator

new_worker(task: Callable[[...], Any], *args: Any, **kwargs: Any) Worker

Creates an instance of a Worker class to be used to run tasks in background.

class nova.mvvm.pyqt6_binding.PyQt6Binding

Binding Interface implementation for PyQt.

new_bind(linked_object: Any = None, linked_object_arguments: Any = None, callback_after_update: Any = None) Any

Each new_bind returns an object that can be used to bind a ViewModel/Model variable.

For PyQt we use pyqtSignal to trigger GU I update and linked_object to trigger ViewModel/Model update

new_worker(task: Callable[[...], Any], *args: Any, **kwargs: Any) Worker

Creates an instance of a Worker class to be used to run tasks in background.

class nova.mvvm.pyqt5_binding.PyQt5Binding

Binding Interface implementation for PyQt.

new_bind(linked_object: Any = None, linked_object_arguments: Any = None, callback_after_update: Any = None) Any

Each new_bind returns an object that can be used to bind a ViewModel/Model variable.

For PyQt we use pyqtSignal to trigger GU I update and linked_object to trigger ViewModel/Model update

new_worker(task: Callable[[...], Any], *args: Any, **kwargs: Any) Worker

Creates an instance of a Worker class to be used to run tasks in background.