home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 April / com_0405_1.iso / opensource / BTpp-0.5.4-bin.exe / $INSTDIR / BT++.exe / Logging.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2003-04-19  |  2.1 KB  |  61 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.2)
  3.  
  4. import new
  5. import types
  6.  
  7. class Interface:
  8.     Handlers = []
  9.     
  10.     def __init__(self, *args):
  11.         fullargs = 'self'
  12.         cleanargs = ''
  13.         for arg in args:
  14.             if type(arg) == types.TupleType:
  15.                 name = arg[0]
  16.                 default = arg[1]
  17.             else:
  18.                 name = arg
  19.                 default = NotImplemented
  20.             cleanargs = cleanargs + name + ','
  21.             fullargs = fullargs + ',' + name
  22.             if default != NotImplemented:
  23.                 if type(default) == types.StringType:
  24.                     fullargs = fullargs + "='" + default + "'"
  25.                 else:
  26.                     fullargs = fullargs + '=' + str(default)
  27.             
  28.         
  29.         cleanargs = cleanargs[0:len(cleanargs) - 1]
  30.         callstr = 'lambda ' + fullargs + ': self.Log(' + cleanargs + ')'
  31.         self.__call__ = new.instancemethod(eval(callstr), self, Interface)
  32.  
  33.     
  34.     def __call__(self):
  35.         pass
  36.  
  37.     
  38.     def AddHandler(self, handler):
  39.         if handler not in self.Handlers:
  40.             self.Handlers.append(handler)
  41.         
  42.  
  43.     
  44.     def DelHandler(self, handler):
  45.         self.Handlers.remove(handler)
  46.  
  47.     
  48.     def Log(self, *args):
  49.         for handler in self.Handlers:
  50.             handler.Log(*args)
  51.         
  52.  
  53.  
  54.  
  55. class Handler:
  56.     
  57.     def Log(self, *args):
  58.         print str(args)
  59.  
  60.  
  61.