This commit is contained in:
Kovid Goyal 2012-08-09 12:58:56 +05:30
parent 429096bb54
commit 41d2c59022
2 changed files with 10 additions and 9 deletions

View File

@ -7,8 +7,17 @@ __license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from functools import wraps
from calibre.devices.interface import DevicePlugin
def synchronous(func):
@wraps(func)
def synchronizer(self, *args, **kwargs):
with self.lock:
return func(self, *args, **kwargs)
return synchronizer
class MTPDeviceBase(DevicePlugin):
name = 'SmartDevice App Interface'
gui_name = _('MTP Device')

View File

@ -9,23 +9,15 @@ __docformat__ = 'restructuredtext en'
import time, operator
from threading import RLock
from functools import wraps
from itertools import chain
from collections import deque, OrderedDict
from io import BytesIO
from calibre import prints
from calibre.devices.errors import OpenFailed
from calibre.devices.mtp.base import MTPDeviceBase
from calibre.devices.mtp.base import MTPDeviceBase, synchronous
from calibre.devices.mtp.unix.detect import MTPDetect
def synchronous(func):
@wraps(func)
def synchronizer(self, *args, **kwargs):
with self.lock:
return func(self, *args, **kwargs)
return synchronizer
class FilesystemCache(object):
def __init__(self, files, folders):