Merge branch 'master' of https://github.com/dae/anki
|
@ -695,6 +695,10 @@ select id from notes where mid not in """ + ids2str(self.models.ids()))
|
||||||
self.remNotes(ids)
|
self.remNotes(ids)
|
||||||
# for each model
|
# for each model
|
||||||
for m in self.models.all():
|
for m in self.models.all():
|
||||||
|
for t in m['tmpls']:
|
||||||
|
if t['did'] == "None":
|
||||||
|
t['did'] = None
|
||||||
|
problems.append(_("Fixed AnkiDroid deck override bug."))
|
||||||
if m['type'] == MODEL_STD:
|
if m['type'] == MODEL_STD:
|
||||||
# model with missing req specification
|
# model with missing req specification
|
||||||
if 'req' not in m:
|
if 'req' not in m:
|
||||||
|
|
|
@ -190,7 +190,6 @@ question on all cards."""), help="AddItems")
|
||||||
saveGeom(self, "add")
|
saveGeom(self, "add")
|
||||||
aqt.dialogs.close("AddCards")
|
aqt.dialogs.close("AddCards")
|
||||||
QDialog.reject(self)
|
QDialog.reject(self)
|
||||||
self.deleteLater()
|
|
||||||
|
|
||||||
def canClose(self):
|
def canClose(self):
|
||||||
if (self.forceClose or self.editor.fieldsAreBlank() or
|
if (self.forceClose or self.editor.fieldsAreBlank() or
|
||||||
|
|
|
@ -373,11 +373,6 @@ class Browser(QMainWindow):
|
||||||
self.onSearch()
|
self.onSearch()
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def _headerKey(self):
|
|
||||||
if qtmajor >= 5:
|
|
||||||
return "editor2"
|
|
||||||
return "editor"
|
|
||||||
|
|
||||||
def setupToolbar(self):
|
def setupToolbar(self):
|
||||||
self.toolbarWeb = AnkiWebView()
|
self.toolbarWeb = AnkiWebView()
|
||||||
self.toolbarWeb.setFixedHeight(32 + self.mw.fontHeightDelta)
|
self.toolbarWeb.setFixedHeight(32 + self.mw.fontHeightDelta)
|
||||||
|
@ -463,7 +458,7 @@ class Browser(QMainWindow):
|
||||||
self.editor.setNote(None)
|
self.editor.setNote(None)
|
||||||
saveGeom(self, "editor")
|
saveGeom(self, "editor")
|
||||||
saveState(self, "editor")
|
saveState(self, "editor")
|
||||||
saveHeader(self.form.tableView.horizontalHeader(), self._headerKey())
|
saveHeader(self.form.tableView.horizontalHeader(), "editor")
|
||||||
self.col.conf['activeCols'] = self.model.activeCols
|
self.col.conf['activeCols'] = self.model.activeCols
|
||||||
self.col.setMod()
|
self.col.setMod()
|
||||||
self.hide()
|
self.hide()
|
||||||
|
@ -471,7 +466,6 @@ class Browser(QMainWindow):
|
||||||
self.teardownHooks()
|
self.teardownHooks()
|
||||||
self.mw.maybeReset()
|
self.mw.maybeReset()
|
||||||
evt.accept()
|
evt.accept()
|
||||||
self.deleteLater()
|
|
||||||
|
|
||||||
def canClose(self):
|
def canClose(self):
|
||||||
return True
|
return True
|
||||||
|
@ -629,7 +623,7 @@ class Browser(QMainWindow):
|
||||||
if not isWin:
|
if not isWin:
|
||||||
vh.hide()
|
vh.hide()
|
||||||
hh.show()
|
hh.show()
|
||||||
restoreHeader(hh, self._headerKey())
|
restoreHeader(hh, "editor")
|
||||||
hh.setHighlightSections(False)
|
hh.setHighlightSections(False)
|
||||||
hh.setMinimumSectionSize(50)
|
hh.setMinimumSectionSize(50)
|
||||||
hh.setMovable(True)
|
hh.setMovable(True)
|
||||||
|
@ -722,11 +716,9 @@ by clicking on one on the left."""))
|
||||||
|
|
||||||
def setColumnSizes(self):
|
def setColumnSizes(self):
|
||||||
hh = self.form.tableView.horizontalHeader()
|
hh = self.form.tableView.horizontalHeader()
|
||||||
for i in range(len(self.model.activeCols)):
|
hh.setResizeMode(QHeaderView.Interactive)
|
||||||
if hh.visualIndex(i) == len(self.model.activeCols) - 1:
|
hh.setResizeMode(hh.logicalIndex(len(self.model.activeCols)-1),
|
||||||
hh.setResizeMode(i, QHeaderView.Stretch)
|
QHeaderView.Stretch)
|
||||||
else:
|
|
||||||
hh.setResizeMode(i, QHeaderView.Interactive)
|
|
||||||
# this must be set post-resize or it doesn't work
|
# this must be set post-resize or it doesn't work
|
||||||
hh.setCascadingSectionResizes(False)
|
hh.setCascadingSectionResizes(False)
|
||||||
|
|
||||||
|
@ -869,7 +861,7 @@ by clicking on one on the left."""))
|
||||||
d = QDialog(self)
|
d = QDialog(self)
|
||||||
l = QVBoxLayout()
|
l = QVBoxLayout()
|
||||||
l.setMargin(0)
|
l.setMargin(0)
|
||||||
w = AnkiWebView()
|
w = AnkiWebView(canCopy=True)
|
||||||
l.addWidget(w)
|
l.addWidget(w)
|
||||||
w.stdHtml(info + "<p>" + reps)
|
w.stdHtml(info + "<p>" + reps)
|
||||||
bb = QDialogButtonBox(QDialogButtonBox.Close)
|
bb = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
|
|
|
@ -345,7 +345,7 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
|
||||||
if isMac:
|
if isMac:
|
||||||
size = 28
|
size = 28
|
||||||
else:
|
else:
|
||||||
size = 38 + self.mw.fontHeightDelta*3
|
size = 36 + self.mw.fontHeightDelta*3
|
||||||
self.bottom.web.setFixedHeight(size)
|
self.bottom.web.setFixedHeight(size)
|
||||||
self.bottom.web.setLinkHandler(self._linkHandler)
|
self.bottom.web.setLinkHandler(self._linkHandler)
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ class EditCurrent(QDialog):
|
||||||
self.mw.moveToState("review")
|
self.mw.moveToState("review")
|
||||||
saveGeom(self, "editcurrent")
|
saveGeom(self, "editcurrent")
|
||||||
aqt.dialogs.close("EditCurrent")
|
aqt.dialogs.close("EditCurrent")
|
||||||
self.deleteLater()
|
|
||||||
|
|
||||||
def canClose(self):
|
def canClose(self):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -75,7 +75,7 @@ into a bug report:""")
|
||||||
pluginText = _("""\
|
pluginText = _("""\
|
||||||
An error occurred in an add-on.<br>
|
An error occurred in an add-on.<br>
|
||||||
Please post on the add-on forum:<br>%s<br>""")
|
Please post on the add-on forum:<br>%s<br>""")
|
||||||
pluginText %= "https://groups.google.com/forum/#!forum/anki-addons"
|
pluginText %= "https://anki.tenderapp.com/discussions/add-ons"
|
||||||
if "addon" in error:
|
if "addon" in error:
|
||||||
txt = pluginText
|
txt = pluginText
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -63,6 +63,8 @@ class AnkiQt(QMainWindow):
|
||||||
self.onAppMsg(unicode(args[0], sys.getfilesystemencoding(), "ignore"))
|
self.onAppMsg(unicode(args[0], sys.getfilesystemencoding(), "ignore"))
|
||||||
# Load profile in a timer so we can let the window finish init and not
|
# Load profile in a timer so we can let the window finish init and not
|
||||||
# close on profile load error.
|
# close on profile load error.
|
||||||
|
if isMac and qtmajor >= 5:
|
||||||
|
self.show()
|
||||||
self.progress.timer(10, self.setupProfile, False)
|
self.progress.timer(10, self.setupProfile, False)
|
||||||
|
|
||||||
def setupUI(self):
|
def setupUI(self):
|
||||||
|
@ -1084,7 +1086,7 @@ will be lost. Continue?"""))
|
||||||
def setupFonts(self):
|
def setupFonts(self):
|
||||||
f = QFontInfo(self.font())
|
f = QFontInfo(self.font())
|
||||||
ws = QWebSettings.globalSettings()
|
ws = QWebSettings.globalSettings()
|
||||||
self.fontHeight = max(14, f.pixelSize())
|
self.fontHeight = f.pixelSize()
|
||||||
self.fontFamily = f.family()
|
self.fontFamily = f.family()
|
||||||
self.fontHeightDelta = max(0, self.fontHeight - 13)
|
self.fontHeightDelta = max(0, self.fontHeight - 13)
|
||||||
ws.setFontFamily(QWebSettings.StandardFont, self.fontFamily)
|
ws.setFontFamily(QWebSettings.StandardFont, self.fontFamily)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Reviewer(object):
|
||||||
if isMac:
|
if isMac:
|
||||||
self.bottom.web.setFixedHeight(46)
|
self.bottom.web.setFixedHeight(46)
|
||||||
else:
|
else:
|
||||||
self.bottom.web.setFixedHeight(54+self.mw.fontHeightDelta*4)
|
self.bottom.web.setFixedHeight(52+self.mw.fontHeightDelta*4)
|
||||||
self.bottom.web.setLinkHandler(self._linkHandler)
|
self.bottom.web.setLinkHandler(self._linkHandler)
|
||||||
self._reps = None
|
self._reps = None
|
||||||
self.nextCard()
|
self.nextCard()
|
||||||
|
@ -434,17 +434,11 @@ Please run Tools>Empty Cards""")
|
||||||
return txt.split("::")[0]
|
return txt.split("::")[0]
|
||||||
return txt
|
return txt
|
||||||
matches = [noHint(txt) for txt in matches]
|
matches = [noHint(txt) for txt in matches]
|
||||||
if len(matches) > 1:
|
uniqMatches = set(matches)
|
||||||
arr = []
|
if len(uniqMatches) == 1:
|
||||||
seen = {}
|
|
||||||
for m in matches:
|
|
||||||
if m in seen:
|
|
||||||
continue
|
|
||||||
seen[m] = 1
|
|
||||||
arr.append(m)
|
|
||||||
txt = ", ".join(arr)
|
|
||||||
else:
|
|
||||||
txt = matches[0]
|
txt = matches[0]
|
||||||
|
else:
|
||||||
|
txt = ", ".join(matches)
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def tokenizeComparison(self, given, correct):
|
def tokenizeComparison(self, given, correct):
|
||||||
|
|
|
@ -45,7 +45,6 @@ class DeckStats(QDialog):
|
||||||
def reject(self):
|
def reject(self):
|
||||||
saveGeom(self, self.name)
|
saveGeom(self, self.name)
|
||||||
QDialog.reject(self)
|
QDialog.reject(self)
|
||||||
self.deleteLater()
|
|
||||||
|
|
||||||
def browser(self):
|
def browser(self):
|
||||||
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
|
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
|
||||||
|
|
|
@ -40,7 +40,8 @@ class AnkiWebPage(QWebPage):
|
||||||
|
|
||||||
class AnkiWebView(QWebView):
|
class AnkiWebView(QWebView):
|
||||||
|
|
||||||
def __init__(self, canFocus=False):
|
# canFocus implies canCopy
|
||||||
|
def __init__(self, canFocus=False, canCopy=False):
|
||||||
QWebView.__init__(self)
|
QWebView.__init__(self)
|
||||||
self.setRenderHints(
|
self.setRenderHints(
|
||||||
QPainter.TextAntialiasing |
|
QPainter.TextAntialiasing |
|
||||||
|
@ -60,6 +61,7 @@ class AnkiWebView(QWebView):
|
||||||
# reset each time new html is set; used to detect if still in same state
|
# reset each time new html is set; used to detect if still in same state
|
||||||
self.key = None
|
self.key = None
|
||||||
self.setCanFocus(canFocus)
|
self.setCanFocus(canFocus)
|
||||||
|
self._canCopy = canCopy or canFocus
|
||||||
|
|
||||||
def keyPressEvent(self, evt):
|
def keyPressEvent(self, evt):
|
||||||
if evt.matches(QKeySequence.Copy):
|
if evt.matches(QKeySequence.Copy):
|
||||||
|
@ -79,7 +81,7 @@ class AnkiWebView(QWebView):
|
||||||
QWebView.keyReleaseEvent(self, evt)
|
QWebView.keyReleaseEvent(self, evt)
|
||||||
|
|
||||||
def contextMenuEvent(self, evt):
|
def contextMenuEvent(self, evt):
|
||||||
if not self.isCardViewer:
|
if not self._canCopy:
|
||||||
return
|
return
|
||||||
m = QMenu(self)
|
m = QMenu(self)
|
||||||
a = m.addAction(_("Copy"))
|
a = m.addAction(_("Copy"))
|
||||||
|
@ -109,7 +111,7 @@ class AnkiWebView(QWebView):
|
||||||
|
|
||||||
def stdHtml(self, body, css="", bodyClass="", loadCB=None, js=None, head=""):
|
def stdHtml(self, body, css="", bodyClass="", loadCB=None, js=None, head=""):
|
||||||
if isMac:
|
if isMac:
|
||||||
button = "font-weight: normal; height: 24px;"
|
button = "font-weight: bold; height: 24px;"
|
||||||
else:
|
else:
|
||||||
button = "font-weight: normal;"
|
button = "font-weight: normal;"
|
||||||
self.setHtml("""
|
self.setHtml("""
|
||||||
|
@ -130,12 +132,9 @@ button {
|
||||||
def setBridge(self, bridge):
|
def setBridge(self, bridge):
|
||||||
self._bridge.setBridge(bridge)
|
self._bridge.setBridge(bridge)
|
||||||
|
|
||||||
def setCanFocus(self, isCardViewer=False):
|
def setCanFocus(self, canFocus=False):
|
||||||
"""Set flag to denote if this WebView should follow rules specific to
|
self._canFocus = canFocus
|
||||||
card display (e.g., allow context menu, copy/paste)"""
|
if self._canFocus:
|
||||||
|
|
||||||
self.isCardViewer = isCardViewer
|
|
||||||
if self.isCardViewer:
|
|
||||||
self.setFocusPolicy(Qt.WheelFocus)
|
self.setFocusPolicy(Qt.WheelFocus)
|
||||||
else:
|
else:
|
||||||
self.setFocusPolicy(Qt.NoFocus)
|
self.setFocusPolicy(Qt.NoFocus)
|
||||||
|
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 786 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 802 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 475 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 457 B |
|
@ -29,7 +29,7 @@ do
|
||||||
echo " * "$py
|
echo " * "$py
|
||||||
pyuic4 $i -o $py
|
pyuic4 $i -o $py
|
||||||
# munge the output to use gettext
|
# munge the output to use gettext
|
||||||
perl -pi.bak -e 's/QtGui.QApplication.translate\(".*?", /_(/; s/, None, QtGui.*/))/' $py
|
perl -pi.bak -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' $py
|
||||||
rm $py.bak
|
rm $py.bak
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|