""" RGB Preview Panel Panel for displaying RGB camera feed (coming soon feature). """ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QPainter, QColor, QPen from ui.widgets.panel_header import PanelHeader from ui.widgets.coming_soon_overlay import ComingSoonOverlay class RGBPreviewPanel(QWidget): """ Panel for RGB camera preview. Currently shows "COMING SOON" placeholder for future camera integration. """ def __init__(self, parent=None): super().__init__(parent) self.init_ui() def init_ui(self): """Initialize the panel UI.""" # Set size policy to expand equally self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) # Main panel container with card styling self.setStyleSheet(""" QWidget { background-color: white; border: 1px solid #ddd; } """) # Header header = QWidget() header.setFixedHeight(25) header.setStyleSheet("background-color: #3498db;") header_layout = QHBoxLayout(header) header_layout.setContentsMargins(10, 0, 10, 0) header_layout.setSpacing(0) title = QLabel("RGB Preview") title.setStyleSheet("color: white; font-weight: bold; font-size: 16px;") status_indicator = QWidget() status_indicator.setFixedSize(10, 10) status_indicator.setStyleSheet("background-color: #27ae60; border-radius: 5px;") header_layout.addWidget(title) header_layout.addStretch() header_layout.addWidget(status_indicator) # Content area content = QWidget() content.setMinimumSize(250, 250) # content.setMaximumSize(400, 400) content.setStyleSheet(""" background-color: #2c3e50; border: 1px solid #34495e; border-top: none; """) content_layout = QVBoxLayout(content) content_layout.setAlignment(Qt.AlignCenter) content_layout.setSpacing(5) # Main text container text_container = QWidget() text_layout = QVBoxLayout(text_container) text_layout.setAlignment(Qt.AlignCenter) text_layout.setSpacing(2) # Live RGB Feed text feed_label = QLabel("RGB Live Feed") feed_label.setFont(QFont("Arial", 14)) feed_label.setStyleSheet("color: #bdc3c7;") feed_label.setAlignment(Qt.AlignCenter) text_layout.addWidget(feed_label) # Resolution info res_label = QLabel("1920x1080 @ 30fps\n(Coming soon)") res_label.setFont(QFont("Arial", 11)) res_label.setStyleSheet("color: #7f8c8d;") res_label.setAlignment(Qt.AlignCenter) text_layout.addWidget(res_label) content_layout.addWidget(text_container) layout.addWidget(header) layout.addWidget(content, 1) # Tooltip self.setToolTip("Live RGB camera feed - Coming with hardware integration") class CrosshairPreview(QWidget): """Widget showing crosshair placeholder for camera targeting.""" def __init__(self, parent=None): super().__init__(parent) self.setAttribute(Qt.WA_TransparentForMouseEvents) def paintEvent(self, event): """Draw crosshair overlay.""" painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) # Draw crosshair pen = QPen(QColor("#e74c3c"), 2) painter.setPen(pen) center_x = self.width() // 2 center_y = self.height() // 2 # Horizontal line painter.drawLine(center_x - 20, center_y, center_x + 20, center_y) # Vertical line painter.drawLine(center_x, center_y - 20, center_x, center_y + 20) # Center circle painter.drawEllipse(center_x - 3, center_y - 3, 6, 6)