Samuel
2013-04-24 09:01:45 UTC
Hi,
First of all I really appreciate the effort to build this higher level
layer on pyQt for scientific data. I am relatively new to guidata and maybe
I am missing something obvious here.
The general idea of what I am trying to do is basically to use guidata
together with some hardware interfacing modules to replace labview, As
pointed out here
https://groups.google.com/forum/#!topic/guidata_guiqwt/9qk0TPGLMzk/discussion,
there are some tools to add up some interactivity to the datasets, but it
doesn't really help for what I am trying to do.
For instance, I want to implement a slow software lock, with P,I and D
fields that control the proportional, integral, and derivative gain of the
feedback loop. For this I define a dataset like this:
*class PIDdataset(dt.DataSet):*
* setPoint = di.FloatItem("set point", default = 0.0)*
* negative = di.BoolItem("negative",default = False)*
* P = di.FloatItem("P",default = 0.0,min = 0,max = 100.0)*
* I = di.FloatItem("I",default = 1.0,min = 0,max = 100.0)*
* D = di.FloatItem("D",default = 0.0,min = 0,max = 100.0)*
* delay = di.IntItem("interrogation delay (ms)",default = 100)*
* lock = di.BoolItem("Lock",default = False)*
Then, I integrate this in a QtDialog
*class PIDDialog(QDialog):*
* def __init__(self):*
* QDialog.__init__(self)*
* self.groupbox1 = DataSetEditGroupBox("Parametres de
lock",PIDdataset,show_button = False)*
And a simple QTimer is used to regularly read the error signal, compute the
requested feedback using the values of *self.groupbox1.dataset*
At first, I was expecting that using the option *show_button = False* in* **DataSetEditGroupBox
*would already do the trick, that is, as soon as a value was edited in the
dataset GUI (checkbox stateChanged or editingFinished in the FloatItems),
then, the values of the dataset would be updated and usable by my feedback
loop. I quickly realized that it was not the case and that I still had to
manually *call self.groupbox1.set()*. I then thought: "no problem, let's
simply use the normal Qt SIGNAL SLOTS mechanisms to do that": for instance,
with the checkbox "lock", I tried:
*checkbox = self.groupbox1.get_edit_layout().widgets[-2].checkbox*
*checkbox.stateChanged.connect(self.update_values)*
(the function *self.update_values* is essentially calling *
self.groupbox1.set*)
However, things do not work at all as expected: as soon as I connect
something to the widget's signals of the dataset (using the function *
checkbox.stateChanged.connect(self.update_values)*), even if the function *
self.update_values* does nothing, the normal update mechanism of the
dataset doesn't work anymore: that is to say, even an external call to the
function *groupbox1.set* doesn't update the values of the dataset according
to the GUI values anymore!
I am completely puzzled by this behaviour. Can someone give me a hint why
connecting things (even dummy functions) to the dataset widgets is harmful
to the normal way of working of the dataset ?
If this is normal, can someone tell me how I should proceed to update "on
the fly" my dataset as soon as the user has entered a different value in
the GUI fields or if I should completely give up guidata and program with
raw pyqt objects ?
I hope my question makes sense and someone can help, because I already
spent some time trying to find a solution myself and got unlucky.
Thanks in advance,
Samuel
First of all I really appreciate the effort to build this higher level
layer on pyQt for scientific data. I am relatively new to guidata and maybe
I am missing something obvious here.
The general idea of what I am trying to do is basically to use guidata
together with some hardware interfacing modules to replace labview, As
pointed out here
https://groups.google.com/forum/#!topic/guidata_guiqwt/9qk0TPGLMzk/discussion,
there are some tools to add up some interactivity to the datasets, but it
doesn't really help for what I am trying to do.
For instance, I want to implement a slow software lock, with P,I and D
fields that control the proportional, integral, and derivative gain of the
feedback loop. For this I define a dataset like this:
*class PIDdataset(dt.DataSet):*
* setPoint = di.FloatItem("set point", default = 0.0)*
* negative = di.BoolItem("negative",default = False)*
* P = di.FloatItem("P",default = 0.0,min = 0,max = 100.0)*
* I = di.FloatItem("I",default = 1.0,min = 0,max = 100.0)*
* D = di.FloatItem("D",default = 0.0,min = 0,max = 100.0)*
* delay = di.IntItem("interrogation delay (ms)",default = 100)*
* lock = di.BoolItem("Lock",default = False)*
Then, I integrate this in a QtDialog
*class PIDDialog(QDialog):*
* def __init__(self):*
* QDialog.__init__(self)*
* self.groupbox1 = DataSetEditGroupBox("Parametres de
lock",PIDdataset,show_button = False)*
And a simple QTimer is used to regularly read the error signal, compute the
requested feedback using the values of *self.groupbox1.dataset*
At first, I was expecting that using the option *show_button = False* in* **DataSetEditGroupBox
*would already do the trick, that is, as soon as a value was edited in the
dataset GUI (checkbox stateChanged or editingFinished in the FloatItems),
then, the values of the dataset would be updated and usable by my feedback
loop. I quickly realized that it was not the case and that I still had to
manually *call self.groupbox1.set()*. I then thought: "no problem, let's
simply use the normal Qt SIGNAL SLOTS mechanisms to do that": for instance,
with the checkbox "lock", I tried:
*checkbox = self.groupbox1.get_edit_layout().widgets[-2].checkbox*
*checkbox.stateChanged.connect(self.update_values)*
(the function *self.update_values* is essentially calling *
self.groupbox1.set*)
However, things do not work at all as expected: as soon as I connect
something to the widget's signals of the dataset (using the function *
checkbox.stateChanged.connect(self.update_values)*), even if the function *
self.update_values* does nothing, the normal update mechanism of the
dataset doesn't work anymore: that is to say, even an external call to the
function *groupbox1.set* doesn't update the values of the dataset according
to the GUI values anymore!
I am completely puzzled by this behaviour. Can someone give me a hint why
connecting things (even dummy functions) to the dataset widgets is harmful
to the normal way of working of the dataset ?
If this is normal, can someone tell me how I should proceed to update "on
the fly" my dataset as soon as the user has entered a different value in
the GUI fields or if I should completely give up guidata and program with
raw pyqt objects ?
I hope my question makes sense and someone can help, because I already
spent some time trying to find a solution myself and got unlucky.
Thanks in advance,
Samuel
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.