+ support of Python feature classes without an execute() method

+ if execute() method of Python feature is missing or if it returns false call the execute() method of the C++ feature
+ fix SketchObjectPython
This commit is contained in:
wmayer
2015-10-21 00:22:40 +02:00
parent 169b2e356e
commit e7a3dc48e8
4 changed files with 45 additions and 19 deletions

View File

@@ -44,7 +44,7 @@ public:
FeaturePythonImp(App::DocumentObject*);
~FeaturePythonImp();
DocumentObjectExecReturn *execute();
bool execute();
void onBeforeChange(const Property* prop);
void onChanged(const Property* prop);
PyObject *getPyObject(void);
@@ -84,7 +84,15 @@ public:
}
/// recalculate the Feature
virtual DocumentObjectExecReturn *execute(void) {
return imp->execute();
try {
bool handled = imp->execute();
if (!handled)
return FeatureT::execute();
}
catch (const Base::Exception& e) {
return new App::DocumentObjectExecReturn(e.what());
}
return DocumentObject::StdReturn;
}
/// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {