ServerManagerConfiguration for a "source"


(Cornelis Bockemühl) #1

I have written “source” filters in the past, and normally the first property that I put into the XML was this:




Specify a CSV file that contains the Assay table of the sampling

In a property panel widget constructor I could then write something like this to retrieve the file name:

std::string fname;
vtkSMProperty* fnProp = smproxy->GetProperty(“FileName”);
if(0 != fnProp)
fname = pqSMAdaptor::getFileListProperty(fnProp).first().toStdString();

So far so good, but now I am writing another source with again of course an input file, but then optionally two additional files which the user should be able to choose from the properties panel - or not. In my XML I have now this:




Specify a CSV file that contains the Assay table of the sampling




Specify a CSV file that contains the Collar table of the sampling. If
such a file is not given, the collar coordinates must be included in the
Assay table




Specify a CSV file that contains the Survey table of the sampling. It
is only required if the sample drill holes are not vertical

In the panel widget code I am starting with the same piece of code to retrieve the “main” file name - but it does not appear!

With a little research I found out that it ends up in the “CollarFile” property, not in the “FileName” property that comes first in the XML.

Is there any way I can make sure that the “initial” or “main” filename ends up in the “FileName” property? For the others it is then a job for the properties panel to take care.


(Cornelis Bockemühl) #2

What a horror - how is this posting screwed up! Let’s try again thus:

I have written “source” filters in the past, and normally the first property that I put into the XML was this:

<StringVectorProperty
name="FileName"
command="SetFileName"
panel_visibility="never"
number_of_elements="1">
<FileListDomain name="files"/>
<Documentation>
Specify a CSV file that contains the description of a block model,
including some columns with special meaning.
</Documentation>
</StringVectorProperty>

In a property panel widget constructor I could then write something like this to retrieve the file name:

std::string fname;
vtkSMProperty* fnProp = smproxy->GetProperty(“FileName”);
if(0 != fnProp)
fname = pqSMAdaptor::getFileListProperty(fnProp).first().toStdString();

So far so good, but now I am writing another source with again of course an input file, but then optionally two additional files which the user should be able to choose from the properties panel - or not. In my XML I have now this:

  <StringVectorProperty
      name="FileName"
      command="SetFileName"
      panel_visibility="never"
      number_of_elements="1">
    <FileListDomain name="files"/>
    <Documentation>
      Specify a CSV file that contains the Assay table of the sampling
    </Documentation>
  </StringVectorProperty>

  <StringVectorProperty
      name="CollarFile"
      label="Collar File"
      command="SetCollarFile"
      number_of_elements="1">
    <FileListDomain name="files"/>
    <Documentation>
      Specify a CSV file that contains the Collar table of the sampling. If
      such a file is not given, the collar coordinates must be included in the
      Assay table
    </Documentation>
  </StringVectorProperty>

  <StringVectorProperty
      name="SurveyFile"
      label="Survey File"
      command="SetSurveyFile"
      number_of_elements="1">
    <FileListDomain name="files"/>
    <Documentation>
      Specify a CSV file that contains the Survey table of the sampling. It
      is only required if the sample drill holes are not vertical
    </Documentation>
  </StringVectorProperty>

In the panel widget code I am starting with the same piece of code to retrieve the “main” file name - but it does not appear!

With a little research I found out that it ends up in the “CollarFile” property, not in the “FileName” property that comes first in the XML.

Is there any way I can make sure that the “initial” or “main” filename ends up in the “FileName” property? For the others it is then a job for the properties panel to take care.


(Cornelis Bockemühl) #3

Interesting additional finding: I renamed the “FileName” property to “AssayFile” (which is actually the correct name of the item) - and now the “main file path” is not any more assigned to “CollarFile” but to the “AssayFile”!

So far so good!

Only I will have to find out if this is systematic, like “just take the first file property that you find - alphabetically”, or rather like “just take the first file property that you find - no matter which happens to appear”.

In the fist case I can be glad that my first and mandatory file happens to be the first alphabetically.

Otherwise I would still like to find out if there is a way to explicitly tell Paraview which of the properties is supposed to be the “main input”.


(Mathieu Westphal (Kitware)) #4

Hi Cornelis.

you have to use the dedicated hints to override the behavior you are seeing.

  <Hints>
    <!-- This hint tells the GUI that the File | Open dialog sets the MyFileName
     property -->
    <DefaultFileNameProperty name="MyFileName" />
  </Hints>

(Cornelis Bockemühl) #5

Thanks a lot - and I like it much more than my “empirical impression” that in the case of doubt it would take the first property in alphabetical order!

In my case it “accidentally” even makes sense, but in another case it could also be rather weird…