live_feed.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. """
  2. Live Feed Panel
  3. Displays live camera and audio feeds (placeholders for now).
  4. """
  5. from PyQt5.QtWidgets import QGroupBox, QHBoxLayout, QVBoxLayout, QLabel
  6. from PyQt5.QtCore import Qt
  7. from ui.widgets.status_indicator import StatusIndicator
  8. from resources.styles import (GROUP_BOX_STYLE, RGB_FEED_STYLE, MS_FEED_STYLE,
  9. THERMAL_FEED_STYLE, AUDIO_FEED_STYLE)
  10. from utils.config import FEED_MIN_WIDTH, FEED_MIN_HEIGHT
  11. class LiveFeedPanel(QGroupBox):
  12. """
  13. Panel displaying live camera and audio feeds.
  14. Shows placeholders for:
  15. - RGB Camera
  16. - Multispectral Camera
  17. - Thermal Camera
  18. - Audio Spectrogram
  19. Note: For Phase 1, these are placeholders. Live feeds will be
  20. implemented in future phases.
  21. """
  22. def __init__(self):
  23. """Initialize the live feed panel."""
  24. super().__init__("Live Camera Feeds")
  25. self.setStyleSheet(GROUP_BOX_STYLE)
  26. self.init_ui()
  27. def init_ui(self):
  28. """Initialize the UI components."""
  29. layout = QHBoxLayout()
  30. # RGB Feed
  31. rgb_layout = QVBoxLayout()
  32. self.rgb_feed = QLabel()
  33. self.rgb_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
  34. self.rgb_feed.setStyleSheet(RGB_FEED_STYLE)
  35. self.rgb_feed.setAlignment(Qt.AlignCenter)
  36. self.rgb_feed.setText("RGB Camera\n\n🚀 Coming Soon!\nLive feed integration")
  37. self.rgb_status = StatusIndicator("offline")
  38. rgb_layout.addWidget(self.rgb_feed)
  39. rgb_layout.addWidget(self.rgb_status, alignment=Qt.AlignCenter)
  40. layout.addLayout(rgb_layout)
  41. # Multispectral Feed
  42. ms_layout = QVBoxLayout()
  43. self.ms_feed = QLabel()
  44. self.ms_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
  45. self.ms_feed.setStyleSheet(MS_FEED_STYLE)
  46. self.ms_feed.setAlignment(Qt.AlignCenter)
  47. self.ms_feed.setText("Multispectral\n\n🚀 Coming Soon!\n8-Band integration")
  48. self.ms_status = StatusIndicator("offline")
  49. ms_layout.addWidget(self.ms_feed)
  50. ms_layout.addWidget(self.ms_status, alignment=Qt.AlignCenter)
  51. layout.addLayout(ms_layout)
  52. # Thermal Feed
  53. thermal_layout = QVBoxLayout()
  54. self.thermal_feed = QLabel()
  55. self.thermal_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
  56. self.thermal_feed.setStyleSheet(THERMAL_FEED_STYLE)
  57. self.thermal_feed.setAlignment(Qt.AlignCenter)
  58. self.thermal_feed.setText("Thermal Camera\n\n🚀 Coming Soon!\nThermal imaging")
  59. self.thermal_status = StatusIndicator("offline")
  60. thermal_layout.addWidget(self.thermal_feed)
  61. thermal_layout.addWidget(self.thermal_status, alignment=Qt.AlignCenter)
  62. layout.addLayout(thermal_layout)
  63. # Audio Visualization
  64. audio_layout = QVBoxLayout()
  65. self.audio_feed = QLabel()
  66. self.audio_feed.setMinimumSize(FEED_MIN_WIDTH, FEED_MIN_HEIGHT)
  67. self.audio_feed.setStyleSheet(AUDIO_FEED_STYLE)
  68. self.audio_feed.setAlignment(Qt.AlignCenter)
  69. self.audio_feed.setText("Audio Feed\n\n🚀 Coming Soon!\nLive spectrogram")
  70. self.audio_status = StatusIndicator("offline")
  71. audio_layout.addWidget(self.audio_feed)
  72. audio_layout.addWidget(self.audio_status, alignment=Qt.AlignCenter)
  73. layout.addLayout(audio_layout)
  74. self.setLayout(layout)
  75. def update_rgb_feed(self, pixmap):
  76. """
  77. Update RGB camera feed with new image.
  78. Args:
  79. pixmap: QPixmap image to display
  80. """
  81. self.rgb_feed.setPixmap(pixmap)
  82. self.rgb_status.set_status("online")
  83. def update_ms_feed(self, pixmap):
  84. """
  85. Update multispectral camera feed with new image.
  86. Args:
  87. pixmap: QPixmap image to display
  88. """
  89. self.ms_feed.setPixmap(pixmap)
  90. self.ms_status.set_status("online")
  91. def update_thermal_feed(self, pixmap):
  92. """
  93. Update thermal camera feed with new image.
  94. Args:
  95. pixmap: QPixmap image to display
  96. """
  97. self.thermal_feed.setPixmap(pixmap)
  98. self.thermal_status.set_status("online")
  99. def update_audio_feed(self, pixmap):
  100. """
  101. Update audio spectrogram display.
  102. Args:
  103. pixmap: QPixmap spectrogram image to display
  104. """
  105. self.audio_feed.setPixmap(pixmap)
  106. self.audio_status.set_status("online")
  107. def set_feed_offline(self, feed_name: str):
  108. """
  109. Set a specific feed to offline status.
  110. Args:
  111. feed_name: Feed name ('rgb', 'ms', 'thermal', or 'audio')
  112. """
  113. if feed_name == 'rgb':
  114. self.rgb_status.set_status("offline")
  115. self.rgb_feed.clear()
  116. self.rgb_feed.setText("RGB Camera\nOFFLINE")
  117. elif feed_name == 'ms':
  118. self.ms_status.set_status("offline")
  119. self.ms_feed.clear()
  120. self.ms_feed.setText("Multispectral\nOFFLINE")
  121. elif feed_name == 'thermal':
  122. self.thermal_status.set_status("offline")
  123. self.thermal_feed.clear()
  124. self.thermal_feed.setText("Thermal\nOFFLINE")
  125. elif feed_name == 'audio':
  126. self.audio_status.set_status("offline")
  127. self.audio_feed.clear()
  128. self.audio_feed.setText("Audio\nOFFLINE")