Skip to content

Commit 35ed2b0

Browse files
committed
fix: wire NF signal connections at startup; add live ring redraw on BC/Lsd change
nf_qt.py: - Moved frameScrolled, cursorMoved, dataStatsUpdated, and col_group signal connections from _on_font_changed into _wire_signals where they belong. They were accidentally nested in the font handler and only fired when font size changed — causing MinI/MaxI to never update. ff_asym_qt.py: - _draw_rings reads BC_Y, BC_Z, Lsd directly from text fields - editingFinished on BC_Y/BC_Z/Lsd triggers automatic ring redraw
1 parent 5aea8f6 commit 35ed2b0

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

gui/ff_asym_qt.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,10 @@ def _wire_signals(self):
634634
self.image_view.frameScrolled.connect(self._on_frame_scroll)
635635
# Cursor tracking
636636
self.image_view.cursorMoved.connect(self._on_cursor_moved)
637+
# Live ring redraw on BC/Lsd change
638+
self.bcy_edit.editingFinished.connect(self._redraw_if_rings)
639+
self.bcz_edit.editingFinished.connect(self._redraw_if_rings)
640+
self.lsd_edit.editingFinished.connect(self._redraw_if_rings)
637641
self.image_view.dataStatsUpdated.connect(self._on_stats_updated)
638642

639643
def _show_help(self):
@@ -908,17 +912,30 @@ def _load_and_display(self):
908912

909913
# ── Rings ──────────────────────────────────────────────────────
910914

915+
def _redraw_if_rings(self):
916+
if self.show_rings and self.ring_rads:
917+
self._draw_rings()
918+
911919
def _draw_rings(self):
912920
self.image_view.clear_overlays()
913921
if not self.ring_rads:
914922
return
915923
px = self.pixel_size
924+
# Always read current values from text fields
925+
try:
926+
bc_y = float(self.bcy_edit.text())
927+
bc_z = float(self.bcz_edit.text())
928+
lsd = float(self.lsd_edit.text())
929+
except ValueError:
930+
return
931+
self.bc_local = [bc_y, bc_z]
932+
self.lsd_local = lsd
916933
colors = _color_cycle_colors
917-
print(f"[Rings] BC_Y={self.bc_local[0]}, BC_Z={self.bc_local[1]}, "
918-
f"Lsd={self.lsd_local}, Lsd_orig={self.lsd_orig}, px={px}")
934+
print(f"[Rings] BC_Y={bc_y}, BC_Z={bc_z}, "
935+
f"Lsd={lsd}, Lsd_orig={self.lsd_orig}, px={px}")
919936
for idx, rad in enumerate(self.ring_rads):
920-
Y, Z = compute_ring_points(rad, self.lsd_local, self.lsd_orig,
921-
self.bc_local, px)
937+
Y, Z = compute_ring_points(rad, lsd, self.lsd_orig,
938+
[bc_y, bc_z], px)
922939
print(f" Ring {idx}: rad={rad:.1f}, center=({Y.mean():.1f}, {Z.mean():.1f}), "
923940
f"Y=[{Y.min():.1f}..{Y.max():.1f}], Z=[{Z.min():.1f}..{Z.max():.1f}]")
924941
color = colors[idx % len(colors)]

gui/nf_qt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,15 @@ def _wire_signals(self):
518518
lambda n: self.image_view.set_colormap(n))
519519
self.theme_combo.currentTextChanged.connect(
520520
lambda t: apply_theme(QtWidgets.QApplication.instance(), t))
521-
522-
def _on_font_changed(self, size):
523-
QtWidgets.QApplication.instance().setStyleSheet(f'* {{ font-size: {size}pt; }}')
524521
self.image_view.frameScrolled.connect(
525522
lambda d: self.frame_spin.setValue(self.frame_spin.value() + d))
526523
self.image_view.cursorMoved.connect(self._on_cursor_moved)
527524
self.image_view.dataStatsUpdated.connect(self._on_stats_updated)
528525
self.col_group.buttonClicked.connect(self._on_col_mode_changed)
529526

527+
def _on_font_changed(self, size):
528+
QtWidgets.QApplication.instance().setStyleSheet(f'* {{ font-size: {size}pt; }}')
529+
530530
def _show_help(self):
531531
QtWidgets.QMessageBox.information(self, 'NF Viewer — Controls',
532532
'Mouse Controls:\n'

0 commit comments

Comments
 (0)