| 160 | } |
| 161 | |
| 162 | bool FeaturePythonImp::onBeforeChangeLabel(std::string& newLabel) |
| 163 | { |
| 164 | if (py_onBeforeChangeLabel.isNone()) { |
| 165 | return false; |
| 166 | } |
| 167 | |
| 168 | // Run the execute method of the proxy object. |
| 169 | Base::PyGILStateLocker lock; |
| 170 | try { |
| 171 | Py::Tuple args(2); |
| 172 | args.setItem(0, Py::Object(object->getPyObject(), true)); |
| 173 | args.setItem(1, Py::String(newLabel)); |
| 174 | Py::Object ret(Base::pyCall(py_onBeforeChangeLabel.ptr(), args.ptr())); |
| 175 | if (!ret.isNone()) { |
| 176 | if (!ret.isString()) { |
| 177 | throw Py::TypeError("onBeforeChangeLabel expects to return a string"); |
| 178 | } |
| 179 | newLabel = ret.as_string(); |
| 180 | return true; |
| 181 | } |
| 182 | } |
| 183 | catch (Py::Exception&) { |
| 184 | Base::PyException e; // extract the Python error text |
| 185 | e.reportException(); |
| 186 | } |
| 187 | return false; |
| 188 | } |
| 189 | |
| 190 | void FeaturePythonImp::onChanged(const Property* prop) |
| 191 | { |
nothing calls this directly
no test coverage detected