dabo Commit
Revision 4411
Date: 2008-08-14 13:37:27 -0700 (Thu, 14 Aug 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4411
Changed:
U branches/Nate/dabo/ui/uiwx/dPageFrame.py
Log:
Added property support for Active and Inactive tab text color and for the menu
area back color.
Diff:
Modified: branches/Nate/dabo/ui/uiwx/dPageFrame.py
===================================================================
--- branches/Nate/dabo/ui/uiwx/dPageFrame.py 2008-08-13 22:19:12 UTC (rev
4410)
+++ branches/Nate/dabo/ui/uiwx/dPageFrame.py 2008-08-14 20:37:27 UTC (rev
4411)
@@ -10,6 +10,7 @@
import dabo.dEvents as dEvents
from dabo.dLocalize import _
from dPageFrameMixin import dPageFrameMixin
+import dabo.dColors as dColors
# dDockForm is not available with wxPython < 2.7
_USE_DOCK = (wx.VERSION >= (2, 7))
@@ -55,6 +56,8 @@
self._baseClass = dAdvancedPageFrame
preClass = fnb.FlatNotebook
+ self._inactiveTabTextColor = None
+ self._menuBackColor = None
self._showDropdownTabList = False
self._showMenuCloseButton = True
self._showMenuOnSingleTab = True
@@ -105,6 +108,57 @@
self.GetPage(self.GetSelection()).raiseEvent(dEvents.PageContextMenu)
#Property getters and setters
+ def _getActiveTabTextColor(self):
+ return self._activeTabTextColor
+
+ def _setActiveTabTextColor(self, val):
+ if self._constructed():
+ self._activeTabTextColor = val
+ if isinstance(val, basestring):
+ val = dColors.colorTupleFromName(val)
+ if isinstance(val, tuple):
+ self.SetActiveTabTextColour(wx.Colour(*val))
+ self.Refresh()
+ else:
+ raise ValueError, (_("'%s' can not be
translated into a color" % val))
+ else:
+ self._properties["ActiveTabTextColor"] = val
+
+
+ def _getInactiveTabTextColor(self):
+ return self._inactiveTabTextColor
+
+ def _setInactiveTabTextColor(self, val):
+ if self._constructed():
+ self._inactiveTabTextColor = val
+ if isinstance(val, basestring):
+ val = dColors.colorTupleFromName(val)
+ if isinstance(val, tuple):
+ self.SetNonActiveTabTextColour(wx.Colour(*val))
+ self.Refresh()
+ else:
+ raise ValueError, (_("'%s' can not be
translated into a color" % val))
+ else:
+ self._properties["InactiveTabTextColor"] = val
+
+
+ def _getMenuBackColor(self):
+ return self._menuBackColor
+
+ def _setMenuBackColor(self, val):
+ if self._constructed():
+ self._menuBackColor = val
+ if isinstance(val, basestring):
+ val = dColors.colorTupleFromName(val)
+ if isinstance(val, tuple):
+ self.SetTabAreaColour(wx.Colour(*val))
+ self.Refresh()
+ else:
+ raise ValueError, (_("'%s' can not be
translated into a color" % val))
+ else:
+ self._properties["MenuBackColor"] = val
+
+
def _getShowDropdownTabList(self):
return self._showDropdownTabList
@@ -116,6 +170,7 @@
self._showNavButtons = False
else:
self._delWindowStyleFlag(fnb.FNB_DROPDOWN_TABS_LIST)
+
self._showDropdownTabList = val
@@ -225,6 +280,18 @@
#Property definitions
+ ActiveTabTextColor = property(_getActiveTabTextColor,
_setActiveTabTextColor, None,
+ _("""Specifies the color of the text of the active tab (str or
3-tuple) (Default=None)
+ Note, is not visible with the 'VC8' TabStyle"""))
+
+ InactiveTabTextColor = property(_getInactiveTabTextColor,
_setInactiveTabTextColor, None,
+ _("""Specifies the color of the text of non active tabs (str or
3-tuple) (Default=None)
+ Note, is not visible with the 'VC8' TabStyle"""))
+
+ MenuBackColor = property(_getMenuBackColor, _setMenuBackColor, None,
+ _("""Specifies the background color of the menu (str or
3-tuple) (Default=None)
+ Note, is not visible with 'VC71' TabStyle."""))
+
ShowDropdownTabList = property(_getShowDropdownTabList,
_setShowDropdownTabList, None,
_("""Specifies whether the dropdown tab list button is
visible in the menu (bool) (Default=False)
Setting this property to True will set ShowNavButtons
to False"""))
@@ -250,7 +317,7 @@
TabSideIncline = property(_getTabSideIncline, _setTabSideIncline, None,
_("""Specifies the incline of the sides of the tab in
degrees (int) (Default=0)
Acceptable values are 0 - 15.
- Note this property will have no effect when
TabStyle is something other than Default.
+ Note this property will have no effect on
TabStyles other than Default.
"""))
TabStyle = property(_getTabStyle, _setTabStyle, None,
@@ -437,14 +504,18 @@
class _dAdvancedPageFrame_test(TestMixin, dAdvancedPageFrame):
def initProperties(self):
+ print "in init properties"
self.Width = 400
self.Height = 175
+ self.TabStyle = random.choice(("Default", "VC8", "VC71",
"Fancy", "Firefox"))
self.TabPosition = random.choice(("Top", "Bottom"))
+ self.ShowPageCloseButtons = random.choice(("True", "False"))
self.ShowDropdownTabList = random.choice(("True", "False"))
self.ShowMenuClose = random.choice(("True", "False"))
- self.ShowPageCloseButtons = random.choice(("True", "False"))
self.ShowMenuOnSingleTab = random.choice(("True", "False"))
- self.TabStyle = random.choice(("Default", "VC8", "VC71",
"Fancy", "Firefox"))
+ self.MenuBackColor = random.choice(dColors.colors)
+ self.InactiveTabTextColor = random.choice(dColors.colors)
+ self.ActiveTabTextColor = random.choice(dColors.colors)
class _dPageFrame_test(TestMixin, dPageFrame): pass
class _dPageList_test(TestMixin, dPageList): pass
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]