Change export notes' parent window in card browser (#2761)

This commit is contained in:
kelciour 2023-10-22 03:23:58 +03:00 committed by GitHub
parent f9de92ee09
commit 1954a28bcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -916,10 +916,10 @@ class Browser(QMainWindow):
def _on_export_notes(self) -> None: def _on_export_notes(self) -> None:
if not self.mw.pm.legacy_import_export(): if not self.mw.pm.legacy_import_export():
nids = self.selected_notes() nids = self.selected_notes()
ExportDialog(self.mw, nids=nids) ExportDialog(self.mw, nids=nids, parent=self)
else: else:
cids = self.selectedNotesAsCards() cids = self.selectedNotesAsCards()
LegacyExportDialog(self.mw, cids=list(cids)) LegacyExportDialog(self.mw, cids=list(cids), parent=self)
# Flags & Marking # Flags & Marking
###################################################################### ######################################################################

View file

@ -7,6 +7,7 @@ import os
import re import re
import time import time
from concurrent.futures import Future from concurrent.futures import Future
from typing import Optional
import aqt import aqt
import aqt.forms import aqt.forms
@ -34,8 +35,9 @@ class ExportDialog(QDialog):
mw: aqt.main.AnkiQt, mw: aqt.main.AnkiQt,
did: DeckId | None = None, did: DeckId | None = None,
cids: list[CardId] | 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.mw = mw
self.col = mw.col.weakref() self.col = mw.col.weakref()
self.frm = aqt.forms.exporting.Ui_ExportDialog() self.frm = aqt.forms.exporting.Ui_ExportDialog()

View file

@ -8,7 +8,7 @@ import re
import time import time
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from typing import Sequence, Type from typing import Optional, Sequence, Type
import aqt.forms import aqt.forms
import aqt.main import aqt.main
@ -36,8 +36,9 @@ class ExportDialog(QDialog):
mw: aqt.main.AnkiQt, mw: aqt.main.AnkiQt,
did: DeckId | None = None, did: DeckId | None = None,
nids: Sequence[NoteId] | 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.mw = mw
self.col = mw.col.weakref() self.col = mw.col.weakref()
self.frm = aqt.forms.exporting.Ui_ExportDialog() self.frm = aqt.forms.exporting.Ui_ExportDialog()