From: vsr Date: Fri, 18 Apr 2014 14:11:44 +0000 (+0400) Subject: Catch exception from data server raised when there's active study on a server X-Git-Tag: V7_4_0rc1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=093b350612b993e7f3cfa79abfeb1b6cdcfefd8e;p=modules%2Fgui.git Catch exception from data server raised when there's active study on a server --- diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 070cfef7d..8bb0ee178 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -41,6 +41,9 @@ #include #include #include +#include +#include +#include #include @@ -458,7 +461,15 @@ bool SalomeApp_Study::createDocument( const QString& theStr ) // initialize myStudyDS, read HDF file QString aName = newStudyName(); - _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.toUtf8().data() ) ); + + _PTR(Study) study; + try { + study = _PTR(Study)( SalomeApp_Application::studyMgr()->NewStudy( aName.toUtf8().data() ) ); + } + catch(...) { + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + tr("ERR_ERROR"), tr("ERR_ACTIVE_STUDY_CREATE") ); + } if ( !study ) return false; @@ -494,7 +505,14 @@ bool SalomeApp_Study::openDocument( const QString& theFileName ) MESSAGE( "openDocument" ); // initialize myStudyDS, read HDF file - _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( theFileName.toUtf8().data() ) ); + _PTR(Study) study; + try { + study = _PTR(Study) ( SalomeApp_Application::studyMgr()->Open( theFileName.toUtf8().data() ) ); + } + catch(...) { + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + tr("ERR_ERROR"), tr("ERR_ACTIVE_STUDY_OPEN") ); + } if ( !study ) return false; diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index 446b0292a..d663c6ecb 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -84,6 +84,16 @@ Python file must include only letters, digits and underscores and start from let ERR_NO_VARIABLE Variable with name "%1" doesn't exist + + ERR_ACTIVE_STUDY_CREATE + Cannot create study: there is already an active study in this session. +Launch a new session or close the study. + + + ERR_ACTIVE_STUDY_OPEN + Cannot open study: there is already an active study in this session. +Launch a new session or close the study. + SalomeApp_Application diff --git a/src/SalomeApp/resources/SalomeApp_msg_fr.ts b/src/SalomeApp/resources/SalomeApp_msg_fr.ts index faf47a579..40d7aaa79 100755 --- a/src/SalomeApp/resources/SalomeApp_msg_fr.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_fr.ts @@ -84,6 +84,16 @@ Un fichier Python ne doit être composé que de lettres, chiffres et tirets bas ERR_NO_VARIABLE La variable "%1" n'existe pas. + + ERR_ACTIVE_STUDY_CREATE + Cannot create study: there is already an active study in this session. +Launch a new session or close the study. + + + ERR_ACTIVE_STUDY_OPEN + Cannot open study: there is already an active study in this session. +Launch a new session or close the study. + SalomeApp_Application diff --git a/src/SalomeApp/resources/SalomeApp_msg_ja.ts b/src/SalomeApp/resources/SalomeApp_msg_ja.ts index 819d6272d..d55a84b9b 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_ja.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_ja.ts @@ -83,6 +83,16 @@ ERR_NO_VARIABLE 変数"%1"は存在しません。 + + ERR_ACTIVE_STUDY_CREATE + Cannot create study: there is already an active study in this session. +Launch a new session or close the study. + + + ERR_ACTIVE_STUDY_OPEN + Cannot open study: there is already an active study in this session. +Launch a new session or close the study. + SalomeApp_Application