[Paraview] upgrading reader module/plugin
Mark Olesen
Mark.Olesen at esi-group.com
Wed Jan 4 11:20:34 EST 2017
Second attempt at posting:
---
I'm currently upgrading a reader module from using a pqAutoGeneratedObjectPanel to a using a property group widget (as per http://www.paraview.org/Wiki/Plugin_HowTo#Adding_Customizations_for_Properties_Panel).
I have my bunch of properties in a PropertyGroup and have a panel_widget associated with them. Everything loads up, and using printf() I can verify that the property values are all being updated.
However, not only does it seems rather clunky, I cannot get the "Apply" button on the property panel to notice when the property values have been updated.
Here's a basic sketch of what I have:
// Get the property from the group (with down-cast):
interpolateFields_ = group->GetProperty("interpolate");
// Provide a checkbox as widget for it - two-column layout.
QCheckBox* b = new QCheckBox(prop->GetXMLLabel(), this);
form->addWidget(b, row, col, Qt::AlignLeft);
// Connect to slot:
connect(b, SIGNAL(toggled(bool)), this, SLOT(interpolateFields(bool)));
// This is ugly, but seems to be needed???
interpolateFields_->SetImmediateUpdate(true);
// And the slot itself
void interpolateFields(bool checked)
{
interpolateFields_->SetElement(0, checked);
// this->setModified();
//^^^ used to work with pqAutoGeneratedObjectPanel
}
I used to rely on the setModified() method from the pqAutoGeneratedObjectPanel, but now can't seem to get from the SMproxy to the pqProxy or whatever.
Or am I going about this entirely the wrong way?
FWIW, here are the relevant sub-entries from the XML, in case there is something missing there:
<IntVectorProperty
name="InterpolateFields"
command="SetInterpolateVolFields"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation></Documentation>
</IntVectorProperty>
<PropertyGroup
label="General Controls"
panel_widget="my_reader_controls">
<Property name="InterpolateFields"/>
...
</PropertyGroup>
Unfortunately, the Examples/Plugins/PropertyWidgets is a bit scanty here.
Thanks for any advice,
/mark
More information about the ParaView
mailing list