[Paraview] question on using python programmable source

Robert Maynard robertjmaynard at gmail.com
Sun Jun 1 13:30:21 EDT 2008


SetParameters takes to char* and copies them directly into the script as 
a global define. So yes if you want to pass in string properties the end 
user has to actually quote them selves.

The other problem is that SetParameters are only done once so you cannot 
change the parameters you send to the python interpreter between the 
RequestInformation script and the RequestData script.

Recently I solved this problem by making a child of the 
PythonProgrammableFilter and passing in memory references of objects, 
like how it gets 'self' into the script. Once this was working it 
allowed me to share information between the qt panel, 
RequestInformation, and RequestData. We had a major problem though than 
with the delete code in PythonProgrammableFilter, but it works now.

Jed Frechette wrote:
>
> On May 30, 2008, at 3:21 PM, Berk Geveci wrote:
>
>>> Unfortunately, I need to include the quotes when entering a path in 
>>> the ui,
>>> otherwise Python will throw an exception when it tries to do:
>>>
>>> filename = /tmp/test.xyz
>>>
>>> Is there a way to modify the ui so that it automatically returns a raw
>>> string containing whatever is entered in a text box?
>>
>> What happens when you enter the filename between the quotes currently?
>> Are the quotes discarded?
>
> If I enter the filename with quotes everything works fine. I haven't 
> dug into the source but based on the exception I think whatever is 
> entered in the ui text box is assigned verbatim to the variable so:
>
> '/tmp/test.xyz'
>
> works but:
>
> /tmp/test.xyz
>
> raises an exception.
>
>> It sounds like we really need a type for the
>> parameters so that it automatically quotes string parameters.
>
> That's what I was wondering about if there was something like a 
> type="String" attribute for the xml. I guess another option would be 
> to just return all input as raw string's and let the script worry 
> about doing conversions. The latter was the behavior I originally 
> expected given the name of the element, StringVectorProperty.
>
>> I would like to see a programmable reader in the future. It would be
>> very cool if you somehow you specify a python script and register it
>> with the list of readers. The file name(s) would be passed to this
>> reader from the GUI. This would be pretty easy to do from the XML if
>> we create a new VTK class.
>
>
> That would be ideal and it doesn't seem like the required 
> functionality would be all that different from the current programable 
> source.
>
> Best,
>
> -- 
> Jed Frechette
>
> University of New Mexico Lidar Lab
> www.unm.edu/~lidar
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list