gui: add checkable constellation legend to filter sky plot by GNSS system
Replaces the static painted legend with real checkboxes (one per GNSS system, color-swatched to match GNSS_COLORS) so users can toggle which constellations show in the sky plot and satellite table, mirroring the existing receiver-source filter checkboxes.
This commit is contained in:
+1
-20
@@ -11,7 +11,7 @@ from PyQt5.QtWidgets import QWidget, QSizePolicy, QApplication
|
||||
from PyQt5.QtGui import (QPainter, QColor, QPen, QBrush, QFont, QImage)
|
||||
from PyQt5.QtCore import Qt, QPointF, QRectF, QThread, pyqtSignal
|
||||
|
||||
from data_model import GNSS_NAMES, GNSS_COLORS, GNSS_SHORT
|
||||
from data_model import GNSS_COLORS, GNSS_SHORT
|
||||
|
||||
# ── Static colors (created once in main thread, read-only in render thread) ──
|
||||
_C_BG = QColor('#1a1a2e')
|
||||
@@ -92,7 +92,6 @@ class SkyRenderThread(QThread):
|
||||
if trails:
|
||||
self._draw_trails(p, cx, cy, max_r, trails)
|
||||
self._draw_satellites(p, cx, cy, max_r, sats)
|
||||
self._draw_legend(p, sats)
|
||||
|
||||
p.end()
|
||||
return img
|
||||
@@ -184,24 +183,6 @@ class SkyRenderThread(QThread):
|
||||
p.drawText(QRectF(x + size + 1, y - 6, 28, 12),
|
||||
Qt.AlignLeft, f"{short}{sat.sv_id}")
|
||||
|
||||
def _draw_legend(self, p: QPainter, sats):
|
||||
used = {sat.gnss_id for _, sat in sats}
|
||||
if not used:
|
||||
return
|
||||
f = QFont(); f.setPointSize(8)
|
||||
p.setFont(f)
|
||||
lx, ly = 8, 8
|
||||
for gid in sorted(used):
|
||||
color = _GNSS_QCOLORS.get(gid)
|
||||
if color is None:
|
||||
continue
|
||||
p.setBrush(QBrush(color))
|
||||
p.setPen(Qt.NoPen)
|
||||
p.drawEllipse(QPointF(lx + 5, ly + 6), 5, 5)
|
||||
p.setPen(QPen(_C_SAT_LBL))
|
||||
p.drawText(lx + 14, ly + 11, GNSS_NAMES.get(gid, f'SYS{gid}'))
|
||||
ly += 18
|
||||
|
||||
|
||||
# ── Widget ────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user