Fixed Parameter.sigValueChanging

This commit is contained in:
Luke Campagnola 2014-03-25 13:15:29 -04:00
parent 00c9c1e2a7
commit 2ce6196ac0
3 changed files with 16 additions and 2 deletions

View File

@ -77,6 +77,7 @@ pyqtgraph-0.9.9 [unreleased]
- MeshData can generate edges from face-indexed vertexes - MeshData can generate edges from face-indexed vertexes
- Fixed multiprocess deadlocks on windows - Fixed multiprocess deadlocks on windows
- Fixed GLGridItem.setSize - Fixed GLGridItem.setSize
- Fixed parametertree.Parameter.sigValueChanging
pyqtgraph-0.9.8 2013-11-24 pyqtgraph-0.9.8 2013-11-24

View File

@ -123,6 +123,17 @@ def change(param, changes):
p.sigTreeStateChanged.connect(change) p.sigTreeStateChanged.connect(change)
def valueChanging(param, value):
print "Value changing (not finalized):", param, value
# Too lazy for recursion:
for child in p.children():
child.sigValueChanging.connect(valueChanging)
for ch2 in child.children():
ch2.sigValueChanging.connect(valueChanging)
def save(): def save():
global state global state
state = p.saveState() state = p.saveState()

View File

@ -208,12 +208,14 @@ class WidgetParameterItem(ParameterItem):
val = self.widget.value() val = self.widget.value()
newVal = self.param.setValue(val) newVal = self.param.setValue(val)
def widgetValueChanging(self): def widgetValueChanging(self, *args):
""" """
Called when the widget's value is changing, but not finalized. Called when the widget's value is changing, but not finalized.
For example: editing text before pressing enter or changing focus. For example: editing text before pressing enter or changing focus.
""" """
pass # This is a bit sketchy: assume the last argument of each signal is
# the value..
self.param.sigValueChanging.emit(self.param, args[-1])
def selected(self, sel): def selected(self, sel):
"""Called when this item has been selected (sel=True) OR deselected (sel=False)""" """Called when this item has been selected (sel=True) OR deselected (sel=False)"""