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

This commit is contained in:
Damien Elmes 2017-07-17 13:16:06 +10:00
commit dffab1376f
3 changed files with 23 additions and 6 deletions

View file

@ -13,6 +13,14 @@ If you call wrap() with pos='around', the original function will not be called
automatically but can be called with _old(). automatically but can be called with _old().
""" """
import functools
try:
# optional: like functools.wraps, but signature-preserving
import decorator
except ImportError:
decorator = None
# Hooks # Hooks
############################################################################## ##############################################################################
@ -59,4 +67,11 @@ def wrap(old, new, pos="after"):
return old(*args, **kwargs) return old(*args, **kwargs)
else: else:
return new(_old=old, *args, **kwargs) return new(_old=old, *args, **kwargs)
return repl
if decorator is None:
return functools.wraps(repl)
def decorator_wrapper(f, *args, **kwargs):
return repl(*args, **kwargs)
return decorator.decorator(decorator_wrapper)(old)

View file

@ -333,14 +333,15 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
# Top buttons # Top buttons
###################################################################### ######################################################################
def _drawButtons(self): drawLinks = [
links = [
["", "shared", _("Get Shared")], ["", "shared", _("Get Shared")],
["", "create", _("Create Deck")], ["", "create", _("Create Deck")],
["Ctrl+I", "import", _("Import File")], ["Ctrl+I", "import", _("Import File")], # Ctrl+I works from menu
] ]
def _drawButtons(self):
buf = "" buf = ""
for b in links: for b in drawLinks:
if b[0]: if b[0]:
b[0] = _("Shortcut key: %s") % shortcut(b[0]) b[0] = _("Shortcut key: %s") % shortcut(b[0])
buf += """ buf += """

View file

@ -3,3 +3,4 @@ send2trash
httplib2 httplib2
pyaudio pyaudio
requests requests
decorator