Main GUI application for labeling, training/inference, and proofreading.
Each open project is an instance of
The main window contains a
QtVideoPlayer widget for showing
video frames (the video player widget contains both a graphics view widget
that shows the frame image and a seekbar widget for navigation). The main
window also contains various “data views”–tables which can be docked
in the window as well as a status bar.
When a new instance of
MainWindow is created, it creates
all of these widgets, sets up the menus, and also creates
multiple overlay objects (subclasses of
A timer is started (runs via Qt event loop) which enables/disables various menu items and buttons based on current state (e.g., you can’t delete an instance if no instance is selected).
Shortcuts are loaded using
Shortcuts class. Preferences
are loaded by importing prefs, a singleton instance of
GuiState is used for storing “global” state for the project
Labels object, the current frame, current instance,
whether to show track trails, etc.). every menu command with state
(e.g., check/uncheck) should be connected to a state variable.
CommandContext has methods which can be triggered
by menu items/buttons/etc in the GUI to perform various actions. The
command context enforces a pattern for implementing each command in
its own class, it keeps track of whether there are unsaved changes
(and in the future would make it easier to implement undo/redo), and
it handles triggering the relevant updates in the GUI based on the
effects of the command (these are passed using UpdateTopic enum and
handed by :py:method:`MainWindow.on_data_update()`).
ColorManager loads color palettes, keeps track of current
palette, and should always be queried for how to draw instances–this
ensures consistency (e.g.) between color of instances drawn on video
frame and instances listed in data view table.
MainWindow(labels_path: Optional[str] = None, *args, **kwargs)¶
The SLEAP GUI application.
Each project (Labels dataset) that you have loaded in the GUI will have its own MainWindow object.
Labelsdataset. If None, a new, empty project (i.e.,
Labelsobject) will be created.
Object that holds GUI state, e.g., current video, frame, whether to show node labels, etc.
Closes application window, prompting for saving as needed.
event(e: PySide2.QtCore.QEvent) → bool¶
Custom event handler.
We use this to ignore events that would clear status bar.
e – The event.
True if we ignore event, otherwise returns whatever the usual event handler would return.
loadLabelsObject(labels: sleap.io.dataset.Labels, filename: Optional[str] = None)¶
Loads a Labels object into the GUI, replacing any currently loaded.
labels – The Labels object to load.
filename – The filename where this file is saved, if any.
loadProjectFile(filename: Optional[str] = None)¶
Loads given labels file into GUI.
filename – The path to the saved labels dataset. If None, then don’t do anything.
- Return type
Plots (or replots) current frame.
Decorates a function with a call to first process events.
Sets window title (if value is not None).
updateStatusMessage(message: Optional[str] = None)¶
Updates status bar.
Starts new instance of app.