-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <SUIT_ResourceMgr.h>
#include <SUIT_TreeModel.h>
#include <SUIT_DataBrowser.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
#include <LightApp_Displayer.h>
}
break;
}
+#ifndef DISABLE_PYCONSOLE
case 6: //NoteBook variables were modified
{
myStudy->onNoteBookVarUpdate( QString( theID.c_str() ) );
break;
}
+#endif
default:MESSAGE("Unknown event: " << event);break;
} //switch
} //notifyObserverID_real
}
}
+#ifndef DISABLE_PYCONSOLE
void SalomeApp_Study::onNoteBookVarUpdate( QString theVarName)
{
emit notebookVarUpdated( theVarName );
}
+#endif
/*!
Gets study id.
// 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(const SALOME_Exception& ex) {
+ 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"));
+ return false;
+ }
+
if ( !study )
return false;
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(const SALOME_Exception& ex) {
+ 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"));
+ return false;
+ }
+
if ( !study )
return false;
_PTR(Study) studyPtr = studyDS();
if ( studyPtr )
{
- if(permanently) {
+ if ( myObserver )
+ myStudyDS->detach( myObserver->_this() );
+ if ( permanently ) {
SalomeApp_Application::studyMgr()->Close( studyPtr );
}
SALOMEDSClient_Study* aStudy = 0;
}
}
+#ifndef DISABLE_PYCONSOLE
/*!
Mark the study as saved in the file
\param theFileName - the name of file
studyDS()->Name(theFileName.toStdString());
setIsSaved( isSaved );
}
+#endif
LightApp_DataObject* SalomeApp_Study::findObjectByEntry( const QString& theEntry )
{