Salome HOME
Upgrade to paraview 5.4
[modules/gui.git] / src / SALOME_PYQT / SALOME_PYQT_GUILight / SALOME_PYQT_PyModule.cxx
index a344757d4766bf2ce8871127fa4c2aee11d3b98f..459839a9b74c549636310023d832868e505a5644 100644 (file)
@@ -1170,6 +1170,7 @@ void PyModuleHelper::actionActivated()
 void PyModuleHelper::selectionUpdated(const QStringList& entries)
 {
   FuncMsg fmsg( "PyModuleHelper::selectionUpdated()" );
+  MESSAGE("selectionUpdated");
 
   // perform synchronous request to Python event dispatcher
   class SelectionReq : public PyInterp_LockRequest
@@ -1181,10 +1182,13 @@ void PyModuleHelper::selectionUpdated(const QStringList& entries)
       : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
         myHelper( _helper ),
         myEntries( _entries  )
-    {}
+    {
+      MESSAGE("SelectionReq");
+    }
   protected:
     virtual void execute()
     {
+      MESSAGE("execute");
       myHelper->internalSelectionUpdated( myEntries );
     }
   private:
@@ -1192,11 +1196,6 @@ void PyModuleHelper::selectionUpdated(const QStringList& entries)
     const QStringList& myEntries;
   };
 
-  // get sender action
-  QAction* action = qobject_cast<QAction*>( sender() );
-  if ( !action )
-    return;
-
   // post request
   PyInterp_Dispatcher::Get()->Exec( new SelectionReq( myInterp, this, entries ) );
 }
@@ -1953,9 +1952,9 @@ void PyModuleHelper::internalInitialize( CAM_Application* app )
           // parse the return value
           // it should be a map: {integer:integer}
           int aKey, aValue;
-          if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
-            aKey   = PyInt_AsLong( key );
-            aValue = PyInt_AsLong( value );
+          if( key && PyLong_Check( key ) && value && PyLong_Check( value ) ) {
+            aKey   = PyLong_AsLong( key );
+            aValue = PyLong_AsLong( value );
             myWindowsMap[ aKey ] = aValue;
           }
         }
@@ -1973,16 +1972,16 @@ void PyModuleHelper::internalInitialize( CAM_Application* app )
     else {
       // parse the return value
       // result can be one string...
-      if ( PyString_Check( res2 ) ) {
-        myViewMgrList.append( PyString_AsString( res2 ) );
+      if ( PyUnicode_Check( res2 ) ) {
+        myViewMgrList.append( PyUnicode_AsUTF8( res2 ) );
       }
       // ... or list of strings
       else if ( PyList_Check( res2 ) ) {
         int size = PyList_Size( res2 );
         for ( int i = 0; i < size; i++ ) {
           PyObject* value = PyList_GetItem( res2, i );
-          if( value && PyString_Check( value ) ) {
-            myViewMgrList.append( PyString_AsString( value ) );
+          if( value && PyUnicode_Check( value ) ) {
+            myViewMgrList.append( PyUnicode_AsUTF8( value ) );
           }
         }
       }
@@ -2271,6 +2270,7 @@ void PyModuleHelper::internalActionActivated( int id )
 void PyModuleHelper::internalSelectionUpdated(const QStringList& entries)
 {
   FuncMsg fmsg("--- PyModuleHelper::internalSelectionUpdated()");
+  MESSAGE("internalSelectionUpdated");
 
   // Python interpreter should be initialized and Python module should be imported first
   if (!myInterp || !myPyModule)
@@ -2285,6 +2285,7 @@ void PyModuleHelper::internalSelectionUpdated(const QStringList& entries)
 #endif
   if (PyObject_HasAttrString(myPyModule, (char*) "onSelectionUpdated"))
     {
+      MESSAGE("call onSelectionUpdated");
       PyObjWrapper res(PyObject_CallMethod(myPyModule, (char*) "onSelectionUpdated", (char*) "O", sipList.get()));
 
       if (!res)
@@ -2534,8 +2535,8 @@ void PyModuleHelper::internalSave( QStringList& files, const QString& url )
     else {
       // parse the return value
       // result can be one string...
-      if ( PyString_Check( res ) ) {
-        QString astr = PyString_AsString( res );
+      if ( PyUnicode_Check( res ) ) {
+        QString astr = PyUnicode_AsUTF8( res );
         files.append( astr );
       }
       //also result can be a list...
@@ -2543,8 +2544,8 @@ void PyModuleHelper::internalSave( QStringList& files, const QString& url )
         int size = PyList_Size( res );
         for ( int i = 0; i < size; i++ ) {
           PyObject* value = PyList_GetItem( res, i );
-          if ( value && PyString_Check( value ) ) {
-            files.append( PyString_AsString( value ) );
+          if ( value && PyUnicode_Check( value ) ) {
+            files.append( PyUnicode_AsUTF8( value ) );
           }
         }
       }
@@ -2622,8 +2623,8 @@ void PyModuleHelper::internalDumpPython( QStringList& files )
     else {
       // parse the return value
       // result can be one string...
-      if ( PyString_Check( res ) ) {
-        QString astr = PyString_AsString( res );
+      if ( PyUnicode_Check( res ) ) {
+        QString astr = PyUnicode_AsUTF8( res );
         //SCRUTE(astr);
         files.append(astr);
       }
@@ -2632,8 +2633,8 @@ void PyModuleHelper::internalDumpPython( QStringList& files )
         int size = PyList_Size( res );
         for ( int i = 0; i < size; i++ ) {
           PyObject* value = PyList_GetItem( res, i );
-          if( value && PyString_Check( value ) ) {
-            files.append( PyString_AsString( value ) );
+          if( value && PyUnicode_Check( value ) ) {
+            files.append( PyUnicode_AsUTF8( value ) );
           }
         }
       }
@@ -2775,8 +2776,8 @@ QString PyModuleHelper::internalEngineIOR() const
       }
       else {
         // parse the return value, result chould be string
-        if ( PyString_Check( res ) ) {
-          ior = PyString_AsString( res );
+        if ( PyUnicode_Check( res ) ) {
+          ior = PyUnicode_AsUTF8( res );
         }
       }
     }