-
Notifications
You must be signed in to change notification settings - Fork 1
Add plot grid #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SimonHeybrock
wants to merge
46
commits into
main
Choose a base branch
from
plot-grid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add plot grid #519
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
ba52191
Add PlotGrid widget for multi-plot dashboard layouts
SimonHeybrock a4840a4
Improve PlotGrid UX with better visual feedback during selection
SimonHeybrock be02993
Add larger font during PlotGrid cell selection using stylesheets
SimonHeybrock 8590853
Fix close button position
SimonHeybrock fa0488c
Batch PlotGrid cell updates to eliminate visual cascade effect
SimonHeybrock 224ee58
Fix PlotGrid close button styling using stylesheets
SimonHeybrock d233f19
Add plan
SimonHeybrock 11a842e
Integrate PlotGrid into dashboard with modal workflow
SimonHeybrock f74fb90
Fix Panel GridSpec overlap warnings in PlotGrid
SimonHeybrock 0179fca
Set min height
SimonHeybrock d66bc97
Fix PlotGrid modal workflow race conditions and update tests
SimonHeybrock 903f391
Refactor plotter selection to use buttons instead of dropdown
SimonHeybrock cc59187
Remove unused demo and planning docs
SimonHeybrock b469215
Remove unnecessary refresh() method from PlotGridTab
SimonHeybrock 56efa2d
Remove unused _setup_keyboard_handler method from PlotGrid
SimonHeybrock 0b72f4b
WIP
SimonHeybrock 0dd6c9c
Fix PlotGrid height shrinking when modal opens
SimonHeybrock e1d6ad9
Refactor PlotGrid: extract styling constants and region helpers
SimonHeybrock 9764453
Fix: Reset _success_callback_invoked flag in JobPlotterSelectionModal…
SimonHeybrock adb411a
Optimize PlotGrid: remove redundant cell refreshes during plot creation
SimonHeybrock 28af084
Refactor JobPlotterSelectionModal: Replace flag with state enum
SimonHeybrock 596db1d
Enable pn.state.notifications
SimonHeybrock c38d40d
Refactor JobPlotterSelectionModal: Extract step components
SimonHeybrock 17d3bd6
Fix PlotGrid tests
SimonHeybrock 96d2d89
Refactor JobPlotterSelectionModal: Extract step 1 component
SimonHeybrock 8710637
Refactor PlotGrid tests to test public behavior only
SimonHeybrock a558b3d
Replace unittest.mock.MagicMock with simple FakeCallback
SimonHeybrock 0d532ef
Extract generic Wizard component from JobPlotterSelectionModal
SimonHeybrock 6c8fcbf
Refactor Wizard: Separate navigation logic from modal presentation
SimonHeybrock 9db5cd5
Refactor Wizard: Replace callback injection with observer pattern
SimonHeybrock cf13547
Refactor wizard button layout for consistency and standard conventions
SimonHeybrock e46ccfa
Move button logic from ConfigurationPanel to ConfigurationModal
SimonHeybrock 07533a1
Replace action_button_label method with Wizard constructor parameter
SimonHeybrock c0f017a
Add comprehensive tests for Wizard and WizardStep classes
SimonHeybrock 9186264
Refactor wizard to auto-generate step headers using template method p…
SimonHeybrock 95e686e
Cleanup
SimonHeybrock 061f12b
Refactor wizard and configuration panel to separate validation from e…
SimonHeybrock 9dae9e7
WIP: Checkpoint - Refactor wizard to use typed data flow pattern
SimonHeybrock fe8409a
Refactor: Use callback pattern instead of return values in Configurat…
SimonHeybrock 1f95775
Rename WizardStep.execute() to commit() for clearer semantics
SimonHeybrock d598975
Use pn.io.hold() consistently in PlotGrid._insert_plot()
SimonHeybrock 97b0f37
Improve type hints and remove unmotivated exception handling
SimonHeybrock 423dbab
Move non-widget file
SimonHeybrock 7e05f91
Remove dev file
SimonHeybrock 875231d
Refactor: Replace WizardState enum with boolean flag
SimonHeybrock 57b651d
Address review comments from PR #519
SimonHeybrock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # Copyright (c) 2025 Scipp contributors (https://github.com/scipp) | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
| import pydantic | ||
|
|
||
| from ess.livedata.config.workflow_spec import JobNumber | ||
| from ess.livedata.dashboard.configuration_adapter import ConfigurationAdapter | ||
| from ess.livedata.dashboard.plotting import PlotterSpec | ||
| from ess.livedata.dashboard.plotting_controller import PlottingController | ||
|
|
||
|
|
||
| class PlotConfigurationAdapter(ConfigurationAdapter): | ||
| """Adapter for plot configuration modal.""" | ||
|
|
||
| def __init__( | ||
| self, | ||
| job_number: JobNumber, | ||
| output_name: str | None, | ||
| plot_spec: PlotterSpec, | ||
| available_sources: list[str], | ||
| plotting_controller: PlottingController, | ||
| success_callback, | ||
| ): | ||
| self._job_number = job_number | ||
| self._output_name = output_name | ||
| self._plot_spec = plot_spec | ||
| self._available_sources = available_sources | ||
| self._plotting_controller = plotting_controller | ||
| self._success_callback = success_callback | ||
|
|
||
| self._persisted_config = ( | ||
| self._plotting_controller.get_persistent_plotter_config( | ||
| job_number=self._job_number, | ||
| output_name=self._output_name, | ||
| plot_name=self._plot_spec.name, | ||
| ) | ||
| ) | ||
|
|
||
| @property | ||
| def title(self) -> str: | ||
| return f"Configure {self._plot_spec.title}" | ||
|
|
||
| @property | ||
| def description(self) -> str: | ||
| return self._plot_spec.description | ||
|
|
||
| def model_class(self) -> type[pydantic.BaseModel] | None: | ||
| return self._plot_spec.params | ||
|
|
||
| @property | ||
| def source_names(self) -> list[str]: | ||
| return self._available_sources | ||
|
|
||
| @property | ||
| def initial_source_names(self) -> list[str]: | ||
| if self._persisted_config is not None: | ||
| # Filter persisted source names to only include those still available | ||
| persisted_sources = [ | ||
| name | ||
| for name in self._persisted_config.source_names | ||
| if name in self._available_sources | ||
| ] | ||
| return persisted_sources if persisted_sources else self._available_sources | ||
| return self._available_sources | ||
|
|
||
| @property | ||
| def initial_parameter_values(self) -> dict[str, Any]: | ||
| if self._persisted_config is not None: | ||
| return self._persisted_config.config.params | ||
| return {} | ||
|
|
||
| def start_action( | ||
| self, | ||
| selected_sources: list[str], | ||
| parameter_values: Any, | ||
| ) -> None: | ||
| """Create the plot and call the success callback with the result.""" | ||
| plot = self._plotting_controller.create_plot( | ||
| job_number=self._job_number, | ||
| source_names=selected_sources, | ||
| output_name=self._output_name, | ||
| plot_name=self._plot_spec.name, | ||
| params=parameter_values, | ||
| ) | ||
| self._success_callback(plot, selected_sources) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted from
plot_creation_widget.py