MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / onChanged

Method onChanged

src/App/FeaturePython.cpp:190–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void FeaturePythonImp::onChanged(const Property* prop)
191{
192 if (py_onChanged.isNone()) {
193 return;
194 }
195 // Run the execute method of the proxy object.
196 Base::PyGILStateLocker lock;
197 try {
198 const char* prop_name = object->getPropertyName(prop);
199 if (!prop_name) {
200 return;
201 }
202 if (has__object__) {
203 Py::Tuple args(1);
204 args.setItem(0, Py::String(prop_name));
205 Base::pyCall(py_onChanged.ptr(), args.ptr());
206 }
207 else {
208 Py::Tuple args(2);
209 args.setItem(0, Py::Object(object->getPyObject(), true));
210 args.setItem(1, Py::String(prop_name));
211 Base::pyCall(py_onChanged.ptr(), args.ptr());
212 }
213 }
214 catch (Py::Exception&) {
215 Base::PyException e; // extract the Python error text
216 e.reportException();
217 }
218}
219
220void FeaturePythonImp::onDocumentRestored()
221{

Callers

nothing calls this directly

Calls 8

pyCallFunction · 0.85
isNoneMethod · 0.80
StringClass · 0.70
ObjectClass · 0.70
getPropertyNameMethod · 0.45
ptrMethod · 0.45
getPyObjectMethod · 0.45
reportExceptionMethod · 0.45

Tested by

no test coverage detected