[Paraview] Issue with PV 3.7 python bindings: bug or feature?

pat marion pat.marion at kitware.com
Wed Oct 7 14:17:37 EDT 2009


In recent versions, paraview uses the xml label attribute as the
property name in python.  It converts the label string to a valid
python identifier by calling paraview.make_new_valid(str).  The
problem is that make_name_valid returns None for names with
parentheses.  When None is detected the property is not added to the
module's dictionary.  The property is still there, you can access it
by calling writer_instance.GetProperty("Compression").

I could correct make_name_valid so that it handles strings with
parentheses instead of returning None.  Then the property would show
up in dir() as Compressionfooisadvised.  Another option is to fallback
to using the xml name attribute when it appears that the label
attribute is not a good candidate (decided if the label contains
parentheses or not).  The latter option might be better for your
situation, but maybe there is a good reason for always using the label
attribute.  Either of the fixes are easy to make.

Berk?

Pat


On Wed, Oct 7, 2009 at 1:20 PM, Karl König <kkoenig11 at web.de> wrote:
> Hi,
>
> in short:
> When using the 'label' keyword in server manager XML and its value contains parentheses, the according object is missing in python. Is this a bug or a feature?
>
> longer version including recipe:
> Consider ParaView3/Examples/Plugins/Writer, replace its CMakeLists.txt with the version attached such that cmake does not complain any more if the plugin is built standalone against a PV build using CVS version as of last night and give one of the *VectorProperty tags a label, extend e.g.:
>
>      <IntVectorProperty name="Compression"
>                         command="SetCompression"
>                         number_of_elements="1"
>                         default_values="1">
>
> to
>
>      <IntVectorProperty name="Compression"
>                         command="SetCompression"
>                         number_of_elements="1"
>                         default_values="1"
>                         label="Compression (foo is advised)">
>
> compile, invoke pvpython and run the following:
>>>> from paraview.simple import *; paraview.servermanager.LoadPlugin("./libMyTiffWriter.so"); connection = servermanager.Connect(); dir(servermanager.writers.MyTIFFWriter)
>
> If the label contains parentheses, the list generated by 'dir(servermanager.writers.MyTIFFWriter)' will be one item short: there is no "Compression" any more.
> Is this a known restriction to the use of 'label' in server manager XML?
>
> Thanks
> Karl
> ______________________________________________________
> GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://movieflat.web.de
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list