diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index bee9a5665..b8e7ce1ad 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -916,10 +916,10 @@ class Browser(QMainWindow): def _on_export_notes(self) -> None: if not self.mw.pm.legacy_import_export(): nids = self.selected_notes() - ExportDialog(self.mw, nids=nids) + ExportDialog(self.mw, nids=nids, parent=self) else: cids = self.selectedNotesAsCards() - LegacyExportDialog(self.mw, cids=list(cids)) + LegacyExportDialog(self.mw, cids=list(cids), parent=self) # Flags & Marking ###################################################################### diff --git a/qt/aqt/exporting.py b/qt/aqt/exporting.py index a3eeb96a9..149d486e6 100644 --- a/qt/aqt/exporting.py +++ b/qt/aqt/exporting.py @@ -7,6 +7,7 @@ import os import re import time from concurrent.futures import Future +from typing import Optional import aqt import aqt.forms @@ -34,8 +35,9 @@ class ExportDialog(QDialog): mw: aqt.main.AnkiQt, did: DeckId | None = None, cids: list[CardId] | None = None, + parent: Optional[QWidget] = None, ): - QDialog.__init__(self, mw, Qt.WindowType.Window) + QDialog.__init__(self, parent or mw, Qt.WindowType.Window) self.mw = mw self.col = mw.col.weakref() self.frm = aqt.forms.exporting.Ui_ExportDialog() diff --git a/qt/aqt/import_export/exporting.py b/qt/aqt/import_export/exporting.py index f4967961b..529856061 100644 --- a/qt/aqt/import_export/exporting.py +++ b/qt/aqt/import_export/exporting.py @@ -8,7 +8,7 @@ import re import time from abc import ABC, abstractmethod from dataclasses import dataclass -from typing import Sequence, Type +from typing import Optional, Sequence, Type import aqt.forms import aqt.main @@ -36,8 +36,9 @@ class ExportDialog(QDialog): mw: aqt.main.AnkiQt, did: DeckId | None = None, nids: Sequence[NoteId] | None = None, + parent: Optional[QWidget] = None, ): - QDialog.__init__(self, mw, Qt.WindowType.Window) + QDialog.__init__(self, parent or mw, Qt.WindowType.Window) self.mw = mw self.col = mw.col.weakref() self.frm = aqt.forms.exporting.Ui_ExportDialog()