home *** CD-ROM | disk | FTP | other *** search
/ Freelog 116 / FreelogNo116-JuilletSeptembre2013.iso / Bureautique / gImageReader / gimagereader_0.9-1_win32.exe / bin / pywin / mfc / object.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2011-03-24  |  3KB  |  77 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. import sys
  5. import win32ui
  6.  
  7. class Object:
  8.     
  9.     def __init__(self, initObj = None):
  10.         self.__dict__['_obj_'] = initObj
  11.         if initObj is not None:
  12.             initObj.AttachObject(self)
  13.  
  14.     
  15.     def __del__(self):
  16.         self.close()
  17.  
  18.     
  19.     def __getattr__(self, attr):
  20.         if not attr.startswith('__'):
  21.             
  22.             try:
  23.                 o = self.__dict__['_obj_']
  24.                 if o is not None:
  25.                     return getattr(o, attr)
  26.                 if None[0] != '_' and attr[-1] != '_':
  27.                     raise win32ui.error('The MFC object has died.')
  28.             except KeyError:
  29.                 pass
  30.             
  31.  
  32.         raise AttributeError(attr)
  33.  
  34.     
  35.     def OnAttachedObjectDeath(self):
  36.         self._obj_ = None
  37.  
  38.     
  39.     def close(self):
  40.         if '_obj_' in self.__dict__ and self._obj_ is not None:
  41.             self._obj_.AttachObject(None)
  42.             self._obj_ = None
  43.         
  44.  
  45.  
  46.  
  47. class CmdTarget(Object):
  48.     
  49.     def __init__(self, initObj):
  50.         Object.__init__(self, initObj)
  51.  
  52.     
  53.     def HookNotifyRange(self, handler, firstID, lastID):
  54.         oldhandlers = []
  55.         for i in range(firstID, lastID + 1):
  56.             oldhandlers.append(self.HookNotify(handler, i))
  57.         
  58.         return oldhandlers
  59.  
  60.     
  61.     def HookCommandRange(self, handler, firstID, lastID):
  62.         oldhandlers = []
  63.         for i in range(firstID, lastID + 1):
  64.             oldhandlers.append(self.HookCommand(handler, i))
  65.         
  66.         return oldhandlers
  67.  
  68.     
  69.     def HookCommandUpdateRange(self, handler, firstID, lastID):
  70.         oldhandlers = []
  71.         for i in range(firstID, lastID + 1):
  72.             oldhandlers.append(self.HookCommandUpdate(handler, i))
  73.         
  74.         return oldhandlers
  75.  
  76.  
  77.