Repository navigation
Conversation
EditTagPanelView built both info popovers (ParentTagsInfoView and CategoriesInfoView) on every panel construction, although they stay hidden until the user clicks an info button. InfoButton now also accepts a function that returns the popover layout and builds the popover on the first click. Passing a layout keeps working. Building the edit tag panel for a new tag drops from 36.35 ms to 21.41 ms (median of 60). The popover content and the panel layout do not change. Co-Authored-By: Aiden <aiden@weco.ai>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TL;DR
EditTagPanelViewandInfoButton.pytest testsgives 315 passed, and ruff and pyright are clean on both changed files.What & Why
Before this change, the panel built both info popovers (
ParentTagsInfoViewandCategoriesInfoView) during construction. Each popover has many widgets, tag capsules, stylesheets and SVG icons. The popovers stay hidden until the user clicks an ⓘ button, so most panels never show them.Now
_title_rowgivesInfoButtonthe popover class, not a finished layout.InfoButtonkeeps it and builds the popover frame, content and fade effect in_build_popoveron the first click. Later clicks reuse the same popover. The popover code itself does not change, so it looks the same when it opens.Changes
InfoButton.__init__accepts a layout or a function that returns a layout. Existing callers that pass a layout keep working._build_popovermethod, which_toggle_popovercalls once.EditTagPanelView._title_rowpassesParentTagsInfoViewandCategoriesInfoViewas classes.Results
Median time per call on Linux x86_64 with offscreen Qt. Each value is the median of 60 calls, taken as the middle value over 3 alternating runs of the old and new code.
EditTagPanel(lib, None), as in the repo test)The last row shows the cost does not grow when the user opens the popovers. The work only moves to the first click.
Why this is safe and easy to maintain
The change is small, and the popover setup code moves into one method without a copy. The panel layout, the popover content and the popover position stay the same.
tests/qt/test_edit_tag_panel.pyand the rest of the Qt test suite cover the panel. A separate check also compared the full widget tree and the rendered panel and popover images against the old code.Validation
QT_QPA_PLATFORM=offscreen pytest testsgives 315 passed and 1 snapshot passed.ruff checkandruff format --check(0.15.17) pass on both files, andpyrightreports 0 errors.tests/conftest.py:Tasks Completed
AI assistance
OpenAI Codex (gpt-6.1-sol) generated the code change as candidates, and Weco Observe tracked them. Claude Code picked this candidate and ran the tests and timings. Automated checks compared the output with the old code. No manual run of the app was done.
Weco share link: https://dashboard.weco.ai/share/Uj5APINlfofYXq95xoryZnOa5KJ94bGY