Skip to content

Port ListBox2D and ListBoxItem2D to v2 #1111 architecture#1131

Open
AdityaGupta716 wants to merge 16 commits intofury-gl:v2from
AdityaGupta716:port-listbox2d-v2
Open

Port ListBox2D and ListBoxItem2D to v2 #1111 architecture#1131
AdityaGupta716 wants to merge 16 commits intofury-gl:v2from
AdityaGupta716:port-listbox2d-v2

Conversation

@AdityaGupta716
Copy link
Copy Markdown
Contributor

@AdityaGupta716 AdityaGupta716 commented Feb 27, 2026

Closes #1111

Summary

Ports ListBox2D and ListBoxItem2D from the legacy branch to the v2 architecture, following the same patterns used by existing v2 components like Panel2D.

Changes

  • ListBox2D and ListBoxItem2D now properly inherit from UI and implement all required abstract methods (_setup, _get_actors, _add_to_scene, _get_size, _set_position, _update_actors_position)
  • Uses v2 components: Panel2D, Rectangle2D, TextBlock2D
  • Event callbacks updated to v2 signature (self, event)
  • Registered ListBox2D and ListBoxItem2D in fury/ui/__init__.pyi and __init__.py following the lazy loader pattern

Bug Fix

  • Fixed Panel2D._get_actors and _update_actors_position crashing with AttributeError: 'Panel2D' object has no attribute 'borders' when has_border=False

Known Limitations

  • Mouse wheel scrolling is not yet wired up as WheelEvent is not yet integrated into the v2 UI event system. A TODO comment has been left for when this is supported.

Tests

  • All 5 tests passing

@AdityaGupta716 AdityaGupta716 marked this pull request as draft February 27, 2026 02:49
@AdityaGupta716 AdityaGupta716 marked this pull request as ready for review February 27, 2026 03:12
@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

@maharshi-gor @ganimtron-10 plz review

@AdityaGupta716 AdityaGupta716 changed the title Port ListBox2D and ListBoxItem2D to v2 architecture Port ListBox2D and ListBoxItem2D to v2 #1111 architecture Feb 27, 2026
Copy link
Copy Markdown
Contributor

@ganimtron-10 ganimtron-10 left a comment

Choose a reason for hiding this comment

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

Hi @AdityaGupta716 , Thanks for the PR.

The changes should be done into the exisiting format and structure. Please refer review comments and Panel2D PR.

Also make sure all the existing features and test are present as it is and please add a demo file so its easier to test the UI element.

Thanks!

@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

Hi @ganimtron-10, addressed all review comments — moved both classes and tests into containers.py and test_containers.py, deleted the separate files, and added a demo at docs/examples/viz_listbox.py along with registering it in _valid_examples.toml. PTAL.

Copy link
Copy Markdown
Contributor

@ganimtron-10 ganimtron-10 left a comment

Choose a reason for hiding this comment

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

Hi @AdityaGupta716 ,

I started reviewing but executing the demo file gave me this blank grey box so stopped moving further.

Image

Please fix it and let me know will continue. PTAL few comments mentioned.

# npt.assert_equal(5, next(collapses))


@pytest.mark.filterwarnings("ignore::RuntimeWarning")
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.

We should not ignore RuntimeWarning

assert lb.selected == []


@pytest.mark.filterwarnings("ignore::RuntimeWarning")
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.

same here

assert lb.selected == ["a"]


@pytest.mark.filterwarnings("ignore::RuntimeWarning")
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.

same here

assert set(lb.selected) == {"a", "b"}


@pytest.mark.filterwarnings("ignore::RuntimeWarning")
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.

same here

assert lb.selected == ["a", "b", "c"]


@pytest.mark.filterwarnings("ignore::RuntimeWarning")
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.

same here

@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

@ganimtron-10 Hi done with the changes
Screenshot 2026-03-15 at 3 05 31 AM

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.

Port ListBox2D Component to v2

2 participants