removing PreviewDialog dataclass
It can be replaced by the previewer itself. As suggested by Glutanimate https://github.com/ankitects/anki/pull/532#discussion_r401252970
This commit is contained in:
parent
c722b5bd2c
commit
92cec5c327
@ -1,7 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from dataclasses import dataclass
|
|
||||||
from typing import Any, List, Optional, Union
|
from typing import Any, List, Optional, Union
|
||||||
|
|
||||||
from anki.cards import Card
|
from anki.cards import Card
|
||||||
@ -23,12 +22,6 @@ from aqt.utils import restoreGeom, saveGeom
|
|||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class PreviewDialog:
|
|
||||||
dialog: QDialog
|
|
||||||
parent: QWidget
|
|
||||||
|
|
||||||
|
|
||||||
class Previewer:
|
class Previewer:
|
||||||
_lastPreviewState = None
|
_lastPreviewState = None
|
||||||
_previewCardChanged = False
|
_previewCardChanged = False
|
||||||
@ -105,15 +98,11 @@ class Previewer:
|
|||||||
"mathjax/MathJax.js",
|
"mathjax/MathJax.js",
|
||||||
"reviewer.js",
|
"reviewer.js",
|
||||||
]
|
]
|
||||||
web_context = PreviewDialog(dialog=self._previewWindow, parent=self.parent)
|
|
||||||
self._previewWeb.stdHtml(
|
self._previewWeb.stdHtml(
|
||||||
self.mw.reviewer.revHtml(),
|
self.mw.reviewer.revHtml(), css=["reviewer.css"], js=jsinc, context=self,
|
||||||
css=["reviewer.css"],
|
|
||||||
js=jsinc,
|
|
||||||
context=web_context,
|
|
||||||
)
|
)
|
||||||
self._previewWeb.set_bridge_command(
|
self._previewWeb.set_bridge_command(
|
||||||
self._on_preview_bridge_cmd, web_context,
|
self._on_preview_bridge_cmd, self,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _on_preview_bridge_cmd(self, cmd: str) -> Any:
|
def _on_preview_bridge_cmd(self, cmd: str) -> Any:
|
||||||
|
Loading…
Reference in New Issue
Block a user