From 1215ee7849db3e2d531e3f70394da0b79b13c50b Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 8 Dec 2022 22:17:26 +1000 Subject: [PATCH] Deck options: hide webview after showing dialog This seems to reduce flicker, presumably because the webview doesn't pick up the correct geometry until the dialog is shown. --- qt/aqt/deckoptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/aqt/deckoptions.py b/qt/aqt/deckoptions.py index baf5320de..431622adb 100644 --- a/qt/aqt/deckoptions.py +++ b/qt/aqt/deckoptions.py @@ -33,7 +33,6 @@ class DeckOptionsDialog(QDialog): self.mw = mw self._deck = deck self._setup_ui() - self.show() def _setup_ui(self) -> None: self.setWindowModality(Qt.WindowModality.ApplicationModal) @@ -44,12 +43,13 @@ class DeckOptionsDialog(QDialog): addCloseShortcut(self) self.web = AnkiWebView(title=self.TITLE) - self.web.setVisible(False) self.web.load_ts_page("deck-options") layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.web) self.setLayout(layout) + self.show() + self.web.hide_while_preserving_layout() self.web.eval( f"""const $deckOptions = anki.setupDeckOptions({self._deck["id"]});"""