Skip to content

feat/bl-status-browser#1181

Merged
wyzula-jan merged 18 commits into
mainfrom
feat/bl-status-browser
Jun 12, 2026
Merged

feat/bl-status-browser#1181
wyzula-jan merged 18 commits into
mainfrom
feat/bl-status-browser

Conversation

@wyzula-jan

@wyzula-jan wyzula-jan commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a Beamline State Manager widget for browsing and managing BEC beamline states from the GUI.

The widget displays all configured BEC beamline states as status pills with semantic styling for VALID, WARNING, INVALID, and unknown states. Pills can be expanded to inspect and edit the underlying Pydantic config, update parameters, revert unsaved changes, or remove a state. New states can be added from the manager toolbar using generated forms based on the beamline-state config models.

A reusable PydanticWidgetForm utility was introduced to generate Qt forms from Pydantic models using field types and metadata. This keeps the beamline-state UI generic and avoids hard-coding individual config fields such as limits or tolerance.

The PR also includes supporting cleanup and fixes discovered while integrating the widget in the dock area and companion app: shared color/theme helpers, improved notification light-mode styling, safer notification event filters, incremental model updates for the beamline-state list, and device/signal combobox fixes.

Type of Change

  • Feature: add BeamlineStateManager and BeamlineStatePill widgets.
  • Feature: add add-state dialog, filtering by state/device, expandable edit panels, update/revert/remove actions.
  • Feature: add generic PydanticWidgetForm utility with DeviceComboBox and SignalComboBox support through WidgetIO.
  • Integration: register beamline-state widgets for CLI/designer and expose the manager in dock-area utilities.
  • Fix: avoid destructive list resets when adding/updating beamline states, preserving existing pill widgets/editors.
  • Fix: lazy-create expanded pill forms and instantiate them with the correct config class directly.
  • Fix: improve light/dark semantic styling for beamline-state pills and notification banners.
  • Fix: guard notification event filters against invalid non-QEvent inputs from PySide.
  • Fix: improve device/signal combobox validity styling and signal group header handling.
  • Tests: add unit coverage for forms, widget behavior, filters, model updates, notification styling/event filters, and an e2e beamline-state manager test.

How to test

  • Open the companion app or dock area and add BeamlineStateManager from the utilities toolbar.
  • Add a device-within-limits state for samx, move the device in/out of range, and verify the pill updates immediately.
  • Expand a pill, edit limits, verify dirty highlighting, update/revert behavior, and state removal.
  • Switch between light and dark mode and verify contrast/styling for pills and notifications.

Potential side effects

  • BeamlineStateManager uses Qt model/view with persistent pill editors. This is the right structure for filtering and incremental updates, but row widget lifetime is managed by Qt, so future changes should avoid full model resets unless all pills should be recreated.
  • PydanticWidgetForm is generic and may be reused beyond beamline states, but currently only covers the widget types needed here.
  • Notification event filters now ignore non-QEvent inputs defensively; valid Qt events are unchanged.
  • Device/signal combobox stylesheet behavior changed so valid/disabled state clears local styles instead of forcing transparent borders.

Additional Comments

Should be tested at least with bec branch `fix/field-types-in-bl-states

@wyzula-jan wyzula-jan self-assigned this May 29, 2026
@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Benchmark comparison

Threshold: 20% (lower is better).
Result: 0 regression(s), 0 improvement(s) beyond threshold.

No benchmark regression exceeded the configured threshold.

No benchmark improvement exceeded the configured threshold.

All benchmark results
Benchmark Baseline Current Change Status
BEC IPython client with companion app 6.05711 s 5.92806 s -2.13% ok
BEC IPython client without companion app 2.08694 s 1.96583 s -5.80% ok
Import bec_widgets 0.0141585 s 0.012907 s -8.84% ok
tests/unit_tests/benchmarks/test_dock_area_benchmark.py::test_add_waveform_to_dock_area 0.145439 s 0.149597 s +2.86% ok

@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch 4 times, most recently from 26fb4d9 to 9047d69 Compare June 5, 2026 15:29
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch 3 times, most recently from f6951b9 to 084e871 Compare June 9, 2026 11:27
@wyzula-jan wyzula-jan marked this pull request as ready for review June 9, 2026 11:30
Copilot AI review requested due to automatic review settings June 9, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Beamline State Manager UI to browse/manage BEC beamline states, backed by a reusable Pydantic-to-Qt form generator, and includes several UI/theming and widget-IO fixes plus new tests.

Changes:

  • Introduces BeamlineStateManager / BeamlineStatePill widgets (dialogs, filtering, update/revert/remove flows) and registers them for Designer/CLI.
  • Adds PydanticWidgetForm to generate Qt forms from Pydantic models (including Device/Signal combobox integration and optional-value handling).
  • Improves theming/helpers (colors + notifications), updates device/signal combobox behavior, and expands unit/e2e test coverage.

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit_tests/test_widget_io.py Adds unit coverage for WidgetIO support of Device/Signal comboboxes.
tests/unit_tests/test_notifications.py Adds tests for theme-change propagation, light-mode traceback styling, and defensive event filters.
tests/unit_tests/test_name_utils.py Adds tests for new sanitize_identifier() helper.
tests/unit_tests/test_main_widnow.py Removes a status-tip event test tied to the removed event() override.
tests/unit_tests/test_generated_form_form.py Adds comprehensive unit coverage for PydanticWidgetForm behavior and widget selection.
tests/unit_tests/test_dock_area.py Ensures BeamlineStateManager docks correctly and is exposed via toolbar actions.
tests/unit_tests/test_device_signal_input.py Adds coverage for disabled group headers and updated validity styling behavior.
tests/unit_tests/test_device_input_widgets.py Updates expectations for disabled combobox validity styling (stylesheet cleared).
tests/unit_tests/test_color_utils.py Adds tests for new color/theme helpers (get_theme_name, theme_color, rgba).
tests/unit_tests/test_beamline_state_pill.py Adds extensive unit coverage for beamline state pills/manager/dialog flows.
tests/end-2-end/test_beamline_state_manager_e2e.py Adds an e2e test validating real BEC beamline-state integration.
bec_widgets/widgets/services/beamline_states/register_beamline_state_pill.py Designer registration entrypoint for BeamlineStatePill.
bec_widgets/widgets/services/beamline_states/register_beamline_state_manager.py Designer registration entrypoint for BeamlineStateManager.
bec_widgets/widgets/services/beamline_states/dialogs.py Implements add-state dialog and status/device filter dialogs.
bec_widgets/widgets/services/beamline_states/beamline_state_pill.pyproject Declares Designer plugin project for pill widget module.
bec_widgets/widgets/services/beamline_states/beamline_state_pill.py Implements BeamlineStatePill + BeamlineStateManager widgets, model/delegate/view.
bec_widgets/widgets/services/beamline_states/beamline_state_pill_plugin.py Designer plugin wrapper for BeamlineStatePill.
bec_widgets/widgets/services/beamline_states/beamline_state_manager.pyproject Declares Designer plugin project for manager widget module.
bec_widgets/widgets/services/beamline_states/beamline_state_manager_plugin.py Designer plugin wrapper for BeamlineStateManager.
bec_widgets/widgets/services/beamline_states/init.py Package init (kept empty).
bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py Fixes validity styling, safer enabled-item checks, and group-header disabling.
bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py Fixes validity styling so disabled/valid clears local stylesheet.
bec_widgets/widgets/containers/main_window/main_window.py Removes status-tip swallowing event() override.
bec_widgets/widgets/containers/main_window/addons/notification_center/notification_banner.py Improves theme integration, light-mode styling, and event-filter robustness.
bec_widgets/widgets/containers/dock_area/dock_area.py Adds BeamlineStateManager to dock-area utilities toolbar.
bec_widgets/utils/widget_io.py Adds specialized handlers for Device/Signal comboboxes.
bec_widgets/utils/name_utils.py Adds sanitize_identifier() utility for normalizing user-provided names.
bec_widgets/utils/forms_from_types/pydantic_widget_form.py Adds PydanticWidgetForm + OptionalValueWidget for Pydantic-driven Qt forms.
bec_widgets/utils/colors.py Adds theme_color/rgba helpers; refactors colormap formatting helpers.
bec_widgets/cli/designer_plugins.py Registers new beamline-state widgets in Designer plugin mappings and icons.
bec_widgets/cli/client.py Exposes new widgets via the RPC/CLI client surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bec_widgets/utils/widget_io.py Outdated
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch from 084e871 to 985f0a6 Compare June 9, 2026 12:25

@wakonig wakonig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a quick first round

Comment thread bec_widgets/widgets/services/beamline_states/beamline_state_manager_plugin.py Outdated
Comment thread bec_widgets/widgets/services/beamline_states/beamline_state_pill_plugin.py Outdated
Comment thread bec_widgets/widgets/services/beamline_states/beamline_state_pill.py
Comment thread bec_widgets/widgets/services/beamline_states/beamline_state_pill.py
Comment thread bec_widgets/widgets/services/beamline_states/beamline_state_pill.py
Comment thread tests/unit_tests/test_beamline_state_pill.py Outdated
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch 13 times, most recently from fe4e40f to 14c2b66 Compare June 11, 2026 09:37
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch 2 times, most recently from 069a2d3 to 463183d Compare June 11, 2026 14:20
Comment thread pyproject.toml
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch 2 times, most recently from 3897451 to 8ad9d86 Compare June 12, 2026 09:08
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch from 8ad9d86 to 808d434 Compare June 12, 2026 09:21
@wyzula-jan wyzula-jan requested a review from wakonig June 12, 2026 09:35
@wyzula-jan wyzula-jan force-pushed the feat/bl-status-browser branch from 351c00e to dd96596 Compare June 12, 2026 13:33
@wyzula-jan wyzula-jan merged commit 3dfed23 into main Jun 12, 2026
43 checks passed
@wyzula-jan wyzula-jan deleted the feat/bl-status-browser branch June 12, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants