[Paraview] question on using python programmable source

Berk Geveci berk.geveci at kitware.com
Fri May 30 17:21:44 EDT 2008


> I have been following this discussion and am trying to solve a related
> problem. I only have one file to deal with but would like the user to be
> able to specify the filename from a nice interface, similar to the Helix
> example. Ideally I would pop up a file browser but for now simply typing the
> path is sufficient. I have this working with an xml file that includes an
> element like:
>
> <StringVectorProperty
>  name="FileName"
>  command="SetParameter"
>  number_of_elements="2"
>  default_values_delimiter=";"
>  default_values="filename;r'/tmp/test.xyz'">
> </StringVectorProperty>
>
> 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? It sounds like we really need a type for the
parameters so that it automatically quotes string parameters.

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.

-berk


More information about the ParaView mailing list