Files
yolocam-linux/yolocam-gui/yolocam_gui/ui/panels/stream_panel.py
T
Seth Hillbrand 3cbc946565 Clean up GUI panels and fix sidebar icons
Rename the Stream panel to Output throughout the app,
menu, sidebar, and docs since the S3 does not support
network streaming. Remove the UVC toggle section from
the output panel and the recording section from the
console panel, along with all controller wiring for
both. Replace emoji sidebar icons for Color and Output
with Unicode geometric shapes that render correctly in
Qt. Wire the Help > Documentation menu action to open
the GitLab repository URL. Update the GUI guide to
match all panel and menu changes.
2026-02-15 13:34:52 -08:00

131 lines
4.2 KiB
Python

# Copyright (C) 2026 Seth Hillbrand
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""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
class _HDMISection(CollapsibleSection):
"""HDMI output format and color space settings."""
param_changed = Signal(str, object)
def __init__(self, parent=None):
super().__init__("HDMI Output", parent)
self.format_combo = QComboBox()
for label, data in [("Auto", 0), ("4K", 1), ("1080p", 2), ("720p", 3)]:
self.format_combo.addItem(label, data)
self.format_combo.currentIndexChanged.connect(self._format_changed)
self.add_widget(self._labeled("Format", self.format_combo))
self.color_combo = QComboBox()
for label, data in [("Auto", 0), ("RGB", 1), ("YUV422", 2)]:
self.color_combo.addItem(label, data)
self.color_combo.currentIndexChanged.connect(self._color_changed)
self.add_widget(self._labeled("Color Space", self.color_combo))
def _format_changed(self, index: int):
if index >= 0:
self.param_changed.emit("hdmi-format", self.format_combo.itemData(index))
def _color_changed(self, index: int):
if index >= 0:
self.param_changed.emit("hdmi-color", self.color_combo.itemData(index))
def set_hdmi_format(self, value: int):
self.format_combo.blockSignals(True)
for i in range(self.format_combo.count()):
if self.format_combo.itemData(i) == value:
self.format_combo.setCurrentIndex(i)
break
self.format_combo.blockSignals(False)
def set_hdmi_color(self, value: int):
self.color_combo.blockSignals(True)
for i in range(self.color_combo.count()):
if self.color_combo.itemData(i) == value:
self.color_combo.setCurrentIndex(i)
break
self.color_combo.blockSignals(False)
@staticmethod
def _labeled(text: str, widget: QWidget) -> QWidget:
row = QWidget()
layout = QHBoxLayout(row)
layout.setContentsMargins(0, 2, 0, 2)
layout.setSpacing(8)
lbl = QLabel(text)
lbl.setFixedWidth(110)
layout.addWidget(lbl)
layout.addWidget(widget)
layout.addStretch()
return row
class StreamPanel(QWidget):
"""Panel with HDMI output settings."""
param_changed = Signal(str, object)
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("streamPanel")
self.setStyleSheet(f"#streamPanel {{ background-color: {COLOR_BG_PANEL}; }}")
outer = QVBoxLayout(self)
outer.setContentsMargins(0, 0, 0, 0)
outer.setSpacing(0)
header = QWidget()
header.setFixedHeight(36)
header_layout = QHBoxLayout(header)
header_layout.setContentsMargins(12, 4, 12, 4)
header_layout.setSpacing(8)
title = QLabel("Output")
title_font = QFont()
title_font.setBold(True)
title_font.setPointSize(11)
title.setFont(title_font)
header_layout.addWidget(title)
header_layout.addStretch()
outer.addWidget(header)
self.hdmi = _HDMISection()
self.hdmi.param_changed.connect(self.param_changed.emit)
outer.addWidget(self.hdmi)
outer.addStretch()
def set_hdmi_format(self, value: int):
self.hdmi.set_hdmi_format(value)
def set_hdmi_color(self, value: int):
self.hdmi.set_hdmi_color(value)