Skip to content

Fix flashing when opening the stats, empty cards or find dupes dialogs #3928

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

Merged
merged 5 commits into from
Apr 17, 2025

Conversation

iamllama
Copy link
Contributor

@iamllama iamllama commented Apr 17, 2025

There's a slight visual regression (sorry!) after #3925 whereby the aforementioned dialogs flash more(?) after opening

AnkiWebView.set_kind now potentially sets a new page, and it flashes despite setting its background colour immediately after. set_kind needs to be called for those dialogs because their forms are codegen'd from qt ui designer files, which, as far as i can tell from the schema, don't seem to allow passing in custom arguments directly to widget constructors

The fix proposed here is to replace the webview widgets in those ui files with subclasses that have the correct kind filled in, to avoid calling set_kind after init

After this, only the legacy deck stats would still call it (and use the hack in set_kind), as it shares the same form (and webview widget) with the "new" deck stats

EDIT: I've overthought this by overlooking that the page's background colour wasn't set again after set_kind sets a new page, adding it seems to have gotten rid of the flashes

@abdnh abdnh merged commit a74fd74 into ankitects:main Apr 17, 2025
1 check passed
@dae
Copy link
Member

dae commented Apr 17, 2025

Simple solutions are always nice! Thank you both for the quick fix.

dae pushed a commit that referenced this pull request Apr 17, 2025
#3928)

* add AnkiWebView subclasses for stats, empty cards and find dupes ui

* update ui files to use subclassed webviews instead

* remove superfluous calls to AnkiWebView.set_kind

* revert impl

* set page background colour after setPage in AnkiWebView.set_kind

(cherry picked from commit a74fd74)
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