GUI API¶
Main Window¶
body_eye_sync.gui.main_window
¶
MainWindow
¶
Bases: QMainWindow
Source code in src/body_eye_sync/gui/main_window.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
load_experiment(folder)
¶
Open an experiment folder, as the File â–¸ Open action does.
Public entry point for launching the GUI on an experiment directly. Invalid folders are reported to the user, not raised.
Source code in src/body_eye_sync/gui/main_window.py
Pipeline Editor¶
body_eye_sync.gui.pipeline_editor
¶
Editor for an experiment's pipeline: which steps run, and their arguments.
The pipeline structure is hard-coded here -- the known steps and their order --
while each step's arguments are edited by an auto-generated :class:PydanticForm.
Object tracking is the mandatory base pass; face and body-pose detection are
optional passes that run over its tracked boxes, so they are toggled on/off.
This widget concerns itself only with the pipeline; managing the experiment's inputs (videos, gaze data, ...) is a separate interface.
PipelineEditor
¶
Bases: QWidget
Edit an experiment's pipeline steps and their arguments.
Populate from an experiment with :meth:set_from (or :meth:reset to
defaults), and write the edited values back into one with :meth:apply_to.
changed fires on any toggle or field edit. Each step has its own "Run"
button (run_requested, with the step's type); run_all_requested fires
from the button that runs every enabled step in order. Running is out of
scope for this widget -- it only reports the requests, and its buttons'
enabled state is driven from outside via
:meth:set_run_enabled/:meth:set_run_all_enabled.
Source code in src/body_eye_sync/gui/pipeline_editor.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
apply_to(config)
¶
Write the edited steps back onto config's pipeline fields.
Disabled optional steps become None. All steps are validated before
anything is assigned, so an invalid field leaves config intact.
Raises :class:pydantic.ValidationError / :class:ValueError if any
step's arguments are invalid.
Source code in src/body_eye_sync/gui/pipeline_editor.py
config_for(step_type)
¶
The validated config for one step, whether or not it is enabled.
Lets an interactive run of a single pass use the arguments the user has
set, independent of whether the step is toggled into the saved pipeline.
Raises :class:pydantic.ValidationError / :class:ValueError if invalid.
Source code in src/body_eye_sync/gui/pipeline_editor.py
enabled_steps()
¶
The enabled steps, in order, built and validated from the widgets.
Raises :class:pydantic.ValidationError / :class:ValueError if any
enabled step's arguments are invalid.
Source code in src/body_eye_sync/gui/pipeline_editor.py
reset()
¶
Reset every step to its defaults, optional steps switched off.
set_from(config)
¶
Populate the editor from config's pipeline (no changed).
Source code in src/body_eye_sync/gui/pipeline_editor.py
set_run_enabled(step_type, enabled)
¶
Enable/disable one step's "Run" button (e.g. while its inputs aren't ready).
Video Viewer¶
body_eye_sync.gui.video_viewer
¶
A Qt widget that plays a video with frame-accurate seeking, and displays boxes
VideoViewer
¶
Bases: QWidget
Display a video with play/pause, a seek slider and a frame spinbox.
Source code in src/body_eye_sync/gui/video_viewer.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
enable_controls(enable)
¶
Enable or disable the play button and seek controls.
Source code in src/body_eye_sync/gui/video_viewer.py
load(video)
¶
Display video, showing its first frame and its boxes (if any).
Source code in src/body_eye_sync/gui/video_viewer.py
refresh_overlays()
¶
Redraw the current frame's person boxes and any detected faces.
Source code in src/body_eye_sync/gui/video_viewer.py
set_frame(index)
¶
show_live_face_frame(result)
¶
Display a freshly face-detected frame, with person boxes and faces.
Connected to the face-detection worker's per-frame signal; result is
a :class:FaceFrameResult with 0-based indexing. The person boxes come
from the already-tracked video, the faces straight from the result.
Source code in src/body_eye_sync/gui/video_viewer.py
show_live_frame(frame)
¶
Display a freshly tracked frame and draw its boxes directly.
Connected to the object tracking worker's per-frame signal; frame is
a BoxMOT per-frame result with 1-based indexing.
Source code in src/body_eye_sync/gui/video_viewer.py
show_live_pose_frame(result)
¶
Display a freshly pose-detected frame, with person boxes and poses.
Connected to the body-pose worker's per-frame signal; result is a
:class:PoseFrameResult with 0-based indexing. The person boxes come
from the already-tracked video, the poses straight from the result.
Source code in src/body_eye_sync/gui/video_viewer.py
Pydantic Form¶
body_eye_sync.gui.pydantic_form
¶
Auto-generate an editing form for a flat pydantic model.
:class:PydanticForm builds one input widget per model field from the field's
type, constraints and metadata, so the pydantic schema stays the single source
of truth for both serialisation and the GUI. It supports the scalar field types
the pipeline step models use (str, int, float, bool, a
list of scalars) plus choices metadata; it is not a general recursive
form and does not descend into nested models.
Widget mapping:
choicesinjson_schema_extra-> editable :class:QComboBoxbool-> :class:QCheckBoxint(withge/lebounds) -> :class:QSpinBoxfloat(withge/lebounds)-> :class:QDoubleSpinBoxlist[...]-> :class:QLineEdit(comma separated)- anything else /
str-> :class:QLineEdit
Literal fields (the discriminator tags) are fixed and not shown.
PydanticForm
¶
Bases: QWidget
An editing form for one flat pydantic model instance.
Populate from a model with :meth:from_model, read the edited values back
(validated) with :meth:to_model. changed fires on any edit.
Source code in src/body_eye_sync/gui/pydantic_form.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
from_model(model)
¶
Populate the widgets from model's current values.
Source code in src/body_eye_sync/gui/pydantic_form.py
to_model()
¶
Build a validated model from the current widget values.
Raises :class:pydantic.ValidationError (or :class:ValueError from
list parsing) if the edited values are invalid.
Source code in src/body_eye_sync/gui/pydantic_form.py
Workers¶
body_eye_sync.gui.base_worker
¶
BaseWorker
¶
Bases: QObject
Runs a video pipeline off the GUI thread, into a :class:Video.
Subclasses supply the per-run work: :meth:_items yields each computed
frame/result, :meth:_accumulate stores one into the video, :meth:_finalise
folds the accumulated results once the run completes, and :meth:_discard
rolls the video back if the run is cancelled or fails. Each item is emitted
via new_frame so the GUI can draw it live; finished (after
:meth:_finalise) or cancelled (after :meth:_discard) fires once the
run ends, and any exception is reported via failed with a traceback (also
after :meth:_discard). operation_name labels the run for the GUI.
Source code in src/body_eye_sync/gui/base_worker.py
body_eye_sync.gui.object_tracking_worker
¶
ObjectTrackingWorker
¶
Bases: BaseWorker
Runs :func:detect_tracklets off the GUI thread, into a :class:Video.
Each tracked frame is appended to the :class:Video as it is computed and
emitted via new_frame so the GUI can draw it live; the results are folded
into the video once the run finishes, or discarded if it is cancelled/fails.
The tracking arguments come from step.
Source code in src/body_eye_sync/gui/object_tracking_worker.py
body_eye_sync.gui.face_detection_worker
¶
FaceDetectionWorker
¶
Bases: BaseWorker
Runs :func:detect_faces off the GUI thread, into a :class:Video.
Faces are detected inside the person boxes already tracked into the
:class:Video. Each frame's faces are accumulated and emitted via
new_frame so the GUI can draw them live, then folded onto the matching
rows once the run finishes; a cancelled/failed pass keeps the tracked boxes.
The detection arguments come from step.
Source code in src/body_eye_sync/gui/face_detection_worker.py
body_eye_sync.gui.body_pose_worker
¶
BodyPoseWorker
¶
Bases: BaseWorker
Runs :func:detect_body_poses off the GUI thread, into a :class:Video.
Body poses are detected inside the person boxes already tracked into the
:class:Video. Each frame's poses are accumulated and emitted via
new_frame so the GUI can draw them live, then folded onto the matching
rows once the run finishes; a cancelled/failed pass keeps the tracked boxes.
The detection arguments come from step.
Source code in src/body_eye_sync/gui/body_pose_worker.py
Utilities¶
body_eye_sync.gui.utils
¶
body_eye_sync.gui.autoupdate
¶
Check GitHub for a newer version of body-eye-sync and offer to install it.
The version currently comes from the pyproject.toml on the main branch on
GitHub, and updates are installed straight from a source archive of that branch.
If any deps are missing we instead point the user at the full installer.
TODO: Once body-eye-sync is published on PyPI, check the version there
(https://pypi.org/pypi/body-eye-sync/json) and install with
pip install --upgrade body-eye-sync instead of using GitHub.
UpdateInfo
dataclass
¶
check_for_update()
¶
Return info about a newer version if found, otherwise None.