| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- """
- Live Feed Panel
- Displays live camera and audio feeds (placeholders for now).
- """
- from PyQt5.QtWidgets import QGroupBox, QHBoxLayout, QVBoxLayout, QLabel
- from PyQt5.QtCore import Qt
- from ui.widgets.status_indicator import StatusIndicator
- from resources.styles import (GROUP_BOX_STYLE, RGB_FEED_STYLE, MS_FEED_STYLE,
- THERMAL_FEED_STYLE, AUDIO_FEED_STYLE)
- from utils.config import FEED_MIN_WIDTH, FEED_MIN_HEIGHT
- class LiveFeedPanel(QGroupBox):
- """
- Panel displaying live camera and audio feeds.
-
- Shows placeholders for:
- - RGB Camera
- - Multispectral Camera
- - Thermal Camera
- - Audio Spectrogram
-
- Note: For Phase 1, these are placeholders. Live feeds will be
- implemented in future phases.
- """
-
- def __init__(self):
- """Initialize the live feed panel."""
- super().__init__("Live Camera Feeds")
- self.setStyleSheet(GROUP_BOX_STYLE)
- self.init_ui()
-
- def init_ui(self):
- """Initialize the UI components."""
- layout = QHBoxLayout()
-
- # RGB Feed
- rgb_layout = QVBoxLayout()
- self.rgb_feed = QLabel()
- self.rgb_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
- self.rgb_feed.setStyleSheet(RGB_FEED_STYLE)
- self.rgb_feed.setAlignment(Qt.AlignCenter)
- self.rgb_feed.setText("RGB Camera\n\n🚀 Coming Soon!\nLive feed integration")
- self.rgb_status = StatusIndicator("offline")
- rgb_layout.addWidget(self.rgb_feed)
- rgb_layout.addWidget(self.rgb_status, alignment=Qt.AlignCenter)
- layout.addLayout(rgb_layout)
-
- # Multispectral Feed
- ms_layout = QVBoxLayout()
- self.ms_feed = QLabel()
- self.ms_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
- self.ms_feed.setStyleSheet(MS_FEED_STYLE)
- self.ms_feed.setAlignment(Qt.AlignCenter)
- self.ms_feed.setText("Multispectral\n\n🚀 Coming Soon!\n8-Band integration")
- self.ms_status = StatusIndicator("offline")
- ms_layout.addWidget(self.ms_feed)
- ms_layout.addWidget(self.ms_status, alignment=Qt.AlignCenter)
- layout.addLayout(ms_layout)
-
- # Thermal Feed
- thermal_layout = QVBoxLayout()
- self.thermal_feed = QLabel()
- self.thermal_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
- self.thermal_feed.setStyleSheet(THERMAL_FEED_STYLE)
- self.thermal_feed.setAlignment(Qt.AlignCenter)
- self.thermal_feed.setText("Thermal Camera\n\n🚀 Coming Soon!\nThermal imaging")
- self.thermal_status = StatusIndicator("offline")
- thermal_layout.addWidget(self.thermal_feed)
- thermal_layout.addWidget(self.thermal_status, alignment=Qt.AlignCenter)
- layout.addLayout(thermal_layout)
-
- # Audio Visualization
- audio_layout = QVBoxLayout()
- self.audio_feed = QLabel()
- self.audio_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
- self.audio_feed.setStyleSheet(AUDIO_FEED_STYLE)
- self.audio_feed.setAlignment(Qt.AlignCenter)
- self.audio_feed.setText("Audio Feed\n\n🚀 Coming Soon!\nLive spectrogram")
- self.audio_status = StatusIndicator("offline")
- audio_layout.addWidget(self.audio_feed)
- audio_layout.addWidget(self.audio_status, alignment=Qt.AlignCenter)
- layout.addLayout(audio_layout)
-
- self.setLayout(layout)
-
- def update_rgb_feed(self, pixmap):
- """
- Update RGB camera feed with new image.
-
- Args:
- pixmap: QPixmap image to display
- """
- self.rgb_feed.setPixmap(pixmap)
- self.rgb_status.set_status("online")
-
- def update_ms_feed(self, pixmap):
- """
- Update multispectral camera feed with new image.
-
- Args:
- pixmap: QPixmap image to display
- """
- self.ms_feed.setPixmap(pixmap)
- self.ms_status.set_status("online")
-
- def update_thermal_feed(self, pixmap):
- """
- Update thermal camera feed with new image.
-
- Args:
- pixmap: QPixmap image to display
- """
- self.thermal_feed.setPixmap(pixmap)
- self.thermal_status.set_status("online")
-
- def update_audio_feed(self, pixmap):
- """
- Update audio spectrogram display.
-
- Args:
- pixmap: QPixmap spectrogram image to display
- """
- self.audio_feed.setPixmap(pixmap)
- self.audio_status.set_status("online")
-
- def set_feed_offline(self, feed_name: str):
- """
- Set a specific feed to offline status.
-
- Args:
- feed_name: Feed name ('rgb', 'ms', 'thermal', or 'audio')
- """
- if feed_name == 'rgb':
- self.rgb_status.set_status("offline")
- self.rgb_feed.clear()
- self.rgb_feed.setText("RGB Camera\nOFFLINE")
- elif feed_name == 'ms':
- self.ms_status.set_status("offline")
- self.ms_feed.clear()
- self.ms_feed.setText("Multispectral\nOFFLINE")
- elif feed_name == 'thermal':
- self.thermal_status.set_status("offline")
- self.thermal_feed.clear()
- self.thermal_feed.setText("Thermal\nOFFLINE")
- elif feed_name == 'audio':
- self.audio_status.set_status("offline")
- self.audio_feed.clear()
- self.audio_feed.setText("Audio\nOFFLINE")
|