feat(flomni): info popup for manual shift x in tomo parameters GUI
CI for csaxs_bec / test (push) Successful in 3m2s
CI for csaxs_bec / test (push) Successful in 3m2s
Add a per-field "?" help button, same pattern already used for the offsets section and Fermat asymmetry. Explains that manual_shift_x is a constant, angle-independent offset applied on top of the alignment, only needed in special cases (e.g. when the FZP-to-sample distance is changed after alignment). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPZ9gzN2rt3wgiMnTKyrug
This commit is contained in:
1 parent
2a91f94c06
commit
cf66e0d1ec
1 file changed
+45
-6
@@ -528,7 +528,9 @@ class OMNY_TomoParams(BECWidget, QWidget):
|
||||
common_form, "ptycho_reconstruct_foldername", "Reconstruct folder"
|
||||
),
|
||||
"manual_shift": lambda: self._build_double_group(
|
||||
common_form, self._profile["manual_shift_fields"]
|
||||
common_form,
|
||||
self._profile["manual_shift_fields"],
|
||||
help_texts=self._profile.get("manual_shift_help"),
|
||||
),
|
||||
"piezo_range": lambda: self._build_double_group(
|
||||
common_form, self._profile["piezo_range_fields"]
|
||||
@@ -572,10 +574,16 @@ class OMNY_TomoParams(BECWidget, QWidget):
|
||||
return box
|
||||
|
||||
def _build_double_group(
|
||||
self, form: QFormLayout, fields: list[tuple[str, str, float, float, int]]
|
||||
self,
|
||||
form: QFormLayout,
|
||||
fields: list[tuple[str, str, float, float, int]],
|
||||
help_texts: dict[str, str] | None = None,
|
||||
) -> None:
|
||||
for key, label, min_, max_, decimals in fields:
|
||||
self._add_double(form, key, label, min_=min_, max_=max_, decimals=decimals)
|
||||
help_text = help_texts.get(key) if help_texts else None
|
||||
self._add_double(
|
||||
form, key, label, min_=min_, max_=max_, decimals=decimals, help_text=help_text
|
||||
)
|
||||
|
||||
def _build_int_group(self, form: QFormLayout, fields: list[tuple[str, str, int, int]]) -> None:
|
||||
for key, label, min_, max_ in fields:
|
||||
@@ -626,7 +634,9 @@ class OMNY_TomoParams(BECWidget, QWidget):
|
||||
form.addRow(header_row)
|
||||
for key, label, min_, max_, decimals, _axis in self._profile["offset_fields"]:
|
||||
self._add_double(form, key, label, min_=min_, max_=max_, decimals=decimals)
|
||||
self._build_double_group(form, self._profile["manual_shift_fields"])
|
||||
self._build_double_group(
|
||||
form, self._profile["manual_shift_fields"], help_texts=self._profile.get("manual_shift_help")
|
||||
)
|
||||
|
||||
def _show_offsets_help(self) -> None:
|
||||
QMessageBox.information(
|
||||
@@ -857,14 +867,36 @@ class OMNY_TomoParams(BECWidget, QWidget):
|
||||
# ── widget factory helpers ────────────────────────────────────────────────
|
||||
|
||||
def _add_double(
|
||||
self, form: QFormLayout, key: str, label: str, min_: float, max_: float, decimals: int
|
||||
self,
|
||||
form: QFormLayout,
|
||||
key: str,
|
||||
label: str,
|
||||
min_: float,
|
||||
max_: float,
|
||||
decimals: int,
|
||||
help_text: str | None = None,
|
||||
) -> QDoubleSpinBox:
|
||||
w = QDoubleSpinBox()
|
||||
w.setDecimals(decimals)
|
||||
w.setRange(min_, max_)
|
||||
w.setEnabled(False)
|
||||
self._pw[key] = w
|
||||
form.addRow(f"{label}:", w)
|
||||
if help_text is None:
|
||||
form.addRow(f"{label}:", w)
|
||||
else:
|
||||
# same "?" help-button pattern as _build_offsets_section/
|
||||
# _build_fermat_asymmetry_row -- a per-field popup instead of a
|
||||
# per-group one.
|
||||
row = QHBoxLayout()
|
||||
row.addWidget(w, stretch=1)
|
||||
btn_help = QPushButton("?")
|
||||
btn_help.setFixedWidth(24)
|
||||
btn_help.setToolTip(f"What does {label} do?")
|
||||
btn_help.clicked.connect(
|
||||
lambda: QMessageBox.information(self, label, help_text)
|
||||
)
|
||||
row.addWidget(btn_help)
|
||||
form.addRow(f"{label}:", row)
|
||||
return w
|
||||
|
||||
def _add_int(self, form: QFormLayout, key: str, label: str, min_: int, max_: int) -> QSpinBox:
|
||||
@@ -2481,6 +2513,13 @@ SETUP_PROFILES: dict[str, dict[str, Any]] = {
|
||||
("manual_shift_x", "Manual shift x (µm)", -10.0, 10.0, 3),
|
||||
("manual_shift_y", "Manual shift y (µm)", -50.0, 50.0, 3),
|
||||
],
|
||||
"manual_shift_help": {
|
||||
"manual_shift_x": (
|
||||
"A constant offset applied on top of the alignment, independent of "
|
||||
"the rotation angle. Normally zero -- only needed in special cases, "
|
||||
"e.g. when the FZP-to-sample distance is changed after alignment."
|
||||
)
|
||||
},
|
||||
"piezo_range_fields": [],
|
||||
"offset_fields": [],
|
||||
"offset_getter": None,
|
||||
|
||||
Reference in new issue
Block a user