home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import wx
- from gui.windowfx import fadein, fadeout
- from dragtimer import DragTimer, WinDragTimer
- from OverlayImage import SimpleOverlayImage
- from common import pref
- from weakref import ref
-
- class TabManager(object):
-
- def __init__(self):
- self.books = []
- self.source = None
- self.destination = None
- self.fadeflag = True
- self.fadeobject = None
- self.dropmarker = None
- self.dragtimer = DragTimer(self)
-
-
- def Register(self, book):
- self.books.append(ref(book))
-
-
- def UnRegister(self, book):
- for bookref in self.books[:]:
- if bookref() is book:
- self.books.remove(bookref)
- continue
-
-
-
- def ReadyBook(self, currentbook, pos):
- if not (self.destination) or not self.destination.window.Rect.Contains(pos):
- for bookref in self.books[:]:
- book = bookref()
- if book is None or wx.IsDestroyed(book):
- self.books.remove(bookref)
- continue
- if book.window != currentbook.window:
- rect = book.window.Rect
- if rect.Contains(pos) and self.destination != book:
- self.destination = book
- self.destination.tabbar.Toggle(True)
-
- if self.destination and not rect.Contains(pos) and self.destination == book:
- tb = self.destination.tabbar
- tb.Toggle()
- tb.dragtarget = None
- tb.dragorigin = None
- tb.dropmarker.Show(False)
- tb.dragside = None
- self.destination = None
- if not self.fadeflag:
- fadein(currentbook.window, pref('tabs.fade_speed', 'normal'))
- if currentbook.preview:
- currentbook.preview.Show(False)
-
-
- self.fadeflag = True
-
- self.destination == book
-
-
- if self.destination:
- barrect = self.destination.tabbar.Rect
- if barrect.Contains(self.destination.ScreenToClient(pos)):
- self.destination.tabbar.DragCalc(self.destination.tabbar.ScreenToClient(pos))
- self.destination.tabbar.dragorigin = None
- if currentbook.preview:
- currentbook.preview.Move(wx.GetMousePosition() + (2, 4))
-
- if self.fadeflag:
- self.fadeobject = currentbook.window.Show(False)
- if currentbook.preview:
- fadein(currentbook.preview, pref('tabs.fade_speed', 'normal'), to = currentbook.preview.alpha)
-
- self.fadeflag = False
-
- else:
- self.destination.tabbar.dropmarker.Show(False)
- if not self.fadeflag:
- fadein(currentbook.window, pref('tabs.fade_speed', 'normal'))
- if currentbook.preview:
- currentbook.preview.Show(False)
-
-
- self.fadeflag = True
-
-
-
- def Transaction(self, currentbook):
- if self.destination and self.destination.tabbar.Rect.Contains(self.destination.ScreenToClient(wx.GetMousePosition())):
- destination = self.destination
- pages = [ tab.page for tab in currentbook.tabbar.tabs ]
- for i, page in enumerate(pages):
- destination.pagecontainer.Append(page)
- destbar = destination.tabbar
- destbar.Add(page, page.tab.active, False)
- destbar.dragorigin = page.tab
- destbar.DragFinish(True)
- destbar.dragtarget = page.tab
- destbar.dragside = 1
-
- for tab in list(currentbook.tabbar.tabs):
- currentbook.tabbar.tabs.remove(tab)
- tab.Destroy()
-
- self.fadeflag = True
-
- if self.destination:
- self.destination.tabbar.Toggle()
- self.destination.tabbar.dragtarget = None
- self.destination.tabbar.dragorigin = None
- self.destination.tabbar.dropmarker.Show(False)
- self.destination.tabbar.dragside = None
- self.destination = None
-
-
-
- def Notify(self, notebook = None):
- self.source = notebook
- if self.source:
- self.dragtimer.Start(SimpleOverlayImage(notebook, self.source.tabbar.dragorigin))
-
-
-
- def Request(self, notebook = None):
- self.destination = notebook
-
-
- def Trigger(self):
- if self.source:
- self.source.tabbar.DragFinish()
-
-
-
- def ShowDropMarker(self, dropmarker = None):
- if not dropmarker:
- if self.dropmarker and not wx.IsDestroyed(self.dropmarker):
- self.dropmarker.Show(False)
-
- return None
-
- if self.dropmarker and not wx.IsDestroyed(self.dropmarker) and self.dropmarker is not dropmarker:
- self.dropmarker.Show(False)
-
- self.dropmarker = dropmarker
- self.dropmarker.Show(True)
-
-
-
- class TabWindowManager(object):
-
- def __init__(self, create_window_func):
- self.wdt = WinDragTimer()
- self.tabman = TabManager()
- self.factory = create_window_func
-
-
- def TabManager(self):
- return self.tabman
-
- TabManager = property(TabManager)
-
- def NewWindow(self, tabman = None, pos = wx.DefaultPosition, size = None):
- win = self.factory(pos, size)
- win.Show(False)
- fadein(win, 'normal')
- return win
-
-
-