2.1.46 Browser white screen

When I try to open the browser a full white screen appear for a couple of seconds which is controversial with the dark mode. If the white screen color could be changed to dark/black. I would be grateful

I cannot reproduce this. Did you rule out add-ons?

Yes I ruld out addon, You can see the white screen in the video

Oh, I noticed something else, that white screen is actually present with other buttons, (Status, Add).
however it’s not a white definite screen like in the browser(video).
It’s more like flashes of light. (like the time of the white screen is less)
I really have zero knowledge but I think anki is some sort of (web application or it acts like a webpage) so I tried some searching, maybe this could have some relation

However in the Browse screen, only the Editor section is a webview, the rest is Qt.

I can reproduce it on Windows. Anki has set the background color before showing the window, so I’m not sure if this is just a limitation of the toolkit, or whether there would be some practical way to work around it.

1 Like

@dae any news about this problem ?

Happy to accept a patch if someone figures out a workaround.

1 Like

@dae I searched about this problem. it seems like it’s hard coded in windows 10 and even 11. It present on browsers even Explorer.exe has the problem. It’s been years like that. people started noticed with the increasing transition to dark mode in every aspect.

So there seems to be no solution to this from microsoft side.

My suggestion is that. can browser be preloaded like when we open anki. it also load browser in memory just waiting to be clicked to open immediately

Just think of it as it was minimized and you click browser button = it will open immediately

So the benefits of this workaround will be

1- Immediate browser opening instead of the few seconds lag in the start incase of large decks e.g; Anking has like ~30K cards
2- Bypass the white screen flashing

I’ve prepared a fix. There is still a flicker, but only when the browser is opened for the first time, and it doesn’t scale with the collection size, so in your case it should be much quicker.
I’m not optimistic that we can get rid of it completely.

3 Likes

@Rumo
Great !! Thank you !!. I know this is not how github works but can this fix be applied to anki 2.1.49 ? like (download a file and paste it in anki folder) ?

You could create an add-on with the patch. Just create a folder in your add-ons folder, and put a file called __init__.py there with the following content:

from aqt.browser.browser import *


def browser_init(
    self,
    mw: AnkiQt,
    card: Optional[Card] = None,
    search: Optional[Tuple[Union[str, SearchNode]]] = None,
) -> None:
    """
    card -- try to select the provided card after executing "search" or
            "deck:current" (if "search" was None)
    search -- set and perform search; caller must ensure validity
    """

    QMainWindow.__init__(self, None, Qt.Window)
    self.mw = mw
    self.col = self.mw.col
    self.lastFilter = ""
    self.focusTo: Optional[int] = None
    self._previewer: Optional[Previewer] = None
    self._closeEventHasCleanedUp = False
    self.form = aqt.forms.browser.Ui_Dialog()
    self.form.setupUi(self)
    self.setupSidebar()
    restoreGeom(self, "editor", 0)
    restoreState(self, "editor")
    restoreSplitter(self.form.splitter, "editor3")
    self.form.splitter.setChildrenCollapsible(False)
    self.card: Optional[Card] = None
    self.setup_table()
    self.setupMenus()
    self.setupHooks()
    self.setupEditor()
    # disable undo/redo
    self.on_undo_state_change(mw.undo_actions_info())
    # legacy alias
    self.model = MockModel(self)
    self.setupSearch(card, search)
    gui_hooks.browser_will_show(self)
    self.show()


aqt.browser.browser.Browser.__init__ = browser_init

This may not work if you have other add-ons modifying the browser, and I can guarantee it will break things on other Anki versions.

I’d be interested to know in how far it mitigates the issue for you!

2 Likes

It Worked !!! as you said. it’s still there but still waaay better than before. I half lot’s of addons installed. :smiley: but for now, no erros appeared. will keep testing. Thank you!!

1 Like