From e2d8473c43932b43c58a3ed929b6e659852f9b5c Mon Sep 17 00:00:00 2001 From: mpa Date: Thu, 3 Nov 2016 16:07:16 +0300 Subject: [PATCH] Make some GUI changes --- src/LightApp/LightApp_Application.cxx | 31 +++++++++++---------- src/SalomeApp/SalomeApp_Application.cxx | 26 ++++------------- src/SalomeApp/SalomeApp_Study.cxx | 2 +- src/SalomeApp/resources/SalomeApp_msg_en.ts | 4 --- src/SalomeApp/resources/SalomeApp_msg_fr.ts | 4 --- src/SalomeApp/resources/SalomeApp_msg_ja.ts | 5 ---- src/Session/Session_ServerCheck.cxx | 2 +- 7 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 0f9388e8b..4fffbcb10 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -444,6 +444,8 @@ void LightApp_Application::start() desktop()->statusBar()->showMessage( "" ); LightApp_EventFilter::Init(); + + onNewDoc(); } /*!Closeapplication.*/ @@ -5095,29 +5097,28 @@ bool LightApp_Application::checkExistingDoc() { bool result = true; if( activeStudy() ) { - int answer = SUIT_MessageBox::question( desktop(), - tr( "APPCLOSE_CAPTION" ), + int answer = SUIT_MessageBox::question( desktop(), + tr( "APPCLOSE_CAPTION" ), tr( "STUDYCLOSE_DESCRIPTION" ), - tr( "APPCLOSE_SAVE" ), + tr( "APPCLOSE_SAVE" ), tr( "APPCLOSE_CLOSE" ), tr( "APPCLOSE_CANCEL" ), 0 ); if(answer == 0) { if ( activeStudy()->isSaved() ) { - onSaveDoc(); - closeDoc( false ); - } else if ( onSaveAsDoc() ) { - if( !closeDoc( false ) ) { - result = false; - } - } else { - result = false; - } + onSaveDoc(); + closeDoc( false ); + } + else if ( onSaveAsDoc() ) { + if( !closeDoc( false ) ) + result = false; + } + else + result = false; } - else if( answer == 1 ) { + else if( answer == 1 ) closeDoc( false ); - } else if( answer == 2 ) { + else if( answer == 2 ) result = false; - } } return result; } diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 6d60921dd..3e4fa7ae6 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -206,7 +206,6 @@ void SalomeApp_Application::start() QString hdffile; QStringList pyfiles; - QString loadStudy; for (int i = 1; i < qApp->arguments().size(); i++) { QRegExp rxs ("--study-hdf=(.+)"); @@ -240,14 +239,8 @@ void SalomeApp_Application::start() SALOME_EventFilter::Init(); setProperty("open_study_from_command_line", true); - if ( !hdffile.isEmpty() ) // open hdf file given as parameter + if ( !hdffile.isEmpty() ) // open hdf file given as parameter onOpenDoc( hdffile ); - else if ( pyfiles.count() > 0 ) // create new study - onNewDoc(); - else if (!loadStudy.isEmpty()) {// load study by name - if (onLoadDoc(loadStudy)) - updateObjectBrowser(true); - } setProperty("open_study_from_command_line", QVariant()); #ifndef DISABLE_PYCONSOLE @@ -335,10 +328,14 @@ void SalomeApp_Application::createActions() createAction( ConnectId, tr( "TOT_DESK_CONNECT_STUDY" ), QIcon(), tr( "MEN_DESK_CONNECT" ), tr( "PRP_DESK_CONNECT" ), Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) ); + //no need at this action for mono-study application because study is always exists + action( ConnectId )->setVisible( false ); createAction( DisconnectId, tr( "TOT_DESK_DISCONNECT_STUDY" ), QIcon(), tr( "MEN_DESK_DISCONNECT" ), tr( "PRP_DESK_DISCONNECT" ), Qt::CTRL+Qt::Key_U, desk, false, this, SLOT( onUnloadDoc() ) ); + //no need at this action for mono-study application because study is always exists + action( DisconnectId )->setVisible( false ); int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); @@ -2058,18 +2055,7 @@ void SalomeApp_Application::afterCloseDoc() */ bool SalomeApp_Application::checkExistingDoc() { - bool result = LightApp_Application::checkExistingDoc(); - /*if ( result && !activeStudy() ) { - SALOMEDSClient_StudyManager* aMgr = studyMgr(); - if ( aMgr ) { - std::vector List = studyMgr()->GetOpenStudies(); - if( List.size() > 0 ) { - SUIT_MessageBox::critical( desktop(), tr( "WRN_WARNING" ), tr( "ERR_ACTIVEDOC_LOAD" )); - result = false; - } - } - }*/ // NB!!! - return result; + return LightApp_Application::checkExistingDoc(); } diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index aea2607e1..9027bf160 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -728,7 +728,7 @@ void SalomeApp_Study::closeDocument(bool permanently) SUIT_Desktop* desk = SUIT_Session::session()->activeApplication()->desktop(); bool isBlocked = desk->signalsBlocked(); desk->blockSignals( true ); - studyDS()->Clear(); + SalomeApp_Application::getStudy()->Clear(); desk->blockSignals( isBlocked ); #ifndef DISABLE_PYCONSOLE SalomeApp_Application* app = dynamic_cast( application() ); diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index 58fb8aced..b767eee7a 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -7,10 +7,6 @@ WRN_FILE_NOT_EXIST The file %1 does not exist. - - ERR_ACTIVEDOC_LOAD - A study is already active in your session, but you are not connected to it. Use the Connect button to load it in the interface. - WRN_STUDY_LOCKED Study is locked. diff --git a/src/SalomeApp/resources/SalomeApp_msg_fr.ts b/src/SalomeApp/resources/SalomeApp_msg_fr.ts index 5709c9727..b3c87d068 100755 --- a/src/SalomeApp/resources/SalomeApp_msg_fr.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_fr.ts @@ -7,10 +7,6 @@ WRN_FILE_NOT_EXIST Le fichier %1 n'existe pas. - - ERR_ACTIVEDOC_LOAD - Une étude est déjà chargée dans votre session mais vous n'y êtes pas connectée. Utilisez le bouton "Connecter" pour charger l'étude dans l'interface. - WRN_STUDY_LOCKED L'étude est verrouillée diff --git a/src/SalomeApp/resources/SalomeApp_msg_ja.ts b/src/SalomeApp/resources/SalomeApp_msg_ja.ts index 1d9a98edb..ff59df505 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_ja.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_ja.ts @@ -7,11 +7,6 @@ WRN_FILE_NOT_EXIST ファイル %1 は存在しません。 - - ERR_ACTIVEDOC_LOAD - A study is already active in your session, but you are not connected to it. Use the Connect button to load it in the interface. -スタディはあなたのセッション内ですでにアクティブになっていますが、接続できません。インターフェイス内でそれをロードするための接続用ボタンを使用してください。 - WRN_STUDY_LOCKED スタディがロックされています diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx index 0c1786b24..3e3e062fe 100644 --- a/src/Session/Session_ServerCheck.cxx +++ b/src/Session/Session_ServerCheck.cxx @@ -357,7 +357,7 @@ void Session_ServerCheck::run() CORBA::Object_var obj = NS.Resolve( "/Study" ); SALOMEDS::Study_var study = SALOMEDS::Study::_narrow( obj ); if ( !CORBA::is_nil( study ) ) { - MESSAGE( "/myStudy is found" ); + MESSAGE( "/Study is found" ); study->ping(); MESSAGE( "Study was activated" ); setStep( ++current * myAttempts ); -- 2.39.2