[Paraview] settings and default values

Cory Quammen cory.quammen at kitware.com
Fri Jun 6 12:06:06 EDT 2014


Hi Felipe,

The general approach would be:

- create a VTK singleton class, say vtkPxdmfSettings
- configure your settings proxy group to use this settings class as follows:

<ProxyGroup name="settings">
    <SettingsProxy name="PxdmfSettings" label="Pxdmf"
      processes="client|dataserver|renderserver"
      class="vtkPxdmfSettings">
      <Documentation>
        Custom settings for Pxdmf plugin.
      </Documentation>

      <IntVectorProperty name="GUIMaxNbModes"
        number_of_elements="1"
        default_values="0">
        <Documentation>
        </Documentation>
        <!-- Note that if you include the hint below, this setting will be
saved to the Qt settings -->
        <Hints>
          <SaveInQSettings />
        </Hints>
      </IntVectorProperty>
    </SettingsProxy>
  </ProxyGroup>

- Create your custom VTK filter and set up the XML as usual
- Within your VTK filter, access the singleton class you created in the
first step and read the settings file in the constructor

For a concrete example, take a look at how this is done for the
RenderViewSettings in the following files:

The singleton class for settings:
ParaViewCore/ClientServerCore/Rendering/vtkPVRenderViewSettings.cxx

The XML for the singleton class:
ParaViewCore/ServerManager/Default/settings.xml

A VTK filter that accesses the settings singleton and setting values:
ParaViewCore/ServerManager/Rendering/vtkSMRepresentationTypeDomain.cxx

The hint SaveInQSettings tells ParaView to save the setting in the Qt .ini
file - you don't need to include it, but I suspect you may have it in your
settings XML. It may also be saved to the JSON file if this hint is present
(which could be considered a bug), so that might be why you are seeing the
setting in two places.

Hope that helps,
Cory


On Thu, Jun 5, 2014 at 11:28 AM, Felipe Bordeu <felipe.bordeu at ec-nantes.fr>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> hi to all,
>
> I have a custom filter with default values (defined in the xml). but now
> I want to populate the default values from the data coming from the
> plugin settings.
>
> so a have a <ProxyGroup name="settings"> with the descriptions of my
> settings window. but I don't know how to put this information into my
> filter.
>
> I'm trying something like this
>
>
> vtkSMIntVectorProperty::SafeDownCast(proxy()->GetProperty("GUIMaxNbModes"))->SetElement(0,settings->value("PxdmfSettings.GUIMaxNbModes",100).toInt());
>
> (in the constructor of a pqPropertyWidget) but I don't know if this is
> the right way.
>
> Also when I use the setting menu, my data ("GUIMaxNbModes") is written
> in the ParaView4.1.0.ini AND in the UserSettings.json. Why ???
>
> Thank to all
> Felipe
>
> - --
> Felipe Bordeu Weldt
> Ingénieur de Recherche
> - -------------------------------------
> Tél. : 33 (0)2 40 37 16 57
> Fax. : 33 (0)2 40 74 74 06
> Felipe.Bordeu at ec-nantes.fr
> Institut GeM - UMR CNRS 6183
> École Centrale Nantes
> 1 Rue de La Noë, 44321 Nantes, FRANCE
> - -------------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJTkIyaAAoJEE/fMfNgU9/DKzQH/ikRCDd+/3Fu49XnZxTGrETF
> 98MCPlFMeYYKT9FksqcgZyKvt0qeF0uPsBpc7Dpt8yUlbWHgZ4DEQtGlZ/s/wJ1H
> 3a7p5Do+zd1tocjFVCvZ8JE7REjEuVBv8Furh0X5JAzVZF3YY8alkmR/MIPBBHEm
> Rci7BWU2kUL6vPLV31Z0Hwl+0ksvotOJ/byM2HxBgcAFBHRVdLcN8QQYpuQGSy73
> otX4m/n/9EkJmiFfsnW0cFvOq5tPiZp4x1tBYD40d6ulS6jsr1Z7+pGT/OP0ECPs
> RwBzPL94kMLZtqvByjY6CmGg0sLByGDxU9M5eMjPf9cHNkc0DsT1UR3Egns7iek=
> =KwyN
> -----END PGP SIGNATURE-----
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20140606/ccd37d68/attachment.html>


More information about the ParaView mailing list