mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
going on holiday
This commit is contained in:
parent
8781e84beb
commit
09eb8f2db0
@ -12,13 +12,15 @@
|
||||
## You should have received a copy of the GNU General Public License along
|
||||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
"""
|
||||
Define the minimum interface that a device backend must satisfy to be used in
|
||||
the GUI. A device backend must subclass the L{Device} class. See prs500.py for
|
||||
a backend that implement the Device interface for the SONY PRS500 Reader.
|
||||
"""
|
||||
|
||||
import threading
|
||||
from functools import wraps
|
||||
|
||||
class Device(object):
|
||||
"""
|
||||
Defines the interface that should be implemented by backends that
|
||||
@ -113,3 +115,19 @@ class Device(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def _safe(func):
|
||||
@wraps(func)
|
||||
def run_in_thread(*args, **kwargs):
|
||||
dm = args[0]
|
||||
dm
|
||||
|
||||
class DeviceManager(object):
|
||||
|
||||
def __init__(self, device):
|
||||
if not isinstance(device, Device):
|
||||
raise TypeError, '%s must implement the Device interface' % (str(device),)
|
||||
self.dev = device
|
||||
self.lock = threading.RLock()
|
||||
|
||||
|
||||
|
||||
|
@ -46,9 +46,7 @@ Contains the logic for communication with the device (a SONY PRS-500).
|
||||
The public interface of class L{PRS500} defines the
|
||||
methods for performing various tasks.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import sys, os
|
||||
from tempfile import TemporaryFile
|
||||
from array import array
|
||||
from functools import wraps
|
||||
|
Loading…
x
Reference in New Issue
Block a user