Conversation
- Area detector in a new file structure - Area detector includes docks - cli points to new area_detector_viewer.py file - Dock Header theme add: roi and stats pv's are hardcoded in pva_reader.py
add: test_cli to test the cli buttons run
…urve toggles in stats plot; drop HKL Viewer/Save buttons from image dock
There was a problem hiding this comment.
Review Notes — PR #82
Ruff violations (5 errors)
pva_reader.py:1— I001 import block unsorted (collectionsis stdlib, must come before third-party imports)area_det_viewer.py:680— F841 unused variableprocess(assigned but never read)test_cli.py:31, 39, 47— F841 unused variableresult(3 occurrences)
Bug: user_config.py config file path
_CONFIG_FILE = Path(__file__).resolve().parents[1] / ".dashpva_data.json" resolves to src/dashpva/.dashpva_data.json — inside the package directory. This will fail on pip-installed packages (site-packages is read-only) and would get tracked by git. Should use settings.PROJECT_ROOT / ".dashpva_data.json" instead.
Bug: IOC_PREFIX vs DETECTOR_PREFIX in PVAReader._configure
The fallback changed from DETECTOR_PREFIX to IOC_PREFIX. ROI/Stats PVs use the detector prefix (e.g., s6lambda1:ROI1:MinX), not the IOC prefix (e.g., 6idb1:ScanOn:Value). At beamlines where these differ (6-ID-B: DETECTOR_PREFIX=s6lambda1, IOC_PREFIX=6idb1), this constructs wrong PV names. Additionally, IOC_PREFIX includes a trailing colon, so f'{pva_prefix}:ROI1:MinX' produces "6idb1::ROI1:MinX" (double colon). Currently latent because the area detector viewer always passes pva_prefix explicitly, but the old DETECTOR_PREFIX behavior was correct.
Cosmetic: Value label alignment inconsistency
ROI dock values use Qt.AlignRight — good for numeric readability. But Stats dock and Mouse Position dock value labels have no alignment set (left-aligned by default). All numeric value labels across docks should use Qt.AlignRight | Qt.AlignVCenter for consistency.
Cosmetic: Decimal formatting
Numeric values (pixel values, stats totals, etc.) should be formatted to 2 decimal places (e.g., f"{value:.2f}") so digits align vertically and users can read them at a glance. Currently some values display with full floating-point precision.
Default dock visibility
Current defaults: Stats + Mask + Mouse Position visible; Image + ROI + Analysis hidden. Suggested order for defaults:
- Stats — always visible (first)
- Image — always visible (second)
- Mouse Position — always visible (third)
- ROI, Analysis, Mask — available via Windows menu, shown on demand
add: editable/readonly bg styles, fix: make pvapy:image an exception channel instead of appending it to :Pva1:Image fix: right-align plotting_frequency in Image
PR #82 — Review (Round 2)Several items from the first review were fixed (ruff clean, 1. PV prefix handling — reverted from agreed patternThe This PR changed the Fix: Restore the
2. Autoscale default ON — not workingThe code sets 3. GPU/CPU in status barPR #82 changed 4. Hardcoded theme colorsOsayi moved the PV input channel, start/stop buttons, and value labels into
5. Dock stacking orderCurrent layout (lines 317-342): Stats + Image + Mouse Position are stuffed into a single Preferred layout: Stats and Mask tabified together (visible), Image and Mouse Position tabified together (visible), both groups stacked vertically — no "Info" wrapper dock. Osayi used Fix: Use standard 6. "Info" dock title bar visible
7. Fusion style forced globally
8. "Show Rois" → "Show ROIs"
9. Decimal formatting — values jumpingDecimal places are mostly correct ( |
pecomyint
left a comment
There was a problem hiding this comment.
Please see the new comments above
…theme_colors -- addresses "Hardcoded theme colors"
…- GPU/CPU in status bar
…tyle forced globally'
fix: decimal jump to stay in fixed colum
… - addresses "Dock stacking order" fix: analysis button dropdown (pyFAI / Phase Fitter / HKL 3D) fix: shrink analysis button height 80→50
fix: revert autoscale to dev-peco design (passive update_min_max, per-frame apply, drop timer_autoscale)
…_channel, _PVAPY_FULL_CHANNEL) fix: tabify stats/mask docks
…and have/perf/spinner constants remove: dead code (roi_x test stub, commented imports/disconnects) fix: lbl_roi_specifi_stats typo fix: detector prefix label capital P
There was a problem hiding this comment.
-
start_scan_monitor() is defined but never called
The scan FLAG_PV camonitor was extracted out of start_channel_monitor() into a new start_scan_monitor() method (
pva_reader.py:L514
), but nothing in _connect_pv_pollers() or anywhere else actually calls it. This means scan-mode users will never get the FLAG_PV monitored — is_scan_complete is never toggled, which can cause the viewer to sit at "listening" with no images. Please wire it into _connect_pv_pollers() after the stats monitors. -
Hard-coded light-mode colors break macOS dark mode
The new QSS rules force light hex backgrounds without setting a corresponding dark text color:
QLineEdit#pv_prefix { background-color: #F8F9FA } — white bg, but Fusion dark palette gives white text → invisible
QLabel[valueLabel="true"] { background-color: #DEE2E6 } — same problem on every value label in the docks
QSpinBox#plotting_frequency, QDoubleSpinBox#min_setting_val, QDoubleSpinBox#max_setting_val — same
start_live_view / stop_live_view buttons already had a light gradient, but the text color is never set explicitly → white-on-white under Fusion dark
These widgets were unstyled on main and worked fine across light/dark because Qt's native style handled it. Please either use palette() roles instead of hex values, or add explicit color: #2C3E50 to every rule that forces a light background.
Alternatively, revert these specific background rules — the dock structure itself doesn't depend on them.
This is a style consistency issue too — the project's existing convention in theme.qss was to use palette() for adaptive elements (e.g. QMessageBox QLabel { color: palette(text) }, QDockWidget::pane { border: 1px solid palette(mid) }). The new rules break that convention by mixing in hard-coded hex colors that only work in light mode. -
DOCK_MAX_WIDTH = 380 is a hard-coded pixel value
BaseDock (
base_dock.py:L6
) is logical px on macOS Retina (auto-scaled, fine) but physical px on beamline Linux boxes running stock X11 without QT_SCALE_FACTOR (unusably narrow on high-DPI). Make it a constructor kwarg with a default, or compute from font metrics so it scales on both platforms. -
Dock object names could collide setObjectName(self.title) uses bare names ("Stats", "ROI"). If workbench/HKL later use BaseDock with the same titles, saveState will cross-wire layouts. Namespace them (e.g. f"area_det_{self.title}").
-
Typo: "horiontal" → "horizontal" at
area_det_viewer.py:L198
…ts / PlotStats; namespace BaseDock objectName by host; typo horiontal->horizontal
52c6b72 to
d202cd0
Compare
remove: strip QSS + setObjectName on stats/plotstats/live-view buttons - match mask-dock pattern so they render natively and adapt to OS dark mode remove: strip generic QPushButton QSS from launcher.ui so launch buttons render natively and adapt to OS dark mode fix: editable inputs use palette(midlight) + border for visible non-white bg adapting to light/dark fix: adaptive palette colors for value labels, spinbox buttons, and borders in area det docks fix: adaptive palette styling across area det docks; remove torch from default deps
dc07f62 to
8694911
Compare
…spinboxes under fusion; reset dock to initial layout
…ack spinboxes under fusion; reset dock to initial layout
…e/black spinboxes
…spinboxes under fusion; reset dock to initial layout fix: adaptive palette(base) for all inputs and value labels; white/black spinboxes under fusion; reset dock to initial layout fix: revert start/stop live view buttons to light gradient; keep white/black spinboxes remove: DOCK_MAX_WIDTH constant and setMaximumWidth from all area-det docks fix: restore pva_prefix tracking, pvapy:image default, mask hidden, start_scan_monitor wired fix: white/black spinboxes; remove DOCK_MAX_WIDTH; restore pva_prefix, pvapy:image default, mask hidden, start_scan_monitor
…80px; reset via remove/re-add fix: dpi-aware dock sizing, clamp to window thirds, clamp window geom to screen on restore and reset fix: roi dock as standalone at bottom; only clamp window geom when exceeding screen
…rn to default layout
…ead of arbitrary px
What changed
Major refactor of the area detector viewer. The monolithic
area_det_viewer.pywas split into a package undersrc/dashpva/viewer/area_det/, with each panel extracted into its own dock module (docks/image_dock.py,docks/roi_dock.py,docks/stats_dock.py,docks/mask_dock.py,docks/mouse_pos_dock.py,docks/analysis_dock.py). The CLI entry point now resolves to the new path. Subsequent commits on the branch are layered on top of this restructure:test_clito exercise the CLI button surfaceTest plan
area_det_viewer.pyand the window opens with stats, mouse position, and mask docks initiallypytest tests/unit/test_cli.pypasses -- because we changed the area_det structure it passes