Merge branch 'master' of github.com:dae/anki

This commit is contained in:
Damien Elmes 2016-11-29 11:09:17 +10:00
commit e7c3859303
2 changed files with 8 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import os
import urllib.request, urllib.error, urllib.parse
import ctypes
import urllib.request, urllib.parse, urllib.error
import warnings
from anki.lang import _
from aqt.qt import *
@ -641,7 +642,9 @@ class Editor(object):
html = form.textEdit.toPlainText()
# filter html through beautifulsoup so we can strip out things like a
# leading </div>
html = str(BeautifulSoup(html, "html.parser"))
with warnings.catch_warnings() as w:
warnings.simplefilter('ignore', UserWarning)
html = str(BeautifulSoup(html, "html.parser"))
self.note.fields[self.currentField] = html
self.loadNote()
# focus field so it's saved
@ -871,7 +874,9 @@ to a cloze type first, via Edit>Change Note Type."""))
######################################################################
def _filterHTML(self, html, localize=False):
doc = BeautifulSoup(html, "html.parser")
with warnings.catch_warnings() as w:
warnings.simplefilter('ignore', UserWarning)
doc = BeautifulSoup(html, "html.parser")
# remove implicit regular font style from outermost element
if doc.span:
try:

View file

@ -225,7 +225,7 @@ you can enter it here. Use \\t to represent tab."""),
self.grid.addWidget(QLabel(text), num, 1)
button = QPushButton(_("Change"))
self.grid.addWidget(button, num, 2)
button.clicked.connect(lambda s=self,n=num: s.changeMappingNum(n))
button.clicked.connect(lambda _, s=self,n=num: s.changeMappingNum(n))
def changeMappingNum(self, n):
f = ChangeMap(self.mw, self.importer.model, self.mapping[n]).getField()