pyvisor.GUI.model package

Submodules

pyvisor.GUI.model.animal module

class pyvisor.GUI.model.animal.Animal(number: int, name: str)[source]

Bases: object

Represents a single animal being observed.

Each animal has a numeric ID, a display name, and a dictionary of Behaviour objects keyed by their label strings.

all_actions_have_buttons_assigned(animal_behaviours: List[str], movie_commands: List[str]) bool[source]
behaviour_with_name_exists(name: str)[source]
copy_behaviours(behaviours: Dict[str, Behaviour])[source]
static from_json_dict(json_dict: Dict[str, Any]) Animal[source]
static from_key_assignment_dictionary(key_assignments: Dict[str, Behaviour]) Animal[source]
get_behaviour_assigned_to(selected_device, button_identifier) Behaviour | None[source]
get_behaviours_without_buttons_assigned(device: str) List[Behaviour][source]
get_behaviours_without_icons() List[Behaviour][source]
get_button_assignments(selected_device: str) Dict[str, Behaviour][source]
get_unique_name() str[source]
has_behaviour(name: str) bool[source]
items()[source]
key_is_assigned(button_identifier) bool[source]
keys()[source]
remove_behaviour(behaviour: Behaviour)[source]
rename_behaviour(behaviour: Behaviour, name: str)[source]
to_savable_dict() Dict[str, Any][source]

pyvisor.GUI.model.behaviour module

class pyvisor.GUI.model.behaviour.Behaviour(animal_number: int = None, color: str = '#C0C0C0', icon_path: str = None, name: str = None, compatible_with: List[str] = None)[source]

Bases: ScorerAction

A scoreable behaviour linked to an animal.

Extends ScorerAction with animal association, display colour, icon path, and a compatibility list controlling which other behaviours can be active simultaneously.

ANIMAL_MOVIE = -1
static from_dict(d: Dict[str, Any]) Behaviour[source]
static from_object_dict_to_savable_dict(bindings: Dict[str, Behaviour]) Dict[str, Any][source]
static from_savable_dict_to_dict_of_objects(plain_dict: Dict[str, Dict[str, Any]]) Dict[str, Behaviour][source]
property icon
property is_movie: bool
property label: str
static parse_label(label: str) Tuple[int, str][source]
set_key_binding(device: str, binding: str)[source]
to_dict() Dict[str, Any][source]

pyvisor.GUI.model.callback_handler module

Simple observer-pattern callback registry.

class pyvisor.GUI.model.callback_handler.CallbackHandler[source]

Bases: object

Manages a set of registered callback functions.

Widgets register callables via register() and receive a numeric ID for later removal. Iterating over the handler invokes all registered callbacks.

pop(n: int)[source]
register(callback) int[source]

pyvisor.GUI.model.gui_data_interface module

class pyvisor.GUI.model.gui_data_interface.GUIDataInterface[source]

Bases: object

Central data model shared across all GUI tabs.

Holds the animal/behaviour definitions, device selection, movie bindings, autosave settings, and the active scorer instance. Provides callback hooks so UI widgets can react to model changes.

add_animal(name: str, number: int) Animal[source]
add_behaviour(animal: Animal, behav: Behaviour)[source]
change_animal_name(animal: Animal, new_name: str)[source]
change_behaviour_name(behaviour: Behaviour, name: str)[source]
change_button_binding(action: ScorerAction, button_identifier: str | None, is_behaviour: bool)[source]
get_action_assigned_to(button_identifier) Tuple[Behaviour, bool] | Tuple[None, bool][source]

Find the first action bound to button_identifier.

Returns (action, is_behaviour) or (None, False).

get_behaviours_without_icons() List[Behaviour][source]
get_button_assignments(selected_device: str) Dict[str, Behaviour][source]
get_savable_dict() Dict[str, Any][source]
get_savable_list() List[Dict[str, Any]][source]
get_scorer_actions_without_buttons_assigned() List[ScorerAction][source]
register_callback_animal_added(callback: Callable[[Animal], None]) int[source]
register_callback_behaviour_added(callback: Callable[[Animal, Behaviour], None])[source]
register_callback_compatibility_changed(callback: Callable[[Behaviour, Behaviour], None])[source]
register_callback_key_binding_changed(callback: Callable[[ScorerAction, bool], None]) int[source]
remove_animal(animal)[source]
remove_behaviour(behaviour: Behaviour)[source]
reset_all_bindings()[source]
save_state()[source]
set_compatibility(behav1: Behaviour, behav2: Behaviour, state: bool)[source]
set_icon(behaviour: Behaviour, icon_path)[source]
set_icon_color(behaviour: Behaviour, color: str)[source]
steal_button(button_identifier: str)[source]

Clear button_identifier from every behaviour and movie action.

Called before assigning the button to a new action so that no duplicates remain.

exception pyvisor.GUI.model.gui_data_interface.NameExistsException[source]

Bases: RuntimeError

exception pyvisor.GUI.model.gui_data_interface.NameIdenticalException[source]

Bases: RuntimeError

pyvisor.GUI.model.key_bindings module

class pyvisor.GUI.model.key_bindings.KeyBindings[source]

Bases: object

Per-device button/key binding storage.

Stores one binding string per supported device category: X-Box, Playstation, Keyboard, or Free.

static from_dict(d: Dict[str, None | str])[source]
get(device: str) str | None[source]
to_dict() Dict[str, None | str][source]

pyvisor.GUI.model.movie_bindings module

class pyvisor.GUI.model.movie_bindings.MovieBindings[source]

Bases: object

Collection of movie-control actions with their key bindings.

Manages bindings for play/pause, stop, forward, reverse, FPS adjustment, and frame stepping.

static from_dict(d: Dict[str, Dict[str, None | str]]) MovieBindings[source]
get_action_assigned_to(device: str, button_identifier: str) ScorerAction[source]
get_actions_without_buttons_assigned(device: str) List[ScorerAction][source]
keys()[source]
to_dict() Dict[str, Dict[str, None | str]][source]

pyvisor.GUI.model.scorer_action module

class pyvisor.GUI.model.scorer_action.ScorerAction(name: str, icon_path: str = None)[source]

Bases: object

Base class for any action that can be bound to a button.

Used for both behaviours and movie control actions (play, pause, seek, etc.). Stores per-device key bindings.

property name: str
set_name(s: str)[source]

Module contents

Data model classes shared across the pyVISOR GUI.