mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
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.
This commit is contained in:
parent
93d14de95c
commit
1215ee7849
1 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,6 @@ class DeckOptionsDialog(QDialog):
|
||||||
self.mw = mw
|
self.mw = mw
|
||||||
self._deck = deck
|
self._deck = deck
|
||||||
self._setup_ui()
|
self._setup_ui()
|
||||||
self.show()
|
|
||||||
|
|
||||||
def _setup_ui(self) -> None:
|
def _setup_ui(self) -> None:
|
||||||
self.setWindowModality(Qt.WindowModality.ApplicationModal)
|
self.setWindowModality(Qt.WindowModality.ApplicationModal)
|
||||||
|
@ -44,12 +43,13 @@ class DeckOptionsDialog(QDialog):
|
||||||
addCloseShortcut(self)
|
addCloseShortcut(self)
|
||||||
|
|
||||||
self.web = AnkiWebView(title=self.TITLE)
|
self.web = AnkiWebView(title=self.TITLE)
|
||||||
self.web.setVisible(False)
|
|
||||||
self.web.load_ts_page("deck-options")
|
self.web.load_ts_page("deck-options")
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
layout.addWidget(self.web)
|
layout.addWidget(self.web)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
self.show()
|
||||||
|
self.web.hide_while_preserving_layout()
|
||||||
|
|
||||||
self.web.eval(
|
self.web.eval(
|
||||||
f"""const $deckOptions = anki.setupDeckOptions({self._deck["id"]});"""
|
f"""const $deckOptions = anki.setupDeckOptions({self._deck["id"]});"""
|
||||||
|
|
Loading…
Reference in a new issue