Part: Fixed python representation of Part2DObject - fixes #1387

This commit is contained in:
Yorik van Havre 2014-02-24 16:10:51 -03:00
parent bab0c366a7
commit 3f99b6ec26
2 changed files with 12 additions and 3 deletions

View File

@ -20,7 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <TopoDS_Shape.hxx>
@ -48,6 +48,8 @@
#include "Part2DObject.h"
#include "Geometry.h"
#include <App/FeaturePythonPyImp.h>
#include "Part2DObjectPy.h"
using namespace Part;
@ -311,7 +313,14 @@ namespace App {
PROPERTY_SOURCE_TEMPLATE(Part::Part2DObjectPython, Part::Part2DObject)
template<> const char* Part::Part2DObjectPython::getViewProviderName(void) const {
return "PartGui::ViewProvider2DObjectPython";
}
}
template<> PyObject* Part::Part2DObjectPython::getPyObject(void) {
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new FeaturePythonPyT<Part::Part2DObjectPy>(this),true);
}
return Py::new_reference_to(PythonObject);
}
/// @endcond
// explicit template instantiation

View File

@ -12,7 +12,7 @@ using namespace Part;
// returns a string which represents the object e.g. when printed in python
std::string Part2DObjectPy::representation(void) const
{
return std::string("<Part2DObject object>");
return std::string("<Part::Part2DObject>");
}