diff --git a/docs/gui-guide.md b/docs/gui-guide.md index 6bb936b..c4cdcaa 100644 --- a/docs/gui-guide.md +++ b/docs/gui-guide.md @@ -6,44 +6,19 @@ PySide6 desktop application for controlling the YoloCam S3 camera with live vide 1. YoloCam S3 connected via USB 2. CDC NCM network interface configured (camera at 192.168.126.10) -3. System packages: - ```bash - sudo apt install python3-pyside6.qtcore python3-pyside6.qtgui \ - python3-pyside6.qtwidgets python3-opencv - ``` -4. `yolocam-lib` installed: `cd yolocam-lib && pip install -e .` +3. Install via `make install && make install-gui-deps` from the repository root -**Important**: Use PySide6 from `apt`, not from `pip`. The pip version conflicts +**Important**: PySide6 must come from `apt`, not from `pip`. The pip version conflicts with system Qt6 libraries. ## Launching ```bash -cd yolocam-gui -python run.py +yolocam-gui ``` The application auto-connects to the camera on startup and displays the UVC video feed. -## Interface Layout - -``` -┌──────┬─────────────────────┬──────────────────────────────────┐ -│ │ │ │ -│ Side │ Panel Area │ Video Feed │ -│ bar │ (scrollable) │ (live UVC) │ -│ │ │ │ -│ [1] │ │ │ -│ [2] │ │ │ -│ [3] │ │ │ -│ [4] │ │ │ -│ [5] │ │ │ -│ │ │ │ -├──────┴─────────────────────┴──────────────────────────────────┤ -│ Status bar │ -└───────────────────────────────────────────────────────────────┘ -``` - ## Panels ### 1. Camera Parameters (Ctrl+1) @@ -96,9 +71,12 @@ shows the result of fast mode edits. Protocol console showing raw command/response traffic. -### 4. Stream (Ctrl+4) +### 4. Output (Ctrl+4) -Streaming and recording controls. +HDMI and UVC output settings. The S3 does not support network streaming (RTMP/SRT/RTSP); +it operates as a USB webcam with HDMI passthrough. + +**HDMI Output** -- Format (Auto/4K/1080p/720p), Color Space (Auto/RGB/YUV422) ### 5. Settings (Ctrl+5) @@ -112,7 +90,7 @@ Application configuration. | Ctrl+1 | Camera Parameters panel | | Ctrl+2 | Color Grading panel | | Ctrl+3 | Console panel | -| Ctrl+4 | Stream panel | +| Ctrl+4 | Output panel | | Ctrl+5 | Settings panel | | Ctrl+Shift+C | Toggle camera connection | | F11 | Toggle fullscreen | @@ -127,6 +105,9 @@ Application configuration. - Panel shortcuts (Ctrl+1 through Ctrl+5) - Toggle Fullscreen (F11) +**Help** +- Documentation (opens GitLab repository) + ## Color Grading Workflow ### Quick Color Correction (Fast Mode) diff --git a/yolocam-gui/yolocam_gui/controller.py b/yolocam-gui/yolocam_gui/controller.py index 93b497a..293c328 100644 --- a/yolocam-gui/yolocam_gui/controller.py +++ b/yolocam-gui/yolocam_gui/controller.py @@ -89,8 +89,6 @@ class CameraController(QObject): self._client.camera_connected.connect(self._on_connected) self._client.camera_disconnected.connect(self._on_disconnected) self._client.error_occurred.connect(self._on_error) - self._client.recording_state_changed.connect(self._console_panel.set_recording_state) - self._client.recording_duration_changed.connect(self._console_panel.set_recording_duration) self._panel.param_changed.connect(self._on_param_changed) self._panel.refresh_requested.connect(self.refresh_all) @@ -180,14 +178,6 @@ class CameraController(QObject): if not self._connected: return - if name == "recording-start": - self._do_recording(True) - return - - if name == "recording-stop": - self._do_recording(False) - return - if name == "ai-tracking": self._do_ai_tracking(int(value)) return @@ -262,19 +252,6 @@ class CameraController(QObject): threading.Thread(target=_send, daemon=True, name=f"set-{name}").start() - def _do_recording(self, start: bool): - def _run(): - if start: - success = self._client.start_recording() - else: - success = self._client.stop_recording() - - if not success: - log.warning("Recording %s failed", "start" if start else "stop") - self._client.recording_state_changed.emit(not start) - - threading.Thread(target=_run, daemon=True, name="recording").start() - def _do_ai_tracking(self, mode: int): def _run(): self._client.set_ai_tracking(mode) @@ -393,7 +370,7 @@ class CameraController(QObject): if name == "wb-mode": return int(value) - if name in ("shading", "hdr", "exposure-lock", "wb-lock", "focus-caf", "au-gain", "uvc"): + if name in ("shading", "hdr", "exposure-lock", "wb-lock", "focus-caf", "au-gain"): return 1 if value else 0 if name == "zoom": diff --git a/yolocam-gui/yolocam_gui/ui/main_window.py b/yolocam-gui/yolocam_gui/ui/main_window.py index c6c4b57..74b6225 100644 --- a/yolocam-gui/yolocam_gui/ui/main_window.py +++ b/yolocam-gui/yolocam_gui/ui/main_window.py @@ -17,8 +17,8 @@ import logging -from PySide6.QtCore import Qt, QTimer -from PySide6.QtGui import QKeySequence, QShortcut +from PySide6.QtCore import Qt, QTimer, QUrl +from PySide6.QtGui import QDesktopServices, QKeySequence, QShortcut from PySide6.QtWidgets import ( QMainWindow, QWidget, QHBoxLayout, QScrollArea, QStackedWidget, QSizePolicy, ) @@ -112,7 +112,7 @@ class MainWindow(QMainWindow): for i, (label, key) in enumerate([ ("Camera", "1"), ("Color", "2"), ("Console", "3"), - ("Stream", "4"), ("Settings", "5"), + ("Output", "4"), ("Settings", "5"), ]): action = view_menu.addAction(label) action.setShortcut(QKeySequence(f"Ctrl+{key}")) @@ -124,7 +124,10 @@ class MainWindow(QMainWindow): fullscreen_action.triggered.connect(self._toggle_fullscreen) help_menu = menu_bar.addMenu("Help") - help_menu.addAction("Documentation") + doc_action = help_menu.addAction("Documentation") + doc_action.triggered.connect( + lambda: QDesktopServices.openUrl(QUrl("https://gitlab.com/sethhillbrand/yolocam-linux")) + ) def _switch_panel(self, index: int): if 0 <= index < self._stacked.count(): diff --git a/yolocam-gui/yolocam_gui/ui/panels/console_panel.py b/yolocam-gui/yolocam_gui/ui/panels/console_panel.py index 8822940..d8c58c3 100644 --- a/yolocam-gui/yolocam_gui/ui/panels/console_panel.py +++ b/yolocam-gui/yolocam_gui/ui/panels/console_panel.py @@ -13,127 +13,22 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""Console panel with recording, AI tracking, and zoom controls.""" +"""Console panel with AI tracking and zoom controls.""" from PySide6.QtCore import Qt, Signal from PySide6.QtWidgets import ( QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, ) -from PySide6.QtGui import QFont, QPainter, QColor +from PySide6.QtGui import QFont from ..theme import ( - COLOR_ACCENT, COLOR_BG_PANEL, COLOR_BG_INPUT, COLOR_BORDER, - COLOR_TEXT_PRIMARY, COLOR_TEXT_SECONDARY, + COLOR_BG_PANEL, COLOR_BG_INPUT, COLOR_BORDER, ) from ..widgets import CollapsibleSection, SegmentButton AI_TRACKING_MAP = {0: 2, 1: 0, 2: 1} -class _RecordButton(QPushButton): - """Circular record button that toggles between ready and recording states.""" - - def __init__(self, parent=None): - super().__init__(parent) - self._recording = False - self.setFixedSize(60, 60) - self.setCursor(Qt.CursorShape.PointingHandCursor) - self.setStyleSheet("QPushButton { background: transparent; border: none; }") - - @property - def recording(self) -> bool: - return self._recording - - @recording.setter - def recording(self, value: bool): - self._recording = value - self.update() - - def paintEvent(self, event): - p = QPainter(self) - p.setRenderHint(QPainter.RenderHint.Antialiasing) - - p.setPen(Qt.PenStyle.NoPen) - p.setBrush(QColor(COLOR_ACCENT)) - p.drawEllipse(2, 2, 56, 56) - - p.setBrush(QColor(COLOR_TEXT_PRIMARY)) - - if self._recording: - # White square (stop icon) - p.drawRoundedRect(20, 20, 20, 20, 3, 3) - else: - # White circle (record icon) - p.drawEllipse(17, 17, 26, 26) - - p.end() - - -class _RecordingSection(CollapsibleSection): - """Recording controls with record button, duration, and status.""" - - param_changed = Signal(str, object) - - def __init__(self, parent=None): - super().__init__("Recording", parent) - - self._recording = False - - btn_container = QWidget() - btn_layout = QVBoxLayout(btn_container) - btn_layout.setContentsMargins(0, 4, 0, 4) - btn_layout.setSpacing(6) - btn_layout.setAlignment(Qt.AlignmentFlag.AlignCenter) - - self.record_btn = _RecordButton() - self.record_btn.clicked.connect(self._toggle_recording) - btn_layout.addWidget(self.record_btn, 0, Qt.AlignmentFlag.AlignCenter) - - self.duration_label = QLabel("00:00:00") - duration_font = QFont("monospace", 14) - self.duration_label.setFont(duration_font) - self.duration_label.setAlignment(Qt.AlignmentFlag.AlignCenter) - btn_layout.addWidget(self.duration_label) - - self.status_label = QLabel("Ready") - self.status_label.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.status_label.setStyleSheet(f"color: {COLOR_TEXT_SECONDARY};") - btn_layout.addWidget(self.status_label) - - self.add_widget(btn_container) - - def _toggle_recording(self): - self._recording = not self._recording - self.record_btn.recording = self._recording - - if self._recording: - self.status_label.setText("Recording") - self.status_label.setStyleSheet(f"color: {COLOR_ACCENT};") - self.param_changed.emit("recording-start", True) - else: - self.status_label.setText("Ready") - self.status_label.setStyleSheet(f"color: {COLOR_TEXT_SECONDARY};") - self.param_changed.emit("recording-stop", True) - - def set_recording_state(self, recording: bool): - self._recording = recording - self.record_btn.recording = recording - - if recording: - self.status_label.setText("Recording") - self.status_label.setStyleSheet(f"color: {COLOR_ACCENT};") - else: - self.status_label.setText("Ready") - self.status_label.setStyleSheet(f"color: {COLOR_TEXT_SECONDARY};") - self.duration_label.setText("00:00:00") - - def set_recording_duration(self, seconds: int): - h = seconds // 3600 - m = (seconds % 3600) // 60 - s = seconds % 60 - self.duration_label.setText(f"{h:02d}:{m:02d}:{s:02d}") - - class _AITrackingSection(CollapsibleSection): """AI tracking mode selection.""" @@ -256,7 +151,7 @@ class _ZoomSection(CollapsibleSection): class ConsolePanel(QWidget): - """Panel with recording, AI tracking, and zoom controls.""" + """Panel with AI tracking and zoom controls.""" param_changed = Signal(str, object) @@ -283,22 +178,15 @@ class ConsolePanel(QWidget): header_layout.addStretch() outer.addWidget(header) - self.recording = _RecordingSection() self.ai_tracking = _AITrackingSection() self.zoom = _ZoomSection() - for section in [self.recording, self.ai_tracking, self.zoom]: + for section in [self.ai_tracking, self.zoom]: section.param_changed.connect(self.param_changed.emit) outer.addWidget(section) outer.addStretch() - def set_recording_state(self, recording: bool): - self.recording.set_recording_state(recording) - - def set_recording_duration(self, seconds: int): - self.recording.set_recording_duration(seconds) - def set_zoom(self, value: float): self.zoom.set_zoom(value) diff --git a/yolocam-gui/yolocam_gui/ui/panels/stream_panel.py b/yolocam-gui/yolocam_gui/ui/panels/stream_panel.py index 48b922b..400334d 100644 --- a/yolocam-gui/yolocam_gui/ui/panels/stream_panel.py +++ b/yolocam-gui/yolocam_gui/ui/panels/stream_panel.py @@ -13,14 +13,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""Stream output panel with HDMI and UVC settings.""" +"""Output panel with HDMI settings.""" from PySide6.QtCore import Signal from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox from PySide6.QtGui import QFont from ..theme import COLOR_BG_PANEL -from ..widgets import CollapsibleSection, ToggleSwitch +from ..widgets import CollapsibleSection class _HDMISection(CollapsibleSection): @@ -89,37 +89,8 @@ class _HDMISection(CollapsibleSection): return row -class _UVCSection(CollapsibleSection): - """UVC output enable/disable toggle.""" - - param_changed = Signal(str, object) - - def __init__(self, parent=None): - super().__init__("UVC Output", parent) - - self.uvc_toggle = ToggleSwitch() - self.uvc_toggle.toggled.connect(lambda v: self.param_changed.emit("uvc", v)) - self.add_widget(self._toggle_row("Enable", self.uvc_toggle)) - - def set_uvc_enabled(self, enabled: bool): - self.uvc_toggle.set_checked(enabled, emit=False) - - @staticmethod - def _toggle_row(text: str, toggle: ToggleSwitch) -> QWidget: - row = QWidget() - layout = QHBoxLayout(row) - layout.setContentsMargins(0, 2, 0, 2) - layout.setSpacing(8) - lbl = QLabel(text) - lbl.setFixedWidth(170) - layout.addWidget(lbl) - layout.addStretch() - layout.addWidget(toggle) - return row - - class StreamPanel(QWidget): - """Panel with HDMI and UVC output settings.""" + """Panel with HDMI output settings.""" param_changed = Signal(str, object) @@ -137,7 +108,7 @@ class StreamPanel(QWidget): header_layout = QHBoxLayout(header) header_layout.setContentsMargins(12, 4, 12, 4) header_layout.setSpacing(8) - title = QLabel("Stream") + title = QLabel("Output") title_font = QFont() title_font.setBold(True) title_font.setPointSize(11) @@ -147,11 +118,8 @@ class StreamPanel(QWidget): outer.addWidget(header) self.hdmi = _HDMISection() - self.uvc = _UVCSection() - - for section in [self.hdmi, self.uvc]: - section.param_changed.connect(self.param_changed.emit) - outer.addWidget(section) + self.hdmi.param_changed.connect(self.param_changed.emit) + outer.addWidget(self.hdmi) outer.addStretch() @@ -160,6 +128,3 @@ class StreamPanel(QWidget): def set_hdmi_color(self, value: int): self.hdmi.set_hdmi_color(value) - - def set_uvc_enabled(self, enabled: bool): - self.uvc.set_uvc_enabled(enabled) diff --git a/yolocam-gui/yolocam_gui/ui/sidebar.py b/yolocam-gui/yolocam_gui/ui/sidebar.py index 6879bee..b59905d 100644 --- a/yolocam-gui/yolocam_gui/ui/sidebar.py +++ b/yolocam-gui/yolocam_gui/ui/sidebar.py @@ -29,9 +29,9 @@ class Sidebar(QWidget): ICONS = [ ("\u2699", "Parameters"), - ("\U0001F3A8", "Color"), + ("\u25D0", "Color"), ("\u2328", "Console"), - ("\U0001F4E1", "Stream"), + ("\u25B6", "Output"), ("\u2638", "Settings"), ]