main logo
Subject: [dabo-dev] dabo Commit 1080
Author: Ed Leafe
Posted: 2005/07/30 17:38:26
 
View Entire Thread
New Search


dabo Commit
Revision 1080
Date: 2005-07-30 15:43:38 -0700 (Sat, 30 Jul 2005)
Author: ed

Changed:
U trunk/ui/uiwx/dGridSizer.py
U trunk/ui/uiwx/dSizerMixin.py

Log:
Wrapped the wx constants for the various flags used.


Diff:
Modified: trunk/ui/uiwx/dGridSizer.py
===================================================================
--- trunk/ui/uiwx/dGridSizer.py 2005-07-30 16:19:33 UTC (rev 1079)
+++ trunk/ui/uiwx/dGridSizer.py 2005-07-30 22:43:38 UTC (rev 1080)
@@ -6,6 +6,7 @@

class dGridSizer(wx.GridBagSizer, dSizerMixin.dSizerMixin):
_IsContainer = False
+ GridSizerItem = wx.GBSizerItem

def __init__(self, vgap=3, hgap=3, maxRows=0, maxCols=0, **kwargs):
self._baseClass = dGridSizer
@@ -22,7 +23,7 @@
else:
# Rows were passed.
self.MaxRows = maxRows
- self.SetFlexibleDirection(wx.BOTH)
+ self.SetFlexibleDirection(self.bothFlag)
# Keep track of the highest numbered row/col that
# contains an item
self._highRow = self._highCol = -1
@@ -260,7 +261,7 @@
"""Given an object that is contained in this grid
sizer, returns a (row,col) tuple for that item's location.
"""
- if isinstance(obj, wx.GBSizerItem):
+ if isinstance(obj, self.GridSizerItem):
obj = self.getItem(obj)
try:
row, col = self.GetItemPosition(obj)
@@ -274,7 +275,7 @@
"""Given an object that is contained in this grid
sizer, returns a (row,col) tuple for that item's cell span.
"""
- if isinstance(obj, wx.GBSizerItem):
+ if isinstance(obj, self.GridSizerItem):
obj = self.getItem(obj)
try:
row, col = self.GetItemSpan(win)

Modified: trunk/ui/uiwx/dSizerMixin.py
===================================================================
--- trunk/ui/uiwx/dSizerMixin.py 2005-07-30 16:19:33 UTC (rev 1079)
+++ trunk/ui/uiwx/dSizerMixin.py 2005-07-30 22:43:38 UTC (rev 1080)
@@ -36,7 +36,24 @@
# we need to work with them directly.
horizontalFlag = wx.HORIZONTAL
verticalFlag = wx.VERTICAL
-
+ bothFlag = wx.BOTH
+ leftFlag = wx.ALIGN_LEFT
+ rightFlag = wx.ALIGN_RIGHT
+ centerFlag = wx.ALIGN_CENTER
+ centreFlag = wx.ALIGN_CENTER
+ topFlag = wx.ALIGN_TOP
+ bottomFlag = wx.ALIGN_BOTTOM
+ middleFlag = wx.ALIGN_CENTER_VERTICAL
+ borderBottomFlag = wx.BOTTOM
+ borderLeftFlag = wx.LEFT
+ borderRightFlag = wx.RIGHT
+ borderTopFlag = wx.TOP
+ borderAllFlag = wx.ALL
+ expandFlag = wx.EXPAND
+ growFlag = wx.EXPAND
+ fixedFlag = wx.FIXED_MINSIZE
+
+
def append(self, item, layout="normal", proportion=0, alignment=None,
halign="left", valign="top", border=None, borderFlags=None):
"""Adds the passed object to the end of the list of items controlled
@@ -260,51 +277,51 @@
alignFlags = (halign, valign)
for flag in [flag.lower() for flag in alignFlags]:
if flag == "left":
- _wxFlags = _wxFlags | wx.ALIGN_LEFT
+ _wxFlags = _wxFlags | self.leftFlag
elif flag == "right":
- _wxFlags = _wxFlags | wx.ALIGN_RIGHT
+ _wxFlags = _wxFlags | self.rightFlag
elif flag in ("center", "centre"):
- _wxFlags = _wxFlags | wx.ALIGN_CENTER
+ _wxFlags = _wxFlags | self.centerFlag
elif flag == "top":
- _wxFlags = _wxFlags | wx.ALIGN_TOP
+ _wxFlags = _wxFlags | self.topFlag
elif flag == "bottom":
- _wxFlags = _wxFlags | wx.ALIGN_BOTTOM
+ _wxFlags = _wxFlags | self.bottomFlag
elif flag == "middle":
- _wxFlags = _wxFlags | wx.ALIGN_CENTER_VERTICAL
+ _wxFlags = _wxFlags | self.middleFlag

if isinstance(borderFlags, basestring):
borderFlags = (borderFlags, )
if borderFlags is None:
# Add any default borders. If no defaults set, set it to the default 'all'
if self.BorderBottom:
- _wxFlags = _wxFlags | wx.BOTTOM
+ _wxFlags = _wxFlags | self.borderBottomFlag
if self.BorderLeft:
- _wxFlags = _wxFlags | wx.LEFT
+ _wxFlags = _wxFlags | self.borderLeftFlag
if self.BorderRight:
- _wxFlags = _wxFlags | wx.RIGHT
+ _wxFlags = _wxFlags | self.borderRightFlag
if self.BorderTop:
- _wxFlags = _wxFlags | wx.TOP
+ _wxFlags = _wxFlags | self.borderTopFlag
# Should we set the default?
if not (self.BorderBottom or self.BorderLeft
or self.BorderRight or self.BorderTop):
- _wxFlags = _wxFlags | wx.ALL
+ _wxFlags = _wxFlags | self.borderAllFlag
else:
for flag in [flag.lower() for flag in borderFlags]:
if flag == "left":
- _wxFlags = _wxFlags | wx.LEFT
+ _wxFlags = _wxFlags | self.borderLeftFlag
elif flag == "right":
- _wxFlags = _wxFlags | wx.RIGHT
+ _wxFlags = _wxFlags | self.borderRightFlag
elif flag == "top":
- _wxFlags = _wxFlags | wx.TOP
+ _wxFlags = _wxFlags | self.borderTopFlag
elif flag == "bottom":
- _wxFlags = _wxFlags | wx.BOTTOM
+ _wxFlags = _wxFlags | self.borderBottomFlag
elif flag == "all":
- _wxFlags = _wxFlags | wx.ALL
+ _wxFlags = _wxFlags | self.borderAllFlag

if layout.lower() in ("expand", "ex", "exp", "x", "grow"):
- _wxFlags = _wxFlags | wx.EXPAND
+ _wxFlags = _wxFlags | self.expandFlag
elif layout.lower() == "fixed":
- _wxFlags = _wxFlags | wx.FIXED_MINSIZE
+ _wxFlags = _wxFlags | self.fixedFlag

return _wxFlags

@@ -373,18 +390,18 @@

def _getOrientation(self):
o = self.GetOrientation()
- if o == wx.VERTICAL:
+ if o == self.verticalFlag:
return "Vertical"
- elif o == wx.HORIZONTAL:
+ elif o == self.horizontalFlag:
return "Horizontal"
else:
return "?"

def _setOrientation(self, val):
if val[0].lower() == "v":
- self.SetOrientation(wx.VERTICAL)
+ self.SetOrientation(self.verticalFlag)
else:
- self.SetOrientation(wx.HORIZONTAL)
+ self.SetOrientation(self.horizontalFlag)

def _getSpacing(self):
try:





 
©2005 Ed Leafe
<-- Prior Message New Search Next Message -->