1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : PyInterp_PyQt.cxx
8 // Author : Christian CAREMOLI, Paul RASCLE, EDF
12 #include "PyInterp_PyQt.h"
13 #include "utilities.h"
19 * constructor : the main SALOME Python interpreter is used for PyQt GUI.
20 * calls initialize method defined in base class, which calls virtual methods
21 * initstate & initcontext redefined here
23 PyInterp_PyQt::PyInterp_PyQt(): PyInterp_base()
27 PyInterp_PyQt::~PyInterp_PyQt()
31 void PyInterp_PyQt::initState()
33 SCRUTE(PyInterp_base::_gtstate);
34 _tstate=PyInterp_base::_gtstate;
35 PyThreadState_Swap(_tstate);
39 void PyInterp_PyQt::initContext()
41 _g = PyDict_New(); // create interpreter dictionnary context
42 PyObject *bimod = PyImport_ImportModule("__builtin__");
43 PyDict_SetItemString(_g, "__builtins__", bimod);
47 void PyInterp_PyQt::run(const char *command)
50 PyLockWrapper aLock(_tstate);
51 PyObject *code = Py_CompileString((char *)command,"PyGUI",Py_file_input);
53 // Une erreur s est produite en general SyntaxError
57 PyObject *r = PyEval_EvalCode(code,_g,_g);
60 // Une erreur s est produite a l execution