# How to replace XML specification with python decorators?

**URL:** https://discourse.paraview.org/t/how-to-replace-xml-specification-with-python-decorators/2664
**Category:** ParaView Support
**Created:** [October 1, 2019, 3:53pm UTC](https://discourse.paraview.org/t/how-to-replace-xml-specification-with-python-decorators/2664 "2019-10-01T15:53:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Loic](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e9c0ed/32.png) [@Loic](https://discourse.paraview.org/u/Loic)
#### Post date: [October 1, 2019, 3:53pm UTC](https://discourse.paraview.org/t/how-to-replace-xml-specification-with-python-decorators/2664/1 "2019-10-01T15:53:11Z")

</div>

Hi,

I would like to replace an old vtkPythonProgrammableFilter with a subclass of VTKPythonAlgorithmBase.

There was an XML specification file to expose that filter in ParaView and I would like to use some decorators to replace that file as described in this [link](https://kitware.github.io/paraview-docs/latest/python/paraview.util.vtkAlgorithm.html).

I’m looking for some examples to replace part of that file.

1. Do you have any hint to define a sub-menu with an enumeration of choices, as in the following XML code ?

```xml
    <IntVectorProperty
            name="geomOrigin"
            label="Origin"
            initial_string="geomOrigin"
            command="SetParameter"
            animateable="1"
            default_values="1"
            panel_visibility="advanced"
            number_of_elements="1">
            <EnumerationDomain name="enum">
              <Entry value="1" text="One"/>
              <Entry value="2" text="Two"/>
            </EnumerationDomain>
            <Documentation>Description...</Documentation>
      </IntVectorProperty>

```

1. Do you have any hint to create a checkbox, as in the following example?

```xml
    <IntVectorProperty
        name="verbose"
        label="Details"
        initial_string="verbose"
        command="SetParameter"
        animateable="1"
        default_values="0"
        number_of_elements="1">
        <BooleanDomain name="bool" />
    </IntVectorProperty>

```

1. Is there any possibility to write the XML corresponding to a decorated class?

Thanks in advance.

Regards,  
Loic

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 2, 2019, 2:39am UTC](https://discourse.paraview.org/t/how-to-replace-xml-specification-with-python-decorators/2664/2 "2019-10-02T02:39:14Z")

</div>

You can use your xmls as is, see  
`paraview/Examples/Plugins/PythonAlgorithm/PythonAlgorithmExamples.py`
