# Created: 2002/11/20
# Version: 0.1
# RCS-ID: $Id$
-# License: wxWindows licensie
+# License: wxWindows license
#----------------------------------------------------------------------
# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o 2.5 compatability update.
#
+# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o wxMultiSash -> MultiSash
+# o wxMultiSplit -> MultiSplit
+# o wxMultiViewLeaf -> MultiViewLeaf
+#
import wx
#----------------------------------------------------------------------
-class wxMultiSash(wx.Window):
+class MultiSash(wx.Window):
def __init__(self, *_args,**_kwargs):
apply(wx.Window.__init__,(self,) + _args,_kwargs)
self._defChild = EmptyChild
- self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
+ self.child = MultiSplit(self,self,(0,0),self.GetSize())
self.Bind(wx.EVT_SIZE,self.OnMultiSize)
def SetDefaultChildClass(self,childCls):
def Clear(self):
old = self.child
- self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
+ self.child = MultiSplit(self,self,(0,0),self.GetSize())
old.Destroy()
self.child.OnSize(None)
def GetSaveData(self):
saveData = {}
- saveData['_defChild'] = str(self._defChild)
+ saveData['_defChild_class'] = self._defChild.__name__
+ saveData['_defChild_mod'] = self._defChild.__module__
saveData['child'] = self.child.GetSaveData()
return saveData
def SetSaveData(self,data):
- dChild = data['_defChild']
- mod = dChild.split('.')[0]
+ mod = data['_defChild_mod']
+ dChild = mod + '.' + data['_defChild_class']
exec 'import %s' % mod
self._defChild = eval(dChild)
old = self.child
- self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
+ self.child = MultiSplit(self,self,wx.Point(0,0),self.GetSize())
self.child.SetSaveData(data['child'])
old.Destroy()
self.OnMultiSize(None)
#----------------------------------------------------------------------
-class wxMultiSplit(wx.Window):
+class MultiSplit(wx.Window):
def __init__(self,multiView,parent,pos,size,view1 = None):
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
style = wx.CLIP_CHILDREN)
self.view1.Reparent(self)
self.view1.MoveXY(0,0)
else:
- self.view1 = wxMultiViewLeaf(self.multiView,self,
+ self.view1 = MultiViewLeaf(self.multiView,self,
(0,0),self.GetSize())
self.direction = None
saveData = {}
if self.view1:
saveData['view1'] = self.view1.GetSaveData()
- if isinstance(self.view1,wxMultiSplit):
+ if isinstance(self.view1,MultiSplit):
saveData['view1IsSplit'] = 1
if self.view2:
saveData['view2'] = self.view2.GetSaveData()
- if isinstance(self.view2,wxMultiSplit):
+ if isinstance(self.view2,MultiSplit):
saveData['view2IsSplit'] = 1
saveData['direction'] = self.direction
v1,v2 = self.GetPosition()
def SetSaveData(self,data):
self.direction = data['direction']
- self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
+ self.SetDimensions(int(data['x']), int(data['y']), int(data['w']), int(data['h']))
v1Data = data.get('view1',None)
if v1Data:
isSplit = data.get('view1IsSplit',None)
old = self.view1
if isSplit:
- self.view1 = wxMultiSplit(self.multiView,self,
+ self.view1 = MultiSplit(self.multiView,self,
(0,0),self.GetSize())
else:
- self.view1 = wxMultiViewLeaf(self.multiView,self,
+ self.view1 = MultiViewLeaf(self.multiView,self,
(0,0),self.GetSize())
self.view1.SetSaveData(v1Data)
if old:
isSplit = data.get('view2IsSplit',None)
old = self.view2
if isSplit:
- self.view2 = wxMultiSplit(self.multiView,self,
+ self.view2 = MultiSplit(self.multiView,self,
(0,0),self.GetSize())
else:
- self.view2 = wxMultiViewLeaf(self.multiView,self,
+ self.view2 = MultiViewLeaf(self.multiView,self,
(0,0),self.GetSize())
self.view2.SetSaveData(v2Data)
if old:
def AddLeaf(self,direction,caller,pos):
if self.view2:
if caller == self.view1:
- self.view1 = wxMultiSplit(self.multiView,self,
+ self.view1 = MultiSplit(self.multiView,self,
caller.GetPosition(),
caller.GetSize(),
caller)
self.view1.AddLeaf(direction,caller,pos)
else:
- self.view2 = wxMultiSplit(self.multiView,self,
+ self.view2 = MultiSplit(self.multiView,self,
caller.GetPosition(),
caller.GetSize(),
caller)
x,y = (0,pos)
w1,h1 = (w,h-pos)
w2,h2 = (w,pos)
- self.view2 = wxMultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
+ self.view2 = MultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
self.view1.SetSize((w2,h2))
self.view2.OnSize(None)
else:
v1h = v2h = h
- self.view1.SetDimensions(v1x,v1y,v1w,v1h)
- self.view2.SetDimensions(v2x,v2y,v2w,v2h)
+ self.view1.SetDimensions(int(v1x), int(v1y), int(v1w), int(v1h))
+ self.view2.SetDimensions(int(v2x), int(v2y), int(v2w), int(v2h))
self.view1.OnSize(None)
self.view2.OnSize(None)
#----------------------------------------------------------------------
-class wxMultiViewLeaf(wx.Window):
+class MultiViewLeaf(wx.Window):
def __init__(self,multiView,parent,pos,size):
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
style = wx.CLIP_CHILDREN)
self.Bind(wx.EVT_SIZE,self.OnSize)
+ self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
+
def GetSaveData(self):
saveData = {}
- saveData['detailClass'] = str(self.detail.child.__class__)
+ saveData['detailClass_class'] = self.detail.child.__class__.__name__
+ saveData['detailClass_mod'] = self.detail.child.__module__
if hasattr(self.detail.child,'GetSaveData'):
attr = getattr(self.detail.child,'GetSaveData')
if callable(attr):
return saveData
def SetSaveData(self,data):
- dChild = data['detailClass']
- mod = dChild.split('.')[0]
+ mod = data['detailClass_mod']
+ dChild = mod + '.' + data['detailClass_class']
exec 'import %s' % mod
detClass = eval(dChild)
self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
self.Bind(wx.EVT_LEFT_DOWN,self.OnPress)
self.Bind(wx.EVT_LEFT_UP,self.OnRelease)
+ self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
+
def CalcSizePos(self,parent):
pw,ph = parent.GetSize()
if self.side == MV_HOR:
# Draw outline
dc.SetPen(highlight)
- dc.DrawLine((0,0), (0,h))
- dc.DrawLine((0,0), (w,0))
+ dc.DrawLine(0,0, 0,h)
+ dc.DrawLine(0,0, w,0)
dc.SetPen(black)
- dc.DrawLine((0,h), (w+1,h))
- dc.DrawLine((w,0), (w,h))
+ dc.DrawLine(0,h, w+1,h)
+ dc.DrawLine(w,0, w,h)
dc.SetPen(shadow)
- dc.DrawLine((w-1,2), (w-1,h))
+ dc.DrawLine(w-1,2, w-1,h)
#----------------------------------------------------------------------
bmp = wx.EmptyBitmap(8,8)
bdc = wx.MemoryDC()
bdc.SelectObject(bmp)
- bdc.DrawRectangle((-1,-1), (10,10))
+ bdc.DrawRectangle(-1,-1, 10,10)
for i in range(8):
for j in range(8):
if ((i + j) & 1):
- bdc.DrawPoint((i,j))
+ bdc.DrawPoint(i,j)
brush = wx.Brush(wx.Colour(0,0,0))
brush.SetStipple(bmp)
h = body_h
if direction == MV_HOR:
- dc.DrawRectangle((x,y-2), (w,4))
+ dc.DrawRectangle(x,y-2, w,4)
else:
- dc.DrawRectangle((x-2,y), (4,h))
+ dc.DrawRectangle(x-2,y, 4,h)
dc.EndDrawingOnTop()