Apply some fixes from Abdo

https://github.com/ankitects/anki/pull/2612#issuecomment-1712320801
This commit is contained in:
Damien Elmes 2023-09-09 09:12:31 +10:00
parent 71028207e0
commit 89854ac2b9
2 changed files with 5 additions and 2 deletions

View file

@ -3,6 +3,8 @@
from __future__ import annotations
import json
import aqt
import aqt.deckconf
import aqt.main
@ -48,9 +50,9 @@ class ImportDialog(QDialog):
self.setLayout(layout)
restoreGeom(self, self.TITLE, default_size=(800, 800))
escaped_path = path.replace("'", r"\'")
escaped_path = json.dumps(path.replace("'", r"\'"))
self.web.evalWithCallback(
f"anki.{self.SETUP_FUNCTION_NAME}('{escaped_path}');",
f"anki.{self.SETUP_FUNCTION_NAME}({escaped_path});",
lambda _: self.web.setFocus(),
)
self.setWindowTitle(tr.decks_import_file())

View file

@ -11,6 +11,7 @@
@import "bootstrap/scss/modal";
@import "bootstrap/scss/carousel";
@import "sass/bootstrap-forms";
@import "sass/bootstrap-tooltip";
.night-mode {
@include bootstrap-dark.night-mode;