Merge pull request #639 from sandersantema/master

add saveGeom and restoreGeom to htmlEditor and remove unused variable w
This commit is contained in:
Damien Elmes 2020-05-27 21:30:51 +10:00 committed by GitHub
commit d60155bc92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,7 @@ Rai (Michal Pokorny) <agentydragon@gmail.com>
Zeno Gantner <zeno.gantner@gmail.com> Zeno Gantner <zeno.gantner@gmail.com>
Henrik Giesel <hengiesel@gmail.com> Henrik Giesel <hengiesel@gmail.com>
Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com> Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Sander Santema <github.com/sandersantema/>
******************** ********************

View File

@ -32,6 +32,8 @@ from aqt.utils import (
getFile, getFile,
openHelp, openHelp,
qtMenuShortcutWorkaround, qtMenuShortcutWorkaround,
restoreGeom,
saveGeom,
shortcut, shortcut,
showInfo, showInfo,
showWarning, showWarning,
@ -523,6 +525,7 @@ class Editor:
d = QDialog(self.widget) d = QDialog(self.widget)
form = aqt.forms.edithtml.Ui_Dialog() form = aqt.forms.edithtml.Ui_Dialog()
form.setupUi(d) form.setupUi(d)
restoreGeom(d, "htmlEditor")
qconnect(form.buttonBox.helpRequested, lambda: openHelp("editor")) qconnect(form.buttonBox.helpRequested, lambda: openHelp("editor"))
form.textEdit.setPlainText(self.note.fields[field]) form.textEdit.setPlainText(self.note.fields[field])
d.show() d.show()
@ -533,13 +536,14 @@ class Editor:
if html.find(">") > -1: if html.find(">") > -1:
# filter html through beautifulsoup so we can strip out things like a # filter html through beautifulsoup so we can strip out things like a
# leading </div> # leading </div>
with warnings.catch_warnings() as w: with warnings.catch_warnings():
warnings.simplefilter("ignore", UserWarning) warnings.simplefilter("ignore", UserWarning)
html = str(BeautifulSoup(html, "html.parser")) html = str(BeautifulSoup(html, "html.parser"))
self.note.fields[field] = html self.note.fields[field] = html
if not self.addMode: if not self.addMode:
self.note.flush() self.note.flush()
self.loadNote(focusTo=field) self.loadNote(focusTo=field)
saveGeom(d, "htmlEditor")
# Tag handling # Tag handling
###################################################################### ######################################################################