Remove .exec() from QMenus in Deck Browser, Reviewer, and Card Template screens (#1674)

* Call StudyDeck with callback

* StudyDeck w/ callback, remove redundant assignment

* Replace exec() with show() for various dialogs

* Update super init args for Models.__init__

* Make StudyDialog ApplicationModal

* Remove .exec() from various dialogs and menus
This commit is contained in:
roxgib 2022-02-18 18:18:29 +11:00 committed by GitHub
parent 79df188e2a
commit 14af96d580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -404,7 +404,7 @@ class CardLayout(QDialog):
a.setChecked(self.mobile_emulation_enabled)
qconnect(a.toggled, self.on_mobile_class_action_toggled)
m.exec(self.pform.preview_settings.mapToGlobal(QPoint(0, 0)))
m.popup(self.pform.preview_settings.mapToGlobal(QPoint(0, 0)))
def on_preview_toggled(self) -> None:
self.have_autoplayed = False
@ -721,7 +721,7 @@ class CardLayout(QDialog):
a = m.addAction(tr.card_templates_browser_appearance())
qconnect(a.triggered, self.onBrowserDisplay)
m.exec(self.topAreaForm.templateOptions.mapToGlobal(QPoint(0, 0)))
m.popup(self.topAreaForm.templateOptions.mapToGlobal(QPoint(0, 0)))
def onBrowserDisplay(self) -> None:
d = QDialog()

View file

@ -274,7 +274,7 @@ class DeckBrowser:
a = m.addAction(tr.actions_delete())
qconnect(a.triggered, lambda b, did=did: self._delete(DeckId(int(did))))
gui_hooks.deck_browser_will_show_options_menu(m, int(did))
m.exec(QCursor.pos())
m.popup(QCursor.pos())
def _export(self, did: DeckId) -> None:
self.mw.onExport(did=did)

View file

@ -96,7 +96,7 @@ def _deck_prompt_dialog(decks: list[DeckDict]) -> None:
qconnect(button.clicked, diag.close)
box.addWidget(button)
diag.setLayout(box)
diag.exec()
diag.open()
def display_options_for_deck_id(deck_id: DeckId) -> None:

View file

@ -956,7 +956,7 @@ time = %(time)d;
gui_hooks.reviewer_will_show_context_menu(self, m)
qtMenuShortcutWorkaround(m)
m.exec(QCursor.pos())
m.popup(QCursor.pos())
def _addMenuItems(self, m: QMenu, rows: Sequence) -> None:
for row in rows: