| 129 | |
| 130 | |
| 131 | void FeaturePythonImp::onBeforeChange(const Property* prop) |
| 132 | { |
| 133 | if (py_onBeforeChange.isNone()) { |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | // Run the execute method of the proxy object. |
| 138 | Base::PyGILStateLocker lock; |
| 139 | try { |
| 140 | const char* prop_name = object->getPropertyName(prop); |
| 141 | if (!prop_name) { |
| 142 | return; |
| 143 | } |
| 144 | if (has__object__) { |
| 145 | Py::Tuple args(1); |
| 146 | args.setItem(0, Py::String(prop_name)); |
| 147 | Base::pyCall(py_onBeforeChange.ptr(), args.ptr()); |
| 148 | } |
| 149 | else { |
| 150 | Py::Tuple args(2); |
| 151 | args.setItem(0, Py::Object(object->getPyObject(), true)); |
| 152 | args.setItem(1, Py::String(prop_name)); |
| 153 | Base::pyCall(py_onBeforeChange.ptr(), args.ptr()); |
| 154 | } |
| 155 | } |
| 156 | catch (Py::Exception&) { |
| 157 | Base::PyException e; // extract the Python error text |
| 158 | e.reportException(); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | bool FeaturePythonImp::onBeforeChangeLabel(std::string& newLabel) |
| 163 | { |
nothing calls this directly
no test coverage detected