-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
_global_context = PyModule_GetDict(m); // get interpreter global variable context
Py_INCREF(_global_context);
_local_context = _global_context;
- return true;
+
+ int ret = PyRun_SimpleString("import salome_iapp;salome_iapp.IN_SALOME_GUI=True");
+
+ return ret == 0;
}
/*!
int PyInterp_Interp::run(const char *command)
{
beforeRun();
- return simpleRun(command);
+ int ret = simpleRun(command);
+ afterRun();
+ return ret;
}
/**
return 0;
}
+/**
+ * Called after a command is run (when calling run() method). Not thread-safe. Caller's responsability
+ * to acquire GIL if needed.
+ */
+int PyInterp_Interp::afterRun()
+{
+ return 0;
+}
+
/*!
\brief Run Python command (used internally). Not thread-safe. GIL acquisition is caller's responsability.
\param command Python command