| 613 | } |
| 614 | |
| 615 | bool ViewProviderFeaturePythonImp::setupContextMenu(QMenu* menu) |
| 616 | { |
| 617 | _FC_PY_CALL_CHECK(setupContextMenu, return (false)); |
| 618 | |
| 619 | // Run the attach method of the proxy object. |
| 620 | Base::PyGILStateLocker lock; |
| 621 | try { |
| 622 | if (has__object__) { |
| 623 | PythonWrapper wrap; |
| 624 | wrap.loadGuiModule(); |
| 625 | wrap.loadWidgetsModule(); |
| 626 | Py::Tuple args(1); |
| 627 | args.setItem(0, wrap.fromQWidget(menu, "QMenu")); |
| 628 | return Base::pyCall(py_setupContextMenu.ptr(), args.ptr()).isTrue(); |
| 629 | } |
| 630 | else { |
| 631 | PythonWrapper wrap; |
| 632 | wrap.loadGuiModule(); |
| 633 | wrap.loadWidgetsModule(); |
| 634 | Py::Tuple args(2); |
| 635 | args.setItem(0, Py::Object(object->getPyObject(), true)); |
| 636 | args.setItem(1, wrap.fromQWidget(menu, "QMenu")); |
| 637 | return Base::pyCall(py_setupContextMenu.ptr(), args.ptr()).isTrue(); |
| 638 | } |
| 639 | } |
| 640 | catch (Py::Exception&) { |
| 641 | if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) { |
| 642 | PyErr_Clear(); |
| 643 | return false; |
| 644 | } |
| 645 | Base::PyException e; // extract the Python error text |
| 646 | e.reportException(); |
| 647 | } |
| 648 | return true; |
| 649 | } |
| 650 | |
| 651 | void ViewProviderFeaturePythonImp::attach(App::DocumentObject* pcObject) |
| 652 | { |
nothing calls this directly
no test coverage detected