diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2026-06-09 18:49:05 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2026-06-09 18:49:05 -0600 |
| commit | 51f04ada503b02c598c9940c96fdc444cf5da52a (patch) | |
| tree | 7fd4db831b96323dc5451e11b63ec329a320df97 /plugins/motion_capture/camera_panel.py | |
| parent | c16b8546c72673534965da5590a62ba3ee7635d3 (diff) | |
| parent | 898fde4dc286517cb27590b2f9cd7406d9922bd4 (diff) | |
Merge fix/motion-capture: template matching + frame-freeze selection UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'plugins/motion_capture/camera_panel.py')
| -rw-r--r-- | plugins/motion_capture/camera_panel.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/plugins/motion_capture/camera_panel.py b/plugins/motion_capture/camera_panel.py index 3fdd286..5e25f7f 100644 --- a/plugins/motion_capture/camera_panel.py +++ b/plugins/motion_capture/camera_panel.py @@ -1,15 +1,25 @@ """ motion_capture/camera_panel.py -CameraPanel for AddDeviceDialog — shows selected camera info and builds -a CameraDevice when the user clicks "Add Device". +CameraPanel for AddDeviceDialog. Camera discovery and simulation toggle are handled by AddDeviceDialog. +CameraScanThread is kept here and used by the unified scanner. """ from __future__ import annotations +from typing import Optional, Tuple from PyQt6.QtCore import QThread, pyqtSignal -from PyQt6.QtWidgets import QLabel, QVBoxLayout, QWidget +from PyQt6.QtWidgets import QComboBox, QFormLayout, QLabel, QVBoxLayout, QWidget + + +_RESOLUTIONS = { + "Default": None, + "640 × 480": (640, 480), + "1280 × 720": (1280, 720), + "1920 × 1080": (1920, 1080), + "2560 × 1440": (2560, 1440), +} class CameraScanThread(QThread): @@ -38,8 +48,8 @@ class CameraPanel(QWidget): def __init__(self): super().__init__() - self._selected_index: int = 0 - self._simulate: bool = False + self._selected_index: int = 0 + self._simulate: bool = False lay = QVBoxLayout(self) lay.setContentsMargins(0, 4, 0, 4) @@ -50,6 +60,13 @@ class CameraPanel(QWidget): self._selected_lbl.setWordWrap(True) lay.addWidget(self._selected_lbl) + form = QFormLayout() + form.setContentsMargins(0, 0, 0, 0) + self.res_cb = QComboBox() + self.res_cb.addItems(list(_RESOLUTIONS.keys())) + form.addRow("Resolution:", self.res_cb) + lay.addLayout(form) + note = QLabel( "Requires OpenCV: pip install opencv-python\n" "Use Simulation mode if no camera is available." @@ -71,8 +88,12 @@ class CameraPanel(QWidget): def build_device(self, device_id: str): from device import CameraDevice + resolution: Optional[Tuple[int, int]] = _RESOLUTIONS.get( + self.res_cb.currentText() + ) return CameraDevice( device_id=device_id, camera_index=self._selected_index, simulate=self._simulate, + resolution=resolution, ) |
