[vistrails-users] QtWidget, QtGui.QGridLayout and dynamic module adding
dakoop at cs.utah.edu
Sun Oct 2 18:57:42 EDT 2011
On Sep 29, 2011, at 2:00 AM, Lourens Dijk wrote:
> Lately, i have developed some packages regarding VisTrails. One of these is in the style of the pythonCalcQt. I have also created a dialog (QtWidget, QtGui.QGridLayout). I can fill in a couple of fields, add records, retrieve svn and password data etc. I have added a button to create a separate module for every record; which are then all placed on the canvas.
> I have a couple of questions:
> 1) Is it possible to save the layout and values of my dialog (QtWidget)?
As you have probably found, VisTrails provides hooks for packages to provide their own QWidgets for module configuration. Each of these widgets should subclass gui.modules.module_configure.StandardModuleConfigurationWidget. Because the module being configured is passed to the __init__ for such configuration widget, you should be able to use any of the saved module information to configured that widget. For example, you might read the module_functions list for that module and use that information to configure the widget.
You can also provide more general widgets like the one pythonCalcQt provides that are not tied to any specific module. Any layouts or values can be saved into module parameters, or you might choose to save them globally (perhaps serialized to a file in the .vistrails directory). There are no specific methods provided for serialization outside of the vistrail/workflow.
> 2) Can I interact between the modules on the canvas and the records on my dialog? In other words: after I created modules of all my records on the canvas, i want to change one of these modules, and maybe add one from the modules container. Now i want to synchronize my dialog from the modules on the canvas to the canvas. Can i create this sort of interaction?
> E.g. when i clicked on create module on the pythonCalcGUI it is created and placed on the canvas. Now i change the operator and want to send this back to the pythonCalcGUI. How can i achieve this?
For module configuration widgets, the saveTriggered and resetTriggered methods should be called upon saving/reseting the configuration widget. In these methods, you can use the controller object to make necessary changes to the workflow. At a more general level, you can obtain the controller from the api, as in pythonCalcQt to persist the changes.
For the types of changes you propose, you would have to maintain a map from the pipeline to the configuration dialog. Each module and parameter has a unique id so you could use them to identify associations. However, if you want to immediately update the global pythonCalcQt widget after a pipeline change, you would probably have to add a notification from the "pipeline_changed" signal to a callback in that widget. I am not familiar with any packages that use this type of interaction, but the people working on the UV-CDAT project may have done something similar.
> 3) How can a retrieve the unique id's of the newly made modules? Of course I have some more questions.
The add_module action in the controller returns the module (with its id set). You can access the id via Module.id.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vistrails-users