ajbmachon / guidata

Automatically exported from code.google.com/p/guidata
Other
0 stars 0 forks source link

Inheritance issue with custom dataset items #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the attached file in ipython
2. A gui will show up. Enable on of the two check boxes to enable editing of 
the items in the corresponding group.
3. Click OK.
4. Reopen gui in ipython (> gp.edit()  )
5. Both subgroup are editable although only one of them was enabled.

Ideally I would expect that the gui remains consistent before and after closing 
the gui for the first time. This I believe is because both parameter items 
belong to the same class and share class variables. So when one of them gets 
edited, the variable is also effected on the other instances of the same class.

I have tried this on Ubuntu 12.10 with guidata v1.5.1

I do not want to explicitly instantiate different variables for each item as in 
your example in the documentation.

http://packages.python.org/guidata/examples.html#data-item-groups-and-group-sele
ction

I would like to instantiate a gui with multiple objects of a user defined type. 
How do I do that ? Am I missing something fundamental here in my implementation 
?

Thanks and regards,
Sadique

Original issue reported on code.google.com by sheiksad...@gmail.com on 12 Nov 2012 at 5:33

Attachments:

GoogleCodeExporter commented 9 years ago
Is this project still active ? Can I expect some support ?

Original comment by sheiksad...@gmail.com on 26 Nov 2012 at 6:33

GoogleCodeExporter commented 9 years ago
Be reassured, the projects are still actively used/maintained internally: many 
internal applications (with a long-term support) are relying on guidata and 
guiqwt libraries.

The open-source project sometimes lack of support, depending on our 
availability.

I'll take a look at your request personnally, as soon as I can.

Original comment by pierre.raybaut on 26 Nov 2012 at 7:03

GoogleCodeExporter commented 9 years ago
Ok, I took a look at your sample code.

To answer your questions/comments:
1. Yes, it is possible to make custom datasets and to use class inheritance as 
you did in your example which is well written.
2. The thing is that the property mechanism within guidata ("set_prop", 
"ValueProp", ...) has not been implemented to support inheritance. In TestGroup 
class, the two  instances of ParameterUIItem share the same item objects as 
they were constructed once and for all when the ParameterUI class was defined. 
The fact that these item objects are the same is not a problem knowing how 
things work in guidata internals. However, the fact that the property ('prop') 
is the same object is an issue here as the value of the BoolItem is stored in a 
shared property object... hence the side effects you experienced.

This is just a quick overlook. I may have misunderstood some of the internals 
at stake here. I'll have to dig further.

Original comment by pierre.raybaut on 26 Nov 2012 at 9:37

GoogleCodeExporter commented 9 years ago
Thanks for considering the issue.

So, while the property mechanism as it is now doesn't support inheritance, the 
other variables (eg. FloatItem) will still hold independent data per 
instantiation (which is some how internally taken care of)?

Original comment by sheiksad...@gmail.com on 27 Nov 2012 at 2:30