Skip to content

Fix timeline plot not updating on category change#44

Merged
rtomek merged 1 commit into
masterfrom
feature/pip_support
Mar 3, 2026
Merged

Fix timeline plot not updating on category change#44
rtomek merged 1 commit into
masterfrom
feature/pip_support

Conversation

@rtomek
Copy link
Copy Markdown
Collaborator

@rtomek rtomek commented Mar 3, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 3, 2026 17:08
@rtomek rtomek merged commit d42fb36 into master Mar 3, 2026
1 check passed
Copy link
Copy Markdown

Copilot AI left a comment

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 addresses a UI-state synchronization issue where changing the selected category didn’t reliably propagate to the underlying selection state used for plotting (notably the timeline plot).

Changes:

  • Refresh GroupBoxData.category_info from the PySide6 category combobox selection when get_category_info() is called.
  • Fix custom_age_ranges YAML schema mapping/typing in ConfigData to match the repository’s example/test YAML structure.

Reviewed changes

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

File Description
src/midrc_react/gui/pyside6/dataselectiongroupbox.py Syncs category_info with the current combobox selection when queried.
src/midrc_react/core/jsdconfig.py Updates custom_age_ranges alias/type to align with YAML config files.

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

Comment on lines +126 to +127
if category_index >=0 and category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

get_category_info() now refreshes self.data.category_info only when the combobox has a valid index; when currentIndex() is -1 (e.g., the combobox was cleared or an out-of-range index was set), this returns the previous/stale category_info, which can desync the model from the UI. Consider explicitly clearing/resetting self.data.category_info when the combobox has no valid selection (or clamping to a default index when items exist), so callers don’t keep using an outdated category.

Suggested change
if category_index >=0 and category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
if 0 <= category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
else:
# No valid selection in the category combobox; clear category_info
self.data.category_info = {}

Copilot uses AI. Check for mistakes.
# Define fields based on expected YAML structure
data_sources: DataSourceConfigList = Field(..., alias='data sources')
custom_age_ranges: Optional[Dict[str, List[Union[int, float]]]] = Field(None, alias='custom_age_range')
custom_age_ranges: Optional[Dict[str, List[List[Union[int, float]]]]] = Field(None, alias='custom age ranges')
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The updated custom_age_ranges schema uses List[List[Union[int, float]]], which allows ranges of arbitrary length, but downstream code assumes each range has exactly two elements (min, max). To fail fast on bad YAML, consider modeling each range as a fixed-length tuple (e.g., Tuple[Union[int, float], Union[int, float]]) so Pydantic validates the structure and prevents runtime IndexError/mislabeling later.

Copilot uses AI. Check for mistakes.
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.

2 participants