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.
This commit is contained in:
@@ -13,127 +13,22 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
"""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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user