Pass CardInfoDialog context to stdHtml
This commit is contained in:
parent
bbd667b0ff
commit
5bd38ce0a5
@ -1382,27 +1382,20 @@ by clicking on one on the left."""
|
|||||||
info, cs = self._cardInfoData()
|
info, cs = self._cardInfoData()
|
||||||
reps = self._revlogData(cs)
|
reps = self._revlogData(cs)
|
||||||
|
|
||||||
class CardInfoDialog(QDialog):
|
card_info_dialog = CardInfoDialog(self)
|
||||||
silentlyClose = True
|
|
||||||
|
|
||||||
def reject(self):
|
|
||||||
saveGeom(self, "revlog")
|
|
||||||
return QDialog.reject(self)
|
|
||||||
|
|
||||||
d = CardInfoDialog(self)
|
|
||||||
l = QVBoxLayout()
|
l = QVBoxLayout()
|
||||||
l.setContentsMargins(0, 0, 0, 0)
|
l.setContentsMargins(0, 0, 0, 0)
|
||||||
w = AnkiWebView(title="browser card info")
|
w = AnkiWebView(title="browser card info")
|
||||||
l.addWidget(w)
|
l.addWidget(w)
|
||||||
w.stdHtml(info + "<p>" + reps)
|
w.stdHtml(info + "<p>" + reps, context=card_info_dialog)
|
||||||
bb = QDialogButtonBox(QDialogButtonBox.Close)
|
bb = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
l.addWidget(bb)
|
l.addWidget(bb)
|
||||||
bb.rejected.connect(d.reject)
|
bb.rejected.connect(card_info_dialog.reject)
|
||||||
d.setLayout(l)
|
card_info_dialog.setLayout(l)
|
||||||
d.setWindowModality(Qt.WindowModal)
|
card_info_dialog.setWindowModality(Qt.WindowModal)
|
||||||
d.resize(500, 400)
|
card_info_dialog.resize(500, 400)
|
||||||
restoreGeom(d, "revlog")
|
restoreGeom(card_info_dialog, "revlog", CardInfoDialog)
|
||||||
d.show()
|
card_info_dialog.show()
|
||||||
|
|
||||||
def _cardInfoData(self):
|
def _cardInfoData(self):
|
||||||
from anki.stats import CardStats
|
from anki.stats import CardStats
|
||||||
@ -2480,3 +2473,18 @@ Are you sure you want to continue?"""
|
|||||||
|
|
||||||
def onHelp(self):
|
def onHelp(self):
|
||||||
openHelp("browsermisc")
|
openHelp("browsermisc")
|
||||||
|
|
||||||
|
|
||||||
|
# Card Info Dialog
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
class CardInfoDialog(QDialog):
|
||||||
|
silentlyClose = True
|
||||||
|
|
||||||
|
def __init__(self, browser: Browser, *args, **kwargs):
|
||||||
|
super().__init__(browser, *args, **kwargs)
|
||||||
|
self.browser = browser
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
saveGeom(self, "revlog")
|
||||||
|
return QDialog.reject(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user