Fix issues:

+ improve formatting
+ remove superfluous semicolons
+ comment unused parameters
+ rename Initialisation to Initialization
+ rename Deinitialisation to Finalization
+ remove spaces
This commit is contained in:
wmayer 2016-10-08 12:04:49 +02:00
parent 3a51404dd5
commit 9ac1810ea3
24 changed files with 147 additions and 148 deletions

View File

@ -1136,15 +1136,15 @@ void Application::initTypes(void)
App ::PropertyExpressionEngine ::init(); App ::PropertyExpressionEngine ::init();
// Extension classes // Extension classes
App ::Extension ::init(); App ::Extension ::init();
App ::ExtensionContainer ::init(); App ::ExtensionContainer ::init();
App ::DocumentObjectExtension ::init(); App ::DocumentObjectExtension ::init();
App ::GroupExtension ::init(); App ::GroupExtension ::init();
App ::GroupExtensionPython ::init(); App ::GroupExtensionPython ::init();
App ::GeoFeatureGroupExtension ::init(); App ::GeoFeatureGroupExtension ::init();
App ::GeoFeatureGroupExtensionPython::init(); App ::GeoFeatureGroupExtensionPython::init();
App ::OriginGroupExtension ::init(); App ::OriginGroupExtension ::init();
App ::OriginGroupExtensionPython::init(); App ::OriginGroupExtensionPython ::init();
// Document classes // Document classes
App ::TransactionalObject ::init(); App ::TransactionalObject ::init();

View File

@ -95,10 +95,10 @@ DocumentObjectExecReturn *DocumentObject::execute(void)
{ {
//call all extensions //call all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>(); auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) for(auto ext : vector) {
if(ext->extensionMustExecute()) if(ext->extensionMustExecute())
ext->extensionExecute(); ext->extensionExecute();
}
return StdReturn; return StdReturn;
} }
@ -106,13 +106,13 @@ short DocumentObject::mustExecute(void) const
{ {
if(isTouched()) if(isTouched())
return 1; return 1;
//ask all extensions //ask all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>(); auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) for(auto ext : vector) {
if(ext->extensionMustExecute()) if(ext->extensionMustExecute())
return 1; return 1;
}
return 0; return 0;
} }
@ -388,24 +388,24 @@ void DocumentObject::connectRelabelSignals()
} }
} }
void DocumentObject::onSettingDocument() { void DocumentObject::onSettingDocument()
{
//call all extensions //call all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>(); auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) for(auto ext : vector)
ext->onExtendedSettingDocument(); ext->onExtendedSettingDocument();
} }
void DocumentObject::setupObject() { void DocumentObject::setupObject()
{
//call all extensions //call all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>(); auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) for(auto ext : vector)
ext->onExtendedSetupObject(); ext->onExtendedSetupObject();
} }
void DocumentObject::unsetupObject() { void DocumentObject::unsetupObject()
{
//call all extensions //call all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>(); auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) for(auto ext : vector)

View File

@ -64,7 +64,7 @@ public:
/// returns the type name of the ViewProviderExtension which is automatically attached /// returns the type name of the ViewProviderExtension which is automatically attached
/// to the viewprovider object when it is initiated /// to the viewprovider object when it is initiated
virtual const char* getViewProviderExtensionName(void) const {return "";}; virtual const char* getViewProviderExtensionName(void) const {return "";}
}; };
} //App } //App

View File

@ -39,12 +39,12 @@ std::string DocumentObjectExtensionPy::representation(void) const
return std::string("<document object extension>"); return std::string("<document object extension>");
} }
PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* attr) const PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* /*attr*/) const
{ {
return 0; return 0;
} }
int DocumentObjectExtensionPy::setCustomAttributes(const char* attr, PyObject *obj) int DocumentObjectExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
{ {
return 0; return 0;
} }

View File

@ -46,7 +46,7 @@ public:
/// returns the type name of the ViewProvider /// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const { virtual const char* getViewProviderName(void) const {
return "Gui::ViewProviderDocumentObjectGroup"; return "Gui::ViewProviderDocumentObjectGroup";
}; }
virtual PyObject *getPyObject(void); virtual PyObject *getPyObject(void);
}; };

View File

@ -186,4 +186,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::ExtensionPython, App::ExtensionPython::I
// explicit template instantiation // explicit template instantiation
template class AppExport ExtensionPythonT<Extension>; template class AppExport ExtensionPythonT<Extension>;
} }

View File

@ -9,7 +9,7 @@
Namespace="App" Namespace="App"
FatherInclude="App/PropertyContainerPy.h" FatherInclude="App/PropertyContainerPy.h"
FatherNamespace="App" FatherNamespace="App"
Initialisation="true" Initialization="true"
Constructor = "true"> Constructor = "true">
<Documentation> <Documentation>
<Author Licence="LGPL" Name="Stefan Troeger" EMail="stefantroeger@gmx.net" /> <Author Licence="LGPL" Name="Stefan Troeger" EMail="stefantroeger@gmx.net" />

View File

@ -31,8 +31,8 @@
#include "DocumentObject.h" #include "DocumentObject.h"
// inclution of the generated files (generated out of PropertyContainerPy.xml) // inclution of the generated files (generated out of PropertyContainerPy.xml)
#include "ExtensionContainerPy.h" #include <App/ExtensionContainerPy.h>
#include "ExtensionContainerPy.cpp" #include <App/ExtensionContainerPy.cpp>
using namespace App; using namespace App;
@ -42,16 +42,16 @@ std::string ExtensionContainerPy::representation(void) const
return std::string("<extension>"); return std::string("<extension>");
} }
int ExtensionContainerPy::initialisation() { int ExtensionContainerPy::initialization() {
if (this->ob_type->tp_dict == NULL) { if (this->ob_type->tp_dict == NULL) {
if (PyType_Ready(this->ob_type) < 0) if (PyType_Ready(this->ob_type) < 0)
return 0; return 0;
} }
ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin(); ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin();
for(; it != this->getExtensionContainerPtr()->extensionEnd(); ++it) { for(; it != this->getExtensionContainerPtr()->extensionEnd(); ++it) {
PyObject* obj = (*it).second->getExtensionPyObject(); PyObject* obj = (*it).second->getExtensionPyObject();
PyMethodDef* tmpptr = (PyMethodDef*)obj->ob_type->tp_methods; PyMethodDef* tmpptr = (PyMethodDef*)obj->ob_type->tp_methods;
while(tmpptr->ml_name) { while(tmpptr->ml_name) {
@ -66,10 +66,10 @@ int ExtensionContainerPy::initialisation() {
++tmpptr; ++tmpptr;
} }
} }
return 1; return 1;
} }
int ExtensionContainerPy::deinitialisation() { int ExtensionContainerPy::finalization() {
/* /*
//we need to delete all added python extensions, as we are the owner! //we need to delete all added python extensions, as we are the owner!
ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin(); ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin();
@ -78,7 +78,7 @@ int ExtensionContainerPy::deinitialisation() {
delete (*it).second; delete (*it).second;
}*/ }*/
return 1; return 1;
}; }
PyObject* ExtensionContainerPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper PyObject* ExtensionContainerPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{ {
@ -92,18 +92,18 @@ int ExtensionContainerPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
return 0; return 0;
} }
PyObject *ExtensionContainerPy::getCustomAttributes(const char* attr) const PyObject *ExtensionContainerPy::getCustomAttributes(const char* /*attr*/) const
{ {
return 0; return 0;
} }
int ExtensionContainerPy::setCustomAttributes(const char* attr, PyObject *obj) int ExtensionContainerPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
{ {
return 0; return 0;
} }
PyObject* ExtensionContainerPy::hasExtension(PyObject *args) { PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
char *type; char *type;
if (!PyArg_ParseTuple(args, "s", &type)) if (!PyArg_ParseTuple(args, "s", &type))
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
@ -115,7 +115,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
str << "No extension found of type '" << type << "'" << std::ends; str << "No extension found of type '" << type << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
} }
if(getExtensionContainerPtr()->hasExtension(extension)) { if(getExtensionContainerPtr()->hasExtension(extension)) {
Py_INCREF(Py_True); Py_INCREF(Py_True);
return Py_True; return Py_True;
@ -125,7 +125,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
} }
PyObject* ExtensionContainerPy::addExtension(PyObject *args) { PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
char *type; char *type;
PyObject* proxy; PyObject* proxy;
if (!PyArg_ParseTuple(args, "sO", &type, &proxy)) if (!PyArg_ParseTuple(args, "sO", &type, &proxy))
@ -138,7 +138,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
str << "No extension found of type '" << type << "'" << std::ends; str << "No extension found of type '" << type << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
} }
//register the extension //register the extension
App::Extension* ext = static_cast<App::Extension*>(extension.createInstance()); App::Extension* ext = static_cast<App::Extension*>(extension.createInstance());
//check if this really is a python extension! //check if this really is a python extension!
@ -147,10 +147,10 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
std::stringstream str; std::stringstream str;
str << "Extension is not a python addable version: '" << type << "'" << std::ends; str << "Extension is not a python addable version: '" << type << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
} }
ext->initExtension(getExtensionContainerPtr()); ext->initExtension(getExtensionContainerPtr());
//set the proxy to allow python overrides //set the proxy to allow python overrides
App::Property* pp = ext->extensionGetPropertyByName("ExtensionProxy"); App::Property* pp = ext->extensionGetPropertyByName("ExtensionProxy");
if(!pp) { if(!pp) {
@ -159,7 +159,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
} }
static_cast<PropertyPythonObject*>(pp)->setPyObject(proxy); static_cast<PropertyPythonObject*>(pp)->setPyObject(proxy);
//make sure all functions of the extension are acessible through this object //make sure all functions of the extension are acessible through this object
PyMethodDef* tmpptr = (PyMethodDef*)ext->getExtensionPyObject()->ob_type->tp_methods; PyMethodDef* tmpptr = (PyMethodDef*)ext->getExtensionPyObject()->ob_type->tp_methods;
while(tmpptr->ml_name) { while(tmpptr->ml_name) {
@ -167,12 +167,12 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
// self is added to the functions arguments list. FreeCAD py implementations are not // self is added to the functions arguments list. FreeCAD py implementations are not
// made to handle this, the do not accept self as argument. Hence we only use function // made to handle this, the do not accept self as argument. Hence we only use function
PyObject *func = PyCFunction_New(tmpptr, ext->getExtensionPyObject()); PyObject *func = PyCFunction_New(tmpptr, ext->getExtensionPyObject());
//PyObject *method = PyMethod_New(func, (PyObject*)this, PyObject_Type((PyObject*)this)); //PyObject *method = PyMethod_New(func, (PyObject*)this, PyObject_Type((PyObject*)this));
PyDict_SetItem(this->ob_type->tp_dict, PyString_FromString(tmpptr->ml_name), func); PyDict_SetItem(this->ob_type->tp_dict, PyString_FromString(tmpptr->ml_name), func);
Py_DECREF(func); Py_DECREF(func);
//Py_DECREF(method); //Py_DECREF(method);
++tmpptr; ++tmpptr;
} }
Py_Return; Py_Return;
} }

View File

@ -30,8 +30,8 @@
#include "Application.h" #include "Application.h"
// inclution of the generated files (generated out of PropertyContainerPy.xml) // inclution of the generated files (generated out of PropertyContainerPy.xml)
#include "ExtensionPy.h" #include <App/ExtensionPy.h>
#include "ExtensionPy.cpp" #include <App/ExtensionPy.cpp>
using namespace App; using namespace App;
@ -41,12 +41,12 @@ std::string ExtensionPy::representation(void) const
return std::string("<extension>"); return std::string("<extension>");
} }
PyObject *ExtensionPy::getCustomAttributes(const char* attr) const PyObject *ExtensionPy::getCustomAttributes(const char* /*attr*/) const
{ {
return 0; return 0;
} }
int ExtensionPy::setCustomAttributes(const char* attr, PyObject *obj) int ExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
{ {
return 0; return 0;
} }

View File

@ -152,4 +152,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::GeoFeatureGroupExtensionPython, App::Geo
// explicit template instantiation // explicit template instantiation
template class AppExport ExtensionPythonT<GroupExtensionPythonT<GeoFeatureGroupExtension>>; template class AppExport ExtensionPythonT<GroupExtensionPythonT<GeoFeatureGroupExtension>>;
} }

View File

@ -137,4 +137,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::OriginGroupExtensionPython, App::OriginG
// explicit template instantiation // explicit template instantiation
template class AppExport ExtensionPythonT<GroupExtensionPythonT<OriginGroupExtension>>; template class AppExport ExtensionPythonT<GroupExtensionPythonT<OriginGroupExtension>>;
} }

View File

@ -35,7 +35,6 @@
#pragma warning( disable : 4275 ) #pragma warning( disable : 4275 )
#pragma warning( disable : 4503 ) #pragma warning( disable : 4503 )
#pragma warning( disable : 4786 ) // specifier longer then 255 chars #pragma warning( disable : 4786 ) // specifier longer then 255 chars
#pragma warning( disable : 4250 ) // virtual inheritance warning
#endif #endif
// standard // standard

View File

@ -310,7 +310,7 @@ public:
//restoring the object from document: this may itnerest extensions, hence call them //restoring the object from document: this may itnerest extensions, hence call them
virtual void Restore(Base::XMLReader& reader); virtual void Restore(Base::XMLReader& reader);
bool isRestoring() {return testStatus(Gui::isRestoring);}; bool isRestoring() {return testStatus(Gui::isRestoring);}
/** @name Display mask modes /** @name Display mask modes

View File

@ -161,7 +161,7 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
{ {
// save Object pointer // save Object pointer
pcObject = pcObj; pcObject = pcObj;
// Retrieve the supported display modes of the view provider // Retrieve the supported display modes of the view provider
aDisplayModesArray = this->getDisplayModes(); aDisplayModesArray = this->getDisplayModes();

View File

@ -66,4 +66,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderExtensionPython, Gui::ViewPr
// explicit template instantiation // explicit template instantiation
template class GuiExport ViewProviderExtensionPythonT<ViewProviderExtension>; template class GuiExport ViewProviderExtensionPythonT<ViewProviderExtension>;
} }

View File

@ -65,16 +65,16 @@ public:
virtual void extensionDropObject(App::DocumentObject*) { } virtual void extensionDropObject(App::DocumentObject*) { }
/// Hides the view provider /// Hides the view provider
virtual void extensionHide(void) { }; virtual void extensionHide(void) { }
/// Shows the view provider /// Shows the view provider
virtual void extensionShow(void) { }; virtual void extensionShow(void) { }
virtual SoSeparator* extensionGetFrontRoot(void) const {return nullptr;} virtual SoSeparator* extensionGetFrontRoot(void) const {return nullptr;}
virtual SoGroup* extensionGetChildRoot(void) const {return nullptr;} virtual SoGroup* extensionGetChildRoot(void) const {return nullptr;}
virtual SoSeparator* extensionGetBackRoot(void) const {return nullptr;} virtual SoSeparator* extensionGetBackRoot(void) const {return nullptr;}
virtual void extensionAttach(App::DocumentObject* pcObject) { }; virtual void extensionAttach(App::DocumentObject* pcObject) { }
virtual void extensionSetDisplayMode(const char* ModeName) { }; virtual void extensionSetDisplayMode(const char* ModeName) { }
virtual std::vector<std::string> extensionGetDisplayModes(void) const {return std::vector<std::string>();}; virtual std::vector<std::string> extensionGetDisplayModes(void) const {return std::vector<std::string>();}
//update data of extended opject //update data of extended opject
virtual void extensionUpdateData(const App::Property*); virtual void extensionUpdateData(const App::Property*);

View File

@ -97,4 +97,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderGeoFeatureGroupExtensionPyth
// explicit template instantiation // explicit template instantiation
template class GuiExport ViewProviderExtensionPythonT<ViewProviderGeoFeatureGroupExtension>; template class GuiExport ViewProviderExtensionPythonT<ViewProviderGeoFeatureGroupExtension>;
} }

View File

@ -63,7 +63,7 @@ bool ViewProviderGroupExtension::extensionCanDragObject(App::DocumentObject*) co
} }
void ViewProviderGroupExtension::extensionDragObject(App::DocumentObject* obj) { void ViewProviderGroupExtension::extensionDragObject(App::DocumentObject* obj) {
Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument(\"%s\").getObject(\"%s\").removeObject(" Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument(\"%s\").getObject(\"%s\").removeObject("
"App.getDocument(\"%s\").getObject(\"%s\"))", "App.getDocument(\"%s\").getObject(\"%s\"))",
getExtendedViewProvider()->getObject()->getDocument()->getName(), getExtendedViewProvider()->getObject()->getNameInDocument(), getExtendedViewProvider()->getObject()->getDocument()->getName(), getExtendedViewProvider()->getObject()->getNameInDocument(),
@ -75,28 +75,27 @@ bool ViewProviderGroupExtension::extensionCanDropObjects() const {
} }
bool ViewProviderGroupExtension::extensionCanDropObject(App::DocumentObject* obj) const { bool ViewProviderGroupExtension::extensionCanDropObject(App::DocumentObject* obj) const {
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>(); auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
//we cannot drop thing of this group into it again //we cannot drop thing of this group into it again
if (group->hasObject(obj)) if (group->hasObject(obj))
return false; return false;
//group into group? //group into group?
if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId())) if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId()))
if (group->isChildOf(obj->getExtensionByType<App::GroupExtension>())) if (group->isChildOf(obj->getExtensionByType<App::GroupExtension>()))
return false; return false;
//We need to find the correct App extension to ask if this is a supported type, there should only be one //We need to find the correct App extension to ask if this is a supported type, there should only be one
if(group->allowObject(obj)) if(group->allowObject(obj))
return true; return true;
return false; return false;
} }
void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) { void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) {
// Open command // Open command
App::DocumentObject* grp = static_cast<App::DocumentObject*>(getExtendedViewProvider()->getObject()); App::DocumentObject* grp = static_cast<App::DocumentObject*>(getExtendedViewProvider()->getObject());
App::Document* doc = grp->getDocument(); App::Document* doc = grp->getDocument();
@ -122,27 +121,26 @@ void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) {
.arg(QString::fromLatin1(doc->getName())) .arg(QString::fromLatin1(doc->getName()))
.arg(QString::fromLatin1(grp->getNameInDocument())) .arg(QString::fromLatin1(grp->getNameInDocument()))
.arg(QString::fromLatin1(obj->getNameInDocument())); .arg(QString::fromLatin1(obj->getNameInDocument()));
Gui::Command::doCommand(Gui::Command::App, cmd.toUtf8()); Gui::Command::doCommand(Gui::Command::App, cmd.toUtf8());
gui->commitCommand(); gui->commitCommand();
} }
std::vector< App::DocumentObject* > ViewProviderGroupExtension::extensionClaimChildren(void) const { std::vector< App::DocumentObject* > ViewProviderGroupExtension::extensionClaimChildren(void) const {
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>(); auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
return std::vector<App::DocumentObject*>(group->Group.getValues()); return std::vector<App::DocumentObject*>(group->Group.getValues());
} }
void ViewProviderGroupExtension::extensionShow(void) { void ViewProviderGroupExtension::extensionShow(void) {
// when reading the Visibility property from file then do not hide the // when reading the Visibility property from file then do not hide the
// objects of this group because they have stored their visibility status, too // objects of this group because they have stored their visibility status, too
if (!getExtendedViewProvider()->isRestoring() && !this->visible) { if (!getExtendedViewProvider()->isRestoring() && !this->visible) {
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>(); auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
const std::vector<App::DocumentObject*> & links = group->Group.getValues(); const std::vector<App::DocumentObject*> & links = group->Group.getValues();
Gui::Document* doc = Application::Instance->getDocument(group->getExtendedObject()->getDocument()); Gui::Document* doc = Application::Instance->getDocument(group->getExtendedObject()->getDocument());
for (std::vector<App::DocumentObject*>::const_iterator it = links.begin(); it != links.end(); ++it) { for (std::vector<App::DocumentObject*>::const_iterator it = links.begin(); it != links.end(); ++it) {
@ -157,13 +155,13 @@ void ViewProviderGroupExtension::extensionShow(void) {
} }
void ViewProviderGroupExtension::extensionHide(void) { void ViewProviderGroupExtension::extensionHide(void) {
// when reading the Visibility property from file then do not hide the // when reading the Visibility property from file then do not hide the
// objects of this group because they have stored their visibility status, too // objects of this group because they have stored their visibility status, too
if (!getExtendedViewProvider()->isRestoring() && this->visible) { if (!getExtendedViewProvider()->isRestoring() && this->visible) {
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>(); auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
const std::vector<App::DocumentObject*> & links = group->Group.getValues(); const std::vector<App::DocumentObject*> & links = group->Group.getValues();
Gui::Document* doc = Application::Instance->getDocument(getExtendedViewProvider()->getObject()->getDocument()); Gui::Document* doc = Application::Instance->getDocument(getExtendedViewProvider()->getObject()->getDocument());
for (std::vector<App::DocumentObject*>::const_iterator it = links.begin(); it != links.end(); ++it) { for (std::vector<App::DocumentObject*>::const_iterator it = links.begin(); it != links.end(); ++it) {
@ -178,7 +176,7 @@ void ViewProviderGroupExtension::extensionHide(void) {
} }
bool ViewProviderGroupExtension::extensionOnDelete(const std::vector< std::string >& vec) { bool ViewProviderGroupExtension::extensionOnDelete(const std::vector< std::string >& vec) {
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>(); auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
// If the group is nonempty ask the user if he wants to delete it's content // If the group is nonempty ask the user if he wants to delete it's content
if ( group->Group.getSize () ) { if ( group->Group.getSize () ) {
@ -203,4 +201,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderGroupExtensionPython, Gui::V
// explicit template instantiation // explicit template instantiation
template class GuiExport ViewProviderExtensionPythonT<ViewProviderGroupExtension>; template class GuiExport ViewProviderExtensionPythonT<ViewProviderGroupExtension>;
} }

View File

@ -48,10 +48,10 @@ using namespace Gui;
PROPERTY_SOURCE_WITH_EXTENSIONS(Gui::ViewProviderOriginGroup, Gui::ViewProviderDocumentObject) PROPERTY_SOURCE_WITH_EXTENSIONS(Gui::ViewProviderOriginGroup, Gui::ViewProviderDocumentObject)
ViewProviderOriginGroup::ViewProviderOriginGroup () ViewProviderOriginGroup::ViewProviderOriginGroup ()
{ {
initExtension(this); initExtension(this);
} }
ViewProviderOriginGroup::~ViewProviderOriginGroup () ViewProviderOriginGroup::~ViewProviderOriginGroup ()
{ {
} }

View File

@ -202,4 +202,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderOriginGroupExtensionPython,
// explicit template instantiation // explicit template instantiation
template class GuiExport ViewProviderExtensionPythonT<ViewProviderOriginGroupExtension>; template class GuiExport ViewProviderExtensionPythonT<ViewProviderOriginGroupExtension>;
} }

View File

@ -79,7 +79,7 @@ namespace Gui { namespace PropertyEditor {
} }
} }
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyItem, Base::BaseClass); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyItem, Base::BaseClass)
PropertyItem::PropertyItem() : parentItem(0), readonly(false), cleared(false) PropertyItem::PropertyItem() : parentItem(0), readonly(false), cleared(false)
{ {
@ -475,7 +475,7 @@ void PropertyItem::bind(const App::Property& prop) {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyStringItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyStringItem, Gui::PropertyEditor::PropertyItem)
PropertyStringItem::PropertyStringItem() PropertyStringItem::PropertyStringItem()
{ {
@ -521,7 +521,7 @@ QVariant PropertyStringItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFontItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFontItem, Gui::PropertyEditor::PropertyItem)
PropertyFontItem::PropertyFontItem() PropertyFontItem::PropertyFontItem()
{ {
@ -571,7 +571,7 @@ QVariant PropertyFontItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertySeparatorItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertySeparatorItem, Gui::PropertyEditor::PropertyItem)
QWidget* PropertySeparatorItem::createEditor(QWidget* parent, const QObject* receiver, const char* method) const QWidget* PropertySeparatorItem::createEditor(QWidget* parent, const QObject* receiver, const char* method) const
{ {
@ -583,7 +583,7 @@ QWidget* PropertySeparatorItem::createEditor(QWidget* parent, const QObject* rec
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerItem, Gui::PropertyEditor::PropertyItem)
PropertyIntegerItem::PropertyIntegerItem() PropertyIntegerItem::PropertyIntegerItem()
{ {
@ -650,7 +650,7 @@ QVariant PropertyIntegerItem::toString(const QVariant& v) const {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerConstraintItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerConstraintItem, Gui::PropertyEditor::PropertyItem)
PropertyIntegerConstraintItem::PropertyIntegerConstraintItem() PropertyIntegerConstraintItem::PropertyIntegerConstraintItem()
{ {
@ -733,7 +733,7 @@ QVariant PropertyIntegerConstraintItem::toString(const QVariant& v) const {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatItem, Gui::PropertyEditor::PropertyItem)
PropertyFloatItem::PropertyFloatItem() PropertyFloatItem::PropertyFloatItem()
{ {
@ -802,7 +802,7 @@ QVariant PropertyFloatItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyUnitItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyUnitItem, Gui::PropertyEditor::PropertyItem)
PropertyUnitItem::PropertyUnitItem() PropertyUnitItem::PropertyUnitItem()
{ {
@ -876,7 +876,7 @@ QVariant PropertyUnitItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyUnitConstraintItem, Gui::PropertyEditor::PropertyUnitItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyUnitConstraintItem, Gui::PropertyEditor::PropertyUnitItem)
PropertyUnitConstraintItem::PropertyUnitConstraintItem() PropertyUnitConstraintItem::PropertyUnitConstraintItem()
{ {
@ -912,7 +912,7 @@ void PropertyUnitConstraintItem::setEditorData(QWidget *editor, const QVariant&
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatConstraintItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatConstraintItem, Gui::PropertyEditor::PropertyItem)
PropertyFloatConstraintItem::PropertyFloatConstraintItem() PropertyFloatConstraintItem::PropertyFloatConstraintItem()
{ {
@ -994,7 +994,7 @@ QVariant PropertyFloatConstraintItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyAngleItem, Gui::PropertyEditor::PropertyFloatItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyAngleItem, Gui::PropertyEditor::PropertyFloatItem)
PropertyAngleItem::PropertyAngleItem() PropertyAngleItem::PropertyAngleItem()
{ {
@ -1036,7 +1036,7 @@ QVariant PropertyAngleItem::toString(const QVariant& prop) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyBoolItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyBoolItem, Gui::PropertyEditor::PropertyItem)
PropertyBoolItem::PropertyBoolItem() PropertyBoolItem::PropertyBoolItem()
{ {
@ -1084,7 +1084,7 @@ QVariant PropertyBoolItem::editorData(QWidget *editor) const
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyVectorItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyVectorItem, Gui::PropertyEditor::PropertyItem)
PropertyVectorItem::PropertyVectorItem() PropertyVectorItem::PropertyVectorItem()
{ {
@ -1197,7 +1197,7 @@ void PropertyVectorItem::propertyBound() {
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyVectorDistanceItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyVectorDistanceItem, Gui::PropertyEditor::PropertyItem)
PropertyVectorDistanceItem::PropertyVectorDistanceItem() PropertyVectorDistanceItem::PropertyVectorDistanceItem()
{ {
@ -1312,7 +1312,7 @@ void PropertyVectorDistanceItem::propertyBound() {
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMatrixItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMatrixItem, Gui::PropertyEditor::PropertyItem)
PropertyMatrixItem::PropertyMatrixItem() PropertyMatrixItem::PropertyMatrixItem()
{ {
@ -1733,7 +1733,7 @@ void PlacementEditor::updateValue(const QVariant& v, bool incr, bool data)
} }
} }
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyPlacementItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyPlacementItem, Gui::PropertyEditor::PropertyItem)
PropertyPlacementItem::PropertyPlacementItem() : init_axis(false), changed_value(false), rot_angle(0), rot_axis(0,0,1) PropertyPlacementItem::PropertyPlacementItem() : init_axis(false), changed_value(false), rot_angle(0), rot_axis(0,0,1)
{ {
@ -1952,7 +1952,7 @@ void PropertyPlacementItem::propertyBound() {
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyEnumItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyEnumItem, Gui::PropertyEditor::PropertyItem)
PropertyEnumItem::PropertyEnumItem() PropertyEnumItem::PropertyEnumItem()
{ {
@ -2037,7 +2037,7 @@ QVariant PropertyEnumItem::editorData(QWidget *editor) const
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyStringListItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyStringListItem, Gui::PropertyEditor::PropertyItem)
PropertyStringListItem::PropertyStringListItem() PropertyStringListItem::PropertyStringListItem()
{ {
@ -2109,7 +2109,7 @@ void PropertyStringListItem::setValue(const QVariant& value)
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatListItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFloatListItem, Gui::PropertyEditor::PropertyItem)
PropertyFloatListItem::PropertyFloatListItem() PropertyFloatListItem::PropertyFloatListItem()
{ {
@ -2183,7 +2183,7 @@ void PropertyFloatListItem::setValue(const QVariant& value)
// --------------------------------------------------------------- // ---------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerListItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyIntegerListItem, Gui::PropertyEditor::PropertyItem)
PropertyIntegerListItem::PropertyIntegerListItem() PropertyIntegerListItem::PropertyIntegerListItem()
{ {
@ -2258,7 +2258,7 @@ void PropertyIntegerListItem::setValue(const QVariant& value)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyColorItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyColorItem, Gui::PropertyEditor::PropertyItem)
PropertyColorItem::PropertyColorItem() PropertyColorItem::PropertyColorItem()
{ {
@ -2345,7 +2345,7 @@ namespace Gui { namespace PropertyEditor {
Q_DECLARE_METATYPE(Gui::PropertyEditor::Material) Q_DECLARE_METATYPE(Gui::PropertyEditor::Material)
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialItem, Gui::PropertyEditor::PropertyItem)
PropertyMaterialItem::PropertyMaterialItem() PropertyMaterialItem::PropertyMaterialItem()
{ {
@ -2657,7 +2657,7 @@ QVariant PropertyMaterialItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialListItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialListItem, Gui::PropertyEditor::PropertyItem)
PropertyMaterialListItem::PropertyMaterialListItem() PropertyMaterialListItem::PropertyMaterialListItem()
{ {
@ -3122,7 +3122,7 @@ QVariant PropertyMaterialListItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFileItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyFileItem, Gui::PropertyEditor::PropertyItem)
PropertyFileItem::PropertyFileItem() PropertyFileItem::PropertyFileItem()
{ {
@ -3173,7 +3173,7 @@ QVariant PropertyFileItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyPathItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyPathItem, Gui::PropertyEditor::PropertyItem)
PropertyPathItem::PropertyPathItem() PropertyPathItem::PropertyPathItem()
{ {
@ -3225,7 +3225,7 @@ QVariant PropertyPathItem::editorData(QWidget *editor) const
// -------------------------------------------------------------------- // --------------------------------------------------------------------
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyTransientFileItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyTransientFileItem, Gui::PropertyEditor::PropertyItem)
PropertyTransientFileItem::PropertyTransientFileItem() PropertyTransientFileItem::PropertyTransientFileItem()
{ {
@ -3346,7 +3346,7 @@ void LinkLabel::onLinkActivated (const QString& s)
} }
} }
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyLinkItem, Gui::PropertyEditor::PropertyItem); TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyLinkItem, Gui::PropertyEditor::PropertyItem)
PropertyLinkItem::PropertyLinkItem() PropertyLinkItem::PropertyLinkItem()
{ {
@ -3376,12 +3376,13 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const
// no object assigned // no object assigned
// the document name // the document name
if (c->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) { if (c->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_cast<App::DocumentObject*>(c); App::DocumentObject* obj = static_cast<App::DocumentObject*>(c);
list << QString::fromLatin1(obj->getDocument()->getName()); list << QString::fromLatin1(obj->getDocument()->getName());
} }
else else {
list << QString::fromLatin1(""); list << QString::fromLatin1("");
}
// the internal object name // the internal object name
list << QString::fromLatin1("Null"); list << QString::fromLatin1("Null");
// the object label // the object label
@ -3393,8 +3394,9 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const
App::DocumentObject* obj = static_cast<App::DocumentObject*>(c); App::DocumentObject* obj = static_cast<App::DocumentObject*>(c);
list << QString::fromLatin1(obj->getNameInDocument()); list << QString::fromLatin1(obj->getNameInDocument());
} }
else else {
list << QString::fromLatin1("Null"); list << QString::fromLatin1("Null");
}
return QVariant(list); return QVariant(list);
} }

View File

@ -51,4 +51,4 @@ PyObject* PartFeaturePy::test(PyObject *args)
{ {
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return 0; return 0;
} }

View File

@ -216,7 +216,7 @@ class GenerateModel:
class PythonExport: class PythonExport:
subclass = None subclass = None
def __init__(self, FatherNamespace='', RichCompare=0, Name='', Reference=0, FatherInclude='', Father='', Namespace='', Twin='', Constructor=0, TwinPointer='', Include='', NumberProtocol=0, Delete=0, Documentation=None, Methode=None, Attribute=None, Sequence=None, CustomAttributes='', ClassDeclarations='', Initialisation=0): def __init__(self, FatherNamespace='', RichCompare=0, Name='', Reference=0, FatherInclude='', Father='', Namespace='', Twin='', Constructor=0, TwinPointer='', Include='', NumberProtocol=0, Delete=0, Documentation=None, Methode=None, Attribute=None, Sequence=None, CustomAttributes='', ClassDeclarations='', Initialization=0):
self.FatherNamespace = FatherNamespace self.FatherNamespace = FatherNamespace
self.RichCompare = RichCompare self.RichCompare = RichCompare
self.Name = Name self.Name = Name
@ -231,7 +231,7 @@ class PythonExport:
self.NumberProtocol = NumberProtocol self.NumberProtocol = NumberProtocol
self.Delete = Delete self.Delete = Delete
self.Documentation = Documentation self.Documentation = Documentation
self.Initialisation = Initialisation self.Initialization = Initialization
if Methode is None: if Methode is None:
self.Methode = [] self.Methode = []
else: else:
@ -249,8 +249,8 @@ class PythonExport:
else: else:
return PythonExport(*args_, **kwargs_) return PythonExport(*args_, **kwargs_)
factory = staticmethod(factory) factory = staticmethod(factory)
def getInitialisation(self): return self.Initialisation def getInitialization(self): return self.Initialization
def setInitialisation(self, Initialisation): self.Initialisation = Initialisation def setInitialization(self, Initialization): self.Initialization = Initialization
def getDocumentation(self): return self.Documentation def getDocumentation(self): return self.Documentation
def setDocumentation(self, Documentation): self.Documentation = Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation
def getMethode(self): return self.Methode def getMethode(self): return self.Methode
@ -314,8 +314,8 @@ class PythonExport:
outfile.write(' Twin="%s"' % (self.getTwin(), )) outfile.write(' Twin="%s"' % (self.getTwin(), ))
if self.getConstructor() is not None: if self.getConstructor() is not None:
outfile.write(' Constructor="%s"' % (self.getConstructor(), )) outfile.write(' Constructor="%s"' % (self.getConstructor(), ))
if self.getInitialisation() is not None: if self.getInitialization() is not None:
outfile.write(' Initialisation="%s"' % (self.getInitialisation(), )) outfile.write(' Initialization="%s"' % (self.getInitialization(), ))
outfile.write(' TwinPointer="%s"' % (self.getTwinpointer(), )) outfile.write(' TwinPointer="%s"' % (self.getTwinpointer(), ))
outfile.write(' Include="%s"' % (self.getInclude(), )) outfile.write(' Include="%s"' % (self.getInclude(), ))
if self.getNumberprotocol() is not None: if self.getNumberprotocol() is not None:
@ -359,7 +359,7 @@ class PythonExport:
showIndent(outfile, level) showIndent(outfile, level)
outfile.write('Constructor = "%s",\n' % (self.getConstructor(),)) outfile.write('Constructor = "%s",\n' % (self.getConstructor(),))
showIndent(outfile, level) showIndent(outfile, level)
outfile.write('Initialisation = "%s",\n' % (self.getInitialisation(),)) outfile.write('Initialization = "%s",\n' % (self.getInitialization(),))
outfile.write('TwinPointer = "%s",\n' % (self.getTwinpointer(),)) outfile.write('TwinPointer = "%s",\n' % (self.getTwinpointer(),))
showIndent(outfile, level) showIndent(outfile, level)
outfile.write('Include = "%s",\n' % (self.getInclude(),)) outfile.write('Include = "%s",\n' % (self.getInclude(),))
@ -448,13 +448,13 @@ class PythonExport:
self.Constructor = 0 self.Constructor = 0
else: else:
raise ValueError('Bad boolean attribute (Constructor)') raise ValueError('Bad boolean attribute (Constructor)')
if attrs.get('Initialisation'): if attrs.get('Initialization'):
if attrs.get('Initialisation').value in ('true', '1'): if attrs.get('Initialization').value in ('true', '1'):
self.Initialisation = 1 self.Initialization = 1
elif attrs.get('Initialisation').value in ('false', '0'): elif attrs.get('Initialization').value in ('false', '0'):
self.Initialisation = 0 self.Initialization = 0
else: else:
raise ValueError('Bad boolean attribute (Initialisation)') raise ValueError('Bad boolean attribute (Initialization)')
if attrs.get('TwinPointer'): if attrs.get('TwinPointer'):
self.TwinPointer = attrs.get('TwinPointer').value self.TwinPointer = attrs.get('TwinPointer').value
if attrs.get('Include'): if attrs.get('Include'):
@ -507,7 +507,7 @@ class PythonExport:
ClassDeclarations_ += text__content_.nodeValue ClassDeclarations_ += text__content_.nodeValue
self.ClassDeclarations = ClassDeclarations_ self.ClassDeclarations = ClassDeclarations_
elif child_.nodeType == Node.ELEMENT_NODE and \ elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'Initialisation': nodeName_ == 'Initialization':
obj_ = Documentation.factory() obj_ = Documentation.factory()
obj_.build(child_) obj_.build(child_)
self.setDocumentation(obj_) self.setDocumentation(obj_)
@ -1845,14 +1845,14 @@ class SaxGeneratemodelHandler(handler.ContentHandler):
obj.setConstructor(0) obj.setConstructor(0)
else: else:
self.reportError('"Constructor" attribute must be boolean ("true", "1", "false", "0")') self.reportError('"Constructor" attribute must be boolean ("true", "1", "false", "0")')
val = attrs.get('Initialisation', None) val = attrs.get('Initialization', None)
if val is not None: if val is not None:
if val in ('true', '1'): if val in ('true', '1'):
obj.setInitialisation(1) obj.setInitialization(1)
elif val in ('false', '0'): elif val in ('false', '0'):
obj.setInitialisation(0) obj.setInitialization(0)
else: else:
self.reportError('"Initialisation" attribute must be boolean ("true", "1", "false", "0")') self.reportError('"Initialization" attribute must be boolean ("true", "1", "false", "0")')
val = attrs.get('TwinPointer', None) val = attrs.get('TwinPointer', None)
if val is not None: if val is not None:
obj.setTwinpointer(val) obj.setTwinpointer(val)

View File

@ -60,7 +60,7 @@ public:
static PyObject * richCompare(PyObject *v, PyObject *w, int op); static PyObject * richCompare(PyObject *v, PyObject *w, int op);
- -
static PyGetSetDef GetterSetter[]; static PyGetSetDef GetterSetter[];
virtual PyTypeObject *GetType(void) {return &Type;}; virtual PyTypeObject *GetType(void) {return &Type;}
public: public:
@self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type); @self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type);
@ -68,9 +68,9 @@ public:
virtual int PyInit(PyObject* args, PyObject*k); virtual int PyInit(PyObject* args, PyObject*k);
~@self.export.Name@(); ~@self.export.Name@();
+ if (self.export.Initialisation): + if (self.export.Initialization):
int initialisation(); int initialization();
int deinitialisation(); int finalization();
- -
typedef @self.export.TwinPointer@* PointerType ; typedef @self.export.TwinPointer@* PointerType ;
@ -612,8 +612,8 @@ int @self.export.Name@::staticCallback_set@i.Name@ (PyObject *self, PyObject *va
pcObject->ref(); pcObject->ref();
- -
+ if (self.export.Initialisation): + if (self.export.Initialization):
initialisation(); initialization();
- -
} }
@ -645,8 +645,8 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
@self.export.Name@::PointerType ptr = static_cast<@self.export.Name@::PointerType>(_pcTwinPointer); @self.export.Name@::PointerType ptr = static_cast<@self.export.Name@::PointerType>(_pcTwinPointer);
delete ptr; delete ptr;
- -
+ if (self.export.Initialisation): + if (self.export.Initialization):
deinitialisation(); finalization();
- -
} }
@ -820,12 +820,12 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
} }
- -
+ if (self.export.Initialisation): + if (self.export.Initialization):
int @self.export.Name@::initialisation() int @self.export.Name@::initialization()
{ {
return 0; return 0;
} }
int @self.export.Name@::deinitialisation() int @self.export.Name@::finalization()
{ {
return 0; return 0;
} }