Pierre Raybaut
2011-04-06 10:04:48 UTC
Hi David,
guidata v1.3.0 includes more interactivity.
It's not very well documented for now, but you may try setting the
options "callback" and "value_callback" of the "display" properties of
items. Only items which are represented by a QLineEdit widget support
this feature (e.g. FloatItem, StringItem, IntItem, FileOpenItem,
etc.).
A simple example (not tested though):
def func1(instance, item, value):
# instance: instance of the Example dataset
# item: instance of the FloatItem
print "callback, x:", value
def func2(value):
print "value_callback, x:", value
class Example(DataSet):
item = FloatItem("x").set_prop("display", callback=func1,
value_callback=func2)
-Pierre
guidata v1.3.0 includes more interactivity.
It's not very well documented for now, but you may try setting the
options "callback" and "value_callback" of the "display" properties of
items. Only items which are represented by a QLineEdit widget support
this feature (e.g. FloatItem, StringItem, IntItem, FileOpenItem,
etc.).
A simple example (not tested though):
def func1(instance, item, value):
# instance: instance of the Example dataset
# item: instance of the FloatItem
print "callback, x:", value
def func2(value):
print "value_callback, x:", value
class Example(DataSet):
item = FloatItem("x").set_prop("display", callback=func1,
value_callback=func2)
-Pierre
Hello Pierre,
I am currently using PyQt and pyvisa for some of my scripts to control
instruments in the lab (basically as an alternative to labview). The
one problem I found is that I spend a lot of time thinking about Qt4
related things (signals, slots, widgets etc), rather than my actual
data.
It seems to me that guidata would be the perfect solution for me,
since it abstracts away a lot of the underlying Qt framework. I had a
quick play around with it, and I am quite impressed by what you have
done, however it seems that it may be too "static" for my needs. What
I mean is that you have to click "Apply" after editing every dataset,
whereas I would like the changes to take effect as soon as I update
the widget (or after I press enter or move to another widget). Also,
a dataset may be displayed for user editing, but might also be updated
in response to an external signal from some instrument.
So my question is whether it is feasible for guidata to be used in
such real-time situations, if you have any plans to move in this
direction, or any obstacles I might come across if I tried to
implement such changes myself.
cheers
David
I am currently using PyQt and pyvisa for some of my scripts to control
instruments in the lab (basically as an alternative to labview). The
one problem I found is that I spend a lot of time thinking about Qt4
related things (signals, slots, widgets etc), rather than my actual
data.
It seems to me that guidata would be the perfect solution for me,
since it abstracts away a lot of the underlying Qt framework. I had a
quick play around with it, and I am quite impressed by what you have
done, however it seems that it may be too "static" for my needs. What
I mean is that you have to click "Apply" after editing every dataset,
whereas I would like the changes to take effect as soon as I update
the widget (or after I press enter or move to another widget). Also,
a dataset may be displayed for user editing, but might also be updated
in response to an external signal from some instrument.
So my question is whether it is feasible for guidata to be used in
such real-time situations, if you have any plans to move in this
direction, or any obstacles I might come across if I tried to
implement such changes myself.
cheers
David