dabo Commit
Revision 4612
Date: 2008-10-26 10:00:58 -0700 (Sun, 26 Oct 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4612
Changed:
U trunk/dabo/ui/uiwx/dSlider.py
Log:
Modified the firing of the Hit event when the slider is set to Continuous=True.
Now it will only fire if the underlying value changes. This may be what was
responsible for Trac Issue #1054, in which multiple events were recorded.
Diff:
Modified: trunk/dabo/ui/uiwx/dSlider.py
===================================================================
--- trunk/dabo/ui/uiwx/dSlider.py 2008-10-26 16:54:02 UTC (rev 4611)
+++ trunk/dabo/ui/uiwx/dSlider.py 2008-10-26 17:00:58 UTC (rev 4612)
@@ -17,6 +17,7 @@
def __init__(self, parent, properties=None, attProperties=None, *args,
**kwargs):
self._baseClass = dSlider
self._continuous = False
+ self._lastVal = None
style = self._extractKey((kwargs, properties, attProperties),
"style")
if style is None:
kwargs["style"] = wx.SL_AUTOTICKS
@@ -32,7 +33,10 @@
def _onWxHit(self, evt):
- if self._continuous or not dabo.ui.isMouseLeftDown():
+ newval = self.GetValue()
+ changed = (newval != self._lastVal)
+ self._lastVal = newval
+ if (changed and self._continuous) or not
dabo.ui.isMouseLeftDown():
self.flushValue()
super(dSlider, self)._onWxHit(evt)
_______________________________________________
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]