]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0023184: [CEA 1605] SALOME freezes while loading an empty study
authorvsr <vsr@opencascade.com>
Fri, 16 Oct 2015 10:39:49 +0000 (13:39 +0300)
committervsr <vsr@opencascade.com>
Thu, 29 Oct 2015 06:55:32 +0000 (09:55 +0300)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Study.cxx

index 309f6586699647fd13aa8833135c21959b455ce6..11d041cb7b1d981046b13b446671176f0af93d85 100644 (file)
@@ -237,6 +237,7 @@ void SalomeApp_Application::start()
     LightApp_Application::start();
     SALOME_EventFilter::Init();
 
+    setProperty("open_study_from_command_line", true);
     if ( !hdffile.isEmpty() )       // open hdf file given as parameter
       onOpenDoc( hdffile );
     else if ( pyfiles.count() > 0 ) // create new study
@@ -245,6 +246,7 @@ void SalomeApp_Application::start()
       if (onLoadDoc(loadStudy))
         updateObjectBrowser(true);
     }
+    setProperty("open_study_from_command_line", QVariant());
 
 #ifndef DISABLE_PYCONSOLE
     // import/execute python scripts
index 3211ad20a8938db4a3ebd1a140f714b70a0aad0e..8598e2bdb9b52c409bd9c5708a1f90e564e096f0 100644 (file)
@@ -467,17 +467,23 @@ bool SalomeApp_Study::createDocument( const QString& theStr )
   QString aName = newStudyName();
 
   _PTR(Study) study;
+  bool showError = !application()->property("open_study_from_command_line").isValid() || 
+    !application()->property("open_study_from_command_line").toBool();
   try {
     study = _PTR(Study)( SalomeApp_Application::studyMgr()->NewStudy( aName.toUtf8().data() ) );
   }
   catch(const SALOME_Exception& ex) {
-    SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
-                               tr("ERR_ERROR"), tr(ex.what()));
+    application()->putInfo(tr(ex.what()));
+    if ( showError )
+      SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+                                 tr("ERR_ERROR"), tr(ex.what()));
     return false;
   } 
   catch(...) {
-    SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
-                               tr("ERR_ERROR"), tr("CREATE_DOCUMENT_PROBLEM"));
+    application()->putInfo(tr("CREATE_DOCUMENT_PROBLEM"));
+    if ( showError )
+      SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+                                 tr("ERR_ERROR"), tr("CREATE_DOCUMENT_PROBLEM"));
     return false;
   }
 
@@ -517,17 +523,23 @@ bool SalomeApp_Study::openDocument( const QString& theFileName )
 
   // initialize myStudyDS, read HDF file
   _PTR(Study) study;
+  bool showError = !application()->property("open_study_from_command_line").isValid() || 
+    !application()->property("open_study_from_command_line").toBool();
   try {
     study = _PTR(Study) ( SalomeApp_Application::studyMgr()->Open( theFileName.toUtf8().data() ) );
   }
   catch(const SALOME_Exception& ex) {
-    SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
-                               tr("ERR_ERROR"), tr(ex.what()));
+    application()->putInfo(tr(ex.what()));
+    if ( showError )
+      SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+                                 tr("ERR_ERROR"), tr(ex.what()));
     return false;
   } 
   catch(...) {
-    SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
-                               tr("ERR_ERROR"), tr("OPEN_DOCUMENT_PROBLEM"));
+    application()->putInfo(tr("OPEN_DOCUMENT_PROBLEM"));
+    if ( showError )
+      SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+                                 tr("ERR_ERROR"), tr("OPEN_DOCUMENT_PROBLEM"));
     return false;
   }