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",
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()
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()
# --------------------------------------------------------------------------
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
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
# -----------------------------------------------------------------------------
#
-# 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:
#
# 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']:
#
# 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
#
#
# 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"] \
#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
#
# 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']:
#
# Lancement Container Python local,
- # attente de la disponibilité du Container Python local
+ # attente de la disponibilite du Container Python local
# dans le Naming Service
#
#
# Lancement Container Supervision local,
- # attente de la disponibilité du Container Supervision local
+ # attente de la disponibilite du Container Supervision local
# dans le Naming Service
#
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
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)
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)
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
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
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(
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LIBS)
AC_SUBST(QT_MT_LIBS)
+AC_SUBST(QT_VERS)
AC_LANG_RESTORE
])
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
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)
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(
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 ;;
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)
MOC = @MOC@
UIC = @UIC@
+QT_VERS = @QT_VERS@
#QWT
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" );
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))
{
cout << m4->instanceName() << endl;
}
- catch(CORBA::COMM_FAILURE& ex)
+ catch(CORBA::SystemException& ex)
{
INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
}
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(...)
{
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))
{
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))
{
if (!CORBA::is_nil(theObj))
inc = CosNaming::NamingContext::_narrow(theObj);
if (!CORBA::is_nil(inc)) break;
- } catch( CORBA::COMM_FAILURE& ) {
+ } catch( CORBA::SystemException& ) {
} catch (...) {
}
}
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."
{
string instanceName = compo->instanceName();
}
- catch (CORBA::COMM_FAILURE&)
+ catch (CORBA::SystemException&)
{
INFOS("Caught CORBA::SystemException CommFailure. Engine "
<< path << "does not respond" );
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))
{
{
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
}
{
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();
}
{
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();
}
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();
}
{
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();
}
{
_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();
}
_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();
}
_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();
}
{
_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();
}
{
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();
}
{
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();
}
{
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();
}
{
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();
}
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();
}
{
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();
}
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(...)
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
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
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" )
#-------------------------------------------------------------------------
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
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" )
} 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 (...) {
};
} 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");
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
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)
#ifndef QT_NO_ACTION
+#if QT_VERSION > 0x030005
+#include <qaction.h>
+#define QActionP QAction
+#define QActionPGroup QActionGroup
+#else
+
class QActionPPrivate;
class QActionPGroupPrivate;
class QStatusBar;
#endif
+#endif // QT_VERSION
+
#endif
#include "qlineedit.h"
#endif // QT_H
+#if QT_VERSION > 0x030005
+#include <qfiledialog.h>
+#define QFileDialogP QFileDialog
+#else
+
#ifndef QT_NO_FILEDIALOG
class Q_EXPORT QFileIconProviderP : public QObject
#endif
+#endif // QT_VERSION
+
#endif // QFILEDIALOG_H
#include <qpainter.h>
#include <qdrawutil.h>
#include <qbitmap.h>
+#include <qlayout.h>
#include <private/qlayoutengine_p.h>
#if QT_VERSION < 300
#include <qlist.h>
#include <qlabel.h>
#endif // QT_H
+#if QT_VERSION > 0x030005
+#include <qworkspace.h>
+#define QWorkspaceP QWorkspace
+#else
+
class QWorkspacePChild;
class QShowEvent;
class QWorkspacePPrivate;
QTitleBarPPrivate *d;
};
-
+#endif // QT_VERSION
#endif // QWORKSPACEP_H
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))
{
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))
{
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;
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)
// 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;
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);
#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
{
#include <string>
#include <vector>
-#include <Python.h>
+#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
#include <cStringIO.h>
#include <qmutex.h>
-#include "PyInterp_base.h"
#include "utilities.h"
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
}
_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 = "<<this<<"; _gtstate = "<<_gtstate);
}
// Create cStringIO to capture stdout and stderr
- //PycString_IMPORT;
- PycStringIO = (PycStringIO_CAPI *)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI");
+ PycString_IMPORT;
+ //PycStringIO = (PycStringIO_CAPI *)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI");
_vout = PycStringIO->NewOutput(128);
_verr = PycStringIO->NewOutput(128);
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()
{
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__"));
#include <string>
#include <iostream>
-#include <Python.h>
+// include order important!
+// pthread then python then qt
+#include <pthread.h> // must be before Python.h !
+#include <Python.h> // must be before qt includes ...
class QSemaphore;
class QMutex;
~PyInterp_base();
virtual void initialize();
+ static void init_python();
int run(const char *command);
PyObject * _vout;
PyObject * _verr;
PyObject * _g;
+ PyObject * _codeop;
std::list<std::string> _history;
std::list<std::string>::iterator _ith;
bool _atFirst;
#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"
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) ;
#include <qcombobox.h>
#include <qpushbutton.h>
-// VSR (18/01/2005): use patched QFileDialog only for the official 3.0.5 version of Qt
-#if QT_VERSION == 0x030005
#include <qfiledialogP.h>
-#else
-#include <qfiledialog.h>
-#define QFileDialogP QFileDialog
-#endif
#include "QAD.h"
#include "QAD_FileValidator.h"
// 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"
#ifndef QAD_PyEditor_H
#define QAD_PyEditor_H
+#include "QAD_PyInterp.h" // this include must be first (see PyInterp_base.h)!
#include <qtextedit.h>
#include <qevent.h>
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 = "<<this<<"; _tstate = "<<_tstate);
void QAD_PyInterp::initContext()
{
+ /*
+ * The GIL is assumed to be held
+ * It is the caller responsability caller to acquire the GIL
+ * It will still be held on initContext output
+ */
PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context)
if(!m){
if(MYDEBUG) MESSAGE("problem...");
#ifndef _QAD_PYINTERP_H_
#define _QAD_PYINTERP_H_
-#include "PyInterp_base.h"
+#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
class QAD_PyInterp : public PyInterp_base
{
-#include "QAD_PyInterp_mono.h"
+#include "QAD_PyInterp_mono.h" // this include must be first (see PyInterp_base.h)!
#include "utilities.h"
using namespace std;
#ifndef _QAD_PYINTERP_MONO_H_
#define _QAD_PYINTERP_MONO_H_
-#include "PyInterp_base.h"
+#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
class QAD_PyInterp_mono: public PyInterp_base
{
// Module : SALOME
// $Header$
+#include "QAD_PyEditor.h" // this include must be first (see PyInterp_base.h)!
#include "QAD_RightFrame.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_StudyFrame.h"
#include "QAD_Tools.h"
-#include "QAD_PyEditor.h"
#include "QAD_PyInterp.h"
#include <qvaluelist.h>
\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"
#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"
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();
\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"
#include "QAD_Desktop.h"
#include "QAD_Study.h"
#include "QAD_ObjectBrowser.h"
-#include "QAD_PyInterp.h"
#include <qvaluelist.h>
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(...)
# 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)
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "utilities.h"
+
+#if QT_VERSION > 0x030005
+#include <sipAPISalomePyQt.h>
+#else
#include <sipSalomePyQtDeclSalomePyQt.h>
+#endif
+
#include <sipqtQWorkspace.h>
#include <sipqtQPopupMenu.h>
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){
//=============================================================================
-// 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
#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
%Import qtmod.sip
+
class SALOME_Selection : QObject
{
+
%HeaderCode
#include <SALOME_Selection.h>
%End
+
public:
SALOME_Selection(const QString &);
void Clear();
class SalomePyQt
{
+
%HeaderCode
#include <SalomePyQt.hxx>
%End
--- /dev/null
+%Module SalomePyQt
+
+%Import qtmod.sip
+
+class SALOME_Selection : QObject
+{
+%TypeHeaderCode
+#include <SALOME_Selection.h>
+%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 <SalomePyQt.hxx>
+%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&);
+};
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)
#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
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:
"""
"""
-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
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 :
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 : <module_name> and <module_name>__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():
"""
sys.modules["_omnipy.poa_func"]=_omnipy.poa_func
sys.modules["_omnipy.poamanager_func"]=_omnipy.poamanager_func
sys.modules["_omnipy.orb_func"]=_omnipy.orb_func
+
# File : salome_shared_modules.py
# Module : SALOME
-from SALOME_utilities import *
"""
This module with help of import_hook and *_shared_modules
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
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
#
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
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();
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);
Session_ServerThread::~Session_ServerThread()
{
- //MESSAGE("~Session_ServerThread "<< _argv[0]);
+ MESSAGE("~Session_ServerThread "<< _argv[0]);
}
//=============================================================================
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))
{