going on holiday

This commit is contained in:
Kovid Goyal 2007-05-04 03:15:26 +00:00
parent 8781e84beb
commit 09eb8f2db0
2 changed files with 21 additions and 5 deletions

View File

@ -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
@ -111,5 +113,21 @@ class Device(object):
@param booklists: A tuple containing the result of calls to
(L{books}(oncard=False), L{books}(oncard=True)).
"""
raise NotImplementedError()
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()

View File

@ -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