mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Merge branch 'master' of github.com:dae/anki
This commit is contained in:
commit
dffab1376f
3 changed files with 23 additions and 6 deletions
|
@ -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)
|
||||||
|
|
|
@ -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 += """
|
||||||
|
|
|
@ -3,3 +3,4 @@ send2trash
|
||||||
httplib2
|
httplib2
|
||||||
pyaudio
|
pyaudio
|
||||||
requests
|
requests
|
||||||
|
decorator
|
||||||
|
|
Loading…
Reference in a new issue