mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Avoid hiding webview when refreshing
When opening the graphs screen in dark mode, we want to load the page first and then reveal the webview, to prevent a flash of white that can appear as the page loads. Previously we did this for any call to load_ts_page(), but this results in flicker when refreshing an existing webview, such as the move from deck list to congrats screen. In those cases, at least on the machines I have to test with here, the refresh is smoother without the hide and show step. The new window case is still not ideal - while the hide+show prevents a flash of white, there is a flash of black instead, presumably as the webview draws the initially-blank framebuffer with the contents of the webview.
This commit is contained in:
parent
1ca05b00ec
commit
6095b01301
2 changed files with 1 additions and 1 deletions
|
@ -50,6 +50,7 @@ class NewDeckStats(QDialog):
|
||||||
maybeHideClose(self.form.buttonBox)
|
maybeHideClose(self.form.buttonBox)
|
||||||
addCloseShortcut(self)
|
addCloseShortcut(self)
|
||||||
gui_hooks.stats_dialog_will_show(self)
|
gui_hooks.stats_dialog_will_show(self)
|
||||||
|
self.form.web.hide_while_preserving_layout()
|
||||||
self.show()
|
self.show()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
self.form.web.set_bridge_command(self._on_bridge_cmd, self)
|
self.form.web.set_bridge_command(self._on_bridge_cmd, self)
|
||||||
|
|
|
@ -675,7 +675,6 @@ html {{ {font} }}
|
||||||
extra = "#night"
|
extra = "#night"
|
||||||
else:
|
else:
|
||||||
extra = ""
|
extra = ""
|
||||||
self.hide_while_preserving_layout()
|
|
||||||
self.load_url(QUrl(f"{mw.serverURL()}_anki/pages/{name}.html{extra}"))
|
self.load_url(QUrl(f"{mw.serverURL()}_anki/pages/{name}.html{extra}"))
|
||||||
self.add_dynamic_css_and_classes_then_show()
|
self.add_dynamic_css_and_classes_then_show()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue