From 3f6acc5c3b38480b963d07767b396545c27f4605 Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 18 Mar 2005 12:25:21 +0000 Subject: [PATCH] merged from mergeto_V2_2_0_maintainance_18mar05 --- bin/orbmodule.py | 25 ++--- bin/runSalome.py | 16 +-- bin/salomeConsole.py | 2 +- salome_adm/unix/config_files/check_pyqt.m4 | 20 ++-- salome_adm/unix/config_files/check_qt.m4 | 47 +++++++- salome_adm/unix/config_files/check_qwt.m4 | 20 ++-- salome_adm/unix/config_files/check_sip.m4 | 13 +++ salome_adm/unix/make_commence.in | 1 + src/Container/SALOME_Container.cxx | 4 +- .../SALOME_DataTypeCatalog_Server.cxx | 4 +- src/LifeCycleCORBA/TestLifeCycleCORBA.cxx | 2 +- src/Loader/InquireServersQThread.cxx | 8 +- src/Logger/SALOME_Trace.cxx | 2 +- src/Logger/SALOME_Trace.py | 2 +- .../SALOME_MPILifeCycleCORBA.cxx | 2 +- .../SALOME_ModuleCatalog_Server.cxx | 4 +- .../NamingService_WaitForServerReadiness.cxx | 3 +- src/NamingService/SALOME_NamingService.cxx | 60 +++++------ src/NamingService/SALOME_NamingServicePy.py | 18 ++-- src/Notification/NOTIFICATION.cxx | 4 +- src/PatchQt/Makefile.in | 11 +- src/PatchQt/qactionP.h | 8 ++ src/PatchQt/qfiledialogP.h | 7 ++ src/PatchQt/qsplitterP.cxx | 1 + src/PatchQt/qworkspaceP.h | 7 +- src/Registry/SALOME_Registry_Server.cxx | 4 +- .../SALOME_RessourcesCatalog_Server.cxx | 4 +- src/SALOMEDS/SALOMEDS_Server.cxx | 6 +- src/SALOMEGUI/Makefile.in | 2 +- src/SALOMEGUI/PyInterp_PyQt.cxx | 13 ++- src/SALOMEGUI/PyInterp_PyQt.h | 2 +- src/SALOMEGUI/PyInterp_base.cxx | 60 ++++++----- src/SALOMEGUI/PyInterp_base.h | 7 +- src/SALOMEGUI/QAD_Desktop.cxx | 6 +- src/SALOMEGUI/QAD_FileDlg.h | 6 -- src/SALOMEGUI/QAD_PyEditor.cxx | 3 +- src/SALOMEGUI/QAD_PyEditor.h | 1 + src/SALOMEGUI/QAD_PyInterp.cxx | 10 ++ src/SALOMEGUI/QAD_PyInterp.h | 2 +- src/SALOMEGUI/QAD_PyInterp_mono.cxx | 2 +- src/SALOMEGUI/QAD_PyInterp_mono.h | 2 +- src/SALOMEGUI/QAD_RightFrame.cxx | 2 +- src/SALOMEGUI/QAD_Study.cxx | 4 +- src/SALOMEGUI/QAD_StudyFrame.cxx | 2 +- .../TraceCollector_WaitForServerReadiness.cxx | 4 +- src/SALOME_PYQT/Makefile.in | 48 +++++++-- src/SALOME_PYQT/SALOME_PYQT_GUI.cxx | 12 ++- src/SALOME_PYQT/SALOME_PYQT_GUI.h | 4 +- src/SALOME_PYQT/SalomePyQt.sip | 4 + src/SALOME_PYQT/SalomePyQt_v4.sip | 62 +++++++++++ src/SALOME_SWIG_WITHOUTIHM/import_hook.py | 6 +- .../kernel_shared_modules.py | 101 +++++++++++------- .../salome_shared_modules.py | 13 ++- src/Session/Session_ServerLauncher.cxx | 4 +- src/Session/Session_ServerThread.cxx | 4 +- src/TestContainer/TestContainer.cxx | 4 +- 56 files changed, 480 insertions(+), 215 deletions(-) create mode 100644 src/SALOME_PYQT/SalomePyQt_v4.sip diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 627a90987..fdc254472 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -47,7 +47,7 @@ class client: try: self.rootContext = obj._narrow(CosNaming.NamingContext) return - except CORBA.COMM_FAILURE: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None print "Lancement du Naming Service", @@ -62,7 +62,7 @@ class client: obj = self.orb.resolve_initial_references("NameService") self.rootContext = obj._narrow(CosNaming.NamingContext) break - except (CORBA.COMM_FAILURE,CORBA.OBJECT_NOT_EXIST): + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None sys.stdout.write('+') sys.stdout.flush() @@ -77,15 +77,16 @@ class client: def showNScontext(self,context,dec=''): bl,bi=context.list(0) - ok,b=bi.next_one() - while(ok): - for s in b.binding_name : - print "%s%s.%s" %(dec,s.id,s.kind) - if s.kind == "dir": - obj=context.resolve([s]) - scontext = obj._narrow(CosNaming.NamingContext) - self.showNScontext(scontext,dec=dec+' ') + if bi is not None: ok,b=bi.next_one() + while(ok): + for s in b.binding_name : + print "%s%s.%s" %(dec,s.id,s.kind) + if s.kind == "dir": + obj=context.resolve([s]) + scontext = obj._narrow(CosNaming.NamingContext) + self.showNScontext(scontext,dec=dec+' ') + ok,b=bi.next_one() # -------------------------------------------------------------------------- @@ -112,7 +113,7 @@ class client: obj = None except CosNaming.NamingContext.CannotProceed, ex: obj = None - except CORBA.COMM_FAILURE, ex: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): obj = None return obj @@ -155,7 +156,7 @@ class client: obj = None except CosNaming.NamingContext.CannotProceed, ex: obj = None - except CORBA.COMM_FAILURE, ex: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): obj = None return obj diff --git a/bin/runSalome.py b/bin/runSalome.py index ecb27c691..055268c56 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -222,7 +222,7 @@ def kill_salome(args): # ----------------------------------------------------------------------------- # -# Définition des classes d'objets pour le lancement des Server CORBA +# Definition des classes d'objets pour le lancement des Server CORBA # class Server: @@ -508,7 +508,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement Registry Server, - # attente de la disponibilité du Registry dans le Naming Service + # attente de la disponibilite du Registry dans le Naming Service # if 'registry' not in args['embedded']: @@ -518,7 +518,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement Catalog Server, - # attente de la disponibilité du Catalog Server dans le Naming Service + # attente de la disponibilite du Catalog Server dans le Naming Service # @@ -531,7 +531,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement SalomeDS Server, - # attente de la disponibilité du SalomeDS dans le Naming Service + # attente de la disponibilite du SalomeDS dans le Naming Service # os.environ["CSF_PluginDefaults"] \ @@ -575,7 +575,7 @@ def startSalome(args, modules_list, modules_root_dir): #macomm2=['ddd'] #pid = os.spawnvp(os.P_NOWAIT, macomm2[0], macomm2) # - # Attente de la disponibilité du Session Server dans le Naming Service + # Attente de la disponibilite du Session Server dans le Naming Service # import SALOME @@ -593,7 +593,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement Container C++ local, - # attente de la disponibilité du Container C++ local dans le Naming Service + # attente de la disponibilite du Container C++ local dans le Naming Service # if 'cppContainer' in args['standalone']: @@ -603,7 +603,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement Container Python local, - # attente de la disponibilité du Container Python local + # attente de la disponibilite du Container Python local # dans le Naming Service # @@ -614,7 +614,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Lancement Container Supervision local, - # attente de la disponibilité du Container Supervision local + # attente de la disponibilite du Container Supervision local # dans le Naming Service # diff --git a/bin/salomeConsole.py b/bin/salomeConsole.py index 03c0a5e51..5ce7cec64 100755 --- a/bin/salomeConsole.py +++ b/bin/salomeConsole.py @@ -66,7 +66,7 @@ class client(orbmodule.client): try: self.rootContext = obj._narrow(CosNaming.NamingContext) return - except CORBA.COMM_FAILURE: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): print "It's not a valid naming service" self.rootContext = None raise diff --git a/salome_adm/unix/config_files/check_pyqt.m4 b/salome_adm/unix/config_files/check_pyqt.m4 index cb99775f8..9374319a6 100644 --- a/salome_adm/unix/config_files/check_pyqt.m4 +++ b/salome_adm/unix/config_files/check_pyqt.m4 @@ -56,17 +56,17 @@ fi AC_CHECK_FILE("$PYUIC",pyqt_ok=yes,pyqt_ok=no) -if test "x$pyqt_ok" = xyes ; then - AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no) -fi +dnl if test "x$pyqt_ok" = xyes ; then +dnl AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no) +dnl fi -if test "x$pyqt_ok" = xno ; then - AC_CHECK_FILES("$PYQTLIB/qt/qt.py",pyqt_ok=yes,pyqt_ok=no) -fi +dnl if test "x$pyqt_ok" = xno ; then +dnl AC_CHECK_FILES("$PYQTLIB/qt/qt.py",pyqt_ok=yes,pyqt_ok=no) +dnl fi -if test "x$pyqt_ok" = xyes ; then - AC_CHECK_FILE("$PYQTLIB/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no) -fi +dnl if test "x$pyqt_ok" = xyes ; then +dnl AC_CHECK_FILE("$PYQTLIB/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no) +dnl fi if test "x$pyqt_ok" = xyes ; then AC_CHECK_FILES("$PYQT_SIPS/qtmod.sip",pyqt_ok=yes,pyqt_ok=no) @@ -78,7 +78,7 @@ fi if test "x$pyqt_ok" = xyes ; then PYQT_ROOT=$PYQTDIR PYQT_INCLUDES="-I$PYQT_SIPS" - PYQT_LIBS="-L$PYQTLIB -lqtcmodule" + PYQT_LIBS="-L$PYQTLIB " AC_SUBST(PYQT_ROOT) AC_SUBST(PYQT_INCLUDES) AC_SUBST(PYQT_LIBS) diff --git a/salome_adm/unix/config_files/check_qt.m4 b/salome_adm/unix/config_files/check_qt.m4 index b27de2779..b1557decd 100644 --- a/salome_adm/unix/config_files/check_qt.m4 +++ b/salome_adm/unix/config_files/check_qt.m4 @@ -75,6 +75,25 @@ then fi fi +version=`moc -v > mocversion 2>&1;cut -c40-44 mocversion;rm -rf mocversion` +case "$version" in + 3.3.3) + QT_VERS=v3_3_3 + AC_MSG_RESULT(QT3.3.3 install detected) + qt_ok=yes;; + 3.0.5) + AC_MSG_RESULT(QT3.0.5 install detected) + QT_VERS=v3_0_5 + qt_ok=yes;; + *) + AC_MSG_RESULT(qt version $version not supported) + qt_ok=no + QT_VERS=no ;; +esac + +AC_SUBST(QT_VERS) +AC_MSG_RESULT(qt version $QT_VERS ) + AC_SUBST(QTDIR) QT_ROOT=$QTDIR @@ -90,14 +109,31 @@ then AC_MSG_CHECKING(include of qt headers) - if test "x$qt_ok" = "xno" + if test "x$qt_ok" = "xyes" then - AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include) - AC_MSG_RESULT(QTDIR environment variable may be wrong) - else AC_MSG_RESULT(yes) QT_INCLUDES="-I${QT_ROOT}/include -DQT_THREAD_SUPPORT" QT_MT_INCLUDES="-I${QT_ROOT}/include -DQT_THREAD_SUPPORT" + else + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$QTDIR/include/qt3" + + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER(qapp.h,qt_ok=yes ,qt_ok=no) + + CPPFLAGS=$CPPFLAGS_old + + AC_MSG_CHECKING(include of qt headers) + + if test "x$qt_ok" = "xno" + then + AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include) + AC_MSG_RESULT(QTDIR environment variable may be wrong) + else + AC_MSG_RESULT(yes) + QT_INCLUDES="-I${QT_ROOT}/include/qt3 -DQT_THREAD_SUPPORT" + QT_MT_INCLUDES="-I${QT_ROOT}/include/qt3 -DQT_THREAD_SUPPORT" + fi fi fi @@ -108,7 +144,7 @@ then LIBS="$LIBS -L$QTDIR/lib -lqt-mt $OGL_LIBS" CXXFLAGS_old=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -I$QTDIR/include" + CXXFLAGS="$CXXFLAGS $QT_MT_INCLUDES" AC_CACHE_VAL(salome_cv_lib_qt,[ AC_TRY_LINK( @@ -143,6 +179,7 @@ AC_SUBST(QT_ROOT) AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LIBS) AC_SUBST(QT_MT_LIBS) +AC_SUBST(QT_VERS) AC_LANG_RESTORE diff --git a/salome_adm/unix/config_files/check_qwt.m4 b/salome_adm/unix/config_files/check_qwt.m4 index 4e541d70d..21b15fa3a 100644 --- a/salome_adm/unix/config_files/check_qwt.m4 +++ b/salome_adm/unix/config_files/check_qwt.m4 @@ -22,18 +22,24 @@ AC_ARG_WITH(qwt_inc, ]) if test -z $QWTHOME; then + AC_MSG_RESULT(QWTHOME not defined) exits_ok=no AC_CHECK_FILE("/usr/local/lib/libqwt.so",exits_ok=yes,exits_ok=no) if test "x$exits_ok" = "xyes"; then QWTHOME="/usr/local/lib" + AC_MSG_RESULT(libqwt.so detected in /usr/local/lib) if test -z $QWT_INCLUDES; then QWT_INCLUDES="/usr/local/include/qwt" fi else - QWTHOME="/usr/lib" - if test -z $QWT_INCLUDES; then - QWT_INCLUDES="/usr/include/qwt" - fi + AC_CHECK_FILE("/usr/lib/libqwt.so",exits_ok=yes,exits_ok=no) + if test "x$exits_ok" = "xyes"; then + QWTHOME="/usr/lib" + AC_MSG_RESULT(libqwt.so detected in /usr/lib) + if test -z $QWT_INCLUDES; then + QWT_INCLUDES="/usr/include/qwt" + fi + fi fi else if test -z $QWT_INCLUDES; then @@ -50,7 +56,8 @@ else AC_LANG_CPLUSPLUS CPPFLAGS_old=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$QWT_INCLUDES" - CPPFLAGS="$CPPFLAGS -I$QTDIR/include" + CPPFLAGS="$CPPFLAGS $QT_INCLUDES" +# CPPFLAGS="$CPPFLAGS -I$QTDIR/include" AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no) @@ -70,7 +77,8 @@ then LIBS="$LIBS -L$QTDIR/lib -lqt-mt -L$QWTHOME/lib -lqwt" CXXFLAGS_old=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -I$QTDIR/include -I$QWT_INCLUDES" + CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$QWT_INCLUDES" +# CXXFLAGS="$CXXFLAGS -I$QTDIR/include -I$QWT_INCLUDES" AC_CACHE_VAL(salome_cv_lib_qwt,[ AC_TRY_LINK( diff --git a/salome_adm/unix/config_files/check_sip.m4 b/salome_adm/unix/config_files/check_sip.m4 index 84c2beaf7..84d35f629 100644 --- a/salome_adm/unix/config_files/check_sip.m4 +++ b/salome_adm/unix/config_files/check_sip.m4 @@ -38,6 +38,8 @@ else SIP_VERS=new ;; 3.10*) SIP_VERS=new2 ;; + 4.1*) + SIP_VERS=v4_1 ;; *) AC_MSG_RESULT(sip version $version not supported) SIP_VERS=no ;; @@ -83,6 +85,17 @@ else AC_CHECK_FILE($PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages/libsip.so,sip_ok=$sip_ok,sip_ok=no) SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages -lsip" fi + + if test "x$SIP_VERS" = "xv4_1" + then + dnl 4.1 install : includes and libs are in python install + AC_MSG_RESULT(4.1 install detected) + sip_ok=yes + AC_CHECK_FILE($PYTHON_PREFIX/include/python$PYTHON_VERSION/sip.h,sip_ok=$sip_ok,sip_ok=no) + SIP_INCLUDES="${PYTHON_INCLUDES}" + AC_CHECK_FILE($PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages/sip.so,sip_ok=$sip_ok,sip_ok=no) + SIP_LIBS="${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/sip.so" + fi fi AC_SUBST(SIP) diff --git a/salome_adm/unix/make_commence.in b/salome_adm/unix/make_commence.in index 0ab96fb52..faf3e9a0e 100644 --- a/salome_adm/unix/make_commence.in +++ b/salome_adm/unix/make_commence.in @@ -81,6 +81,7 @@ QT_MT_LIBS = @QT_MT_LIBS@ MOC = @MOC@ UIC = @UIC@ +QT_VERS = @QT_VERS@ #QWT diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index dfd501e9f..be08e2197 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -112,8 +112,8 @@ int main(int argc, char* argv[]) theObj = orb->resolve_initial_references("NameService"); if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); - }catch(CORBA::COMM_FAILURE&){ - MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + }catch(CORBA::SystemException&){ + MESSAGE( "Container: CORBA::SystemException: Unable to contact the Naming Service" ); } if(!CORBA::is_nil(inc)){ MESSAGE( "Container: Naming Service was found" ); diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx index d79829163..ff2151361 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx @@ -83,9 +83,9 @@ int main(int argc,char **argv) theObj = orb->resolve_initial_references("NameService"); if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj);} - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { - MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + MESSAGE( "Data Type Catalog: CORBA::SystemException: Unable to contact the Naming Service" ); } if(!CORBA::is_nil(inc)) { diff --git a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx index 49e3b28b0..312cbd211 100644 --- a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx @@ -111,7 +111,7 @@ int main (int argc, char * argv[]) cout << m4->instanceName() << endl; } - catch(CORBA::COMM_FAILURE& ex) + catch(CORBA::SystemException& ex) { INFOS("Caught system exception COMM_FAILURE -- unable to contact the object."); } diff --git a/src/Loader/InquireServersQThread.cxx b/src/Loader/InquireServersQThread.cxx index a293e4766..a26a1dea2 100644 --- a/src/Loader/InquireServersQThread.cxx +++ b/src/Loader/InquireServersQThread.cxx @@ -312,9 +312,9 @@ bool InquireServersQThread::AskServer(int iteration, QString ** errMessage) IsPassed = true; break; } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - MESSAGE("CORBA::COMM_FAILURE: unable to contact the naming service"); + MESSAGE("CORBA::SystemException: unable to contact the naming service"); } catch(...) { @@ -399,7 +399,7 @@ bool InquireServersQThread::pingServer(int iteration, QString& errMessage) break; case 4: { - CORBA::Object_var obj = NS.Resolve("Kernel/ModulCatalog"); + CORBA::Object_var obj = NS.Resolve("/Kernel/ModulCatalog"); SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ; if (!CORBA::is_nil(catalog)) { @@ -413,7 +413,7 @@ bool InquireServersQThread::pingServer(int iteration, QString& errMessage) break; case 5: { - CORBA::Object_var obj = NS.Resolve("Kernel/Session"); + CORBA::Object_var obj = NS.Resolve("/Kernel/Session"); SALOME::Session_var session = SALOME::Session::_narrow(obj) ; if (!CORBA::is_nil(session)) { diff --git a/src/Logger/SALOME_Trace.cxx b/src/Logger/SALOME_Trace.cxx index 1a33333eb..705f066bd 100644 --- a/src/Logger/SALOME_Trace.cxx +++ b/src/Logger/SALOME_Trace.cxx @@ -62,7 +62,7 @@ int SALOME_Trace::Initialize(CORBA::ORB_ptr theOrb) { if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); if (!CORBA::is_nil(inc)) break; - } catch( CORBA::COMM_FAILURE& ) { + } catch( CORBA::SystemException& ) { } catch (...) { } } diff --git a/src/Logger/SALOME_Trace.py b/src/Logger/SALOME_Trace.py index fd507c7c7..2b88171d6 100644 --- a/src/Logger/SALOME_Trace.py +++ b/src/Logger/SALOME_Trace.py @@ -41,7 +41,7 @@ class SALOME_Trace : except CosNaming.NamingContext.NotFound, e : if steps == 1: print "Caught exception: Naming Service can't found Logger" - except CORBA.COMM_FAILURE, e: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): if steps == 1: print "Caught CORBA::SystemException CommFailure" except CORBA.SystemException, e: if steps == 1: print "Caught CORBA::SystemException." diff --git a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx index 9d342ca32..5dfe13fcb 100644 --- a/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx +++ b/src/MPILifeCycleCORBA/SALOME_MPILifeCycleCORBA.cxx @@ -337,7 +337,7 @@ Engines::Component_var SALOME_MPILifeCycleCORBA::FindOrLoad_MPIComponent { string instanceName = compo->instanceName(); } - catch (CORBA::COMM_FAILURE&) + catch (CORBA::SystemException&) { INFOS("Caught CORBA::SystemException CommFailure. Engine " << path << "does not respond" ); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index ad8cdd43d..f2176aa12 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -85,9 +85,9 @@ int main(int argc,char **argv) if(!CORBA::is_nil(orb)) theObj = orb->resolve_initial_references("NameService"); } - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { - INFOS( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + INFOS( "Module Catalog Server: CORBA::SystemException: Unable to contact the Naming Service" ); } if (!CORBA::is_nil(theObj)) { diff --git a/src/NamingService/NamingService_WaitForServerReadiness.cxx b/src/NamingService/NamingService_WaitForServerReadiness.cxx index 7cb1a6bce..fcdf75f13 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.cxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.cxx @@ -66,7 +66,8 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { if (serverName.length() == 0) { - string curdir = NS->Current_Directory(); // to wait for naming service + //string curdir = NS->Current_Directory(); // to wait for naming service + string dummyadr = NS->getIORaddr(); // to wait for naming service found = 1; break; // naming service found } diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index e939d5341..4beb6d4e3 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -151,9 +151,9 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef, { INFOS("!!!Register() : CosNaming::NamingContext::CannotProceed"); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Register() : CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Register() : CORBA::SystemException : unable to contact" << " the naming service"); throw ServiceUnreachable(); } @@ -218,9 +218,9 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef, { INFOS("!!!Register() : CosNaming::NamingContext::InvalidName"); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Register() :CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Register() :CORBA::SystemException : unable to contact" << " the naming service"); throw ServiceUnreachable(); } @@ -270,9 +270,9 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef, INFOS("!!!Register() : CosNaming::NamingContext::AlreadyBound, object will be rebind"); _current_context->rebind(_context_name, ObjRef); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Register() :CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Register() :CORBA::SystemException : unable to contact" << " the naming service"); throw ServiceUnreachable(); } @@ -352,9 +352,9 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) { INFOS("!!!Resolve() : CosNaming::NamingContext::InvalidName"); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Resolve() :CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Resolve() :CORBA::SystemException : unable to contact" << "the naming service"); throw ServiceUnreachable(); } @@ -390,9 +390,9 @@ int SALOME_NamingService::Find(const char* name) { _Find(name,occurence_number); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Find() : CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Find() : CORBA::SystemException : unable to contact" << " the naming service"); throw ServiceUnreachable(); } @@ -495,10 +495,10 @@ bool SALOME_NamingService::Create_Directory(const char* Path) _return_code = false; INFOS("!!!Create_Directory():CosNaming::NamingContext::InvalidName"); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { _return_code = false; - INFOS("!!!Register() :CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Register() :CORBA::SystemException : unable to contact" << " the naming service"); throw ServiceUnreachable(); } @@ -588,10 +588,10 @@ bool SALOME_NamingService::Change_Directory(const char* Path) _return_code = false; INFOS( "!!!Change_Directory() : CosNaming::NamingContext::InvalidName" ) } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { _return_code = false; - INFOS( "!!!Change_Directory() :CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Change_Directory() :CORBA::SystemException : unable to contact" << "the naming service") throw ServiceUnreachable(); } @@ -633,9 +633,9 @@ char* SALOME_NamingService::Current_Directory() { _current_directory(result_path,i,_ref_context,_continue ); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("!!!Current_Directory(): CORBA::COMM_FAILURE : unable to contact" + INFOS("!!!Current_Directory(): CORBA::SystemException : unable to contact" << " the naming service" ) throw ServiceUnreachable(); } @@ -817,9 +817,9 @@ void SALOME_NamingService::Destroy_Name(const char* Path) { INFOS( "!!!Destroy_Name(): CosNaming::NamingContext::CannotProceed" ) } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Name() : CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Destroy_Name() : CORBA::SystemException : unable to contact" << " the naming service") throw ServiceUnreachable(); } @@ -861,9 +861,9 @@ void SALOME_NamingService::Destroy_Name(const char* Path) { INFOS( "!!!Destroy_Name() : CosNaming::NamingContext::InvalidName") } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Name() :CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Destroy_Name() :CORBA::SystemException : unable to contact" << " the naming service") throw ServiceUnreachable(); } @@ -940,9 +940,9 @@ void SALOME_NamingService::Destroy_Directory(const char* Path) { INFOS("!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" ) } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Destroy_Directory() : CORBA::SystemException : unable to contact" << " the naming service" ) throw ServiceUnreachable(); } @@ -984,9 +984,9 @@ void SALOME_NamingService::Destroy_Directory(const char* Path) { INFOS( "!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" ) } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Destroy_Directory() : CORBA::SystemException : unable to contact" << " the naming service" ) throw ServiceUnreachable(); } @@ -1003,9 +1003,9 @@ void SALOME_NamingService::Destroy_Directory(const char* Path) INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::NoEmpty " << Path << " is not empty" ) } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : " + INFOS( "!!!Destroy_Directory() :CORBA::SystemException : " << "unable to contact the naming service") throw ServiceUnreachable(); } @@ -1039,9 +1039,9 @@ void SALOME_NamingService::Destroy_Directory(const char* Path) { INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName") } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : unable to contact" + INFOS( "!!!Destroy_Directory() :CORBA::SystemException : unable to contact" << " the naming service") throw ServiceUnreachable(); } @@ -1070,9 +1070,9 @@ void SALOME_NamingService::_initialize_root_context() ASSERT(!CORBA::is_nil(_root_context)); } - catch(CORBA::COMM_FAILURE&) + catch(CORBA::SystemException&) { - INFOS("CORBA::COMM_FAILURE: unable to contact the naming service"); + INFOS("CORBA::SystemException: unable to contact the naming service"); throw ServiceUnreachable(); } catch(...) diff --git a/src/NamingService/SALOME_NamingServicePy.py b/src/NamingService/SALOME_NamingServicePy.py index 2bc3c553c..ab7f2050d 100644 --- a/src/NamingService/SALOME_NamingServicePy.py +++ b/src/NamingService/SALOME_NamingServicePy.py @@ -64,7 +64,7 @@ class SALOME_NamingServicePy_i: MESSAGE(" Name service not found") else: ok = 1 - except CORBA.COMM_FAILURE, ex: + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): MESSAGE(" Name service not found") time.sleep(0.25) steps = steps - 1 @@ -100,8 +100,8 @@ class SALOME_NamingServicePy_i: MESSAGE ( "Register : CosNaming.NamingContext.InvalidName" ) except CosNaming.NamingContext.CannotProceed, ex: MESSAGE ( "Register : CosNaming.NamingContext.CannotProceed" ) - except CORBA.COMM_FAILURE, ex: - MESSAGE ( "Register : CORBA.COMM_FAILURE" ) + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): + MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" ) if _not_exist: # at least one context of the complete path is not created, we had @@ -132,8 +132,8 @@ class SALOME_NamingServicePy_i: except CosNaming.NamingContext.AlreadyBound, ex: MESSAGE ( "Register : CosNaming.NamingContext.AlreadyBound, object will be rebind" ) self._current_context.rebind(_context_name,ObjRef) - except CORBA.COMM_FAILURE, ex: - MESSAGE ( "Register : CORBA.COMM_FAILURE" ) + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): + MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" ) #------------------------------------------------------------------------- @@ -161,8 +161,8 @@ class SALOME_NamingServicePy_i: except CosNaming.NamingContext.CannotProceed, ex: MESSAGE ( "Resolve : CosNaming.NamingContext.CannotProceed" ) self._obj = None - except CORBA.COMM_FAILURE, ex: - MESSAGE ( "Resolve : CORBA.COMM_FAILURE" ) + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): + MESSAGE ( "Resolve : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" ) self._obj = None return self._obj @@ -191,8 +191,8 @@ class SALOME_NamingServicePy_i: MESSAGE ( "Create_Directory : CosNaming.NamingContext.InvalidName" ) except CosNaming.NamingContext.CannotProceed, ex: MESSAGE ( "Create_Directory : CosNaming.NamingContext.CannotProceed" ) - except CORBA.COMM_FAILURE, ex: - MESSAGE ( "Create_Directory : CORBA.COMM_FAILURE" ) + except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): + MESSAGE ( "Create_Directory : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" ) diff --git a/src/Notification/NOTIFICATION.cxx b/src/Notification/NOTIFICATION.cxx index bbbb92294..e55d0abc7 100644 --- a/src/Notification/NOTIFICATION.cxx +++ b/src/Notification/NOTIFICATION.cxx @@ -50,7 +50,7 @@ CosNA_EventChannel_ptr NOTIFICATION_channel() { } catch(CORBA::ORB::InvalidName& ex) { MESSAGE("NOTIFICATION Error : service required is invalid [does not exist]"); return(channel); - } catch (CORBA::COMM_FAILURE& ex) { + } catch (CORBA::SystemException& ex) { MESSAGE("NOTIFICATION Error : caught system exception COMM_FAILURE"); return(channel); } catch (...) { @@ -70,7 +70,7 @@ CosNA_EventChannel_ptr NOTIFICATION_channel() { }; } catch(CORBA::ORB::InvalidName& ex) { MESSAGE("NOTIFICATION Error : invalid name"); - } catch (CORBA::COMM_FAILURE& ex) { + } catch (CORBA::SystemException& ex) { MESSAGE("NOTIFICATION Error : caught system exception COMM_FAILURE while resolving event channel name"); } catch (...) { MESSAGE("NOTIFICATION Error : caught exception while resolving event channel name"); diff --git a/src/PatchQt/Makefile.in b/src/PatchQt/Makefile.in index d916a9a7a..7909f104a 100644 --- a/src/PatchQt/Makefile.in +++ b/src/PatchQt/Makefile.in @@ -38,13 +38,18 @@ EXPORT_HEADERS = \ qfiledialogP.h # Libraries targets +ifeq ($(QT_VERS),v3_3_3) + LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx +else + LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx +endif LIB = libqsplitterP.la -LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx + qsplitterP_moc.cxx: $(inc_builddir)/qsplitterP.h $(MOC) $(inc_builddir)/qsplitterP.h -o qsplitterP_moc.cxx -qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h +qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h $(MOC) $(inc_builddir)/qworkspaceP.h -o qworkspaceP_moc.cxx qactionP_moc.cxx: $(inc_builddir)/qactionP.h @@ -53,7 +58,7 @@ qactionP_moc.cxx: $(inc_builddir)/qactionP.h qfiledialogP_moc.cxx: $(inc_builddir)/qfiledialogP.h $(MOC) $(inc_builddir)/qfiledialogP.h -o qfiledialogP_moc.cxx -CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++ +CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++ -I/usr/share/qt3/mkspecs/linux-g++ CXXFLAGS+= LDFLAGS+=$(QT_MT_LIBS) diff --git a/src/PatchQt/qactionP.h b/src/PatchQt/qactionP.h index 1fcf05053..160324087 100644 --- a/src/PatchQt/qactionP.h +++ b/src/PatchQt/qactionP.h @@ -53,6 +53,12 @@ #ifndef QT_NO_ACTION +#if QT_VERSION > 0x030005 +#include +#define QActionP QAction +#define QActionPGroup QActionGroup +#else + class QActionPPrivate; class QActionPGroupPrivate; class QStatusBar; @@ -184,4 +190,6 @@ public: #endif +#endif // QT_VERSION + #endif diff --git a/src/PatchQt/qfiledialogP.h b/src/PatchQt/qfiledialogP.h index f7355a193..ab615b753 100644 --- a/src/PatchQt/qfiledialogP.h +++ b/src/PatchQt/qfiledialogP.h @@ -68,6 +68,11 @@ class QFileDialogQFileListView; #include "qlineedit.h" #endif // QT_H +#if QT_VERSION > 0x030005 +#include +#define QFileDialogP QFileDialog +#else + #ifndef QT_NO_FILEDIALOG class Q_EXPORT QFileIconProviderP : public QObject @@ -525,4 +530,6 @@ private: #endif +#endif // QT_VERSION + #endif // QFILEDIALOG_H diff --git a/src/PatchQt/qsplitterP.cxx b/src/PatchQt/qsplitterP.cxx index 3983746b2..15d5ed2aa 100644 --- a/src/PatchQt/qsplitterP.cxx +++ b/src/PatchQt/qsplitterP.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #if QT_VERSION < 300 #include diff --git a/src/PatchQt/qworkspaceP.h b/src/PatchQt/qworkspaceP.h index fb1523735..2197da251 100644 --- a/src/PatchQt/qworkspaceP.h +++ b/src/PatchQt/qworkspaceP.h @@ -54,6 +54,11 @@ #include #endif // QT_H +#if QT_VERSION > 0x030005 +#include +#define QWorkspaceP QWorkspace +#else + class QWorkspacePChild; class QShowEvent; class QWorkspacePPrivate; @@ -350,5 +355,5 @@ private: QTitleBarPPrivate *d; }; - +#endif // QT_VERSION #endif // QWORKSPACEP_H diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index d47523a93..0756e2b70 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -118,9 +118,9 @@ int main( int argc , char **argv ) if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); } - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { - MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + MESSAGE( "Registry Server: CORBA::SystemException: Unable to contact the Naming Service" ); } if(!CORBA::is_nil(inc)) { diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx index b52c63b67..9625d3a0a 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx @@ -85,9 +85,9 @@ int main(int argc,char **argv) if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); } - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { - INFOS( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + INFOS( "Ressources Catalog: CORBA::SystemException: Unable to contact the Naming Service" ); } if(!CORBA::is_nil(inc)) { diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 70919bba0..ff40576da 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -53,9 +53,13 @@ int main(int argc, char** argv) try { // Initialise the ORB. +#if OMNIORB_VERSION >= 4 + const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; + CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; +#else CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); omniORB::MaxMessageSize(100 * 1024 * 1024); - // Obtain a reference to the root POA. +#endif // Obtain a reference to the root POA. // long TIMESleep = 500000000; int NumberOfTries = 40; diff --git a/src/SALOMEGUI/Makefile.in b/src/SALOMEGUI/Makefile.in index d3acbc362..bd8f7efdd 100644 --- a/src/SALOMEGUI/Makefile.in +++ b/src/SALOMEGUI/Makefile.in @@ -221,7 +221,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ContainerManager.idl \ SALOME_Exception.idl -CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) -DSIP_VERS_@SIP_VERS@ LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSalomePrs LIBS+= $(PYTHON_LIBS) diff --git a/src/SALOMEGUI/PyInterp_PyQt.cxx b/src/SALOMEGUI/PyInterp_PyQt.cxx index 440c302f3..29077ca0e 100644 --- a/src/SALOMEGUI/PyInterp_PyQt.cxx +++ b/src/SALOMEGUI/PyInterp_PyQt.cxx @@ -9,7 +9,7 @@ // Module : SALOME // $Header$ -#include "PyInterp_PyQt.h" +#include "PyInterp_PyQt.h" // this include must be first (see PyInterp_base.h)! #include "utilities.h" using namespace std; @@ -30,14 +30,25 @@ PyInterp_PyQt::~PyInterp_PyQt() void PyInterp_PyQt::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(PyInterp_base::_gtstate); _tstate=PyInterp_base::_gtstate; + PyEval_AcquireLock(); PyThreadState_Swap(_tstate); SCRUTE(_tstate); } void PyInterp_PyQt::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); diff --git a/src/SALOMEGUI/PyInterp_PyQt.h b/src/SALOMEGUI/PyInterp_PyQt.h index 74d743e27..4f2f58f9c 100644 --- a/src/SALOMEGUI/PyInterp_PyQt.h +++ b/src/SALOMEGUI/PyInterp_PyQt.h @@ -12,7 +12,7 @@ #ifndef _PYINTERP_PYQT_H_ #define _PYINTERP_PYQT_H_ -#include "PyInterp_base.h" +#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)! class PyInterp_PyQt : public PyInterp_base { diff --git a/src/SALOMEGUI/PyInterp_base.cxx b/src/SALOMEGUI/PyInterp_base.cxx index 153872048..1c4879d1d 100644 --- a/src/SALOMEGUI/PyInterp_base.cxx +++ b/src/SALOMEGUI/PyInterp_base.cxx @@ -13,12 +13,11 @@ #include #include -#include +#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)! #include #include -#include "PyInterp_base.h" #include "utilities.h" @@ -42,13 +41,14 @@ PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState): mySaveThreadState(PyInterp_base::_gtstate) { PyEval_AcquireLock(); - mySaveThreadState = PyThreadState_Swap(myThreadState); + mySaveThreadState = PyThreadState_Swap(myThreadState); // store previous current in save, + // set local in current } PyLockWrapper::~PyLockWrapper(){ - PyThreadState_Swap(mySaveThreadState); - PyEval_ReleaseLock(); + PyThreadState_Swap(mySaveThreadState); // restore previous current (no need to get local, + PyEval_ReleaseLock(); // local thread state* already in _tstate } @@ -129,24 +129,7 @@ void PyInterp_base::initialize() _history.clear(); // start a new list of user's commands _ith = _history.begin(); - if(!_gtstate){ - PyReleaseLock aReleaseLock; - Py_Initialize(); // Initialize the interpreter - PyEval_InitThreads(); // Initialize and acquire the global interpreter lock - PySys_SetArgv(_argc,_argv); // initialize sys.argv - _gtstate = PyThreadState_Get(); - - /* - * salome_shared_modules should be imported only once - */ - salome_shared_modules_module = PyImport_ImportModule("salome_shared_modules"); - if(!salome_shared_modules_module) - { - INFOS("PyInterp_base::initialize() - salome_shared_modules_module == NULL"); - PyErr_Print(); - PyErr_Clear(); - } - } + if(!_gtstate) init_python(); // Here the global lock is released if(MYPYDEBUG) MESSAGE("PyInterp_base::initialize() - this = "<NewOutput(128); _verr = PycStringIO->NewOutput(128); @@ -175,6 +158,31 @@ void PyInterp_base::initialize() initRun(); } +void PyInterp_base::init_python() +{ + /* + * Initialize the main state (_gtstate) if not already done + * The lock is released on init_python output + * It is the caller responsability to acquire it if needed + */ + if(!_gtstate){ + PyReleaseLock aReleaseLock; + Py_Initialize(); // Initialize the interpreter + PyEval_InitThreads(); // Initialize and acquire the global interpreter lock + PySys_SetArgv(_argc,_argv); // initialize sys.argv + _gtstate = PyThreadState_Get(); + /* + * salome_shared_modules should be imported only once + */ + salome_shared_modules_module = PyImport_ImportModule("salome_shared_modules"); + if(!salome_shared_modules_module) + { + INFOS("PyInterp_base::initialize() - salome_shared_modules_module == NULL"); + PyErr_Print(); + PyErr_Clear(); + } + } +} string PyInterp_base::getbanner() { @@ -193,7 +201,7 @@ int PyInterp_base::initRun() PyObjWrapper verr(PyObject_CallMethod(_verr,"reset","")); PyObjWrapper vout(PyObject_CallMethod(_vout,"reset","")); - PyObject *m = PyImport_GetModuleDict(); + //PyObject *m = PyImport_GetModuleDict(); PySys_SetObject("stdout",PySys_GetObject("__stdout__")); PySys_SetObject("stderr",PySys_GetObject("__stderr__")); diff --git a/src/SALOMEGUI/PyInterp_base.h b/src/SALOMEGUI/PyInterp_base.h index 157d5c3f7..739b5d4f0 100644 --- a/src/SALOMEGUI/PyInterp_base.h +++ b/src/SALOMEGUI/PyInterp_base.h @@ -16,7 +16,10 @@ #include #include -#include +// include order important! +// pthread then python then qt +#include // must be before Python.h ! +#include // must be before qt includes ... class QSemaphore; class QMutex; @@ -71,6 +74,7 @@ class PyInterp_base{ ~PyInterp_base(); virtual void initialize(); + static void init_python(); int run(const char *command); @@ -88,6 +92,7 @@ class PyInterp_base{ PyObject * _vout; PyObject * _verr; PyObject * _g; + PyObject * _codeop; std::list _history; std::list::iterator _ith; bool _atFirst; diff --git a/src/SALOMEGUI/QAD_Desktop.cxx b/src/SALOMEGUI/QAD_Desktop.cxx index 5fa319a28..cbc5a92e7 100644 --- a/src/SALOMEGUI/QAD_Desktop.cxx +++ b/src/SALOMEGUI/QAD_Desktop.cxx @@ -37,13 +37,13 @@ #define DEFAULT_BROWSER "mozilla" +#include "QAD_PyEditor.h" // this include must be first (see PyInterp_base.h)! #include "QAD.h" #include "QAD_Help.h" #include "QAD_Tools.h" #include "QAD_Desktop.h" #include "QAD_LeftFrame.h" #include "QAD_RightFrame.h" -#include "QAD_PyEditor.h" #include "QAD_Operation.h" #include "QAD_XmlHandler.h" #include "QAD_MessageBox.h" @@ -3348,8 +3348,12 @@ SALOMEGUI* QAD_Desktop::getComponentGUI( const QString& component ) dir = QAD_Tools::addSlash(dir) ; #ifdef WNT dir = dir + "libSalomePyQtcmodule.dll" ; +#else +#ifdef SIP_VERS_v4_1 + dir = dir + "SalomePyQt.so" ; #else dir = dir + "libSalomePyQtcmodule.so" ; +#endif #endif MESSAGE ( " GUI library = " << dir ); fileInfo.setFile(dir) ; diff --git a/src/SALOMEGUI/QAD_FileDlg.h b/src/SALOMEGUI/QAD_FileDlg.h index a234de43d..71b19cfe2 100644 --- a/src/SALOMEGUI/QAD_FileDlg.h +++ b/src/SALOMEGUI/QAD_FileDlg.h @@ -15,13 +15,7 @@ #include #include -// VSR (18/01/2005): use patched QFileDialog only for the official 3.0.5 version of Qt -#if QT_VERSION == 0x030005 #include -#else -#include -#define QFileDialogP QFileDialog -#endif #include "QAD.h" #include "QAD_FileValidator.h" diff --git a/src/SALOMEGUI/QAD_PyEditor.cxx b/src/SALOMEGUI/QAD_PyEditor.cxx index bfd4ec997..10c70d5fb 100644 --- a/src/SALOMEGUI/QAD_PyEditor.cxx +++ b/src/SALOMEGUI/QAD_PyEditor.cxx @@ -26,8 +26,7 @@ // Module : SALOME // $Header$ -#include "QAD_PyEditor.h" -#include "QAD_PyInterp.h" +#include "QAD_PyEditor.h" // this include must be first (see PyInterp_base.h)! #include "QAD_Application.h" #include "QAD_Desktop.h" #include "QAD_Config.h" diff --git a/src/SALOMEGUI/QAD_PyEditor.h b/src/SALOMEGUI/QAD_PyEditor.h index 941a340df..8a23d6474 100644 --- a/src/SALOMEGUI/QAD_PyEditor.h +++ b/src/SALOMEGUI/QAD_PyEditor.h @@ -29,6 +29,7 @@ #ifndef QAD_PyEditor_H #define QAD_PyEditor_H +#include "QAD_PyInterp.h" // this include must be first (see PyInterp_base.h)! #include #include diff --git a/src/SALOMEGUI/QAD_PyInterp.cxx b/src/SALOMEGUI/QAD_PyInterp.cxx index d7da14e42..a2ea8ac56 100644 --- a/src/SALOMEGUI/QAD_PyInterp.cxx +++ b/src/SALOMEGUI/QAD_PyInterp.cxx @@ -72,6 +72,11 @@ QAD_PyInterp::~QAD_PyInterp() void QAD_PyInterp::initState() { + /* + * The GIL is acquired and will be held on initState output + * It is the caller responsability to release the lock if needed + */ + PyEval_AcquireLock(); _tstate = Py_NewInterpreter(); // create an interpreter and save current state PySys_SetArgv(PyInterp_base::_argc,PyInterp_base::_argv); // initialize sys.argv if(MYDEBUG) MESSAGE("QAD_PyInterp::initState - this = "< diff --git a/src/SALOMEGUI/QAD_Study.cxx b/src/SALOMEGUI/QAD_Study.cxx index b52002cb2..370df0689 100644 --- a/src/SALOMEGUI/QAD_Study.cxx +++ b/src/SALOMEGUI/QAD_Study.cxx @@ -31,6 +31,7 @@ \brief Study for QAD-based application. */ +#include "QAD_PyInterp.h" // this include must be first (see PyInterp_base.h)! #include "QAD.h" #include "QAD_Tools.h" #include "QAD_Desktop.h" @@ -40,9 +41,7 @@ #include "QAD_MessageBox.h" #include "QAD_Application.h" #include "QAD_ObjectBrowser.h" -#include "QAD_PyInterp.h" #include "QAD_Config.h" -#include "QAD_PyInterp.h" #include "utilities.h" @@ -135,6 +134,7 @@ QAD_Study::QAD_Study(QAD_Application* theApp, Selection( QAD_Application::getDesktop()->getComponentUserName( "KERNEL" ) ); /* create python interpreter */ + QAD_PyInterp::init_python(); // initialize Python out of qthread myInitStudyThread = new TInitStudyThread(myInterp,myMutex); myInitStudyThread->start(); diff --git a/src/SALOMEGUI/QAD_StudyFrame.cxx b/src/SALOMEGUI/QAD_StudyFrame.cxx index cfba6977e..fa1642d6d 100644 --- a/src/SALOMEGUI/QAD_StudyFrame.cxx +++ b/src/SALOMEGUI/QAD_StudyFrame.cxx @@ -31,6 +31,7 @@ \brief Frame window which contains QAD_LeftFrame and QAD_RightFrame. */ +#include "QAD_PyInterp.h" // this include must be first (see PyInterp_base.h)! #include "QAD_StudyFrame.h" #include "QAD_StudyFrame.h" #include "QAD_RightFrame.h" @@ -40,7 +41,6 @@ #include "QAD_Desktop.h" #include "QAD_Study.h" #include "QAD_ObjectBrowser.h" -#include "QAD_PyInterp.h" #include diff --git a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx index 9e91b71d9..5512ea926 100644 --- a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx +++ b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx @@ -79,10 +79,10 @@ CORBA::Object_ptr TraceCollector_WaitForServerReadiness(CORBA::ORB_ptr orb, if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); } - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { cout << "TraceCollector_WaitForServerReadiness: " - << "CORBA::COMM_FAILURE: " + << "CORBA::SystemException: " << "Unable to contact the Naming Service" << endl; } catch(...) diff --git a/src/SALOME_PYQT/Makefile.in b/src/SALOME_PYQT/Makefile.in index a72114d91..a581f99b1 100644 --- a/src/SALOME_PYQT/Makefile.in +++ b/src/SALOME_PYQT/Makefile.in @@ -20,44 +20,78 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # SIP C++ Python # SIP defined in make_commence.in -SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS) +#SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS) # SIP input file(s) -SIP_FILES = SalomePyQt.sip +#SIP_FILES = SalomePyQt.sip # SIP-generated C++ source files (corresponding line should be added for each wrapped class # contained by SalomePyQt module) +#SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \ +# $(CURDIR)/sipSalomePyQtSalomePyQt.cc \ +# $(CURDIR)/sipSalomePyQtSALOME_Selection.cc -SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \ +ifeq ($(SIP_VERS),v4_1) +SIP_FLAGS = -t WS_X11 -t Qt_3_3_0 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS) +SIP_SRC=$(CURDIR)/sipSalomePyQtcmodule.cc \ $(CURDIR)/sipSalomePyQtSalomePyQt.cc \ $(CURDIR)/sipSalomePyQtSALOME_Selection.cc +MOC_SRC = sipSalomePyQtcmodule_moc.cxx +MOC_H = sipSalomePyQtcmodule.h +SIP_FILES = SalomePyQt_v4.sip +#LDFLAGS+= -lSalomeGUI +#LDFLAGS+= -lSalomeGUI -module +LDFLAGS+= -shared -lSalomeGUI +# Libraries targets +LIB = SalomePyQt.so +else ifeq ($(SIP_VERS),new2) +SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS) +SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \ + $(CURDIR)/sipSalomePyQtSalomePyQt.cc \ + $(CURDIR)/sipSalomePyQtSALOME_Selection.cc MOC_SRC = SalomePyQtcmodule_moc.cxx MOC_H = SalomePyQtcmodule.h +SIP_FILES = SalomePyQt.sip +LDFLAGS+= -lSalomeGUI -lqtcmodule + +# Libraries targets +LIB = libSalomePyQtcmodule.la + +EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py else +SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS) +SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \ + $(CURDIR)/sipSalomePyQtSalomePyQt.cc \ + $(CURDIR)/sipSalomePyQtSALOME_Selection.cc MOC_SRC = sipSalomePyQtProxySalomePyQt_moc.cxx MOC_H = sipSalomePyQtProxySalomePyQt.h -endif +SIP_FILES = SalomePyQt.sip +LDFLAGS+= -lSalomeGUI -lqtcmodule # Libraries targets - LIB = libSalomePyQtcmodule.la +EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py +endif +endif + LIB_SRC += SalomePyQt.cxx SALOME_PYQT_GUI.cxx $(SIP_SRC) $(MOC_SRC) LIB_MOC = SALOME_PYQT_GUI.h #LIB_MOC += sipSalomePyQtProxySalomePyQt.h -EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py +#EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_ContainerManager.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -LDFLAGS+= -lSalomeGUI -lqtcmodule +#LDFLAGS+= -lSalomeGUI -lqtcmodule +#LDFLAGS+= -lSalomeGUI # Custom build step: generate C++ wrapping according to $(SIP_FILES) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI.cxx index 1ec297726..da744268e 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI.cxx @@ -16,7 +16,13 @@ #include "SALOMEGUI_QtCatchCorbaException.hxx" #include "utilities.h" + +#if QT_VERSION > 0x030005 +#include +#else #include +#endif + #include #include @@ -41,14 +47,14 @@ void SALOME_PYQT_GUI::setWorkSpace() PyLockWrapper aLock = interp->GetLockWrapper(); // Try to import qt module. If it's not possible don't go on - PyObjWrapper qtmodule(PyImport_ImportModule("qt")); + PyObjWrapper qtmodule(PyImport_ImportModule("SalomePyQt")); if(!qtmodule){ PyErr_Print(); return ; } - PyObjWrapper pyws(sipMapCppToSelf( QAD_Application::getDesktop()->getMainFrame(), - sipClass_QWorkspace)); + QWorkspaceP *sipRes=QAD_Application::getDesktop()->getMainFrame(); + PyObjWrapper pyws(sipMapCppToSelf( sipRes, sipClass_QWorkspace)); PyObjWrapper res(PyObject_CallMethod(_module,"setWorkSpace","O",pyws.get())); SCRUTE(pyws->ob_refcnt); if(!res){ diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI.h b/src/SALOME_PYQT/SALOME_PYQT_GUI.h index eb1ca4861..a8bc62a80 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI.h @@ -1,5 +1,5 @@ //============================================================================= -// File : SALOME_PYQT_GUI.hxx +// File : SALOME_PYQT_GUI.h // Created : mer jun 4 17:17:20 UTC 2003 // Author : Paul RASCLE, EDF // Project : SALOME @@ -10,8 +10,8 @@ #ifndef _SALOME_PYQT_GUI_HXX_ #define _SALOME_PYQT_GUI_HXX_ +#include "PyInterp_PyQt.h" // this include must be first (see PyInterp_base.h)! #include "QAD_Desktop.h" -#include "PyInterp_PyQt.h" #include "SALOMEGUI.h" class SALOME_PYQT_GUI: public SALOMEGUI diff --git a/src/SALOME_PYQT/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt.sip index df84b3fc1..ebfac3e00 100644 --- a/src/SALOME_PYQT/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt.sip @@ -2,12 +2,15 @@ %Import qtmod.sip + class SALOME_Selection : QObject { + %HeaderCode #include %End + public: SALOME_Selection(const QString &); void Clear(); @@ -29,6 +32,7 @@ enum MenuName { class SalomePyQt { + %HeaderCode #include %End diff --git a/src/SALOME_PYQT/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt_v4.sip new file mode 100644 index 000000000..69bbcfd13 --- /dev/null +++ b/src/SALOME_PYQT/SalomePyQt_v4.sip @@ -0,0 +1,62 @@ +%Module SalomePyQt + +%Import qtmod.sip + +class SALOME_Selection : QObject +{ +%TypeHeaderCode +#include +%End + +public: + SALOME_Selection(const QString &); + void Clear(); + void ClearIObjects(); + +signals: + void currentSelectionChanged(); +}; + +enum MenuName { + File = 1, + View = 2, + Edit = 3, + Preferences = 4, + Tools = 5, + Window = 6, + Help = 7 +}; + +class SalomePyQt +{ +%TypeHeaderCode +#include +%End + +public: + static QWidget* getDesktop(); + static QWorkspace* getMainFrame(); + static QMenuBar* getMainMenuBar(); + static QPopupMenu* getPopupMenu( const MenuName ); + static SALOME_Selection* getSelection(); + static int getStudyId(); + static void putInfo( const QString& ); + static void putInfo( const QString&, int ); + + static const QString& getActiveComponent(); + + static void updateObjBrowser( int, bool ); + + + static bool removeSettings(QString); + static QString getSetting(QString); + static void addStringSetting(QString, QString, bool); + static void addIntSetting(QString, int, bool); + static void addDoubleSetting(QString, double, bool); + + static QString getFileName(QWidget*, const QString&, const QStringList&, const QString&, bool); + static QStringList getOpenFileNames(QWidget*, const QString&, const QStringList&, const QString&); + static QString getExistingDirectory(QWidget*, const QString&, const QString&); + static void helpContext(const QString&, const QString&); + static bool dumpView(const QString&); +}; diff --git a/src/SALOME_SWIG_WITHOUTIHM/import_hook.py b/src/SALOME_SWIG_WITHOUTIHM/import_hook.py index 1e6613cd3..79725c627 100755 --- a/src/SALOME_SWIG_WITHOUTIHM/import_hook.py +++ b/src/SALOME_SWIG_WITHOUTIHM/import_hook.py @@ -59,9 +59,10 @@ def is_shared(name): def get_shared_imported(name): return shared_imported.get(name) + def set_shared_imported(name,module): shared_imported[name]=module - #print "Module %s shared registered" % name + #print "Module %s shared registered" % name,module def get_shared_imported_with_copy(name): module_dict= shared_imported.get(name) @@ -73,6 +74,7 @@ def set_shared_imported_with_copy(name,module): #print "Module %s shared registered" % name def import_hook(name, globals=None, locals=None, fromlist=None): + #print "import_hook",name,fromlist module=get_shared_imported(name) if module: sys.modules[name]=module @@ -99,6 +101,8 @@ def init_shared_modules(shared_module): global shared_imported, patterns shared_imported=shared_module.shared_imported patterns= shared_module.patterns + for k,v in shared_imported.items(): + if v is not None:sys.modules[k]=v shared_imported["salome_shared_modules"]=shared_module import salome_shared_modules for m in salome_shared_modules.list_modules: diff --git a/src/SALOME_SWIG_WITHOUTIHM/kernel_shared_modules.py b/src/SALOME_SWIG_WITHOUTIHM/kernel_shared_modules.py index 291e27c26..bcdd46381 100755 --- a/src/SALOME_SWIG_WITHOUTIHM/kernel_shared_modules.py +++ b/src/SALOME_SWIG_WITHOUTIHM/kernel_shared_modules.py @@ -1,9 +1,10 @@ """ """ -import glob,os,sys - import import_hook + +import glob,os,sys,string,imp + from import_hook import register_name from import_hook import register_pattern @@ -11,12 +12,68 @@ register_name("qt") register_pattern(lambda(x):x.endswith("_idl")) register_name("omniORB") -register_name("CosNaming") +import omniORB + +# Modify omniORB to use right sys.modules dictionnary +# with multi-interpreter feature +# openModule and newModule are functions of omniORB/__init__.py module +# modified to register modules to share +# Function to return a Python module for the required IDL module name +def openModule(mname, fname=None): + # Salome modification start + import sys + # Salome modification end + + if mname == "CORBA": + mod = sys.modules["omniORB.CORBA"] + elif sys.modules.has_key(mname): + mod = sys.modules[mname] + else: + mod = newModule(mname) + + # Salome modification start + import_hook.set_shared_imported(mname,mod) + # Salome modification end + + + if not hasattr(mod, "__doc__") or mod.__doc__ is None: + mod.__doc__ = "omniORB IDL module " + mname + "\n\n" + \ + "Generated from:\n\n" + + if fname is not None: + mod.__doc__ = mod.__doc__ + " " + fname + "\n" -register_name("Engines") -register_name("SALOME") -register_name("SALOMEDS") -register_name("SALOME_ModuleCatalog") + return mod + +# Function to create a new module, and any parent modules which do not +# already exist +def newModule(mname): + # Salome modification start + import sys + # Salome modification end + + mlist = string.split(mname, ".") + current = "" + mod = None + + for name in mlist: + current = current + name + + if sys.modules.has_key(current): + mod = sys.modules[current] + else: + newmod = imp.new_module(current) + if mod: setattr(mod, name, newmod) + sys.modules[current] = mod = newmod + + current = current + "." + + return mod +# Replace openModule and newModule by modified ones +# to take into account the sys.modules that matches +# the right one (multi-interpreter feature) +omniORB.openModule=openModule +omniORB.newModule=newModule # BE CAREFUL # Engines, SALOME, SALOMEDS must be imported in that order because : @@ -27,36 +84,7 @@ register_name("SALOME_ModuleCatalog") import Engines import SALOME import SALOMEDS - import SALOME_ModuleCatalog -from SALOME_utilities import MESSAGE -# -# We search all Python CORBA (omniorb) modules. -# A Python CORBA module has 2 associated Python packages -# These packages are named : and __POA -# -# Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set. -salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR")) - -# Register all CORBA modules in the path and python modules in shared_modules -path=salome_path.split(":") -# -for rep in path: - rep_salome=os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome") - # Find all the *__POA packages in the path - for elem in glob.glob(os.path.join(rep_salome,"*__POA")): - if os.path.isdir(elem): - # Found a directory (Python package) named *__POA - module__POA=os.path.basename(elem) - module=module__POA[:-5] - MESSAGE( "Register CORBA module: " + module + ". Directory: " + os.path.abspath(elem)[:-5] ) - register_name(module) - - # Now we import modules found in shared_modules directory - for elem in glob.glob(os.path.join(rep_salome,"shared_modules","*.py")): - module=os.path.basename(elem)[:-3] - MESSAGE( "Register Python module: " + module + ". Location: " + os.path.abspath(elem) ) - register_name(module) def init_shared_modules(): """ @@ -73,3 +101,4 @@ def init_shared_modules(): sys.modules["_omnipy.poa_func"]=_omnipy.poa_func sys.modules["_omnipy.poamanager_func"]=_omnipy.poamanager_func sys.modules["_omnipy.orb_func"]=_omnipy.orb_func + diff --git a/src/SALOME_SWIG_WITHOUTIHM/salome_shared_modules.py b/src/SALOME_SWIG_WITHOUTIHM/salome_shared_modules.py index ebc0d1292..56c884176 100755 --- a/src/SALOME_SWIG_WITHOUTIHM/salome_shared_modules.py +++ b/src/SALOME_SWIG_WITHOUTIHM/salome_shared_modules.py @@ -22,7 +22,6 @@ # File : salome_shared_modules.py # Module : SALOME -from SALOME_utilities import * """ This module with help of import_hook and *_shared_modules @@ -51,9 +50,10 @@ Usage: that could be found in the path SALOMEPATH """ +import import_hook + import glob,os,sys -import import_hook # shared_imported, patterns, register_name, register_pattern # will be shared by all Python sub interpretors from import_hook import shared_imported @@ -72,9 +72,12 @@ list_modules=[] path=salome_path.split(":") for rep in path: # Import all *_shared_modules in rep - for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")): + for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages", + "salome","shared_modules","*_shared_modules.py")): try: - m=__import__(os.path.splitext(os.path.basename(f))[0]) + name=os.path.splitext(os.path.basename(f))[0] + register_name(name) + m=__import__(name) list_modules.append(m) except: pass @@ -85,5 +88,5 @@ for rep in path: # for name,module in sys.modules.items(): if import_hook.is_shared(name) and shared_imported.get(name) is None: - #print "Module shared added to shared_imported: ",name + #print "Module shared added to shared_imported: ",name,module shared_imported[name]=module diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx index 769f04d1b..c1b32b7bd 100644 --- a/src/Session/Session_ServerLauncher.cxx +++ b/src/Session/Session_ServerLauncher.cxx @@ -82,9 +82,9 @@ Session_ServerLauncher::~Session_ServerLauncher() void Session_ServerLauncher::run() { - //MESSAGE("Session_ServerLauncher::run"); + MESSAGE("Session_ServerLauncher::run"); _GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex) - //MESSAGE("Server Launcher thread free to go..."); + MESSAGE("Server Launcher thread free to go..."); _GUIMutex->unlock(); CheckArgs(); diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index bb135235c..d3bf23b36 100644 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -80,7 +80,7 @@ Session_ServerThread::Session_ServerThread(int argc, PortableServer::POA_ptr poa, QMutex *GUIMutex) { - //MESSAGE("Session_ServerThread Constructor " << argv[0]); + MESSAGE("Session_ServerThread Constructor " << argv[0]); _argc = argc; _argv = argv; _orb = CORBA::ORB::_duplicate(orb); @@ -99,7 +99,7 @@ Session_ServerThread::Session_ServerThread(int argc, Session_ServerThread::~Session_ServerThread() { - //MESSAGE("~Session_ServerThread "<< _argv[0]); + MESSAGE("~Session_ServerThread "<< _argv[0]); } //============================================================================= diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index e8492fb6e..b668b740b 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -120,9 +120,9 @@ int main (int argc, char * argv[]) if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); } - catch( CORBA::COMM_FAILURE& ) + catch( CORBA::SystemException& ) { - INFOS( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + INFOS( "Test Container: CORBA::SystemException: Unable to contact the Naming Service" ) } if(!CORBA::is_nil(inc)) { -- 2.39.2