summaryrefslogtreecommitdiff
path: root/plugins/motion_capture/camera_panel.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/motion_capture/camera_panel.py')
-rw-r--r--plugins/motion_capture/camera_panel.py31
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,
)