diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 0c7b6432a..a0e7099c9 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1136,15 +1136,15 @@ void Application::initTypes(void) App ::PropertyExpressionEngine ::init(); // Extension classes - App ::Extension ::init(); - App ::ExtensionContainer ::init(); - App ::DocumentObjectExtension ::init(); - App ::GroupExtension ::init(); - App ::GroupExtensionPython ::init(); - App ::GeoFeatureGroupExtension ::init(); + App ::Extension ::init(); + App ::ExtensionContainer ::init(); + App ::DocumentObjectExtension ::init(); + App ::GroupExtension ::init(); + App ::GroupExtensionPython ::init(); + App ::GeoFeatureGroupExtension ::init(); App ::GeoFeatureGroupExtensionPython::init(); - App ::OriginGroupExtension ::init(); - App ::OriginGroupExtensionPython::init(); + App ::OriginGroupExtension ::init(); + App ::OriginGroupExtensionPython ::init(); // Document classes App ::TransactionalObject ::init(); diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 7a0a70562..6e1417be5 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -95,10 +95,10 @@ DocumentObjectExecReturn *DocumentObject::execute(void) { //call all extensions auto vector = getExtensionsDerivedFromType(); - for(auto ext : vector) + for(auto ext : vector) { if(ext->extensionMustExecute()) ext->extensionExecute(); - + } return StdReturn; } @@ -106,13 +106,13 @@ short DocumentObject::mustExecute(void) const { if(isTouched()) return 1; - + //ask all extensions auto vector = getExtensionsDerivedFromType(); - for(auto ext : vector) + for(auto ext : vector) { if(ext->extensionMustExecute()) return 1; - + } return 0; } @@ -388,24 +388,24 @@ void DocumentObject::connectRelabelSignals() } } -void DocumentObject::onSettingDocument() { - +void DocumentObject::onSettingDocument() +{ //call all extensions auto vector = getExtensionsDerivedFromType(); for(auto ext : vector) ext->onExtendedSettingDocument(); } -void DocumentObject::setupObject() { - +void DocumentObject::setupObject() +{ //call all extensions auto vector = getExtensionsDerivedFromType(); for(auto ext : vector) ext->onExtendedSetupObject(); } -void DocumentObject::unsetupObject() { - +void DocumentObject::unsetupObject() +{ //call all extensions auto vector = getExtensionsDerivedFromType(); for(auto ext : vector) diff --git a/src/App/DocumentObjectExtension.h b/src/App/DocumentObjectExtension.h index 7cba330a0..df6e464ab 100644 --- a/src/App/DocumentObjectExtension.h +++ b/src/App/DocumentObjectExtension.h @@ -64,7 +64,7 @@ public: /// returns the type name of the ViewProviderExtension which is automatically attached /// to the viewprovider object when it is initiated - virtual const char* getViewProviderExtensionName(void) const {return "";}; + virtual const char* getViewProviderExtensionName(void) const {return "";} }; } //App diff --git a/src/App/DocumentObjectExtensionPyImp.cpp b/src/App/DocumentObjectExtensionPyImp.cpp index ddf255afc..371b6f793 100644 --- a/src/App/DocumentObjectExtensionPyImp.cpp +++ b/src/App/DocumentObjectExtensionPyImp.cpp @@ -39,12 +39,12 @@ std::string DocumentObjectExtensionPy::representation(void) const return std::string(""); } -PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* attr) const +PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* /*attr*/) const { return 0; } -int DocumentObjectExtensionPy::setCustomAttributes(const char* attr, PyObject *obj) +int DocumentObjectExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/) { return 0; } diff --git a/src/App/DocumentObjectGroup.h b/src/App/DocumentObjectGroup.h index c771ec939..3e1cef8b0 100644 --- a/src/App/DocumentObjectGroup.h +++ b/src/App/DocumentObjectGroup.h @@ -46,7 +46,7 @@ public: /// returns the type name of the ViewProvider virtual const char* getViewProviderName(void) const { return "Gui::ViewProviderDocumentObjectGroup"; - }; + } virtual PyObject *getPyObject(void); }; diff --git a/src/App/Extension.cpp b/src/App/Extension.cpp index 0cf176d62..a78859d4c 100644 --- a/src/App/Extension.cpp +++ b/src/App/Extension.cpp @@ -186,4 +186,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::ExtensionPython, App::ExtensionPython::I // explicit template instantiation template class AppExport ExtensionPythonT; -} \ No newline at end of file +} diff --git a/src/App/ExtensionContainerPy.xml b/src/App/ExtensionContainerPy.xml index caf5abaab..404a93106 100644 --- a/src/App/ExtensionContainerPy.xml +++ b/src/App/ExtensionContainerPy.xml @@ -9,7 +9,7 @@ Namespace="App" FatherInclude="App/PropertyContainerPy.h" FatherNamespace="App" - Initialisation="true" + Initialization="true" Constructor = "true"> diff --git a/src/App/ExtensionContainerPyImp.cpp b/src/App/ExtensionContainerPyImp.cpp index 627a70113..570f3740f 100644 --- a/src/App/ExtensionContainerPyImp.cpp +++ b/src/App/ExtensionContainerPyImp.cpp @@ -31,8 +31,8 @@ #include "DocumentObject.h" // inclution of the generated files (generated out of PropertyContainerPy.xml) -#include "ExtensionContainerPy.h" -#include "ExtensionContainerPy.cpp" +#include +#include using namespace App; @@ -42,16 +42,16 @@ std::string ExtensionContainerPy::representation(void) const return std::string(""); } -int ExtensionContainerPy::initialisation() { - +int ExtensionContainerPy::initialization() { + if (this->ob_type->tp_dict == NULL) { if (PyType_Ready(this->ob_type) < 0) return 0; } - + ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin(); for(; it != this->getExtensionContainerPtr()->extensionEnd(); ++it) { - + PyObject* obj = (*it).second->getExtensionPyObject(); PyMethodDef* tmpptr = (PyMethodDef*)obj->ob_type->tp_methods; while(tmpptr->ml_name) { @@ -66,10 +66,10 @@ int ExtensionContainerPy::initialisation() { ++tmpptr; } } - return 1; + return 1; } -int ExtensionContainerPy::deinitialisation() { +int ExtensionContainerPy::finalization() { /* //we need to delete all added python extensions, as we are the owner! ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin(); @@ -78,7 +78,7 @@ int ExtensionContainerPy::deinitialisation() { delete (*it).second; }*/ return 1; -}; +} PyObject* ExtensionContainerPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper { @@ -92,18 +92,18 @@ int ExtensionContainerPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) return 0; } -PyObject *ExtensionContainerPy::getCustomAttributes(const char* attr) const -{ +PyObject *ExtensionContainerPy::getCustomAttributes(const char* /*attr*/) const +{ return 0; } -int ExtensionContainerPy::setCustomAttributes(const char* attr, PyObject *obj) -{ +int ExtensionContainerPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/) +{ return 0; } PyObject* ExtensionContainerPy::hasExtension(PyObject *args) { - + char *type; if (!PyArg_ParseTuple(args, "s", &type)) return NULL; // NULL triggers exception @@ -115,7 +115,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) { str << "No extension found of type '" << type << "'" << std::ends; throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); } - + if(getExtensionContainerPtr()->hasExtension(extension)) { Py_INCREF(Py_True); return Py_True; @@ -125,7 +125,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) { } PyObject* ExtensionContainerPy::addExtension(PyObject *args) { - + char *type; PyObject* 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; throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); } - + //register the extension App::Extension* ext = static_cast(extension.createInstance()); //check if this really is a python extension! @@ -147,10 +147,10 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) { std::stringstream str; str << "Extension is not a python addable version: '" << type << "'" << std::ends; throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); - } - + } + ext->initExtension(getExtensionContainerPtr()); - + //set the proxy to allow python overrides App::Property* pp = ext->extensionGetPropertyByName("ExtensionProxy"); if(!pp) { @@ -159,7 +159,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) { throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); } static_cast(pp)->setPyObject(proxy); - + //make sure all functions of the extension are acessible through this object PyMethodDef* tmpptr = (PyMethodDef*)ext->getExtensionPyObject()->ob_type->tp_methods; 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 // made to handle this, the do not accept self as argument. Hence we only use function 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); Py_DECREF(func); //Py_DECREF(method); ++tmpptr; } - + Py_Return; } diff --git a/src/App/ExtensionPyImp.cpp b/src/App/ExtensionPyImp.cpp index 323a430c7..42f9ea5f5 100644 --- a/src/App/ExtensionPyImp.cpp +++ b/src/App/ExtensionPyImp.cpp @@ -30,8 +30,8 @@ #include "Application.h" // inclution of the generated files (generated out of PropertyContainerPy.xml) -#include "ExtensionPy.h" -#include "ExtensionPy.cpp" +#include +#include using namespace App; @@ -41,12 +41,12 @@ std::string ExtensionPy::representation(void) const return std::string(""); } -PyObject *ExtensionPy::getCustomAttributes(const char* attr) const +PyObject *ExtensionPy::getCustomAttributes(const char* /*attr*/) const { return 0; } -int ExtensionPy::setCustomAttributes(const char* attr, PyObject *obj) +int ExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/) { return 0; } diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index d37b80ca2..a76afbef8 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -152,4 +152,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::GeoFeatureGroupExtensionPython, App::Geo // explicit template instantiation template class AppExport ExtensionPythonT>; -} \ No newline at end of file +} diff --git a/src/App/OriginGroupExtension.cpp b/src/App/OriginGroupExtension.cpp index 82acaa8c5..2f0ac1468 100644 --- a/src/App/OriginGroupExtension.cpp +++ b/src/App/OriginGroupExtension.cpp @@ -137,4 +137,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::OriginGroupExtensionPython, App::OriginG // explicit template instantiation template class AppExport ExtensionPythonT>; -} \ No newline at end of file +} diff --git a/src/Gui/PreCompiled.h b/src/Gui/PreCompiled.h index 9bd09593e..775a0c426 100644 --- a/src/Gui/PreCompiled.h +++ b/src/Gui/PreCompiled.h @@ -35,7 +35,6 @@ #pragma warning( disable : 4275 ) #pragma warning( disable : 4503 ) #pragma warning( disable : 4786 ) // specifier longer then 255 chars -#pragma warning( disable : 4250 ) // virtual inheritance warning #endif // standard diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index 0f02ce1d6..a3da5ee44 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -310,7 +310,7 @@ public: //restoring the object from document: this may itnerest extensions, hence call them virtual void Restore(Base::XMLReader& reader); - bool isRestoring() {return testStatus(Gui::isRestoring);}; + bool isRestoring() {return testStatus(Gui::isRestoring);} /** @name Display mask modes diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index df1ac8971..d001f96ec 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -161,7 +161,7 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj) { // save Object pointer pcObject = pcObj; - + // Retrieve the supported display modes of the view provider aDisplayModesArray = this->getDisplayModes(); diff --git a/src/Gui/ViewProviderExtension.cpp b/src/Gui/ViewProviderExtension.cpp index 67b61af9a..0cbba6602 100644 --- a/src/Gui/ViewProviderExtension.cpp +++ b/src/Gui/ViewProviderExtension.cpp @@ -66,4 +66,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderExtensionPython, Gui::ViewPr // explicit template instantiation template class GuiExport ViewProviderExtensionPythonT; -} \ No newline at end of file +} diff --git a/src/Gui/ViewProviderExtension.h b/src/Gui/ViewProviderExtension.h index cc8218e23..d2531cec7 100644 --- a/src/Gui/ViewProviderExtension.h +++ b/src/Gui/ViewProviderExtension.h @@ -65,16 +65,16 @@ public: virtual void extensionDropObject(App::DocumentObject*) { } /// Hides the view provider - virtual void extensionHide(void) { }; + virtual void extensionHide(void) { } /// Shows the view provider - virtual void extensionShow(void) { }; + virtual void extensionShow(void) { } virtual SoSeparator* extensionGetFrontRoot(void) const {return nullptr;} virtual SoGroup* extensionGetChildRoot(void) const {return nullptr;} virtual SoSeparator* extensionGetBackRoot(void) const {return nullptr;} - virtual void extensionAttach(App::DocumentObject* pcObject) { }; - virtual void extensionSetDisplayMode(const char* ModeName) { }; - virtual std::vector extensionGetDisplayModes(void) const {return std::vector();}; + virtual void extensionAttach(App::DocumentObject* pcObject) { } + virtual void extensionSetDisplayMode(const char* ModeName) { } + virtual std::vector extensionGetDisplayModes(void) const {return std::vector();} //update data of extended opject virtual void extensionUpdateData(const App::Property*); diff --git a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp index 6f025e64b..e700b91dd 100644 --- a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp +++ b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp @@ -97,4 +97,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderGeoFeatureGroupExtensionPyth // explicit template instantiation template class GuiExport ViewProviderExtensionPythonT; -} \ No newline at end of file +} diff --git a/src/Gui/ViewProviderGroupExtension.cpp b/src/Gui/ViewProviderGroupExtension.cpp index a86b98a3c..09d1a6f69 100644 --- a/src/Gui/ViewProviderGroupExtension.cpp +++ b/src/Gui/ViewProviderGroupExtension.cpp @@ -63,7 +63,7 @@ bool ViewProviderGroupExtension::extensionCanDragObject(App::DocumentObject*) co } void ViewProviderGroupExtension::extensionDragObject(App::DocumentObject* obj) { - + Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument(\"%s\").getObject(\"%s\").removeObject(" "App.getDocument(\"%s\").getObject(\"%s\"))", getExtendedViewProvider()->getObject()->getDocument()->getName(), getExtendedViewProvider()->getObject()->getNameInDocument(), @@ -75,28 +75,27 @@ bool ViewProviderGroupExtension::extensionCanDropObjects() const { } bool ViewProviderGroupExtension::extensionCanDropObject(App::DocumentObject* obj) const { - + auto* group = getExtendedViewProvider()->getObject()->getExtensionByType(); - + //we cannot drop thing of this group into it again if (group->hasObject(obj)) return false; - + //group into group? if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId())) if (group->isChildOf(obj->getExtensionByType())) return false; - + //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)) return true; - + return false; - } void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) { - + // Open command App::DocumentObject* grp = static_cast(getExtendedViewProvider()->getObject()); App::Document* doc = grp->getDocument(); @@ -122,27 +121,26 @@ void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) { .arg(QString::fromLatin1(doc->getName())) .arg(QString::fromLatin1(grp->getNameInDocument())) .arg(QString::fromLatin1(obj->getNameInDocument())); - + Gui::Command::doCommand(Gui::Command::App, cmd.toUtf8()); - + gui->commitCommand(); } std::vector< App::DocumentObject* > ViewProviderGroupExtension::extensionClaimChildren(void) const { - + auto* group = getExtendedViewProvider()->getObject()->getExtensionByType(); return std::vector(group->Group.getValues()); } - void ViewProviderGroupExtension::extensionShow(void) { - + // when reading the Visibility property from file then do not hide the // objects of this group because they have stored their visibility status, too if (!getExtendedViewProvider()->isRestoring() && !this->visible) { auto* group = getExtendedViewProvider()->getObject()->getExtensionByType(); - + const std::vector & links = group->Group.getValues(); Gui::Document* doc = Application::Instance->getDocument(group->getExtendedObject()->getDocument()); for (std::vector::const_iterator it = links.begin(); it != links.end(); ++it) { @@ -157,13 +155,13 @@ void ViewProviderGroupExtension::extensionShow(void) { } void ViewProviderGroupExtension::extensionHide(void) { - + // when reading the Visibility property from file then do not hide the // objects of this group because they have stored their visibility status, too if (!getExtendedViewProvider()->isRestoring() && this->visible) { - + auto* group = getExtendedViewProvider()->getObject()->getExtensionByType(); - + const std::vector & links = group->Group.getValues(); Gui::Document* doc = Application::Instance->getDocument(getExtendedViewProvider()->getObject()->getDocument()); for (std::vector::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) { - + auto* group = getExtendedViewProvider()->getObject()->getExtensionByType(); // If the group is nonempty ask the user if he wants to delete it's content if ( group->Group.getSize () ) { @@ -203,4 +201,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderGroupExtensionPython, Gui::V // explicit template instantiation template class GuiExport ViewProviderExtensionPythonT; -} \ No newline at end of file +} diff --git a/src/Gui/ViewProviderOriginGroup.cpp b/src/Gui/ViewProviderOriginGroup.cpp index 6a423653c..264d54c0e 100644 --- a/src/Gui/ViewProviderOriginGroup.cpp +++ b/src/Gui/ViewProviderOriginGroup.cpp @@ -48,10 +48,10 @@ using namespace Gui; PROPERTY_SOURCE_WITH_EXTENSIONS(Gui::ViewProviderOriginGroup, Gui::ViewProviderDocumentObject) ViewProviderOriginGroup::ViewProviderOriginGroup () -{ +{ initExtension(this); } ViewProviderOriginGroup::~ViewProviderOriginGroup () -{ -} \ No newline at end of file +{ +} diff --git a/src/Gui/ViewProviderOriginGroupExtension.cpp b/src/Gui/ViewProviderOriginGroupExtension.cpp index a5cb7edad..c87341641 100644 --- a/src/Gui/ViewProviderOriginGroupExtension.cpp +++ b/src/Gui/ViewProviderOriginGroupExtension.cpp @@ -202,4 +202,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderOriginGroupExtensionPython, // explicit template instantiation template class GuiExport ViewProviderExtensionPythonT; -} \ No newline at end of file +} diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 4e6feba1d..309cf2542 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -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) { @@ -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() { @@ -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() { @@ -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 { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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) { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -2345,7 +2345,7 @@ namespace Gui { namespace PropertyEditor { Q_DECLARE_METATYPE(Gui::PropertyEditor::Material) -TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialItem, Gui::PropertyEditor::PropertyItem); +TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMaterialItem, Gui::PropertyEditor::PropertyItem) 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() { @@ -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() { @@ -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() { @@ -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() { @@ -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() { @@ -3376,12 +3376,13 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const // no object assigned // the document name if (c->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) { - App::DocumentObject* obj = static_cast(c); + App::DocumentObject* obj = static_cast(c); list << QString::fromLatin1(obj->getDocument()->getName()); } - else + else { list << QString::fromLatin1(""); - + } + // the internal object name list << QString::fromLatin1("Null"); // the object label @@ -3393,8 +3394,9 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const App::DocumentObject* obj = static_cast(c); list << QString::fromLatin1(obj->getNameInDocument()); } - else + else { list << QString::fromLatin1("Null"); + } return QVariant(list); } diff --git a/src/Mod/Part/App/PartFeaturePyImp.cpp b/src/Mod/Part/App/PartFeaturePyImp.cpp index 1a04c5d59..94a908f54 100644 --- a/src/Mod/Part/App/PartFeaturePyImp.cpp +++ b/src/Mod/Part/App/PartFeaturePyImp.cpp @@ -51,4 +51,4 @@ PyObject* PartFeaturePy::test(PyObject *args) { PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); return 0; -} \ No newline at end of file +} diff --git a/src/Tools/generateBase/generateModel_Module.py b/src/Tools/generateBase/generateModel_Module.py index c067a4ece..691776ef3 100644 --- a/src/Tools/generateBase/generateModel_Module.py +++ b/src/Tools/generateBase/generateModel_Module.py @@ -216,7 +216,7 @@ class GenerateModel: class PythonExport: 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.RichCompare = RichCompare self.Name = Name @@ -231,7 +231,7 @@ class PythonExport: self.NumberProtocol = NumberProtocol self.Delete = Delete self.Documentation = Documentation - self.Initialisation = Initialisation + self.Initialization = Initialization if Methode is None: self.Methode = [] else: @@ -249,8 +249,8 @@ class PythonExport: else: return PythonExport(*args_, **kwargs_) factory = staticmethod(factory) - def getInitialisation(self): return self.Initialisation - def setInitialisation(self, Initialisation): self.Initialisation = Initialisation + def getInitialization(self): return self.Initialization + def setInitialization(self, Initialization): self.Initialization = Initialization def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getMethode(self): return self.Methode @@ -314,8 +314,8 @@ class PythonExport: outfile.write(' Twin="%s"' % (self.getTwin(), )) if self.getConstructor() is not None: outfile.write(' Constructor="%s"' % (self.getConstructor(), )) - if self.getInitialisation() is not None: - outfile.write(' Initialisation="%s"' % (self.getInitialisation(), )) + if self.getInitialization() is not None: + outfile.write(' Initialization="%s"' % (self.getInitialization(), )) outfile.write(' TwinPointer="%s"' % (self.getTwinpointer(), )) outfile.write(' Include="%s"' % (self.getInclude(), )) if self.getNumberprotocol() is not None: @@ -359,7 +359,7 @@ class PythonExport: showIndent(outfile, level) outfile.write('Constructor = "%s",\n' % (self.getConstructor(),)) showIndent(outfile, level) - outfile.write('Initialisation = "%s",\n' % (self.getInitialisation(),)) + outfile.write('Initialization = "%s",\n' % (self.getInitialization(),)) outfile.write('TwinPointer = "%s",\n' % (self.getTwinpointer(),)) showIndent(outfile, level) outfile.write('Include = "%s",\n' % (self.getInclude(),)) @@ -448,13 +448,13 @@ class PythonExport: self.Constructor = 0 else: raise ValueError('Bad boolean attribute (Constructor)') - if attrs.get('Initialisation'): - if attrs.get('Initialisation').value in ('true', '1'): - self.Initialisation = 1 - elif attrs.get('Initialisation').value in ('false', '0'): - self.Initialisation = 0 + if attrs.get('Initialization'): + if attrs.get('Initialization').value in ('true', '1'): + self.Initialization = 1 + elif attrs.get('Initialization').value in ('false', '0'): + self.Initialization = 0 else: - raise ValueError('Bad boolean attribute (Initialisation)') + raise ValueError('Bad boolean attribute (Initialization)') if attrs.get('TwinPointer'): self.TwinPointer = attrs.get('TwinPointer').value if attrs.get('Include'): @@ -507,7 +507,7 @@ class PythonExport: ClassDeclarations_ += text__content_.nodeValue self.ClassDeclarations = ClassDeclarations_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'Initialisation': + nodeName_ == 'Initialization': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) @@ -1845,14 +1845,14 @@ class SaxGeneratemodelHandler(handler.ContentHandler): obj.setConstructor(0) else: 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 in ('true', '1'): - obj.setInitialisation(1) + obj.setInitialization(1) elif val in ('false', '0'): - obj.setInitialisation(0) + obj.setInitialization(0) 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) if val is not None: obj.setTwinpointer(val) diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 9bfa844b3..b3a42e030 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -60,7 +60,7 @@ public: static PyObject * richCompare(PyObject *v, PyObject *w, int op); - static PyGetSetDef GetterSetter[]; - virtual PyTypeObject *GetType(void) {return &Type;}; + virtual PyTypeObject *GetType(void) {return &Type;} public: @self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type); @@ -68,9 +68,9 @@ public: virtual int PyInit(PyObject* args, PyObject*k); ~@self.export.Name@(); -+ if (self.export.Initialisation): - int initialisation(); - int deinitialisation(); ++ if (self.export.Initialization): + int initialization(); + int finalization(); - typedef @self.export.TwinPointer@* PointerType ; @@ -612,8 +612,8 @@ int @self.export.Name@::staticCallback_set@i.Name@ (PyObject *self, PyObject *va pcObject->ref(); - -+ if (self.export.Initialisation): - initialisation(); ++ if (self.export.Initialization): + 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); delete ptr; - -+ if (self.export.Initialisation): - deinitialisation(); ++ if (self.export.Initialization): + finalization(); - } @@ -820,12 +820,12 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) } - -+ if (self.export.Initialisation): -int @self.export.Name@::initialisation() ++ if (self.export.Initialization): +int @self.export.Name@::initialization() { return 0; } -int @self.export.Name@::deinitialisation() +int @self.export.Name@::finalization() { return 0; }