Skip to content

Widget wiring cleanup #86

Merged
LelsersLasers merged 5 commits into
masterfrom
millan/widget_wiring_cleanup
Jul 3, 2026
Merged

Widget wiring cleanup #86
LelsersLasers merged 5 commits into
masterfrom
millan/widget_wiring_cleanup

Conversation

@LelsersLasers

Copy link
Copy Markdown
Member
  • Convert WidgetType to a full Widget Constructor
  • Introduce WidgetIds to automatically assign the widget number (removes all next_widget_name_num)

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

This PR refactors widget spawning by replacing the old WidgetType + per-widget next_*_num counters with a WidgetConstructor that can instantiate widgets and a centralized WidgetIds allocator.

Changes:

  • Introduces WidgetConstructor as the single source of truth for creating widgets (including parameterized widgets like Scope).
  • Adds WidgetIds to replace the many next_*_num fields previously stored on DAQApp.
  • Updates sidebar/ViewerTable UI actions and command palette to spawn widgets using WidgetConstructor.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/widget_ids.rs Adds central widget instance ID allocator.
src/widget_constructor.rs Defines widget constructors and creation logic for each widget variant.
src/ui/viewer_table.rs Updates Scope spawn action to use WidgetConstructor.
src/ui/sidebar.rs Updates “Add …” buttons to use WidgetConstructor.
src/main.rs Registers new widget_constructor and widget_ids modules.
src/app.rs Removes per-widget counters and delegates widget creation to WidgetConstructor::create.
src/action.rs Replaces WidgetType with WidgetConstructor in AppAction and command palette list.

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

Comment thread src/widget_ids.rs
Comment thread src/widget_constructor.rs
@LelsersLasers LelsersLasers requested a review from irvingywang July 3, 2026 04:09
@LelsersLasers LelsersLasers marked this pull request as ready for review July 3, 2026 04:10
Otherwise the fields of the scope constructor impact it's widget number (ie a scope on message X and scope one message Y would get the same counts)
Issue: hash uses Eq, so scopes still get different counters as well as it's memory inefficent/not preformant to hold all those keys
@LelsersLasers LelsersLasers force-pushed the millan/widget_wiring_cleanup branch from 64866ef to d4b0474 Compare July 3, 2026 20:58
@LelsersLasers LelsersLasers merged commit 416e836 into master Jul 3, 2026
1 check passed
@LelsersLasers LelsersLasers deleted the millan/widget_wiring_cleanup branch July 3, 2026 21:01
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