[Paraview] Trouble with "information_only" GUI property in paraview filter
Alex Rattner
Alex.Rattner at gatech.edu
Fri Jun 8 18:15:37 EDT 2012
Hi all,
I was eventually able to work out this display issue. The show command
has to be set as a separate hint in the source proxy, like so:
<IntVectorProperty
name="NumberOfFeatures"
label="Num Features"
command="GetNumFeatures"
number_of_elements="1"
default_values="0"
information_only="1">
<Documentation>
Number of features in the field.
</Documentation>
</IntVectorProperty>
<Hints>
<Property name="NumberOfFeatures" show="1"/>
</Hints>
I hope this saves someone else the trouble. Thanks again Yumin for
pointing me in the right direction.
-Alex
On 06/08/2012 03:35 PM, Alex Rattner wrote:
> Hi Yumin,
>
> Thank you for the suggestion. I debugged into pqNamedWidgets, and
> found that my property was being excluded from the propertiesToShow
> list, even with the show="1" setting. When I manually switched it in
> the debugger, the property showed up and worked correctly.
>
> The issue seems to go a step deeper. The pqNamedWidgets::createWidgets
> function calls pqNamedWidgets::processHints. Now process hints scans
> through the list of hints in the following loop.
>
> for (unsigned int i = 0; i < numHints; i++)
> {
> vtkPVXMLElement *element = hints->GetNestedElement(i);
> if (QString("Property") == element->GetName())
> {
> QString propertyName = element->GetAttribute("name");
> int showProperty;
> if (element->GetScalarAttribute("show", &showProperty))
> {
> if (showProperty)
> {
> propertiesToShow.push_back(propertyName);
> }
> else
> {
> propertiesToHide.push_back(propertyName);
> }
> }
> }
> }
>
> First it checks if the hint is named "Property" (with the attribute
> "show"), but this one is actually named "ShowInMenu". So it seems that
> the hints data structure is not being set up correctly.
>
> Do you happen to have any other thoughts of ways to get this property
> to display?
>
> Thanks again,
> Alex
>
>
> On 06/08/2012 02:28 PM, Yumin Yuan wrote:
>> Hi Alex,
>>
>> If you can debug into pqNamedWidgets::createWidgets(), and see where
>> and why this property is being skipped, it will help to narrow down
>> the problem, especially around this piece of logic (starting with line
>> 892).
>>
>>
>> // skip information properties
>> if((!propertiesToShow.contains(propertyName)&& informationOnly) ||
>> SMProperty->GetIsInternal())
>> {
>> continue;
>> }
>>
>> vtkPVXMLElement *hints = SMProperty->GetHints();
>>
>> // skip non-summary properties if summaryOnly is true
>> if(summaryOnly&& (!hints ||
>> hints->FindNestedElementByName("ShowInSummaryPanel") == 0))
>> {
>> continue;
>> }
>>
>>
>> HTH,
>> Yumin
>>
>> On Fri, Jun 8, 2012 at 3:57 PM, Alex
>> Rattner<Alex.Rattner at gatech.edu> wrote:
>>> Hi Yumin,
>>>
>>> Thank you for the response. I tried this and still no luck, the
>>> property
>>> still won't appear. For reference, my new xml was
>>>
>>> <IntVectorProperty
>>> name="NumberOfFeatures"
>>> label="Num Features"
>>>
>>> command="GetNumFeatures"
>>> number_of_elements="1"
>>> default_values="0"
>>> information_only="1"
>>> show="1">
>>>
>>> <Documentation>
>>> Number of features in the field.
>>> </Documentation>
>>> </IntVectorProperty>
>>>
>>> I'm pretty sure that the property is actually being made and called,
>>> because
>>> I debugged paraview and found that the GetNumFeatures method was being
>>> called. It just seems that the property isn't being displayed. Could
>>> this
>>> really be a bug in paraview?
>>>
>>> Thanks,
>>> Alex
>>>
>>>
>>> On 06/08/2012 01:22 PM, Yumin Yuan wrote:
>>>> Hi Alex,
>>>>
>>>> You can add the following to your xml to see if it helps.
>>>>
>>>> show="1"
>>>>
>>>> If this property does show up after adding that, it should be
>>>> displayed as disabled since it is read-only. If it does not help, this
>>>> could be a bug.
>>>>
>>>> Yumin
>>>>
>>>> On Fri, Jun 8, 2012 at 2:40 PM, Alex Rattner<Alex.Rattner at gatech.edu>
>>>> wrote:
>>>>> Hello,
>>>>>
>>>>> I have been developing a feature tracking filter plug-in for
>>>>> paraview for
>>>>> a
>>>>> couple weeks. I am currently trying to improve the plug-in GUI,
>>>>> but ran
>>>>> into
>>>>> an issue.
>>>>>
>>>>> I want the plug-in to return some basic information to the user in
>>>>> the
>>>>> GUI,
>>>>> so I added a property to the server xml file like:
>>>>>
>>>>> <IntVectorProperty
>>>>> name="NumberOfFeatures"
>>>>> label="Number Of Features"
>>>>> command="GetNumFeatures"
>>>>> number_of_elements="1"
>>>>> default_values="0"
>>>>> information_only="1">
>>>>> <Documentation>
>>>>> Number of features in the field.
>>>>> </Documentation>
>>>>> </IntVectorProperty>
>>>>>
>>>>> with corresponding code in the class definition:
>>>>> vtkGetMacro(NumFeatures, int);
>>>>>
>>>>> However, the property does not appear on the plug-in gui. Similar
>>>>> "input"
>>>>> GUI properties work fine, but I've been messing around for a couple
>>>>> hours
>>>>> and I cannot get this "output" GUI property to appear. Is this
>>>>> specific
>>>>> to
>>>>> the "filters" ProxyGroup - because I have found other plug-ins
>>>>> that use
>>>>> essentially the same xml code to output information? Do you have any
>>>>> suggestions on how to make such output properties display and work?
>>>>>
>>>>> Thanks,
>>>>> Alex
>>>>> _______________________________________________
>>>>> 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