home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- from __future__ import with_statement
- import wx
- from containers import PageContainer
- from OverlayImage import SimpleOverlayImage
- from tab import MultiTab
- from tabbar import TabBar
- from common import pref, profile, setpref
- from logging import getLogger
- log = getLogger('uberbook')
- splitStyle = wx.SP_NOBORDER | wx.SP_LIVE_UPDATE
-
- class NoteBook(wx.SplitterWindow):
-
- def __init__(self, parent, window, manager, skinkey):
- wx.SplitterWindow.__init__(self, parent, style = splitStyle)
- self.window = window
- self.manager = manager
- self.manager.Register(self)
- self.tabbar = TabBar(self, skinkey)
- self.pagecontainer = PageContainer(self)
- self.Bind(wx.EVT_ERASE_BACKGROUND, (lambda e: pass))
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.Bind(wx.EVT_LEFT_UP, self.OnSplitMove)
- self.side_tabs_width = pref('tabs.side_tabs_width', 100)
- profile.prefs.link('tabs.side_tabs', self.OnSideTabsSwitch)
-
-
- def ActiveTab(self):
- return self.tabbar.ActiveTab
-
- ActiveTab = property(ActiveTab)
-
- def GetTabCount(self):
- return self.tabbar.GetTabCount()
-
-
- def Pages(self):
- return _[1]
-
-
- def NextTab(self):
- return self.tabbar.NextTab()
-
-
- def PrevTab(self):
- return self.tabbar.PrevTab()
-
-
- def UpdateSkin(self):
- pass
-
-
- def Split(self, val):
- if val:
- if self.Window2 is None:
- self.OnSideTabsSwitch(pref('tabs.side_tabs'))
-
- elif self.Window2 is not None:
- self.Unsplit(self.tabbar)
-
-
-
- def Explode(self):
- self.tabbar.Explode()
-
-
- def OnSideTabsSwitch(self, val):
- self.side_tabs = val
- split = None(getattr, self + 'Split' if not val else 'Vertically')
- if self.IsSplit():
- self.Unsplit()
-
- pos = None if val else self.tabbar.MinSize.height
- split(self.tabbar, self.pagecontainer, pos)
- None(self.SetSashSize if val else 0)
-
-
- def OnSplitMove(self, event):
- event.Skip()
- if self.side_tabs and self.IsSplit() and self.IsShownOnScreen():
- pos = self.SashPosition
- self.side_tabs_width = pos
- log.info('saving side tabs sash pos of %s', pos)
- setpref('tabs.side_tabs_width', pos)
-
-
-
- def __repr__(self):
- return '<Notebook with %r>' % self.tabbar
-
-
- def Add(self, panel, focus = None):
- self.Frozen().__enter__()
-
- try:
- if focus or not self.tabbar.GetTabCount():
- focus = True
- elif not focus:
- focus = False
-
- s = self.tabbar.Add(self.pagecontainer.Append(panel), focus)
- self.pagecontainer.Layout()
- finally:
- pass
-
- return s
-
-
- def Insert(self, page, resort = True):
- self.pagecontainer.Append(page)
- self.tabbar.Add(page, True, resort)
- self.tabbar.dragorigin = page.tab
- self.tabbar.DragFinish(True)
-
-
- def StartWindowDrag(self):
- if wx.LeftDown():
- wdt = self.window.winman.wdt
- if not wdt.IsRunning():
- self.preview = SimpleOverlayImage(self, MultiTab(self.tabbar.tabs))
- wdt.Start(self)
-
- self.manager.ReadyBook(self, wx.GetMousePosition())
-
-
-
-