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
if (onLoadDoc(loadStudy))
updateObjectBrowser(true);
}
+ setProperty("open_study_from_command_line", QVariant());
#ifndef DISABLE_PYCONSOLE
// import/execute python scripts
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;
}
// 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;
}