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)
|
||||
# for each model
|
||||
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:
|
||||
# model with missing req specification
|
||||
if 'req' not in m:
|
||||
|
|
|
@ -190,7 +190,6 @@ question on all cards."""), help="AddItems")
|
|||
saveGeom(self, "add")
|
||||
aqt.dialogs.close("AddCards")
|
||||
QDialog.reject(self)
|
||||
self.deleteLater()
|
||||
|
||||
def canClose(self):
|
||||
if (self.forceClose or self.editor.fieldsAreBlank() or
|
||||
|
|
|
@ -373,11 +373,6 @@ class Browser(QMainWindow):
|
|||
self.onSearch()
|
||||
self.show()
|
||||
|
||||
def _headerKey(self):
|
||||
if qtmajor >= 5:
|
||||
return "editor2"
|
||||
return "editor"
|
||||
|
||||
def setupToolbar(self):
|
||||
self.toolbarWeb = AnkiWebView()
|
||||
self.toolbarWeb.setFixedHeight(32 + self.mw.fontHeightDelta)
|
||||
|
@ -463,7 +458,7 @@ class Browser(QMainWindow):
|
|||
self.editor.setNote(None)
|
||||
saveGeom(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.setMod()
|
||||
self.hide()
|
||||
|
@ -471,7 +466,6 @@ class Browser(QMainWindow):
|
|||
self.teardownHooks()
|
||||
self.mw.maybeReset()
|
||||
evt.accept()
|
||||
self.deleteLater()
|
||||
|
||||
def canClose(self):
|
||||
return True
|
||||
|
@ -629,7 +623,7 @@ class Browser(QMainWindow):
|
|||
if not isWin:
|
||||
vh.hide()
|
||||
hh.show()
|
||||
restoreHeader(hh, self._headerKey())
|
||||
restoreHeader(hh, "editor")
|
||||
hh.setHighlightSections(False)
|
||||
hh.setMinimumSectionSize(50)
|
||||
hh.setMovable(True)
|
||||
|
@ -722,11 +716,9 @@ by clicking on one on the left."""))
|
|||
|
||||
def setColumnSizes(self):
|
||||
hh = self.form.tableView.horizontalHeader()
|
||||
for i in range(len(self.model.activeCols)):
|
||||
if hh.visualIndex(i) == len(self.model.activeCols) - 1:
|
||||
hh.setResizeMode(i, QHeaderView.Stretch)
|
||||
else:
|
||||
hh.setResizeMode(i, QHeaderView.Interactive)
|
||||
hh.setResizeMode(QHeaderView.Interactive)
|
||||
hh.setResizeMode(hh.logicalIndex(len(self.model.activeCols)-1),
|
||||
QHeaderView.Stretch)
|
||||
# this must be set post-resize or it doesn't work
|
||||
hh.setCascadingSectionResizes(False)
|
||||
|
||||
|
@ -869,7 +861,7 @@ by clicking on one on the left."""))
|
|||
d = QDialog(self)
|
||||
l = QVBoxLayout()
|
||||
l.setMargin(0)
|
||||
w = AnkiWebView()
|
||||
w = AnkiWebView(canCopy=True)
|
||||
l.addWidget(w)
|
||||
w.stdHtml(info + "<p>" + reps)
|
||||
bb = QDialogButtonBox(QDialogButtonBox.Close)
|
||||
|
|
|
@ -345,7 +345,7 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
|
|||
if isMac:
|
||||
size = 28
|
||||
else:
|
||||
size = 38 + self.mw.fontHeightDelta*3
|
||||
size = 36 + self.mw.fontHeightDelta*3
|
||||
self.bottom.web.setFixedHeight(size)
|
||||
self.bottom.web.setLinkHandler(self._linkHandler)
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ class EditCurrent(QDialog):
|
|||
self.mw.moveToState("review")
|
||||
saveGeom(self, "editcurrent")
|
||||
aqt.dialogs.close("EditCurrent")
|
||||
self.deleteLater()
|
||||
|
||||
def canClose(self):
|
||||
return True
|
||||
|
|
|
@ -75,7 +75,7 @@ into a bug report:""")
|
|||
pluginText = _("""\
|
||||
An error occurred in an add-on.<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:
|
||||
txt = pluginText
|
||||
else:
|
||||
|
|
|
@ -63,6 +63,8 @@ class AnkiQt(QMainWindow):
|
|||
self.onAppMsg(unicode(args[0], sys.getfilesystemencoding(), "ignore"))
|
||||
# Load profile in a timer so we can let the window finish init and not
|
||||
# close on profile load error.
|
||||
if isMac and qtmajor >= 5:
|
||||
self.show()
|
||||
self.progress.timer(10, self.setupProfile, False)
|
||||
|
||||
def setupUI(self):
|
||||
|
@ -1084,7 +1086,7 @@ will be lost. Continue?"""))
|
|||
def setupFonts(self):
|
||||
f = QFontInfo(self.font())
|
||||
ws = QWebSettings.globalSettings()
|
||||
self.fontHeight = max(14, f.pixelSize())
|
||||
self.fontHeight = f.pixelSize()
|
||||
self.fontFamily = f.family()
|
||||
self.fontHeightDelta = max(0, self.fontHeight - 13)
|
||||
ws.setFontFamily(QWebSettings.StandardFont, self.fontFamily)
|
||||
|
|
|
@ -47,7 +47,7 @@ class Reviewer(object):
|
|||
if isMac:
|
||||
self.bottom.web.setFixedHeight(46)
|
||||
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._reps = None
|
||||
self.nextCard()
|
||||
|
@ -434,17 +434,11 @@ Please run Tools>Empty Cards""")
|
|||
return txt.split("::")[0]
|
||||
return txt
|
||||
matches = [noHint(txt) for txt in matches]
|
||||
if len(matches) > 1:
|
||||
arr = []
|
||||
seen = {}
|
||||
for m in matches:
|
||||
if m in seen:
|
||||
continue
|
||||
seen[m] = 1
|
||||
arr.append(m)
|
||||
txt = ", ".join(arr)
|
||||
else:
|
||||
uniqMatches = set(matches)
|
||||
if len(uniqMatches) == 1:
|
||||
txt = matches[0]
|
||||
else:
|
||||
txt = ", ".join(matches)
|
||||
return txt
|
||||
|
||||
def tokenizeComparison(self, given, correct):
|
||||
|
|
|
@ -45,7 +45,6 @@ class DeckStats(QDialog):
|
|||
def reject(self):
|
||||
saveGeom(self, self.name)
|
||||
QDialog.reject(self)
|
||||
self.deleteLater()
|
||||
|
||||
def browser(self):
|
||||
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
|
||||
|
|
|
@ -40,7 +40,8 @@ class AnkiWebPage(QWebPage):
|
|||
|
||||
class AnkiWebView(QWebView):
|
||||
|
||||
def __init__(self, canFocus=False):
|
||||
# canFocus implies canCopy
|
||||
def __init__(self, canFocus=False, canCopy=False):
|
||||
QWebView.__init__(self)
|
||||
self.setRenderHints(
|
||||
QPainter.TextAntialiasing |
|
||||
|
@ -60,6 +61,7 @@ class AnkiWebView(QWebView):
|
|||
# reset each time new html is set; used to detect if still in same state
|
||||
self.key = None
|
||||
self.setCanFocus(canFocus)
|
||||
self._canCopy = canCopy or canFocus
|
||||
|
||||
def keyPressEvent(self, evt):
|
||||
if evt.matches(QKeySequence.Copy):
|
||||
|
@ -79,7 +81,7 @@ class AnkiWebView(QWebView):
|
|||
QWebView.keyReleaseEvent(self, evt)
|
||||
|
||||
def contextMenuEvent(self, evt):
|
||||
if not self.isCardViewer:
|
||||
if not self._canCopy:
|
||||
return
|
||||
m = QMenu(self)
|
||||
a = m.addAction(_("Copy"))
|
||||
|
@ -109,7 +111,7 @@ class AnkiWebView(QWebView):
|
|||
|
||||
def stdHtml(self, body, css="", bodyClass="", loadCB=None, js=None, head=""):
|
||||
if isMac:
|
||||
button = "font-weight: normal; height: 24px;"
|
||||
button = "font-weight: bold; height: 24px;"
|
||||
else:
|
||||
button = "font-weight: normal;"
|
||||
self.setHtml("""
|
||||
|
@ -130,12 +132,9 @@ button {
|
|||
def setBridge(self, bridge):
|
||||
self._bridge.setBridge(bridge)
|
||||
|
||||
def setCanFocus(self, isCardViewer=False):
|
||||
"""Set flag to denote if this WebView should follow rules specific to
|
||||
card display (e.g., allow context menu, copy/paste)"""
|
||||
|
||||
self.isCardViewer = isCardViewer
|
||||
if self.isCardViewer:
|
||||
def setCanFocus(self, canFocus=False):
|
||||
self._canFocus = canFocus
|
||||
if self._canFocus:
|
||||
self.setFocusPolicy(Qt.WheelFocus)
|
||||
else:
|
||||
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
|
||||
pyuic4 $i -o $py
|
||||
# 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
|
||||
fi
|
||||
done
|
||||
|
|