home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_747 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  4.3 KB  |  94 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
  6.  
  7. class ProtocolError(Exception):
  8.     
  9.     def __init__(self, msg):
  10.         Exception.__init__(self, msg)
  11.  
  12.  
  13.  
  14. class TimeoutError(ProtocolError):
  15.     
  16.     def __init__(self, func_name):
  17.         ProtocolError.__init__(self, 'There was a timeout while communicating with the device in function: ' + func_name)
  18.  
  19.  
  20.  
  21. class DeviceError(ProtocolError):
  22.     
  23.     def __init__(self, msg = None):
  24.         if msg is None:
  25.             msg = 'Unable to find SONY Reader. Is it connected?'
  26.         
  27.         ProtocolError.__init__(self, msg)
  28.  
  29.  
  30.  
  31. class UserFeedback(DeviceError):
  32.     INFO = 0
  33.     WARN = WARNING = 1
  34.     ERROR = 2
  35.     
  36.     def __init__(self, msg, details, level):
  37.         Exception.__init__(self, msg)
  38.         self.level = level
  39.         self.details = details
  40.         self.msg = msg
  41.  
  42.  
  43.  
  44. class DeviceBusy(ProtocolError):
  45.     
  46.     def __init__(self, uerr = ''):
  47.         ProtocolError.__init__(self, 'Device is in use by another application:\nUnderlying error:' + str(uerr))
  48.  
  49.  
  50.  
  51. class DeviceLocked(ProtocolError):
  52.     
  53.     def __init__(self):
  54.         ProtocolError.__init__(self, 'Device is locked')
  55.  
  56.  
  57.  
  58. class PacketError(ProtocolError):
  59.     pass
  60.  
  61.  
  62. class FreeSpaceError(ProtocolError):
  63.     pass
  64.  
  65.  
  66. class ArgumentError(ProtocolError):
  67.     pass
  68.  
  69.  
  70. class PathError(ArgumentError):
  71.     
  72.     def __init__(self, msg, path = None):
  73.         ArgumentError.__init__(self, msg)
  74.         self.path = path
  75.  
  76.  
  77.  
  78. class ControlError(ProtocolError):
  79.     
  80.     def __init__(self, query = None, response = None, desc = None):
  81.         self.query = query
  82.         self.response = response
  83.         ProtocolError.__init__(self, desc)
  84.  
  85.     
  86.     def __str__(self):
  87.         if self.query and self.response:
  88.             return 'Got unexpected response:\n' + 'query:\n' + str(self.query.query) + '\n' + 'expected:\n' + str(self.query.response) + '\n' + 'actual:\n' + str(self.response)
  89.         if self.desc:
  90.             return self.desc
  91.         return 'Unknown control error occurred'
  92.  
  93.  
  94.