home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / app / __init__.pyo (.txt) next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  1.5 KB  |  57 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import traceback
  5. import types
  6. import wx
  7. exitMainLoopCalled = False
  8.  
  9. def checkMainThread(func):
  10.     
  11.     def new(*args, **kwargs):
  12.         global exitMainLoopCalled
  13.         if func.__name__ == 'ExitMainLoop':
  14.             traceback.print_stack()
  15.             exitMainLoopCalled = True
  16.         
  17.         return func(*args, **kwargs)
  18.  
  19.     return new
  20.  
  21. excludes = [
  22.     'Event',
  23.     'Timer',
  24.     'CallLater',
  25.     'sip']
  26.  
  27. def addThreadChecksToClassRecursive(obj):
  28.     for symbol in dir(obj):
  29.         objname = getattr(obj, '__name__', None)
  30.         if objname is None:
  31.             continue
  32.         
  33.         if hasattr(obj, '__module__'):
  34.             objname = obj.__module__ + '.' + objname
  35.         
  36.         if symbol.startswith('_') or objname.startswith('_'):
  37.             continue
  38.         
  39.         exclude = False
  40.         for exc in excludes:
  41.             if symbol.find(exc) != -1 or objname.find(exc) != -1:
  42.                 exclude = True
  43.                 continue
  44.         
  45.         if exclude:
  46.             continue
  47.         
  48.         exec 'sym = %s.%s' % (objname, symbol)
  49.         if type(sym) == types.MethodType:
  50.             exec '%s.%s = checkMainThread(%s.%s)' % (objname, symbol, objname, symbol)
  51.             continue
  52.         if type(sym) == types.ClassType or type(sym) == types.TypeType:
  53.             addThreadChecksToClassRecursive(sym)
  54.             continue
  55.     
  56.  
  57.