Commit f5753c43 authored by Bob Obara's avatar Bob Obara Committed by Kitware Robot

Merge topic 'operatorViewChanges' into release

aa5f5d3d ENH: Changing default behavior changes for OperatorViews
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !894
parents 2706d7e7 aa5f5d3d
......@@ -113,7 +113,7 @@
VIEW_NAME smtkPolygonEdgeView
)
-->
<View Type="smtkPolygonEdgeView" Title="Create Polygon Edge">
<View Type="smtkPolygonEdgeView" Title="Create Polygon Edge" FilterByCategory="false">
<AttributeTypes>
<Att Type="create edge" />
</AttributeTypes>
......
......@@ -75,7 +75,7 @@
VIEW_NAME smtkPolygonContourView
)
-->
<View Type="smtkPolygonContourView" Title="Extract Contour Edges">
<View Type="smtkPolygonContourView" Title="Extract Contour Edges" FilterByCategory="false">
<AttributeTypes>
<Att Type="extract contours" />
</AttributeTypes>
......
......@@ -94,6 +94,12 @@ bool View::Component::contentsAsVector(std::vector<double>& vec) const
return (vec.size() > 0);
}
bool View::Component::attribute(const std::string& attname) const
{
std::string dummy;
return this->attribute(attname, dummy);
}
bool View::Component::attribute(const std::string& attname, std::string& value) const
{
std::map<std::string, std::string>::const_iterator it;
......
......@@ -55,6 +55,9 @@ public:
// Returns true if the component has an attribute called name and will
// set value to the attribute's values. Else it returns false
bool attribute(const std::string& attname, std::string& value) const;
// Description:
// Simply tests to see if the attribute exists
bool attribute(const std::string& attname) const;
//Description:
// Returns true if the component has an attribute called name and if it has the
// string value of true, t, false, or f (ignoring case). Value will be true if the attribute
......
......@@ -42,7 +42,8 @@ py::class_< smtk::common::View > pybind11_init_smtk_common_View(py::module &m)
.def("contentsAsInt", &smtk::common::View::Component::contentsAsInt, py::arg("val"))
.def("setContents", &smtk::common::View::Component::setContents, py::arg("c"))
.def("setAttribute", &smtk::common::View::Component::setAttribute, py::arg("attname"), py::arg("value"))
.def("attribute", &smtk::common::View::Component::attribute, py::arg("attname"), py::arg("value"))
.def("attribute", (bool (smtk::common::View::Component::*)(::std::string const &, ::std::string &) const) &smtk::common::View::Component::attribute, py::arg("attname"), py::arg("value"))
.def("attribute", (bool (smtk::common::View::Component::*)(::std::string const &) const) &smtk::common::View::Component::attribute, py::arg("attname"))
.def("attributeAsBool", (bool (smtk::common::View::Component::*)(::std::string const &, bool &) const) &smtk::common::View::Component::attributeAsBool, py::arg("attname"), py::arg("value"))
.def("attributeAsBool", (bool (smtk::common::View::Component::*)(::std::string const &) const) &smtk::common::View::Component::attributeAsBool, py::arg("attname"))
.def("attributes", &smtk::common::View::Component::attributes)
......
......@@ -71,6 +71,16 @@ qtOperatorView::qtOperatorView(const OperatorViewInfo& info)
this->Internals->m_instancedViewDef->copyContents(*view);
// We need to remove the TopLevel attribute (if there is one)
this->Internals->m_instancedViewDef->details().unsetAttribute("TopLevel");
// The default top-level behavior is that filter by category and advance level is on by default.
// For Operator View they need to be explicilty set to turn them on
if (!view->details().attribute("FilterByAdvanceLevel"))
{
view->details().setAttribute("FilterByAdvanceLevel", "false");
}
if (!view->details().attribute("FilterByCategory"))
{
view->details().setAttribute("FilterByCategory", "false");
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment