sistemata visualizzazione compact

This commit is contained in:
VALLONGOL 2026-01-16 15:53:31 +01:00
parent b17de5f03c
commit 58d73c0d6b
3 changed files with 38 additions and 10 deletions

View File

@ -1259,6 +1259,19 @@ class SfpConnectorModule:
except Exception:
pass
def update_mfd_lut(self, lut) -> None:
"""Receive an MFD LUT (numpy array or similar) from the UI and store it.
The module will use this LUT when colorizing MFD frames. This is
intentionally lightweight: callers (the viewer) are expected to
construct a proper 256x3 uint8 LUT. We simply store and log it.
"""
try:
self._mfd_lut = lut
logging.getLogger().info("VideoReceiverSFP: MFD LUT updated from UI")
except Exception:
logging.getLogger().exception("VideoReceiverSFP: failed to update MFD LUT from UI")
# Callback registration helpers
def register_callback(self, cb: Callable[[Any], None]) -> None:
try:

View File

@ -98,14 +98,19 @@ class SfpSarViewer:
ctrl_frame.columnconfigure(0, weight=1)
except Exception:
pass
main.rowconfigure(0, weight=1)
main.rowconfigure(1, weight=0)
main.columnconfigure(0, weight=3)
main.columnconfigure(1, weight=1)
main.rowconfigure(0, weight=1)
main.rowconfigure(1, weight=0)
main.columnconfigure(0, weight=3)
main.columnconfigure(1, weight=1)
else:
# Compact: single-column layout so image expands fully
main.rowconfigure(0, weight=1)
main.rowconfigure(1, weight=0)
main.columnconfigure(0, weight=1)
# Bottom: Status bar (FPS)
status_frame = ttk.Frame(main, relief="sunken")
status_frame.grid(row=1, column=0, columnspan=2, sticky="ew", pady=(5, 0))
status_frame.grid(row=1, column=0, columnspan=(1 if self._compact else 2), sticky="ew", pady=(5, 0))
self._fps_label = ttk.Label(status_frame, text="FPS: 0.00")
self._fps_label.pack(side="left", padx=5)

View File

@ -113,6 +113,11 @@ class SfpViewerWithParams:
self._img_canvas = tk.Canvas(image_frame, width=484, height=484, bg="black", highlightthickness=0)
self._img_canvas.pack(fill="both", expand=True)
self._img_label = tk.Label(self._img_canvas, bg="black")
# Ensure right-click on the label (image) also triggers context menu
try:
self._img_label.bind("<Button-3>", self._on_canvas_right_click)
except Exception:
pass
self._img_canvas.create_window(242, 242, window=self._img_label)
# Right: MFD Parameters (hidden in compact mode)
@ -131,16 +136,21 @@ class SfpViewerWithParams:
# Bottom: Status bar
status_frame = ttk.Frame(main_frame, relief="sunken")
status_frame.grid(row=1, column=0, columnspan=2, sticky="ew", pady=(5, 0))
status_frame.grid(row=1, column=0, columnspan=(1 if self._compact else 2), sticky="ew", pady=(5, 0))
self._fps_label = ttk.Label(status_frame, text="FPS: 0.00")
self._fps_label.pack(side="left", padx=5)
# Grid weights
main_frame.rowconfigure(0, weight=1)
main_frame.rowconfigure(1, weight=0)
main_frame.columnconfigure(0, weight=3)
main_frame.columnconfigure(1, weight=1)
if not self._compact:
main_frame.rowconfigure(0, weight=1)
main_frame.rowconfigure(1, weight=0)
main_frame.columnconfigure(0, weight=3)
main_frame.columnconfigure(1, weight=1)
else:
main_frame.rowconfigure(0, weight=1)
main_frame.rowconfigure(1, weight=0)
main_frame.columnconfigure(0, weight=1)
def _build_mfd_params_frame(self, parent) -> ttk.Frame:
"""Build MFD parameters control panel matching ControlPanel layout."""