fix/tomo queue tooltip hides fields irrelevant to a job's tomo_type
Hovering a queue entry showed every snapshotted param unconditionally, including golden-ratio settings on a type-1 (non-golden) job -- and vice versa, type-1-only fields (angle range, zero-deg reference) on a golden-ratio job. Reuses _update_type_visibility()'s existing per-tomo_type section/field gating (already used for the live edit form) to filter _job_tooltip()'s params list the same way, for both flomni and lamni jobs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,29 @@ TOMO_TYPES = {
|
||||
3: "Equally spaced, golden ratio start",
|
||||
}
|
||||
|
||||
# Mirrors _update_type_visibility()'s section/field gating (_sec_type1 shown
|
||||
# only for type 1, golden_ratio_bunch_size shown only for type 2 within
|
||||
# _sec_type23, the rest of _sec_type23 shown for type 2/3) -- reused by
|
||||
# _job_tooltip() so a queued job's hover details don't show fields that are
|
||||
# meaningless for its own tomo_type (e.g. golden-ratio settings on a type-1
|
||||
# job), on both flomni and lamni.
|
||||
_TYPE1_ONLY_PARAMS = {"tomo_angle_range", "zero_deg_reference_at_each_subtomo"}
|
||||
_TYPE2_ONLY_PARAMS = {"golden_ratio_bunch_size"}
|
||||
_TYPE23_PARAMS = {"golden_max_number_of_projections", "golden_projections_at_0_deg_for_damage_estimation"}
|
||||
|
||||
|
||||
def _irrelevant_params_for_type(tomo_type: Any) -> set[str]:
|
||||
"""Param names that don't apply to a job's own tomo_type and should be
|
||||
hidden from its tooltip."""
|
||||
irrelevant: set[str] = set()
|
||||
if tomo_type != 1:
|
||||
irrelevant |= _TYPE1_ONLY_PARAMS
|
||||
if tomo_type not in (2, 3):
|
||||
irrelevant |= _TYPE23_PARAMS
|
||||
if tomo_type != 2:
|
||||
irrelevant |= _TYPE2_ONLY_PARAMS
|
||||
return irrelevant
|
||||
|
||||
STATUS_COLORS = {
|
||||
"pending": "#888888",
|
||||
"running": "#2196F3",
|
||||
@@ -2280,7 +2303,12 @@ def _job_tooltip(job: dict) -> str:
|
||||
# sorted(params) rather than a fixed module-level name tuple -- a
|
||||
# job's own params dict IS whichever setup's param snapshot, so this
|
||||
# works for both flomni and lamni jobs without needing to know which.
|
||||
# Fields irrelevant to this job's own tomo_type (e.g. golden-ratio
|
||||
# settings on a type-1 job) are skipped -- see _irrelevant_params_for_type().
|
||||
irrelevant = _irrelevant_params_for_type(params.get("tomo_type"))
|
||||
for name in sorted(params):
|
||||
if name in irrelevant:
|
||||
continue
|
||||
lines.append(f" {name}: {params[name]}")
|
||||
lines.append(f"Added: {job.get('added_at', '')}")
|
||||
return "\n".join(lines)
|
||||
|
||||
Reference in New Issue
Block a user