diff --git a/src/App/Property.h b/src/App/Property.h
index a9901eb6a..b1046aa34 100644
--- a/src/App/Property.h
+++ b/src/App/Property.h
@@ -107,6 +107,8 @@ public:
* The bits and their meaning are listed below:
* 0 - object is marked as 'touched'
* 1 - object is marked as 'immutable'
+ * 2 - object is marked as 'read-ony' (for property editor)
+ * 3 - object is marked as 'hidden' (for property editor)
*/
std::bitset<32> StatusBits;
diff --git a/src/App/PropertyContainer.cpp b/src/App/PropertyContainer.cpp
index 07a59b135..bc89e5a9b 100644
--- a/src/App/PropertyContainer.cpp
+++ b/src/App/PropertyContainer.cpp
@@ -103,16 +103,6 @@ short PropertyContainer::getPropertyType(const char *name) const
return getPropertyData().getType(this,name);
}
-void PropertyContainer::setPropertyType(const Property* prop, short attr)
-{
- getPropertyData().setType(this,prop,attr);
-}
-
-void PropertyContainer::setPropertyType(const char *name, short attr)
-{
- getPropertyData().setType(this,name,attr);
-}
-
const char* PropertyContainer::getPropertyGroup(const Property* prop) const
{
return getPropertyData().getGroup(this,prop);
@@ -369,22 +359,6 @@ short PropertyData::getType(const PropertyContainer *container,const char* name)
return 0;
}
-void PropertyData::setType(const PropertyContainer *container,const Property* prop, short attr) const
-{
- const PropertyData::PropertySpec* Spec = findProperty(container,prop);
-
- if (Spec)
- const_cast< PropertyData::PropertySpec*>(Spec)->Type = attr;
-}
-
-void PropertyData::setType(const PropertyContainer *container,const char* name, short attr) const
-{
- const PropertyData::PropertySpec* Spec = findProperty(container,name);
-
- if (Spec)
- const_cast< PropertyData::PropertySpec*>(Spec)->Type = attr;
-}
-
const char* PropertyData::getGroup(const PropertyContainer *container,const Property* prop) const
{
const PropertyData::PropertySpec* Spec = findProperty(container,prop);
diff --git a/src/App/PropertyContainer.h b/src/App/PropertyContainer.h
index 88419ce3e..0690fe1b4 100644
--- a/src/App/PropertyContainer.h
+++ b/src/App/PropertyContainer.h
@@ -70,8 +70,6 @@ struct AppExport PropertyData
short getType (const PropertyContainer *container,const char* name) const;
const char* getGroup (const PropertyContainer *container,const char* name) const;
const char* getGroup (const PropertyContainer *container,const Property* prop) const;
- void setType (const PropertyContainer *container,const Property* prop, short) const;
- void setType (const PropertyContainer *container,const char* name, short) const;
const char* getDocumentation(const PropertyContainer *container,const char* name) const;
const char* getDocumentation(const PropertyContainer *container,const Property* prop) const;
@@ -118,10 +116,6 @@ public:
virtual short getPropertyType(const Property* prop) const;
/// get the Type of a named Property
virtual short getPropertyType(const char *name) const;
- /// set the Type of a Property
- virtual void setPropertyType(const Property* prop, short);
- /// set the Type of a named Property
- virtual void setPropertyType(const char *name, short);
/// get the Group of a Property
virtual const char* getPropertyGroup(const Property* prop) const;
/// get the Group of a named Property
diff --git a/src/App/PropertyContainerPy.xml b/src/App/PropertyContainerPy.xml
index d982ab6dc..3b27ec44e 100644
--- a/src/App/PropertyContainerPy.xml
+++ b/src/App/PropertyContainerPy.xml
@@ -23,9 +23,13 @@
Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination.
-
+
- Set the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination.
+ Set the behaviour of the property in the property editor.
+0 - default behaviour
+1 - item is ready-only
+2 - item is hidden
+
diff --git a/src/App/PropertyContainerPyImp.cpp b/src/App/PropertyContainerPyImp.cpp
index 9499bccc7..dd93c7ba8 100644
--- a/src/App/PropertyContainerPyImp.cpp
+++ b/src/App/PropertyContainerPyImp.cpp
@@ -78,14 +78,18 @@ PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args)
return Py::new_reference_to(ret);
}
-PyObject* PropertyContainerPy::setTypeOfProperty(PyObject *args)
+PyObject* PropertyContainerPy::setEditorMode(PyObject *args)
{
char* name;
short type;
if (!PyArg_ParseTuple(args, "sh", &name, &type)) // convert args: Python->C
return NULL; // NULL triggers exception
- getPropertyContainerPtr()->setPropertyType(name, type);
+ App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
+ if (prop) {
+ prop->StatusBits.set(2,(type & 1) > 0);
+ prop->StatusBits.set(3,(type & 2) > 0);
+ }
Py_Return;
}
diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp
index 0a5512187..34f7d2a27 100644
--- a/src/Gui/PropertyView.cpp
+++ b/src/Gui/PropertyView.cpp
@@ -112,7 +112,7 @@ void PropertyView::onSelectionChanged(const SelectionChanges& msg)
for (pt = dataMap.begin(); pt != dataMap.end(); ++pt) {
std::pair nameType = std::make_pair
(pt->first, pt->second->getTypeId().getKey());
- if (!ob->isHidden(pt->second))
+ if (!ob->isHidden(pt->second) && !pt->second->StatusBits.test(3))
propDataMap[nameType].push_back(pt->second);
}
}
diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp
index 5d90f0b1d..4c7966741 100644
--- a/src/Gui/propertyeditor/PropertyItem.cpp
+++ b/src/Gui/propertyeditor/PropertyItem.cpp
@@ -78,7 +78,7 @@ void PropertyItem::setPropertyData(const std::vector& items)
it != items.end(); ++it) {
App::PropertyContainer* parent = (*it)->getContainer();
if (parent)
- ro &= parent->isReadOnly(*it);
+ ro &= (parent->isReadOnly(*it) || (*it)->StatusBits.test(2));
}
this->setReadOnly(ro);
}
@@ -226,7 +226,7 @@ void PropertyItem::setPropertyValue(const QString& value)
for (std::vector::const_iterator it = propertyItems.begin();
it != propertyItems.end(); ++it) {
App::PropertyContainer* parent = (*it)->getContainer();
- if (parent && !parent->isReadOnly(*it)) {
+ if (parent && !parent->isReadOnly(*it) && !(*it)->StatusBits.test(2)) {
QString cmd = QString::fromAscii("%1 = %2").arg(pythonIdentifier(*it)).arg(value);
Gui::Application::Instance->runPythonCode((const char*)cmd.toUtf8());
}