dabo Commit
Revision 7063
Date: 2012-01-28 10:37:34 -0800 (Sat, 28 Jan 2012)
Author: Ed
Trac: http://trac.dabodev.com/changeset/7063
Changed:
U trunk/dabo/ui/uiwx/dHyperLink.py
Log:
Fixed a problem due to an obscure inconsistency in the wx class.
There are 6 settings that affect link appearance: the color and the underline
status of a link, in each of three states: link, visited, and hover. These are
managed at the wx level through GetColours(), SetColours(), GetUnderlines(),
and SetUnderlines(). For each you either pass in or are returned a 3-tuple of
values. In all the order of the values is (link, visited, hover) - except for
GetUnderlines, which returns (link, hover, visited). I've fixed the code to
account for this odd inconsistency.
I also modifed the setting code for these values to do nothing if the new value
is the same as the current state.
Diff:
Modified: trunk/dabo/ui/uiwx/dHyperLink.py
===================================================================
--- trunk/dabo/ui/uiwx/dHyperLink.py 2012-01-27 23:11:38 UTC (rev 7062)
+++ trunk/dabo/ui/uiwx/dHyperLink.py 2012-01-28 18:37:34 UTC (rev 7063)
@@ -52,6 +52,12 @@
self.UpdateLink(True)
+ def _getUnderlines(self, which):
+ """Returns the status for the various underline settings."""
+ types = ("link", "hover", "visited")
+ return self.GetUnderlines()[types.index(which)]
+
+
def _setUnderlines(self, link, visited, hover):
"""Updated the link with the specified underline settings."""
self.SetUnderlines(link, visited, hover)
@@ -74,18 +80,20 @@
def _setHoverColor(self, val):
if self._constructed():
- self._hoverColor = val
- self._setColors()
+ if val != self.HoverColor:
+ self._hoverColor = val
+ self._setColors()
else:
self._properties["HoverColor"] = val
def _getHoverUnderline(self):
- return self.GetUnderlines()[2]
+ return self._getUnderlines("hover")
def _setHoverUnderline(self, val):
if self._constructed():
- self._setUnderlines(self.LinkUnderline,
self.VisitedUnderline, bool(val))
+ if val != self.HoverUnderline:
+ self._setUnderlines(self.LinkUnderline,
self.VisitedUnderline, bool(val))
else:
self._properties["HoverUnderline"] = val
@@ -95,18 +103,20 @@
def _setLinkColor(self, val):
if self._constructed():
- self._linkColor = val
- self._setColors()
+ if val != self.LinkColor:
+ self._linkColor = val
+ self._setColors()
else:
self._properties["LinkColor"] = val
def _getLinkUnderline(self):
- return self.GetUnderlines()[0]
+ return self._getUnderlines("link")
def _setLinkUnderline(self, val):
if self._constructed():
- self._setUnderlines(bool(val), self.VisitedUnderline,
self.HoverUnderline)
+ if val != self.LinkUnderline:
+ self._setUnderlines(bool(val),
self.VisitedUnderline, self.HoverUnderline)
else:
self._properties["LinkUnderline"] = val
@@ -142,18 +152,20 @@
def _setVisitedColor(self, val):
if self._constructed():
- self._visitedColor = val
- self._setColors()
+ if val != self.VisitedColor:
+ self._visitedColor = val
+ self._setColors()
else:
self._properties["VisitedColor"] = val
def _getVisitedUnderline(self):
- return self.GetUnderlines()[1]
+ return self._getUnderlines("visited")
def _setVisitedUnderline(self, val):
if self._constructed():
- self._setUnderlines(self.LinkUnderline, bool(val),
self.HoverUnderline)
+ if val != self.VisitedUnderline:
+ self._setUnderlines(self.LinkUnderline,
bool(val), self.HoverUnderline)
else:
self._properties["VisitedUnderline"] = val
_______________________________________________
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]