Skip to content

Commit

Permalink
Python interface: it shouldn't rely on a plugin being installed!
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 20, 2019
1 parent a0c5919 commit a5c5d38
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/plugins/dataStore/DataStore/src/datastoreplugin.cpp
Expand Up @@ -59,7 +59,7 @@ void DataStorePlugin::retranslateUi()
// Python interface
//==============================================================================

void DataStorePlugin::registerPythonClasses(PyObject *pModule)
void DataStorePlugin::registerPythonClasses(void *pModule)
{
// Register our Python classes

Expand Down
Expand Up @@ -319,7 +319,7 @@ static PyTypeObject DataStoreValuesDict_Type = {

//==============================================================================

DataStorePythonWrapper::DataStorePythonWrapper(PyObject *pModule,
DataStorePythonWrapper::DataStorePythonWrapper(void *pModule,
QObject *pParent) :
QObject(pParent)
{
Expand Down
Expand Up @@ -51,7 +51,7 @@ class DataStorePythonWrapper : public QObject
Q_OBJECT

public:
explicit DataStorePythonWrapper(PyObject *pModule, QObject *pParent);
explicit DataStorePythonWrapper(void *pModule, QObject *pParent);

static DATASTORE_EXPORT PyObject * dataStoreValuesDict(const DataStoreValues *pDataStoreValues,
SimulationSupport::SimulationDataUpdatedFunction *pSimulationDataUpdatedFunction);
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/pythoninterface.h
Expand Up @@ -29,12 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

//==============================================================================

#include "pythonbegin.h"
#include "PythonQt/PythonQtPythonInclude.h"
#include "pythonend.h"

//==============================================================================

namespace OpenCOR {

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/pythoninterface.inl
Expand Up @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Note: make sure to update solverInterfaceVersion() whenever you update
// this interface...

VIRTUAL void registerPythonClasses(PyObject *pModule) PURE_OR_OVERRIDE;
VIRTUAL void registerPythonClasses(void *pModule) PURE_OR_OVERRIDE;
#include "interfaceend.h"

//==============================================================================
Expand Down
Expand Up @@ -409,7 +409,7 @@ QIcon SimulationExperimentViewPlugin::fileTabIcon(const QString &pFileName) cons
// Python interface
//==============================================================================

void SimulationExperimentViewPlugin::registerPythonClasses(PyObject *pModule)
void SimulationExperimentViewPlugin::registerPythonClasses(void *pModule)
{
// Register our Python classes

Expand Down
Expand Up @@ -188,7 +188,7 @@ static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs)

//==============================================================================

SimulationExperimentViewPythonWrapper::SimulationExperimentViewPythonWrapper(PyObject *pModule,
SimulationExperimentViewPythonWrapper::SimulationExperimentViewPythonWrapper(void *pModule,
QObject *pParent) :
QObject(pParent)
{
Expand All @@ -201,7 +201,8 @@ SimulationExperimentViewPythonWrapper::SimulationExperimentViewPythonWrapper(PyO
{ nullptr, nullptr, 0, nullptr }
}};

PyModule_AddFunctions(pModule, PythonSimulationExperimentViewMethods.data());
PyModule_AddFunctions(static_cast<PyObject *>(pModule),
PythonSimulationExperimentViewMethods.data());
}

//==============================================================================
Expand Down
Expand Up @@ -45,7 +45,7 @@ class SimulationExperimentViewPythonWrapper : public QObject
Q_OBJECT

public:
explicit SimulationExperimentViewPythonWrapper(PyObject *pModule,
explicit SimulationExperimentViewPythonWrapper(void *pModule,
QObject *pParent);
};

Expand Down
Expand Up @@ -156,7 +156,7 @@ void SimulationSupportPlugin::retranslateUi()
// Python interface
//==============================================================================

void SimulationSupportPlugin::registerPythonClasses(PyObject *pModule)
void SimulationSupportPlugin::registerPythonClasses(void *pModule)
{
// Register our Python classes

Expand Down
Expand Up @@ -269,7 +269,7 @@ static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs)

//==============================================================================

SimulationSupportPythonWrapper::SimulationSupportPythonWrapper(PyObject *pModule,
SimulationSupportPythonWrapper::SimulationSupportPythonWrapper(void *pModule,
QObject *pParent) :
QObject(pParent)
{
Expand All @@ -290,7 +290,8 @@ SimulationSupportPythonWrapper::SimulationSupportPythonWrapper(PyObject *pModule
{ nullptr, nullptr, 0, nullptr }
}};

PyModule_AddFunctions(pModule, PythonSimulationSupportMethods.data());
PyModule_AddFunctions(static_cast<PyObject *>(pModule),
PythonSimulationSupportMethods.data());
}

//==============================================================================
Expand Down
Expand Up @@ -60,8 +60,7 @@ class SimulationSupportPythonWrapper : public QObject
Q_OBJECT

public:
explicit SimulationSupportPythonWrapper(PyObject *pModule,
QObject *pParent);
explicit SimulationSupportPythonWrapper(void *pModule, QObject *pParent);

private:
qint64 mElapsedTime = -1;
Expand Down

0 comments on commit a5c5d38

Please sign in to comment.