home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / uberwidgets / uberbook / dragtimer.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  3.6 KB  |  91 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import wx
  5. from gui.windowfx import fadein, fadeout
  6. from weakref import ref
  7.  
  8. class DragTimer(wx.Timer):
  9.     
  10.     def __init__(self, manager):
  11.         wx.Timer.__init__(self)
  12.         self.manager = manager
  13.         self.target = None
  14.  
  15.     
  16.     def Start(self, overlayimage):
  17.         wx.Timer.Start(self, 1)
  18.         self.overlay = overlayimage
  19.         self.overlay.Move(wx.GetMousePosition() + (2, 4))
  20.         fadein(self.overlay, to = self.overlay.alpha)
  21.  
  22.     
  23.     def GetFrame(self, window):
  24.         if window:
  25.             while not isinstance(window, wx.Frame):
  26.                 window = window.Parent
  27.         
  28.         return window
  29.  
  30.     
  31.     def Notify(self):
  32.         current = self.GetFrame(wx.FindWindowAtPointer())
  33.         if current and current != self.target:
  34.             if hasattr(self.target, 'notebook'):
  35.                 self.target.notebook.tabbar.Toggle(False)
  36.             
  37.             self.target = current
  38.             if hasattr(self.target, 'notebook'):
  39.                 self.target.notebook.tabbar.Toggle(True)
  40.             
  41.         elif not current:
  42.             if hasattr(self.target, 'notebook'):
  43.                 self.target.notebook.tabbar.Toggle(False)
  44.             
  45.             self.target = current
  46.         
  47.         self.overlay.Move(wx.GetMousePosition() + (2, 4))
  48.         if (not (self.manager.destination) or not self.manager.destination.tabbar.Rect.Contains(self.manager.destination.ScreenToClient(wx.GetMousePosition()))) and not self.manager.source.tabbar.Rect.Contains(self.manager.source.ScreenToClient(wx.GetMousePosition())):
  49.             self.manager.ShowDropMarker()
  50.         
  51.         if not wx.LeftDown():
  52.             self.manager.Trigger()
  53.             self.Stop()
  54.         
  55.  
  56.     
  57.     def Stop(self):
  58.         if self.target and hasattr(self.target, 'notebook'):
  59.             self.target.notebook.tabbar.Toggle(False)
  60.         
  61.         self.target = None
  62.         wx.Timer.Stop(self)
  63.         fadeout(self.overlay)
  64.         del self.overlay
  65.  
  66.  
  67.  
  68. class WinDragTimer(wx.Timer):
  69.     notebook = property((lambda self: None if self._notebook is not None else None), (lambda self, nb: setattr(self, '_notebook', ref(nb))))
  70.     
  71.     def __init__(self, *a, **k):
  72.         self._notebook = None
  73.         wx.Timer.__init__(self)
  74.  
  75.     
  76.     def Start(self, notebook):
  77.         self.notebook = notebook
  78.         wx.Timer.Start(self, 1)
  79.  
  80.     
  81.     def Notify(self):
  82.         if not wx.LeftDown():
  83.             self.Stop()
  84.             nb = self.notebook
  85.             if nb is not None:
  86.                 nb.manager.Transaction(nb)
  87.             
  88.         
  89.  
  90.  
  91.