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:
Arthur Milchior 2020-04-02 09:31:49 +02:00
parent c722b5bd2c
commit 92cec5c327

View File

@ -1,7 +1,6 @@
import json
import re
import time
from dataclasses import dataclass
from typing import Any, List, Optional, Union
from anki.cards import Card
@ -23,12 +22,6 @@ from aqt.utils import restoreGeom, saveGeom
from aqt.webview import AnkiWebView
@dataclass
class PreviewDialog:
dialog: QDialog
parent: QWidget
class Previewer:
_lastPreviewState = None
_previewCardChanged = False
@ -105,15 +98,11 @@ class Previewer:
"mathjax/MathJax.js",
"reviewer.js",
]
web_context = PreviewDialog(dialog=self._previewWindow, parent=self.parent)
self._previewWeb.stdHtml(
self.mw.reviewer.revHtml(),
css=["reviewer.css"],
js=jsinc,
context=web_context,
self.mw.reviewer.revHtml(), css=["reviewer.css"], js=jsinc, context=self,
)
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: