ENH: paraFoam --help => immediate pass-through to paraview --help

ENH: Paraview modules.

- Update props with int, not bool (for more versatility)
- Set properties and tool-tips directly on widgets instead of buttons
This commit is contained in:
Mark Olesen
2017-05-23 08:02:25 +02:00
parent 2495fcb42e
commit 96d98cd2de
6 changed files with 137 additions and 61 deletions

View File

@ -40,13 +40,13 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// file-scope
static QAbstractButton* setButtonProperties
static QWidget* setWidgetProperties
(
QAbstractButton* b,
QWidget* widget,
vtkSMProperty* prop
)
{
QString tip;
widget->setFocusPolicy(Qt::NoFocus); // avoid dotted border
vtkSMDocumentation* doc = prop->GetDocumentation();
if (doc)
@ -54,22 +54,32 @@ static QAbstractButton* setButtonProperties
const char* txt = doc->GetDescription();
if (txt)
{
tip = QString(txt).simplified();
QString tip = QString(txt).simplified();
if (tip.size())
{
widget->setToolTip(tip);
}
}
}
b->setText(prop->GetXMLLabel());
if (tip.size())
{
b->setToolTip(tip);
}
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
return widget;
}
// file-scope
static QAbstractButton* setButtonProperties
(
QAbstractButton* b,
vtkSMProperty* prop
)
{
setWidgetProperties(b, prop);
b->setText(prop->GetXMLLabel());
vtkSMIntVectorProperty* intProp =
vtkSMIntVectorProperty::SafeDownCast(prop);
// initial checked state for integer (bool) properties
// Initial checked state for integer (bool) properties
if (intProp)
{
b->setChecked(intProp->GetElement(0));
@ -111,12 +121,12 @@ void pqFoamBlockMeshControls::fireCommand(vtkSMProperty* prop)
void pqFoamBlockMeshControls::fireCommand
(
vtkSMIntVectorProperty* prop,
bool checked
int val
)
{
vtkSMProxy* pxy = this->proxy();
prop->SetElement(0, checked); // Toogle bool
prop->SetElement(0, val); // Set int value, toogle bool, etc
// Fire off command
prop->Modified();
@ -200,7 +210,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls
setButtonProperties(b, refresh_);
form->addWidget(b, 0, 0, Qt::AlignLeft);
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
connect
(
b, SIGNAL(clicked()), this, SLOT(refreshPressed())
);
}
if (showPatchNames_)
@ -209,7 +222,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls
setButtonProperties(b, showPatchNames_);
form->addWidget(b, 0, 1, Qt::AlignLeft);
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
connect
(
b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool))
);
}
if (showPointNumbers_)
@ -218,7 +234,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls
setButtonProperties(b, showPointNumbers_);
form->addWidget(b, 0, 2, Qt::AlignLeft);
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
connect
(
b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool))
);
}
}

View File

@ -71,8 +71,8 @@ class pqFoamBlockMeshControls
//- Update property
void fireCommand(vtkSMProperty* prop);
//- Toggle and update bool property
void fireCommand(vtkSMIntVectorProperty* prop, bool checked);
//- Update int property or toggle bool property
void fireCommand(vtkSMIntVectorProperty* prop, int val);
//- Update "BlockArrayStatus", "CurvedEdgesArrayStatus" information
void updateParts();