home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / wxextensions.pyo (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  5.3 KB  |  151 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import new
  5. import traceback
  6.  
  7. def SetMinHeight(self, h):
  8.     self.minHeight = h
  9.     if h != -1 and self.GetSize().height < h:
  10.         self.SetSize((-1, h))
  11.     
  12.  
  13.  
  14. def GetMinHeight(self):
  15.     return self.minHeight
  16.  
  17. import wx.lib.expando as wx
  18. wx.lib.expando.ExpandoTextCtrl.SetMinHeight = SetMinHeight
  19. wx.lib.expando.ExpandoTextCtrl.GetMinHeight = GetMinHeight
  20.  
  21. wx.lib.expando.ExpandoTextCtrl.GetExtraHeight = lambda self: self.extraHeight
  22. del SetMinHeight
  23. del GetMinHeight
  24. import cgui
  25. if not hasattr(wx, 'IsMainThread'):
  26.     import threading
  27.     
  28.     def isMainThread():
  29.         return threading.currentThread().getName() == 'MainThread'
  30.  
  31.     wx.IsMainThread = isMainThread
  32.  
  33. wx.Rect.Clamp = new.instancemethod(cgui.RectClamp, None, wx.Rect)
  34. wx.Rect.ClampPoint = new.instancemethod(cgui.RectClampPoint, None, wx.Rect)
  35.  
  36. wx.ContextMenuEvent.IsKeyPress = lambda e: e.Position == (-1, -1)
  37.  
  38. wx.Timer.StartRepeating = lambda self, ms: wx.Timer.Start(self, ms, False)
  39.  
  40. wx.Timer.StartOneShot = lambda self, ms: wx.Timer.Start(self, ms, True)
  41.  
  42. def CreateTransparentBitmap(w, h):
  43.     bitmap = wx.EmptyBitmap(w, h)
  44.     bitmap.UseAlpha()
  45.     return bitmap
  46.  
  47. wx.TransparentBitmap = CreateTransparentBitmap
  48.  
  49. try:
  50.     from cgui import SetBold
  51. except ImportError:
  52.     import sys
  53.     print >>sys.stderr, 'WARNING: using slow SetBold'
  54.     
  55.     def SetBold(win, bold = True):
  56.         f = win.Font
  57.         None(f.SetWeight if bold else wx.FONTWEIGHT_NORMAL)
  58.         win.Font = f
  59.  
  60.  
  61. if getattr(wx, 'WXPY', False):
  62.     wx.WindowClass = wx._Window
  63. else:
  64.     wx.WindowClass = wx.Window
  65. wx.WindowClass.SetBold = new.instancemethod(SetBold, None, wx.WindowClass)
  66.  
  67. def call_later_repr(self):
  68.     funcinfo = funcinfo
  69.     import util
  70.     fi = funcinfo(self.callable)
  71.     if self.running:
  72.         return '<CallLater (running) %s>' % fi
  73.     else:
  74.         return '<CallLater %s>' % fi
  75.  
  76. wx.CallLater.__repr__ = call_later_repr
  77. if not getattr(wx, 'WXPY', False):
  78.     
  79.     wx.Dialog.__enter__ = lambda self: self
  80.     
  81.     wx.Dialog.__exit__ = lambda self, type, value, traceback: self.Destroy()
  82.     
  83.     def IsDestroyed(win):
  84.         return not bool(win)
  85.  
  86.     from cStringIO import StringIO
  87.     
  88.     def ImageFromString(s):
  89.         return wx.ImageFromStream(StringIO(s))
  90.  
  91.     wx.ImageFromString = ImageFromString
  92.     wx.AcceleratorTableFromSequence = wx.AcceleratorTable
  93.     wx.IsDestroyed = IsDestroyed
  94.     del IsDestroyed
  95.  
  96. if not hasattr(wx.RendererNative, 'DrawFocusRect'):
  97.     
  98.     wx.RendererNative.DrawFocusRect = lambda *a, **k: pass
  99.  
  100.  
  101. try:
  102.     import webview
  103. except ImportError:
  104.     traceback.print_exc()
  105.  
  106. if not hasattr(webview.WebView, 'ResetTextSize'):
  107.     
  108.     webview.WebView.ResetTextSize = lambda *a, **k: pass
  109.  
  110. if 'wxGTK' in wx.PlatformInfo:
  111.     orig_bmpeq = wx.Bitmap.__eq__
  112.     
  113.     def bmpeq(self, other):
  114.         if isinstance(other, wx.Bitmap):
  115.             return orig_bmpeq(self, other)
  116.         
  117.         return False
  118.  
  119.     wx.Bitmap.__eq__ = bmpeq
  120.  
  121.  
  122. def RaiseExisting(cls):
  123.     for tlw in wx.GetTopLevelWindows():
  124.         if type(tlw) is cls:
  125.             tlw.Raise()
  126.             return tlw
  127.             continue
  128.     
  129.  
  130. wx.TopLevelWindow.RaiseExisting = classmethod(RaiseExisting)
  131.  
  132. def MakeOrShow(cls, parent = None):
  133.     win = cls.RaiseExisting()
  134.     if win is None:
  135.         win = cls(parent)
  136.         wx.CallAfter(win.Show)
  137.     
  138.     return win
  139.  
  140. wx.TopLevelWindow.MakeOrShow = classmethod(MakeOrShow)
  141.  
  142. try:
  143.     from cgui import LeftDown
  144. except ImportError:
  145.     
  146.     def LeftDown():
  147.         return wx.GetMouseState().LeftDown()
  148.  
  149.  
  150. wx.LeftDown = LeftDown
  151.