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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. import pythoncom
  6.  
  7. class COMException(pythoncom.com_error):
  8.     
  9.     def __init__(self, description = None, scode = None, source = None, helpfile = None, helpContext = None, desc = None, hresult = None):
  10.         if not scode:
  11.             pass
  12.         scode = hresult
  13.         if scode and scode != 1:
  14.             if scode >= -32768 and scode < 32768:
  15.                 scode = -2147024896 | scode & 65535
  16.             
  17.         
  18.         self.scode = scode
  19.         if not description:
  20.             pass
  21.         self.description = desc
  22.         if scode == 1 and not (self.description):
  23.             self.description = 'S_FALSE'
  24.         elif scode and not (self.description):
  25.             self.description = pythoncom.GetScodeString(scode)
  26.         
  27.         self.source = source
  28.         self.helpfile = helpfile
  29.         self.helpcontext = helpContext
  30.         pythoncom.com_error.__init__(self, scode, self.description, None, -1)
  31.  
  32.     
  33.     def __repr__(self):
  34.         return '<COM Exception - scode=%s, desc=%s>' % (self.scode, self.description)
  35.  
  36.  
  37. Exception = COMException
  38.  
  39. def IsCOMException(t = None):
  40.     if t is None:
  41.         t = sys.exc_info()[0]
  42.     
  43.     
  44.     try:
  45.         return issubclass(t, pythoncom.com_error)
  46.     except TypeError:
  47.         return t is pythoncon.com_error
  48.  
  49.  
  50.  
  51. def IsCOMServerException(t = None):
  52.     if t is None:
  53.         t = sys.exc_info()[0]
  54.     
  55.     
  56.     try:
  57.         return issubclass(t, COMException)
  58.     except TypeError:
  59.         return 0
  60.  
  61.  
  62.