From 0160478242225339bb4fd481fe56008d654478e8 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sat, 4 Mar 2017 19:34:52 +0300 Subject: [PATCH] PartDesign: add ViewProviderPython + bind PartDesign::Feature to PartDesign::ViewProvider, and adjust viewprovider of PartDesign::FeaturePython accordingly. --- src/Mod/PartDesign/App/Feature.cpp | 2 +- src/Mod/PartDesign/App/Feature.h | 4 ++++ src/Mod/PartDesign/Gui/AppPartDesignGui.cpp | 1 + src/Mod/PartDesign/Gui/ViewProvider.cpp | 11 +++++++++++ src/Mod/PartDesign/Gui/ViewProvider.h | 3 ++- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index c56137284..4f491122f 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -182,7 +182,7 @@ namespace App { /// @cond DOXERR PROPERTY_SOURCE_TEMPLATE(PartDesign::FeaturePython, PartDesign::Feature) template<> const char* PartDesign::FeaturePython::getViewProviderName(void) const { - return "PartGui::ViewProviderPython"; + return "PartDesignGui::ViewProviderPython"; } template<> PyObject* PartDesign::FeaturePython::getPyObject(void) { if (PythonObject.is(Py::_None())) { diff --git a/src/Mod/PartDesign/App/Feature.h b/src/Mod/PartDesign/App/Feature.h index 80d4d6c7d..698b0133c 100644 --- a/src/Mod/PartDesign/App/Feature.h +++ b/src/Mod/PartDesign/App/Feature.h @@ -70,6 +70,10 @@ public: virtual PyObject* getPyObject(void); + virtual const char* getViewProviderName() const { + return "PartDesignGui::ViewProvider"; + } + protected: /** diff --git a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp index 6f1d51c00..41dd078a7 100644 --- a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp +++ b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp @@ -123,6 +123,7 @@ PyMOD_INIT_FUNC(PartDesignGui) PartDesignGui::Workbench ::init(); PartDesignGui::ViewProvider ::init(); + PartDesignGui::ViewProviderPython ::init(); PartDesignGui::ViewProviderBody ::init(); PartDesignGui::ViewProviderSketchBased ::init(); PartDesignGui::ViewProviderPocket ::init(); diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index dd525e2e5..641954e6b 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -251,3 +251,14 @@ void ViewProvider::makeTemporaryVisible(bool onoff) else Gui::ViewProvider::hide(); } + + +namespace Gui { +/// @cond DOXERR +PROPERTY_SOURCE_TEMPLATE(PartDesignGui::ViewProviderPython, PartDesignGui::ViewProvider); +/// @endcond + +// explicit template instantiation +template class PartDesignGuiExport ViewProviderPythonFeatureT; +} + diff --git a/src/Mod/PartDesign/Gui/ViewProvider.h b/src/Mod/PartDesign/Gui/ViewProvider.h index 14ae46992..7a128402e 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.h +++ b/src/Mod/PartDesign/Gui/ViewProvider.h @@ -25,6 +25,7 @@ #define PARTGUI_ViewProvider_H #include +#include namespace PartDesignGui { @@ -75,7 +76,7 @@ protected: App::DocumentObject* oldTip; }; - +typedef Gui::ViewProviderPythonFeatureT ViewProviderPython; } // namespace PartDesignGui