+ simplify porting of Inspection module to Python3
This commit is contained in:
parent
b5bf7d6b9d
commit
a07b9cd0d4
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
|
||||
* Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -26,30 +26,45 @@
|
|||
# include <Python.h>
|
||||
#endif
|
||||
|
||||
#include <CXX/Extensions.hxx>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include "InspectionFeature.h"
|
||||
|
||||
|
||||
/* registration table */
|
||||
extern struct PyMethodDef Inspection_methods[];
|
||||
namespace Inspection {
|
||||
class Module : public Py::ExtensionModule<Module>
|
||||
{
|
||||
public:
|
||||
Module() : Py::ExtensionModule<Module>("Inspection")
|
||||
{
|
||||
initialize("This module is the Inspection module."); // register with Python
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(module_Inspection_doc,
|
||||
"This module is the Inspection module.");
|
||||
virtual ~Module() {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
PyObject* initModule()
|
||||
{
|
||||
return (new Module)->module().ptr();
|
||||
}
|
||||
|
||||
} // namespace Inspection
|
||||
|
||||
|
||||
/* Python entry */
|
||||
extern "C" {
|
||||
void InspectionExport initInspection() {
|
||||
PyMODINIT_FUNC initInspection() {
|
||||
|
||||
// ADD YOUR CODE HERE
|
||||
//
|
||||
//
|
||||
(void) Py_InitModule3("Inspection", Inspection_methods, module_Inspection_doc); /* mod name, table ptr */
|
||||
(void)Inspection::initModule();
|
||||
Base::Console().Log("Loading Inspection module... done\n");
|
||||
|
||||
Inspection::PropertyDistanceList ::init();
|
||||
Inspection::Feature ::init();
|
||||
Inspection::Group ::init();
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Exception.h>
|
||||
|
||||
|
||||
/* registration table */
|
||||
struct PyMethodDef Inspection_methods[] = {
|
||||
{NULL, NULL} /* end of table marker */
|
||||
};
|
|
@ -27,7 +27,6 @@ set(Inspection_LIBS
|
|||
|
||||
SET(Inspection_SRCS
|
||||
AppInspection.cpp
|
||||
AppInspectionPy.cpp
|
||||
InspectionFeature.cpp
|
||||
InspectionFeature.h
|
||||
PreCompiled.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
|
||||
* Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -26,6 +26,9 @@
|
|||
# include <Python.h>
|
||||
#endif
|
||||
|
||||
#include <CXX/Extensions.hxx>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Application.h>
|
||||
|
||||
|
@ -36,16 +39,30 @@
|
|||
void CreateInspectionCommands(void);
|
||||
|
||||
|
||||
/* registration table */
|
||||
extern struct PyMethodDef InspectionGui_methods[];
|
||||
namespace InspectionGui {
|
||||
class Module : public Py::ExtensionModule<Module>
|
||||
{
|
||||
public:
|
||||
Module() : Py::ExtensionModule<Module>("InspectionGui")
|
||||
{
|
||||
initialize("This module is the InspectionGui module."); // register with Python
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(module_InspectionGui_doc,
|
||||
"This module is the InspectionGui module.");
|
||||
virtual ~Module() {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
PyObject* initModule()
|
||||
{
|
||||
return (new Module)->module().ptr();
|
||||
}
|
||||
|
||||
} // namespace InspectionGui
|
||||
|
||||
|
||||
/* Python entry */
|
||||
extern "C" {
|
||||
void InspectionGuiExport initInspectionGui()
|
||||
PyMODINIT_FUNC initInspectionGui()
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
|
@ -62,8 +79,6 @@ void InspectionGuiExport initInspectionGui()
|
|||
//
|
||||
//
|
||||
|
||||
(void) Py_InitModule3("InspectionGui", InspectionGui_methods, module_InspectionGui_doc); /* mod name, table ptr */
|
||||
(void)InspectionGui::initModule();
|
||||
Base::Console().Log("Loading GUI of Inspection module... done\n");
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) YEAR YOUR NAME <Your e-mail address> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
|
||||
/* registration table */
|
||||
struct PyMethodDef InspectionGui_methods[] = {
|
||||
{NULL, NULL} /* end of table marker */
|
||||
};
|
|
@ -39,7 +39,6 @@ SET(InspectionGui_SRCS
|
|||
${Inspection_QRC_SRCS}
|
||||
${Dialogs_SRCS}
|
||||
AppInspectionGui.cpp
|
||||
AppInspectionGuiPy.cpp
|
||||
Command.cpp
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
|
|
Loading…
Reference in New Issue
Block a user