From: rnv Date: Fri, 17 Apr 2009 11:14:27 +0000 (+0000) Subject: Implementation of the issue 0020151 (SALOME: Light Python module): X-Git-Tag: V5_1_2rc1~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e208d713e31e50bd068e1e130dfed34d3d2630c3;p=modules%2Fgui.git Implementation of the issue 0020151 (SALOME: Light Python module): remove unnecessary files. --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip deleted file mode 100644 index cbfcf330d..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOME_PYQT_GUI.sip -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -%Module SalomePyQtGUI - -%Import QtGuimod.sip -%Import QtXmlmod.sip - diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx deleted file mode 100644 index 5d2228cd1..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOME_PYQT_PyInterp.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// -#include "SALOME_PYQT_PyInterp.h" // this include must be first (see PyInterp_base.h)! -#include -#include - -/*! - * constructor : the main SALOME Python interpreter is used for PyQt GUI. - * calls initialize method defined in base class, which calls virtual methods - * initstate & initcontext redefined here - */ -SALOME_PYQT_PyInterp::SALOME_PYQT_PyInterp(): PyInterp_Interp() -{ -} - -SALOME_PYQT_PyInterp::~SALOME_PYQT_PyInterp() -{ -} - -void SALOME_PYQT_PyInterp::initPython() -{ - /* - * Do nothing - * The initialization has been done in main - */ - MESSAGE("SALOME_PYQT_PyInterp::initPython"); - ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main - SCRUTE(KERNEL_PYTHON::_gtstate); - _gtstate=KERNEL_PYTHON::_gtstate; - _interp=KERNEL_PYTHON::_interp; -} - -bool SALOME_PYQT_PyInterp::initState() -{ - /* - * The GIL is assumed to not be held on the call - * The GIL is acquired in initState and will be held on initState exit - * It is the caller responsability to release the lock on exit if needed - */ - SCRUTE(KERNEL_PYTHON::_gtstate); - _tstate = KERNEL_PYTHON::_gtstate; - PyEval_AcquireThread(_tstate); - SCRUTE(_tstate); - PyEval_ReleaseThread(_tstate); - return true; -} - -bool SALOME_PYQT_PyInterp::initContext() -{ - /* - * The GIL is assumed to be held - * It is the caller responsability to acquire the GIL before calling initContext - * It will still be held on initContext exit - */ - _g = PyDict_New(); // create interpreter dictionnary context - PyObject *bimod = PyImport_ImportModule("__builtin__"); - PyDict_SetItemString(_g, "__builtins__", bimod); - Py_DECREF(bimod); - return true; -} - -int SALOME_PYQT_PyInterp::run(const char *command) -{ - MESSAGE("compile"); - PyObject *code = Py_CompileString((char *)command,"PyGUI",Py_file_input); - if(!code){ - // Une erreur s est produite en general SyntaxError - PyErr_Print(); - return -1; - } - //#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0 - // PyObject *r = PyEval_EvalCode(code,_g,_g); - //#else - PyObject *r = PyEval_EvalCode((PyCodeObject *)code,_g,_g); - //#endif - Py_DECREF(code); - if(!r){ - // Une erreur s est produite a l execution - PyErr_Print(); - return -1 ; - } - Py_DECREF(r); - return 0; -} diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h deleted file mode 100644 index a53ee7264..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOME_PYQT_PyInterp.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// -#ifndef SALOME_PYQT_PYINTERP_H -#define SALOME_PYQT_PYINTERP_H - -#include "SALOME_PYQT_GUI.h" - -#include // this include must be first (see PyInterp_base.h)! - -class SALOME_PYQT_EXPORT SALOME_PYQT_PyInterp : public PyInterp_Interp -{ -public: - SALOME_PYQT_PyInterp(); - ~SALOME_PYQT_PyInterp(); - - int run( const char* ); - -protected: - virtual void initPython(); - virtual bool initState(); - virtual bool initContext(); -}; - -#endif // SALOME_PYQT_PYINTERP_H