Salome HOME
[PYTHON 3] WIP
authorNicolas Geimer <nicolas.geimer@edf.fr>
Tue, 18 Apr 2017 12:47:11 +0000 (14:47 +0200)
committerNicolas Geimer <nicolas.geimer@edf.fr>
Tue, 18 Apr 2017 12:47:11 +0000 (14:47 +0200)
47 files changed:
doc/advancepy.rst
src/engine_swig/CMakeLists.txt
src/engine_swig/engtypemaps.i
src/engine_swig/pilot.i
src/engine_swig/pypilot.i
src/evalyfx/CMakeLists.txt
src/evalyfx/YACSEvalPort.cxx
src/evalyfx/YACSEvalSeqAny.cxx
src/evalyfx/YACSEvalSession.cxx
src/evalyfx/YACSEvalSessionInternal.cxx
src/evalyfx/YACSEvalYFXPattern.cxx
src/evalyfx_swig/CMakeLists.txt
src/evalyfx_swig/evalyfx.i
src/genericgui/CMakeLists.txt
src/genericgui/FormContainerDecorator.cxx
src/genericgui/FormParamContainer.ui
src/genericgui/ListJobs_GUI.cxx
src/hmi/CMakeLists.txt
src/hmi/guiObservers.cxx
src/py2yacs/CMakeLists.txt
src/py2yacs/py2yacs.cxx
src/runtime/CMakeLists.txt
src/runtime/CORBAPorts.cxx
src/runtime/DistributedPythonNode.cxx
src/runtime/PyStdout.cxx
src/runtime/PythonNode.cxx
src/runtime/PythonPorts.cxx
src/runtime/RuntimeSALOME.cxx
src/runtime/RuntimeSALOME.hxx
src/runtime/SalomePythonNode.cxx
src/runtime/Test/CMakeLists.txt
src/runtime/Test/runtimeTest.cxx
src/runtime/TypeConversions.cxx
src/runtime_swig/CMakeLists.txt
src/runtime_swig/SALOMERuntime.i
src/yacsloader/CMakeLists.txt
src/yacsloader/Test/CMakeLists.txt
src/yacsloader/Test/YacsLoaderTest.cxx
src/yacsloader/pmml/CMakeLists.txt
src/yacsloader_swig/CMakeLists.txt
src/ydfx_gui/YDFXGUIHostParametrizer.cxx
src/ydfx_gui/YDFXGUIMain.hxx
src/ydfx_gui/YDFXGUIPortsSelector.cxx
src/ydfx_gui/YDFXGUIPushButtons.cxx
src/ydfx_gui/YDFXGUIPyThreadSaver.hxx
src/ydfx_gui/YDFXGUISeqInit.cxx
src/ydfx_gui/YDFXGUIWrap.cxx

index 5d09877f2ed0447ff4e6c3115d2e59603f5649f9..1fe66b22561d8c71fbf886cee39faf7415bd4e16 100644 (file)
@@ -18,7 +18,7 @@ The protocol name appears in the first part of the type Repository ID (before th
 
 The Python protocol
 ++++++++++++++++++++++
-The Python protocol is based on serialisation done by the cPickle module (C implementation of the pickle module).  
+The Python protocol is based on serialisation done by the pickle module.  
 All that is necessary is to define an object reference type with the Python protocol so that Python objects 
 can be exchanged between Python inline nodes and with SALOME components implemented in Python.  
 SALOME components implemented in Python that are required to support this exchange type must be designed 
@@ -61,14 +61,14 @@ The implementation of component compo1 must handle serialisation / deserialisati
 way as the example in the run method described below::
 
   def run(self,s):
-    o=cPickle.loads(s)
+    o=pickle.loads(s)
     ret={'a':6, 'b':[1,2,3]}
-    return cPickle.dumps(ret,-1)
+    return pickle.dumps(ret,-1)
  
 The json protocol
 ++++++++++++++++++++++
 The json protocol is based on `JSON <http://www.json.org/>`_ (JavaScript Object Notation) 
-serialisation / deserialisation instead of cPickle. JSON supports fewer data types and requires that 
+serialisation / deserialisation instead of pickle. JSON supports fewer data types and requires that 
 the simplejson Python module should be installed, but it has the advantage that it is more interoperable.  
 In particular, there are C++ libraries that serialise/deserialise the JSON.
 
index 4c525af2e9e56b848297705cb2a9ed05aaf5d309..4e1f10a525ef103254b7dc92408df4647455be75 100644 (file)
@@ -31,6 +31,7 @@ ENDIF()
 INCLUDE_DIRECTORIES(
   ${PTHREAD_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
   ${PROJECT_BINARY_DIR}
index d31e8870f6b3027d607f89bf15d92fd4d62e080b..611e55ccfa9e68f486b0445290f3353fbcc20f0c 100644 (file)
 #ifdef OMNIORB
 #include <omniORB4/CORBA.h>
 
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBPYAPI
-{
-  PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-           CORBA::Boolean hold_lock);
-  // Convert a C++ object reference to a Python object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-             CORBA::Boolean hold_lock);
-  // Convert a Python object reference to a C++ object reference.
-  // Raises BAD_PARAM if the Python object is not an object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-  // Sets the Python exception state to reflect the given C++ system
-  // exception. Always returns NULL. The caller must hold the Python
-  // interpreter lock.
-};
-
-omniORBPYAPI* api;
+#include <omniORBpy.h>
+omniORBpyAPI* api=0;
 
 #define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS \
 catch (const CORBA::SystemException& ex) { \
index 6b93d661450955965b697322b4437cb6a6e8333e..34a28121a356d7ab42c14cdc76fa0055ae3b0f4a 100644 (file)
@@ -71,10 +71,10 @@ using namespace YACS::ENGINE;
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
@@ -420,7 +420,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 0
     PyObject *ret0Py(PyList_New(ret0.size()));
     for(std::size_t i=0;i<ret0.size();i++)
-      PyList_SetItem(ret0Py,i,PyInt_FromLong(ret0[i]));
+      PyList_SetItem(ret0Py,i,PyLong_FromLong(ret0[i]));
     PyTuple_SetItem(ret,0,ret0Py);
     // param 1
     PyObject *ret1Py(PyList_New(ret1.size()));
@@ -430,7 +430,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 2
     PyObject *ret2Py(PyList_New(ret2.size()));
     for(std::size_t i=0;i<ret2.size();i++)
-      PyList_SetItem(ret2Py,i,PyString_FromString(ret2[i].c_str()));
+      PyList_SetItem(ret2Py,i,PyBytes_FromString(ret2[i].c_str()));
     PyTuple_SetItem(ret,2,ret2Py);
     return ret;
   }
index 04e1584b0ddc119bb5e58a49c389f021e84e8843..8038d42f758a5366e3c944e5096ccbb7500d7ee6 100644 (file)
@@ -87,10 +87,10 @@ namespace YACS
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
index 98494643803a5439851265512f9953ac1e3e97e2..f46fd014d74c364beb0f4912e8703b5809880437 100644 (file)
@@ -40,6 +40,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 9dce3ae6bf09767f9dd4b6e982dcfc1d358d900c..efe93a9c92cc323b7a5c337137911c64fba17f41 100644 (file)
@@ -149,8 +149,8 @@ YACSEvalAny *YACSEvalInputPort::getDefaultValueDefined() const
         throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : internal error !");
       if(PyFloat_Check(data))
         return new YACSEvalAnyDouble(PyFloat_AsDouble(data));
-      if(PyInt_Check(data))
-        return new YACSEvalAnyInt((int)PyInt_AsLong(data));
+      if(PyLong_Check(data))
+        return new YACSEvalAnyInt((int)PyLong_AsLong(data));
       throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : unmanaged types different from int and double for py !");
     }
   YACS::ENGINE::AnyInputPort *i1(dynamic_cast<YACS::ENGINE::AnyInputPort *>(_ptr));
@@ -220,7 +220,7 @@ void YACSEvalInputPort::setDefaultValue(const YACSEvalAny *parameter)
             }
           else if(par1)
             {
-              PyObject *obj(PyInt_FromLong(par1->toInt()));
+              PyObject *obj(PyLong_FromLong(par1->toInt()));
               i0->put(obj);
               Py_XDECREF(obj);
             }
index 4206e551d2a08b4789a9fc88d786ece5da30df1e..0f0730494580efbbabc187625dd61ee28c5dce9e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+  // Copyright (C) 2012-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -120,7 +120,7 @@ void YACSEvalSeqAnyInt::initialize(YACS::ENGINE::InputPyPort *p) const
   PyObject *ob(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
     {
-      PyList_SetItem(ob,i,PyInt_FromLong((*_arr)[i]));
+      PyList_SetItem(ob,i,PyLong_FromLong((*_arr)[i]));
     }
   p->put(ob);
   p->exSaveInit();
index 3a91c4e2f64b4f33126a35a4de45d04cd000e4c2..02886cbfb99409ec76f3604b633a10aa353b4319 100644 (file)
@@ -72,7 +72,7 @@ void YACSEvalSession::launch()
   _salomeInstance=PyObject_Call(startMeth,myArgs,myKWArgs);//new
   YACS::ENGINE::AutoPyRef getPortMeth(PyObject_GetAttrString(_salomeInstance,const_cast<char *>("get_port")));//new
   YACS::ENGINE::AutoPyRef portPy(PyObject_CallObject(getPortMeth,0));//new
-  _port=PyInt_AsLong(portPy);
+  _port=PyLong_AsLong(portPy);
   //
   int dummy;
   _corbaConfigFileName=GetConfigAndPort(dummy);
@@ -119,7 +119,7 @@ std::string YACSEvalSession::GetPathToAdd()
   PyObject *kernelRootDir(0);// os.environ["KERNEL_ROOT_DIR"]
   {
     YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
-    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyString_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
+    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyBytes_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
     kernelRootDir=PyObject_GetItem(environPy,kernelRootDirStr);//new
   }
   {
@@ -127,11 +127,11 @@ std::string YACSEvalSession::GetPathToAdd()
     YACS::ENGINE::AutoPyRef joinPy(PyObject_GetAttrString(pathPy,const_cast<char *>("join")));//new
     YACS::ENGINE::AutoPyRef myArgs(PyTuple_New(4));
     Py_XINCREF(kernelRootDir); PyTuple_SetItem(myArgs,0,kernelRootDir);
-    PyTuple_SetItem(myArgs,1,PyString_FromString(const_cast<char *>("bin")));
-    PyTuple_SetItem(myArgs,2,PyString_FromString(const_cast<char *>("salome")));
-    PyTuple_SetItem(myArgs,3,PyString_FromString(const_cast<char *>("appliskel")));
+    PyTuple_SetItem(myArgs,1,PyBytes_FromString(const_cast<char *>("bin")));
+    PyTuple_SetItem(myArgs,2,PyBytes_FromString(const_cast<char *>("salome")));
+    PyTuple_SetItem(myArgs,3,PyBytes_FromString(const_cast<char *>("appliskel")));
     YACS::ENGINE::AutoPyRef res(PyObject_CallObject(joinPy,myArgs));
-    ret=PyString_AsString(res);
+    ret=PyBytes_AsString(res);
   }
   Py_XDECREF(kernelRootDir);
   return ret;
@@ -142,13 +142,13 @@ std::string YACSEvalSession::GetConfigAndPort(int& port)
   YACS::ENGINE::AutoPyRef osPy(PyImport_ImportModule(const_cast<char *>("os")));//new
   YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
   //
-  YACS::ENGINE::AutoPyRef corbaConfigStr(PyString_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef corbaConfigStr(PyBytes_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef corbaConfigFileNamePy(PyObject_GetItem(environPy,corbaConfigStr));//new
-  std::string ret(PyString_AsString(corbaConfigFileNamePy));
+  std::string ret(PyBytes_AsString(corbaConfigFileNamePy));
   //
-  YACS::ENGINE::AutoPyRef nsPortStr(PyString_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef nsPortStr(PyBytes_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef nsPortValuePy(PyObject_GetItem(environPy,nsPortStr));//new
-  std::string portStr(PyString_AsString(nsPortValuePy));
+  std::string portStr(PyBytes_AsString(nsPortValuePy));
   std::istringstream iss(portStr);
   iss >> port;
   return ret;
index d5bf80b158e71430e136addc208ffe6b301ffa0b..09a1971c20ef14ea885e22ff6bd91e39ad8a4b33 100644 (file)
@@ -48,7 +48,7 @@ Engines::SalomeLauncher_var YACSEvalSession::YACSEvalSessionInternal::goFetching
   const char fetchPyCmd[]="import salome,CORBA\nsalome.salome_init()\nsl=salome.naming_service.Resolve(\"/SalomeLauncher\")\nif not CORBA.is_nil(sl):\n  return salome.orb.object_to_string(sl)\nelse:\n  raise Exception(\"Impossible to locate salome launcher !\")";
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(methName,fetchPyCmd));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  std::string ior(PyString_AsString(val));
+  std::string ior(PyBytes_AsString(val));
   CORBA::Object_var obj(string_to_object(ior));
   if(CORBA::is_nil(obj))
     throw YACS::Exception("goFetchingSalomeLauncherInNS : fetched ior is NIL !");
index 43b6b6b9dd49c191142eac4e83c00f1a64ba3781..d8128ebed816755502860db4c250c3640d875748 100644 (file)
@@ -261,7 +261,7 @@ YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueInPort(YACS::ENGINE::InputPyPort *
       for(std::size_t i=0;i<sz;i++)
         {
           PyObject *elt(PyList_GetItem(obj,i));
-          eltCpp[i]=PyInt_AsLong(elt);
+          eltCpp[i]=PyLong_AsLong(elt);
         }
       YACS::AutoCppPtr<YACSEvalSeqAnyInt> elt(new YACSEvalSeqAnyInt(eltCpp));
       return elt.dettach();
@@ -869,10 +869,10 @@ void YACSEvalYFXGraphGenCluster::generateGraph()
   //
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  _locSchemaFile=PyString_AsString(val);
+  _locSchemaFile=PyBytes_AsString(val);
   func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
   val=YACS::ENGINE::evalFuncPyWithNoParams(func);
-  _jobName=PyString_AsString(val);
+  _jobName=PyBytes_AsString(val);
   //
   static const char LISTPYOBJ_STR[]="list[pyobj]";
   if(getBoss()->getOutputsOfInterest().empty())
index 38cd7b29b27840f46465d9e66455eea9af3ebb57..9aedfcdc954589e5f4e19957a23ca025d1beb501 100644 (file)
@@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader_swig
   ${PROJECT_SOURCE_DIR}/src/evalyfx
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index a530309024bf07f221f3e2944c88f69c28260240..6796ada923dc5815e2b5da6d8dbfaa1c822e871c 100644 (file)
@@ -46,7 +46,7 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
           PyObject *o=PyList_GetItem(pyLi,i);
           if(PyInt_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -60,9 +60,9 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(PyInt_Check(o))
+          if(PyLong_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -80,7 +80,7 @@ static PyObject *convertToPyToInt(const std::vector<unsigned int>& arr)
   std::size_t sz(arr.size());
   PyObject *ret(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
-    PyList_SetItem(ret,i,PyInt_FromLong(arr[i]));
+    PyList_SetItem(ret,i,PyLong_FromLong(arr[i]));
   return ret;
 }
 
@@ -148,7 +148,7 @@ static PyObject *convertVectOfSeqAny(const std::vector<YACSEvalSeqAny *>& retCpp
           std::size_t sz2(zeArr->size());
           PyObject *ret2(PyList_New(sz2));
           for(std::size_t i2=0;i2<sz2;i2++)
-            PyList_SetItem(ret2,i2,PyInt_FromLong((*zeArr)[i2]));
+            PyList_SetItem(ret2,i2,PyLong_FromLong((*zeArr)[i2]));
           PyList_SetItem(ret,i,ret2);
         }
       else
@@ -249,7 +249,7 @@ public:
            }
          else if(PyInt_Check(parameter))
            {
-             YACSEvalAnyInt tmp((int)PyInt_AsLong(parameter));
+             YACSEvalAnyInt tmp((int)PyLong_AsLong(parameter));
              self->setDefaultValue(&tmp);
            }
          else
@@ -507,7 +507,7 @@ public:
          PyObject *ret0Py(ret0?Py_True:Py_False);
          Py_XINCREF(ret0Py);
          PyTuple_SetItem(ret,0,ret0Py);
-         PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
+         PyTuple_SetItem(ret,1,PyLong_FromLong(ret1));
          return ret;
        }
      }
index 3525093bc0a186649cbc5b84aee82a565c306d5e..f9e4e3ce495463226a1a384004464a0ec3e1d0f1 100644 (file)
@@ -25,6 +25,7 @@ INCLUDE(UseQtExt)
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${GRAPHVIZ_INCLUDE_DIRS}
   ${QT_INCLUDES}
index f5f33b74d591673b45aa174d4bdc12e1b6c79d99..df2a1d314a08a56ef17882958cf505ce6d265ad6 100644 (file)
@@ -179,6 +179,6 @@ void FormContainerDecorator::checkAndRepareTypeIfNecessary(YACS::ENGINE::Contain
 void FormContainerDecorator::connectForTyp()
 {
   connect(_typ->cb_resource,SIGNAL(mousePressed()),this,SLOT(onResMousePressed()));
-  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated));
-  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled()));
+  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated(int)));
+  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled(bool)));
 }
index 41c36c1dd0f0bd55e743be7c96da6ee40dbef99a..010589813abbee16a92b25c9cc5e3cc72b1fb981 100644 (file)
@@ -72,7 +72,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QComboBox" name="cb_resource">
+         <widget class="ComboBox" name="cb_resource">
           <property name="toolTip">
            <string>name of the resource hosting container when manually set</string>
           </property>
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ComboBox</class>
+   <extends>QComboBox</extends>
+   <header>FormComponent.hxx</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
index fa6299c06e37324130007e357ce4e0166e99c143..8ce983ddcb5b147ba8541f67da297b8af87f4161 100644 (file)
@@ -20,8 +20,8 @@
 #include <iostream>
 #include <fstream>
 
-#include "ListJobs_GUI.hxx"
 #include "RuntimeSALOME.hxx"
+#include "ListJobs_GUI.hxx"
 #include "GenericGui.hxx"
 #include "QtGuiContext.hxx"
 #include "YACSGuiLoader.hxx"
index adb7187835f9dd3a0ccc55109ee52f0150e2f03e..5d9c12206b4f355b416220356bfd7955635d01e7 100644 (file)
@@ -27,6 +27,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
index e1414cfd11e64913b1d3dd46db6c23d1b39f2ab6..8e160166ef708f08d6598c88f860367b9d28c90c 100644 (file)
@@ -197,11 +197,11 @@ void Subject::select(bool isSelected)
 
 void Subject::update(GuiEvent event,int type, Subject* son)
 {
-  //DEBTRACE("Subject::update " << type << "," << GuiObserver::eventName(event) << "," << son);
+    std::cerr << "Subject::update " << type << "," << GuiObserver::eventName(event) << "," << son << std::endl;
   set<GuiObserver*> copySet = _setObs;
   for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
     {
-      //DEBTRACE("Subject::update " << *it);
+        std::cerr << "Subject::update " << *it << std::endl;
       try
         {
           (*it)->update(event, type, son);
@@ -209,11 +209,13 @@ void Subject::update(GuiEvent event,int type, Subject* son)
       catch(Exception& ex)
         {
           std::cerr << "Internal error in Subject::update: " << ex.what() << std::endl;
+          std::cerr << "ERREUR ICI" << std::endl;
         }
-      catch(...)
-        {
-          std::cerr << "Internal error in Subject::update: " << std::endl;
-        }
+      //catch(...)
+      //  {
+      //    std::cerr << "Internal error in Subject::update: " << std::endl;
+      //    std::cerr << "ERREUR OU LA " << std::endl;
+      //  }
     }
 }
 
index d5c4ce3bac494195677a779483e753a7be724393..76db23ac82f1863b6c646c9f89bd06506c658f55 100644 (file)
@@ -19,6 +19,7 @@
 
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 9e364400699b47b667279c26cc18a6d0488b4ce7..982b0124c8dfad62c21f96f83f80f062c489982b 100644 (file)
@@ -86,7 +86,7 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
     for(int i=0; i<n; i++)
     {
       PyObject *elem = PyList_GetItem(pyList,i);
-      if(not PyString_Check(elem))
+      if(not PyBytes_Check(elem))
       {
         std::stringstream message;
         message << "List element number " << i << " is not a string.\n";
@@ -95,7 +95,7 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
       }
       else
       {
-        const char * portName = PyString_AsString(elem);
+        const char * portName = PyBytes_AsString(elem);
         cppList.push_back(portName);
       }
     }
@@ -113,14 +113,14 @@ std::string getPyErrorText()
     PyObject *pystr, *module_name, *pyth_module, *pyth_func;
     PyErr_Fetch(&ptype, &pvalue, &ptraceback);
     pystr = PyObject_Str(pvalue);
-    result = PyString_AsString(pystr);
+    result = PyBytes_AsString(pystr);
     result += "\n";
     Py_DECREF(pystr);
     
     /* See if we can get a full traceback */
     if(ptraceback)
     {
-      module_name = PyString_FromString("traceback");
+      module_name = PyBytes_FromString("traceback");
       pyth_module = PyImport_Import(module_name);
       Py_DECREF(module_name);
       if (pyth_module)
@@ -136,7 +136,7 @@ std::string getPyErrorText()
             for(int i=0; i<n; i++)
             {
               pystr = PyList_GetItem(pyList,i);
-              result += PyString_AsString(pystr);
+              result += PyBytes_AsString(pystr);
             }
             Py_DECREF(pyList);
           }
@@ -180,7 +180,7 @@ void Py2yacs::load(const std::string& python_code)
     
     // Py_Initialize();
     YACS::ENGINE::AutoGIL agil;
-    pValue = PyString_FromString(_python_parser_module.c_str());
+    pValue = PyBytes_FromString(_python_parser_module.c_str());
     pModule = PyImport_Import(pValue);
     Py_DECREF(pValue);
 
@@ -198,7 +198,7 @@ void Py2yacs::load(const std::string& python_code)
       if (pFunc && PyCallable_Check(pFunc))
       {
         pArgs = PyTuple_New(1);
-        pValue = PyString_FromString(python_code.c_str());
+        pValue = PyBytes_FromString(python_code.c_str());
         PyTuple_SetItem(pArgs, 0, pValue);
         
         pValue = PyObject_CallObject(pFunc, pArgs);
@@ -232,7 +232,7 @@ void Py2yacs::load(const std::string& python_code)
               
               if(pAttribute = checkAndGetAttribute(fpy, "name", errorMessage))
               {
-                if(not PyString_Check(pAttribute))
+                if(not PyBytes_Check(pAttribute))
                 {
                   errorMessage += "Attribute 'name' should be a string.\n";
                   Py_DECREF(pAttribute);
@@ -241,7 +241,7 @@ void Py2yacs::load(const std::string& python_code)
                 {
                   _functions.push_back(FunctionProperties());
                   FunctionProperties& fcpp = _functions.back();
-                  fcpp._name=PyString_AsString(pAttribute);
+                  fcpp._name=PyBytes_AsString(pAttribute);
                   Py_DECREF(pAttribute);
                   
                   if(pAttribute = checkAndGetAttribute(fpy, "inputs", errorMessage))
index 71fb61e96d23320a6e48b77eabe86ac3d8971679..86cdb00c0cfba739b00874e72763d459af2f5736 100644 (file)
@@ -50,6 +50,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
   ${OMNIORB_ROOT_DIR}/include/omniORB4/internal
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index aeba65639af0882fcff5729ddef54e1032963330..690061c817d30fca4ebeb2ee9cac82669aa3ca0d 100644 (file)
@@ -272,9 +272,9 @@ std::string InputCorbaPort::dump()
 
 std::string InputCorbaPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   Py_DECREF(strPyObj);
@@ -466,7 +466,7 @@ namespace YACS {
 std::string OutputCorbaPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index edd891af98413381e2bebdb4c751263ac7ee27fc..88dff018532dff40366d2a74c46a07dc45eba5b2 100644 (file)
@@ -72,7 +72,7 @@ void DistributedPythonNode::load()
         _errorDetails=msg.str();
         throw Exception(msg.str());
       }
-    const char picklizeScript[]="import cPickle\ndef pickleForDistPyth2009(*args,**kws):\n  return cPickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=cPickle.loads(st)\n  return args\n";
+    const char picklizeScript[]="import pickle\ndef pickleForDistPyth2009(*args,**kws):\n  return pickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=pickle.loads(st)\n  return args\n";
     PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
     if(res == NULL)
       {
@@ -181,7 +181,7 @@ void DistributedPythonNode::execute()
         PyTuple_SetItem(args,pos,ob);
       }
     PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
-    std::string serializationInputC=PyString_AsString(serializationInput);
+    std::string serializationInputC=PyBytes_AsString(serializationInput);
     serializationInputCorba=new Engines::pickledArgs;
     int len=serializationInputC.length();
     serializationInputCorba->length(serializationInputC.length());
@@ -213,7 +213,7 @@ void DistributedPythonNode::execute()
   {
     AutoGIL agil;
     args = PyTuple_New(1);
-    PyObject* resultPython=PyString_FromString(resultCorbaC);
+    PyObject* resultPython=PyBytes_FromString(resultCorbaC);
     delete [] resultCorbaC;
     PyTuple_SetItem(args,0,resultPython);
     PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
index cc939672ce761a48d1c2619466dd956a6ef752f0..0c1cf83ded316005f49952e136bcf61d7deb41a7 100644 (file)
@@ -78,49 +78,49 @@ static PyMemberDef PyStdOut_memberlist[] = {
 static PyTypeObject PyStdOut_Type = {
   /* The ob_type field must be initialized in the module init function
    * to be portable to Windows without using C++. */
-  PyObject_HEAD_INIT(NULL)
-  0,      /*ob_size*/
-  "PyOut",   /*tp_name*/
-  sizeof(PyStdOut),  /*tp_basicsize*/
-  0,      /*tp_itemsize*/
+  PyVarObject_HEAD_INIT(NULL, 0)
+  /*0,*/                            /*ob_size*/
+  "PyOut",                      /*tp_name*/
+  sizeof(PyStdOut),             /*tp_basicsize*/
+  0,                            /*tp_itemsize*/
   /* methods */
   (destructor)PyStdOut_dealloc, /*tp_dealloc*/
-  0,      /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  0,      /*tp_compare*/
-  0,      /*tp_repr*/
-  0,      /*tp_as_number*/
-  0,      /*tp_as_sequence*/
-  0,      /*tp_as_mapping*/
-  0,      /*tp_hash*/
-        0,                      /*tp_call*/
-        0,                      /*tp_str*/
-        PyObject_GenericGetAttr,                      /*tp_getattro*/
-        /* softspace is writable:  we must supply tp_setattro */
-        PyObject_GenericSetAttr,    /* tp_setattro */
-        0,                      /*tp_as_buffer*/
-        Py_TPFLAGS_DEFAULT,     /*tp_flags*/
-        0,                      /*tp_doc*/
-        0,                      /*tp_traverse*/
-        0,                      /*tp_clear*/
-        0,                      /*tp_richcompare*/
-        0,                      /*tp_weaklistoffset*/
-        0,                      /*tp_iter*/
-        0,                      /*tp_iternext*/
-        PyStdOut_methods,                      /*tp_methods*/
-        PyStdOut_memberlist,                      /*tp_members*/
-        0,                      /*tp_getset*/
-        0,                      /*tp_base*/
-        0,                      /*tp_dict*/
-        0,                      /*tp_descr_get*/
-        0,                      /*tp_descr_set*/
-        0,                      /*tp_dictoffset*/
-        0,                      /*tp_init*/
-        0,                      /*tp_alloc*/
-        0,                      /*tp_new*/
-        0,                      /*tp_free*/
-        0,                      /*tp_is_gc*/
+  0,                            /*tp_print*/
+  0,                            /*tp_getattr*/
+  0,                            /*tp_setattr*/
+  0,                            /*tp_compare*/
+  0,                            /*tp_repr*/
+  0,                            /*tp_as_number*/
+  0,                            /*tp_as_sequence*/
+  0,                            /*tp_as_mapping*/
+  0,                            /*tp_hash*/
+  0,                            /*tp_call*/
+  0,                            /*tp_str*/
+  PyObject_GenericGetAttr,      /*tp_getattro*/
+  /* softspace is writable:  we must supply tp_setattro */
+  PyObject_GenericSetAttr,      /* tp_setattro */
+  0,                            /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT,           /*tp_flags*/
+  0,                            /*tp_doc*/
+  0,                            /*tp_traverse*/
+  0,                            /*tp_clear*/
+  0,                            /*tp_richcompare*/
+  0,                            /*tp_weaklistoffset*/
+  0,                            /*tp_iter*/
+  0,                            /*tp_iternext*/
+  PyStdOut_methods,             /*tp_methods*/
+  PyStdOut_memberlist,          /*tp_members*/
+  0,                            /*tp_getset*/
+  0,                            /*tp_base*/
+  0,                            /*tp_dict*/
+  0,                            /*tp_descr_get*/
+  0,                            /*tp_descr_set*/
+  0,                            /*tp_dictoffset*/
+  0,                            /*tp_init*/
+  0,                            /*tp_alloc*/
+  0,                            /*tp_new*/
+  0,                            /*tp_free*/
+  0,                            /*tp_is_gc*/
 };
 
 
@@ -168,7 +168,7 @@ PyObject *evalPy(const std::string& funcName, const std::string& strToEval)
       std::ostringstream oss; oss << "evalPy failed : " << errorDetails;
       throw Exception(oss.str());
     }
-  AutoPyRef res(PyEval_EvalCode(reinterpret_cast<PyCodeObject *>((PyObject *)code),context,context));
+  AutoPyRef res(PyEval_EvalCode((PyObject *)code,context,context));
   PyObject *ret(PyDict_GetItemString(context,funcName.c_str())); //borrowed ref
   if(!ret)
     throw YACS::Exception("evalPy : Error on returned func !");
index b6b7bc47d39a80505bef12575e6cddd93be503ff..02e8e302c98f6c22a7b3d1ba24c8b5300898bc0b 100644 (file)
@@ -48,32 +48,32 @@ typedef int Py_ssize_t;
 using namespace YACS::ENGINE;
 using namespace std;
 
-const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import cPickle\n"
+const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import pickle\n"
     "def pickleForVarSimplePyth2009(val):\n"
-    "  return cPickle.dumps(val,-1)\n"
+    "  return pickle.dumps(val,-1)\n"
     "\n";
 
 const char PythonNode::IMPL_NAME[]="Python";
 const char PythonNode::KIND[]="Python";
 
-const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(kws):\n"
-    "  return cPickle.dumps(((),kws),-1)\n"
+    "  return pickle.dumps(((),kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 const char PythonNode::REMOTE_NAME[]="remote";
 
 const char PythonNode::DPL_INFO_NAME[]="my_dpl_localization";
 
-const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(*args,**kws):\n"
-    "  return cPickle.dumps((args,kws),-1)\n"
+    "  return pickle.dumps((args,kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 
@@ -424,7 +424,7 @@ void PythonNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
       serializationInputCorba->length(len);
       for(int i=0; i < len ; i++)
@@ -476,7 +476,7 @@ void PythonNode::executeRemote()
   {
       AutoGIL agil;
       PyObject *args(0),*ob(0);
-      PyObject* resultPython=PyString_FromStringAndSize(resultCorbaC,resultCorba->length());
+      PyObject* resultPython=PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length());
       delete [] resultCorbaC;
       args = PyTuple_New(1);
       PyTuple_SetItem(args,0,resultPython);
@@ -573,7 +573,7 @@ void PythonNode::executeLocal()
     PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
     if(code == NULL)
       {
-        _errorDetails="";
+        _errorDetails=""; 
         PyObject* new_stderr = newPyStdOut(_errorDetails);
         PySys_SetObject((char*)"stderr", new_stderr);
         PyErr_Print();
@@ -581,7 +581,7 @@ void PythonNode::executeLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode(  code, _context, _context);
 
     Py_DECREF(code);
     Py_XDECREF(res);
@@ -737,7 +737,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
       {
         const std::pair<std::string,int>& p(ret[i]);
         PyObject *elt(PyTuple_New(2));
-        PyTuple_SetItem(elt,0,PyString_FromString(p.first.c_str()));
+        PyTuple_SetItem(elt,0,PyBytes_FromString(p.first.c_str()));
         PyTuple_SetItem(elt,1,PyLong_FromLong(p.second));
         PyList_SetItem(ob,i,elt);
       }
@@ -751,7 +751,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
         Py_XDECREF(ob);
         char *serializationInputC(0);
         Py_ssize_t len;
-        if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+        if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
           throw Exception("DistributedPythonNode problem in python pickle");
         serializationInputCorba->length(len);
         for(int i=0; i < len ; i++)
@@ -897,7 +897,7 @@ void PyFuncNode::loadLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode( code, _context, _context);
     Py_DECREF(code);
     Py_XDECREF(res);
 
@@ -981,7 +981,7 @@ void PyFuncNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
 
       serializationInputCorba->length(len);
@@ -1019,7 +1019,7 @@ void PyFuncNode::executeRemote()
   {
       AutoGIL agil;
 
-      PyObject *resultPython(PyString_FromStringAndSize(resultCorbaC,resultCorba->length()));
+      PyObject *resultPython(PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length()));
       delete [] resultCorbaC;
       PyObject *args(PyTuple_New(1)),*ob(0);
       PyTuple_SetItem(args,0,resultPython);
index f9a218a5979f99dbdd31208774e8fae2f0d8027c..8de6f05e36047d4781a0350db5e28a2276883834 100644 (file)
@@ -38,9 +38,9 @@ void releasePyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o=PyObject_CallMethod(data, (char*)"Destroy", (char*)"");
               if(o)
@@ -74,9 +74,9 @@ void registerPyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o= PyObject_CallMethod(data, (char*)"Register", (char*)"") ;
               if(o)
@@ -198,7 +198,7 @@ std::string InputPyPort::getHumanRepr()
   if(!ret)
     return dump();
   std::string retCpp;
-  char *val(PyString_AsString(ret));
+  char *val(PyBytes_AsString(ret));
   if(val)
     retCpp=val;
   Py_XDECREF(ret);
@@ -262,11 +262,11 @@ std::string InputPyPort::dump()
 
 std::string InputPyPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   //DEBTRACE("isString=" << isString);
   PyObject *strPyObj = PyObject_Str(getPyObj());
   //DEBTRACE(PyString_Size(strPyObj));
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   //DEBTRACE(val);
@@ -361,7 +361,7 @@ std::string OutputPyPort::dump()
 std::string OutputPyPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index 31985cf2f7c8a706dbe86fe68fab83cf78ea44fc..d8f746fe56a7c54367a28b3a4a25c11be258bcbc 100644 (file)
@@ -287,14 +287,26 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
           Py_InitializeEx(0); // do not install signal handlers
 #endif
           if (argc > 0 && argv != NULL)
-            PySys_SetArgv(argc, argv);
+            {
+              wchar_t **changed_argv = new wchar_t*[argc];
+              for (int i = 0; i < argc; i++)
+              {
+                changed_argv[i] = Py_DecodeLocale(argv[i], NULL);
+              }
+              PySys_SetArgv(argc, changed_argv);
+            } 
           else
             {
               int pyArgc = 1;
               char* pyArgv[1];
               char defaultName[] = "SALOME_YACS_RUNTIME";
+              wchar_t **changed_pyArgv = new wchar_t*[pyArgc];
               pyArgv[0] = defaultName;
-              PySys_SetArgv(pyArgc, pyArgv);
+              for (int i = 0; i < pyArgc; i++)
+              {
+                changed_pyArgv[i] = Py_DecodeLocale(pyArgv[i], NULL);
+              }
+              PySys_SetArgv(pyArgc, changed_pyArgv);
             }
           PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
           PyEval_SaveThread(); /* Release the thread state */
@@ -336,7 +348,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
             {
               goto out;
             }
-          _api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi);
+          _api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
           Py_DECREF(pyapi);
 
           res=PyRun_String("\n"
index d9ba31c2360d0b410c163edce99cb604223a62db..85c98309e6225b88992e1756417ca0aaadfa2938 100644 (file)
 
 #include <Python.h>
 #include <omniORB4/CORBA.h>
+#include <omniORBpy.h>
 #include "Runtime.hxx"
 
 #include<string>
 #include<set>
-
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBpyAPI
-{
-      PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                       CORBA::Boolean hold_lock);
-      // Convert a C++ object reference to a Python object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                               CORBA::Boolean hold_lock);
-      // Convert a Python object reference to a C++ object reference.
-      // Raises BAD_PARAM if the Python object is not an object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-      // Sets the Python exception state to reflect the given C++ system
-      // exception. Always returns NULL. The caller must hold the Python
-      // interpreter lock.
-};
-//--- end of from omniORBpy.h (not present on Debian Sarge packages)
       
 namespace YACS
 {
index ceb54864e80be69d5f156bcb6c2c68f5fe542018..6ea9787122c49c768b64d29a9608f074215c4e89 100644 (file)
@@ -72,7 +72,7 @@ void SalomePythonNode::load()
   cerr << "---------------SalomePythonNode::load function---------------" << endl;
   list<OutputPort *>::iterator iter;
   string value2Export=((SalomePythonComponent*)_component)->getStringValueToExportInInterp(this);
-  PyObject* ob=PyString_FromString(value2Export.c_str());
+  PyObject* ob=PyBytes_FromString(value2Export.c_str());
   PyDict_SetItemString(_context,PLACEMENT_VAR_NAME_IN_INTERP,ob);
   for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
     {
index c498db26ce43bd8ea11285f9085a94ccbd74f063..027fa3da1945aceb1b4be3abfc91f3ae15a6ab30 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
@@ -127,4 +128,4 @@ INSTALL(TARGETS runtimeTestEchoSrv DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(TARGETS echo_clt DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(FILES CTestTestfileInstall.cmake
         DESTINATION ${LOCAL_TEST_DIR}
-        RENAME CTestTestfile.cmake)
\ No newline at end of file
+        RENAME CTestTestfile.cmake)
index c2ac9edfc7c13f5ec3f0f07492a4add0954e160e..68c964de65301b36f44a96c5e40e116865480308 100644 (file)
@@ -1155,107 +1155,134 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_10"])->load();
   ((ElementaryNode*)_nodeMap["Node_10"])->execute();
   //  CPPUNIT_ASSERT_DOUBLES_EQUAL(10.51, (ElementaryNode*)_nodeMap["Node_10"])
-
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution Python Node_11" );
+  std::cerr << __LINE__ << std::endl;
   ((ElementaryNode*)_nodeMap["Node_11"])->load();
+  std::cerr << __LINE__ << std::endl;
   ((ElementaryNode*)_nodeMap["Node_11"])->execute();
+  std::cerr << __LINE__ << std::endl;
 
   DEBTRACE(" --- execution Python Node_12" );
   ((ElementaryNode*)_nodeMap["Node_12"])->load();
   ((ElementaryNode*)_nodeMap["Node_12"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_16" );
   ((ElementaryNode*)_nodeMap["Node_16"])->load();
   ((ElementaryNode*)_nodeMap["Node_16"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_17" );
   ((ElementaryNode*)_nodeMap["Node_17"])->load();
   ((ElementaryNode*)_nodeMap["Node_17"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_18" );
   ((ElementaryNode*)_nodeMap["Node_18"])->load();
   ((ElementaryNode*)_nodeMap["Node_18"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_19" );
   ((ElementaryNode*)_nodeMap["Node_19"])->load();
   ((ElementaryNode*)_nodeMap["Node_19"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_20" );
   ((ElementaryNode*)_nodeMap["Node_20"])->load();
   ((ElementaryNode*)_nodeMap["Node_20"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_21" );
   ((ElementaryNode*)_nodeMap["Node_21"])->load();
   ((ElementaryNode*)_nodeMap["Node_21"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_29" );
   ((ElementaryNode*)_nodeMap["Node_29"])->load();
   ((ElementaryNode*)_nodeMap["Node_29"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution Python Node_13" );
   ((ElementaryNode*)_nodeMap["Node_13"])->load();
   ((ElementaryNode*)_nodeMap["Node_13"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_22" );
   ((ElementaryNode*)_nodeMap["Node_22"])->load();
   ((ElementaryNode*)_nodeMap["Node_22"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_23" );
   ((ElementaryNode*)_nodeMap["Node_23"])->load();
   ((ElementaryNode*)_nodeMap["Node_23"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_24" );
   ((ElementaryNode*)_nodeMap["Node_24"])->load();
   ((ElementaryNode*)_nodeMap["Node_24"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_27" );
   ((ElementaryNode*)_nodeMap["Node_27"])->load();
   ((ElementaryNode*)_nodeMap["Node_27"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_28" );
   ((ElementaryNode*)_nodeMap["Node_28"])->load();
   ((ElementaryNode*)_nodeMap["Node_28"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_30" );
   ((ElementaryNode*)_nodeMap["Node_30"])->load();
   ((ElementaryNode*)_nodeMap["Node_30"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_32" );
   ((ElementaryNode*)_nodeMap["Node_32"])->load();
   ((ElementaryNode*)_nodeMap["Node_32"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_26" );
   ((ElementaryNode*)_nodeMap["Node_26"])->load();
   ((ElementaryNode*)_nodeMap["Node_26"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_31" );
   ((ElementaryNode*)_nodeMap["Node_31"])->load();
   ((ElementaryNode*)_nodeMap["Node_31"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution Python Node_14" );
   ((ElementaryNode*)_nodeMap["Node_14"])->load();
   ((ElementaryNode*)_nodeMap["Node_14"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution Python Node_15" );
   ((ElementaryNode*)_nodeMap["Node_15"])->load();
   ((ElementaryNode*)_nodeMap["Node_15"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution XML Node_36" );
   ((ElementaryNode*)_nodeMap["Node_36"])->load();
   ((ElementaryNode*)_nodeMap["Node_36"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_33" );
   ((ElementaryNode*)_nodeMap["Node_33"])->load();
   ((ElementaryNode*)_nodeMap["Node_33"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_34" );
   ((ElementaryNode*)_nodeMap["Node_34"])->load();
   ((ElementaryNode*)_nodeMap["Node_34"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution CORBA Node_35" );
   ((ElementaryNode*)_nodeMap["Node_35"])->load();
   ((ElementaryNode*)_nodeMap["Node_35"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- end of execution" );
 }
 
index 2134240b340044261e7c6ac3e2f9f94e1fc4dc01..e33fae63449686db82b609e01d1399ed8ce3e348 100644 (file)
@@ -695,8 +695,6 @@ namespace YACS
           double x;
           if (PyFloat_Check(o))
             x=PyFloat_AS_DOUBLE(o);
-          else if (PyInt_Check(o))
-            x=PyInt_AS_LONG(o);
           else if(PyLong_Check(o))
             x=PyLong_AsLong(o);
           else
@@ -718,9 +716,7 @@ namespace YACS
       static inline long convert(const TypeCode *t,PyObject* o,void*)
         {
           long l;
-          if (PyInt_Check(o))
-            l=PyInt_AS_LONG(o);
-          else if(PyLong_Check(o))
+          if(PyLong_Check(o))
             l=PyLong_AsLong(o);
           else
             {
@@ -741,8 +737,8 @@ namespace YACS
       static inline std::string convert(const TypeCode *t,PyObject* o,void*)
         {
           std::string s;
-          if (PyString_Check(o))
-            s= PyString_AS_STRING(o);
+          if (PyBytes_Check(o))
+            s= PyBytes_AS_STRING(o);
           else
             {
               stringstream msg;
@@ -764,8 +760,6 @@ namespace YACS
           bool l;
           if (PyBool_Check(o))
               l=(o==Py_True);
-          else if (PyInt_Check(o))
-              l=(PyInt_AS_LONG(o)!=0);
           else if(PyLong_Check(o))
               l=(PyLong_AsLong(o)!=0);
           else
@@ -786,15 +780,15 @@ namespace YACS
     {
       static inline std::string convert(const TypeCode *t,PyObject* o,void*,int protocol)
         {
-          if (PyString_Check(o) && strncmp(t->id(),"python",6)!=0)
+          if (PyBytes_Check(o) && strncmp(t->id(),"python",6)!=0)
             {
               // the objref is used by Python as a string (prefix:value) keep it as a string
-              return PyString_AS_STRING(o);
+              return PyBytes_AS_STRING(o);
             }
           if(strncmp(t->id(),"python",6)==0)
             {
               // It's a native Python object pickle it
-              PyObject* mod=PyImport_ImportModule("cPickle");
+              PyObject* mod=PyImport_ImportModule("pickle");
               PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",o,protocol);
               DEBTRACE(PyObject_REPR(pickled) );
               Py_DECREF(mod);
@@ -803,7 +797,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr(PyString_AsString(pickled),PyString_Size(pickled));
+              std::string mystr(PyBytes_AsString(pickled),PyBytes_Size(pickled));
               Py_DECREF(pickled);
               return mystr;
             }
@@ -823,7 +817,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pickled);
+              std::string mystr=PyBytes_AsString(pickled);
               Py_DECREF(pickled);
               return mystr;
             }
@@ -836,7 +830,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pystring);
+              std::string mystr=PyBytes_AsString(pystring);
               Py_DECREF(pystring);
               return mystr;
             }
@@ -954,7 +948,7 @@ namespace YACS
     {
       static inline PyObject* convert(const TypeCode *t,std::string& o)
         {
-          return PyString_FromString(o.c_str());
+          return PyBytes_FromString(o.c_str());
         }
     };
     template <>
@@ -978,12 +972,12 @@ namespace YACS
           if(t->isA(Runtime::_tc_file))
             {
               //It's an objref file. Convert it specially
-              return PyString_FromString(o.c_str());
+              return PyBytes_FromString(o.c_str());
             }
           if(strncmp(t->id(),"python",6)==0)
             {
               //It's a python pickled object, unpickled it
-              PyObject* mod=PyImport_ImportModule("cPickle");
+              PyObject* mod=PyImport_ImportModule("pickle");
               PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",o.c_str(),o.length());
               DEBTRACE(PyObject_REPR(ob));
               Py_DECREF(mod);
@@ -1864,11 +1858,11 @@ namespace YACS
                     }
 
                   PyGILState_STATE gstate = PyGILState_Ensure(); 
-                  PyObject* mod=PyImport_ImportModule("cPickle");
+                  PyObject* mod=PyImport_ImportModule("pickle");
                   PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",s,buffer->length());
                   PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",ob,protocol);
                   DEBTRACE(PyObject_REPR(pickled));
-                  std::string mystr=PyString_AsString(pickled);
+                  std::string mystr=PyBytes_AsString(pickled);
                   Py_DECREF(mod);
                   Py_DECREF(ob);
                   Py_DECREF(pickled);
@@ -2291,7 +2285,7 @@ namespace YACS
       PyObject *s;
       PyGILState_STATE gstate = PyGILState_Ensure(); 
       s=PyObject_Str(ob);
-      std::string ss(PyString_AsString(s),PyString_Size(s));
+      std::string ss(PyBytes_AsString(s),PyBytes_Size(s));
       Py_DECREF(s);
       PyGILState_Release(gstate);
       return ss;
@@ -2493,8 +2487,6 @@ namespace YACS
       {
         if (PyFloat_Check(o))
           return true;
-        else if (PyInt_Check(o))
-          return true;
         else if(PyLong_Check(o))
           return true;
         else
@@ -2507,7 +2499,7 @@ namespace YACS
     template<>
     inline bool checkInt<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyInt_Check(o) || PyLong_Check(o))
+          if (PyLong_Check(o))
             return true;
           else
             {
@@ -2521,8 +2513,6 @@ namespace YACS
       {
           if (PyBool_Check(o))
               return true;
-          else if (PyInt_Check(o))
-              return true;
           else if(PyLong_Check(o))
               return true;
           else
@@ -2536,7 +2526,7 @@ namespace YACS
     template<>
     inline bool checkString<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyBytes_Check(o))
             return true;
           else
             {
@@ -2548,7 +2538,7 @@ namespace YACS
     template<>
     inline bool checkObjref<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyBytes_Check(o))
             return true;
           if(strncmp(t->id(),"python",6)==0) // a Python object is expected (it's always true)
             return true;
index 1f3e47394eb58687c45896a7a8d68b2adb1a5c23..ef7d9c195ab491007550c15a3b3bce64d4813d2d 100644 (file)
@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
   ${SALOME_INCL_PATH}
   ${PTHREAD_INCLUDE_DIRS}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
index d0d45bb5573c2dc27f20da59d4854864720ae1ae..db43272d647ea4bab76356a6e97c30869bf9db6f 100644 (file)
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 %}
 
index 20052f3721d0c1a7544e13ca1baa66ca60fe6019..91901249cbd872ce75be020b269da5e394f73bf1 100644 (file)
@@ -51,6 +51,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index e226522b3c34ec1c131f64e3550e5eb45dbce721..5595702639493acb199d2f648e8ecbf813534421 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index aded3b161eb7f4af0db340bb80590ba129de1faf..394a68b688f87c5e2d812c4a3f4537310b97ef6c 100644 (file)
@@ -238,7 +238,7 @@ void YacsLoaderTest::eschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);
+      char *text = PyBytes_AsString(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
       delete p;
     }
@@ -254,7 +254,7 @@ void YacsLoaderTest::fschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);;
+      char *text = PyBytes_AsString(data);;
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
       delete p;
     }
index c43db52792d2f7dc64277a4ceff1b192c9662f72..c578f3655091592bfd0af4729eb133100a5e5c6f 100755 (executable)
@@ -27,6 +27,7 @@ ADD_DEFINITIONS(
 INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PTHREADS_INCLUDE_DIRS}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index a2ffe302def98059b1b70f42010ca18d286da916..49a00815f085c839171c85056c2d57eeffaab01e 100644 (file)
@@ -33,6 +33,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader
   ${PROJECT_BINARY_DIR}/src/engine_swig
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index e83c6d94629fa3c688cac008785e434d636781d5..6410c08d967fb0b8efab9cd3746e05a59e597a63 100644 (file)
@@ -131,7 +131,7 @@ void YDFXGUIHostParametrizer::applyToEFX()
       YACSEvalParamsForCluster& ps(res->getAddParamsForCluster());
       _clusterAdvInfo->applyToParams(ps);
     }
-  emit readyForRunSignal(true);
+  Q_EMIT readyForRunSignal(true);
 }
 
 QString YDFXGUIHostParametrizer::getNameOfHost()
@@ -148,7 +148,7 @@ void YDFXGUIHostParametrizer::changeMachine(const QString& newMachineSelected)
   ok->setDisabled(!isInterac && !_clusterAdvInfo->isOK());
   if(_wasInteractive!=isInterac)
     {
-      emit interactivityChanged(isInterac);
+      Q_EMIT interactivityChanged(isInterac);
       _wasInteractive=isInterac;
     }
 }
@@ -346,7 +346,7 @@ void YDFXGUIBatchInfo::loadFromSettings(const QSettings& settings)
     }
   bool newOK(isOK());
   _wasOK=newOK;
-  emit statusOfEntryChanged(newOK);
+  Q_EMIT statusOfEntryChanged(newOK);
 }
 
 void YDFXGUIBatchInfo::learnSettings(QSettings& settings) const
@@ -379,7 +379,7 @@ QString YDFXGUIBatchInfo::getNameOfHost()
 
 void YDFXGUIBatchInfo::somethingChanged()
 {
-  emit statusOfEntryChanged(isOK());
+  Q_EMIT statusOfEntryChanged(isOK());
 }
 
 QString YDFXGUIBatchInfo::NormalizeDuration(const QString& txt)
index 80509ce29136fb829ed5a0a336a65a66cae4b498..a0a99f7e400647427cd82485f04ba567f0c9150a 100644 (file)
@@ -29,8 +29,6 @@
 #include <QThread>
 #include <QMutex>
 
-#include "Python.h"
-
 class YACSEvalSession;
 class YACSEvalYFXWrap;
 class YDFXGUIAllPorts;
index f54c4c0943b497650dde5d49177460a2da17ccbf..2ee3c77176ba2d0f3f20c6e306892558aee0a8b0 100644 (file)
@@ -305,7 +305,7 @@ void YDFXGUIInputPortValueEditor::setText(const QString& text)
     {
       if(wasKO)
         {
-          emit statusChanged();
+          Q_EMIT statusChanged();
           disconnect(this,SIGNAL(changeLook()),this,SLOT(applyModificationOfLook()));
         }
     }
@@ -414,7 +414,7 @@ bool YDFXGUIInputPortValueEditor::toggleRandom()
   bool oldOK(isOK());
   bool oldStatus(_inp->isRandomVar());
   _inp->declareRandomnessStatus(!oldStatus);
-  emit statusChanged(); // always emit because this even if newOK and oldOK are the same the upon status can changed !
+  Q_EMIT statusChanged(); // always Q_EMIT because this even if newOK and oldOK are the same the upon status can changed !
   updateGeometry();
   update();
   return _inp->isRandomVar();
@@ -563,7 +563,7 @@ void InputLabel::paintIfNotOn(QPaintEvent *event)
 
 void InputLabel::pressOccured()
 {
-  emit randomnessStatusChanged();
+  Q_EMIT randomnessStatusChanged();
 }
 
 std::vector<ColoredString> InputLabel::textForEmulatedPushButton() const
@@ -651,7 +651,7 @@ void OutputLabel::pressOccured()
 {
   bool oldStatus(_outp->isQOfInterest());
   _outp->setQOfInterestStatus(!oldStatus);
-  emit clicked();
+  Q_EMIT clicked();
 }
 
 std::vector<ColoredString> OutputLabel::textForEmulatedPushButton() const
@@ -719,7 +719,7 @@ void YDFXGUIGatherPorts::somebodyChangedStatus()
       update();
       setWasOKStatus(newStatus);
     }
-  emit theGlobalStatusChanged(newStatus);// emit signal always because of input ports and sequences definitions.
+  Q_EMIT theGlobalStatusChanged(newStatus);// Q_EMIT signal always because of input ports and sequences definitions.
 }
 
 //////////////////
@@ -820,7 +820,7 @@ void YDFXGUIInputPortsSelector::timerEvent(QTimerEvent *e)
           YDFXGUIInputPortValueEditor *childc(qobject_cast<YDFXGUIInputPortValueEditor *>(child));
           if(childc)
             {
-              emit childc->changeLook();
+              Q_EMIT childc->changeLook();
             }
         }
     }
@@ -977,10 +977,10 @@ void YDFXGUIAllPorts::somethingChangedInPorts(bool status)
   bool step1(_in->isOK() && _out->isOK());
   if(!step1)
     {
-      emit sequencesCanBeDefinedSignal(false);
-      emit canBeExecutedSignal(false);
+      Q_EMIT sequencesCanBeDefinedSignal(false);
+      Q_EMIT canBeExecutedSignal(false);
       return ;
     }
-  emit sequencesCanBeDefinedSignal(true);
-  emit canBeExecutedSignal(_in->areSeqWellDefined());
+  Q_EMIT sequencesCanBeDefinedSignal(true);
+  Q_EMIT canBeExecutedSignal(_in->areSeqWellDefined());
 }
index b76d3d6438e81b6e62a4cd32e359dfd412095f19..29b4972381a8ebd21520ab1925c1214734382d25 100644 (file)
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIPushButtons.hxx"
 
 #include "YDFXGUIWrap.hxx"
 #include "YDFXGUISeqInit.hxx"
-#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIHostParametrizer.hxx"
 
 #include "YACSEvalSession.hxx"
@@ -95,7 +95,7 @@ void YDFXGUISeqInitButton::sequenceInitRequested()
   if(dial.exec())
     {
       _state=zeWidget->saveState();
-      emit sequenceWellDefined(true);
+      Q_EMIT sequenceWellDefined(true);
     }
 }
 
@@ -111,7 +111,7 @@ void YDFXGUIRunInfo::startComputation()
   std::fill(_items.begin(),_items.end(),0);
   _computationInProgress=true;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::endComputation()
@@ -119,7 +119,7 @@ void YDFXGUIRunInfo::endComputation()
   _mut.lock();
   _computationInProgress=false;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleOK(int pos)
@@ -127,7 +127,7 @@ void YDFXGUIRunInfo::sampleOK(int pos)
   _mut.lock();
   _items[pos]=1;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleKO(int pos)
@@ -135,7 +135,7 @@ void YDFXGUIRunInfo::sampleKO(int pos)
   _mut.lock();
   _items[pos]=2;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 std::vector<char> YDFXGUIRunInfo::getItems() const
index d10ee7c679627cae2efeeed817381bd9bc187db3..6ac1c99300708676609944e81bd54bc00c7e62f8 100644 (file)
 #ifndef __YDFXGUIPYTHREADSAVER_HXX__
 #define __YDFXGUIPYTHREADSAVER_HXX__
 
+#include "Python.h"
+
 #include "ydfxwidgetsExport.hxx"
 
-#include "Python.h"
 
 class QThread;
 
index 500ec1ad398e67fc757935aba95955e902682e32..05a92e0ede13c98e2f104ff1a2207e34229c4bcd 100644 (file)
@@ -18,6 +18,7 @@
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "Python.h"
 #include "YDFXGUISeqInit.hxx"
 
 #include <QFile>
@@ -31,7 +32,6 @@
 #include <QFileDialog>
 #include <QApplication>
 
-#include "Python.h"
 
 #include "AutoGIL.hxx"
 
@@ -101,7 +101,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
   //
   if(_fileName.isEmpty())
     {
-      emit problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
+      Q_EMIT problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
       return false;
     }
   QFile file(_fileName);
@@ -117,7 +117,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
       double v(line2.toDouble(&isOK));
       if(!isOK)
         {
-          emit problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
+          Q_EMIT problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
           return false;
         }
       _vect.push_back(v);
@@ -203,22 +203,22 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
     AutoPyRef code(Py_CompileString(txt.c_str(),TMP_FILENAME, Py_file_input));
     if(code.get() == NULL)
       {
-        emit problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
         return false;
       }
     AutoPyRef context(PyDict_New());
     PyDict_SetItemString( context, "__builtins__", PyEval_GetBuiltins() );
-    AutoPyRef res(PyEval_EvalCode((PyCodeObject *)code.get(), context, context));
+    AutoPyRef res(PyEval_EvalCode(code.get(), context, context));
     PyObject *item(PyDict_GetItemString(context,name.c_str()));
     //
     if(!item)
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
         return false;
       }
     if(!PyList_Check(item))
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
         return false;
       }
     sz=PyList_Size(item);
@@ -228,7 +228,7 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
         PyObject *val(PyList_GetItem(item,i));
         if(!PyFloat_Check(val))
           {
-            emit problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
+            Q_EMIT problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
             return false;
           }
         _vect[i]=PyFloat_AS_DOUBLE(val);
@@ -409,7 +409,7 @@ YDFXGUISeqLine::YDFXGUISeqLine(QWidget *parent, YACSEvalInputPort *inp):_combo(0
   connect(_combo,SIGNAL(currentIndexChanged(int)),this,SLOT(typeOfAssignmentChanged(int)));
   horizontalLayout->addWidget(_setter);
   _combo->setCurrentIndex(0);
-  emit _combo->currentIndexChanged(0);//to be sure to sync widgets
+  Q_EMIT _combo->currentIndexChanged(0);//to be sure to sync widgets
 }
 
 void YDFXGUISeqLine::loadState(const QMap<QString,QString>& state)
@@ -551,7 +551,7 @@ void YDFXGUISeqInitEff::assignButtonClicked()
 {
   int sz;
   bool verdict(checkConsistency(sz));
-  emit configurationIsOK(verdict);
+  Q_EMIT configurationIsOK(verdict);
 }
 
 void YDFXGUISeqInitEff::applyOnEFX()
@@ -572,7 +572,7 @@ bool YDFXGUISeqInitEff::checkConsistency(int& sz)
         refSz=locSz;
       if(locSz!=refSz)
         {
-          emit line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
+          Q_EMIT line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
           return false;
         }
     }
index 6c85bf55a596db37afca8b4bc1357eb3ac2b5363..477ff7b2df82b6ee4b01742c228d2c8691e433dd 100644 (file)
@@ -74,7 +74,7 @@ void YACSEvalYFXWrap::registerObserver(YACSEvalObserver *observer)
 void YACSEvalYFXWrap::unlockAll()
 {
   _efx->unlockAll();
-  emit lockSignal(false);
+  Q_EMIT lockSignal(false);
 }
 
 void YACSEvalYFXWrap::lockPortsForEvaluation()
@@ -97,7 +97,7 @@ void YACSEvalYFXWrap::lockPortsForEvaluation()
   _efx->lockPortsForEvaluation(inps2,outps2);
   _efx->giveResources();//do not remove this line to generate resource info
   if(!lockedOrNot)
-    emit lockSignal(true);
+    Q_EMIT lockSignal(true);
 }
 
 int YACSEvalYFXWrap::getNbOfItems() const
@@ -132,7 +132,7 @@ YACSEvalYFXWrap::~YACSEvalYFXWrap()
 void YACSEvalYFXWrap::setRunningStatus(bool status)
 {
   if(_isRunning!=status)
-    emit runSignal(status);
+    Q_EMIT runSignal(status);
   _isRunning=status;
 }
 
@@ -143,7 +143,7 @@ void YACSEvalYFXWrap::updateSequencesStatus()
   if(_isSeqOfValsSet!=newStatus)
     {
       _isSeqOfValsSet=newStatus;
-      emit sequencesAreSetSignal(_isSeqOfValsSet);
+      Q_EMIT sequencesAreSetSignal(_isSeqOfValsSet);
     }
 }