-// 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
// Author: Sergey LITONIN
#ifdef WIN32
-// E.A. : On windows with python 2.6, there is a conflict
-// E.A. : between pymath.h and Standard_math.h which define
-// E.A. : some same symbols : acosh, asinh, ...
-#include <Standard_math.hxx>
-#include <pymath.h>
+ // E.A. : On windows with python 2.6, there is a conflict
+ // E.A. : between pymath.h and Standard_math.h which define
+ // E.A. : some same symbols : acosh, asinh, ...
+ #include <Standard_math.hxx>
+ #ifndef DISABLE_PYCONSOLE
+ #include <pymath.h>
+ #endif
#endif
-#include "SalomeApp_PyInterp.h" // WARNING! This include must be the first!
+#ifndef DISABLE_PYCONSOLE
+ #include "SalomeApp_PyInterp.h" // WARNING! This include must be the first!
+ #include <PyConsole_Console.h>
+ #include "SalomeApp_NoteBook.h"
+#endif
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_VisualState.h"
#include "SalomeApp_StudyPropertiesDlg.h"
#include "SalomeApp_LoadStudiesDlg.h"
-#include "SalomeApp_NoteBook.h"
-
#include "SalomeApp_ExitDlg.h"
#include <LightApp_Application.h>
// temporary commented
//#include <OB_ListItem.h>
-#include <PyConsole_Console.h>
#include <Utils_ORB_INIT.hxx>
#include <Utils_SINGLETON.hxx>
updateObjectBrowser(true);
}
+#ifndef DISABLE_PYCONSOLE
// import/execute python scripts
if ( pyfiles.count() > 0 && activeStudy() ) {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
}
}
}
+#endif
} else {
LightApp_Application::start();
SALOME_EventFilter::Init();
createExtraActions();
+#ifndef DISABLE_PYCONSOLE
+#ifndef DISABLE_SALOMEOBJECT
// import Python module that manages SALOME plugins
{
PyLockWrapper lck; // acquire GIL
PyErr_Print();
}
// end of SALOME plugins loading
+#endif
+#endif
}
QString command = QString("execfile(r\"%1\")").arg(aFile);
+#ifndef DISABLE_PYCONSOLE
PyConsole_Console* pyConsole = pythonConsole();
if ( pyConsole )
pyConsole->exec( command );
+#endif
}
}
connect( aStudy, SIGNAL( saved ( SUIT_Study* ) ), this, SLOT( onStudySaved ( SUIT_Study* ) ) );
connect( aStudy, SIGNAL( closed ( SUIT_Study* ) ), this, SLOT( onStudyClosed ( SUIT_Study* ) ) );
+#ifndef DISABLE_PYCONSOLE
//to receive signal in application that NoteBook's variable was modified
connect( aStudy, SIGNAL(notebookVarUpdated(QString)),
this, SIGNAL(notebookVarUpdated(QString)) );
+#endif
return aStudy;
}
{
QString command = QString("execfile(r\"%1\")").arg(aFile);
+#ifndef DISABLE_PYCONSOLE
PyConsole_Console* pyConsole = pythonConsole();
if ( pyConsole )
pyConsole->exec( command );
+#endif
}
}
QWidget* SalomeApp_Application::createWindow( const int flag )
{
QWidget* wid = 0;
+#ifndef DISABLE_PYCONSOLE
if ( flag != WT_PyConsole ) wid = LightApp_Application::createWindow(flag);
+#else
+ wid = LightApp_Application::createWindow(flag);
+#endif
SUIT_ResourceMgr* resMgr = resourceMgr();
*/
}
}
+#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), new SalomeApp_PyInterp() );
}
wid = getNoteBook();
}
+#endif
return wid;
}
}
-/*!Global utility funciton, returns selected GUI Save point object's ID */
+/*!Global utility function, returns selected GUI Save point object's ID */
int getSelectedSavePoint( const LightApp_SelectionMgr* selMgr )
{
SALOME_ListIO aList;
{
LightApp_Application::onStudyCreated( study );
+#ifndef DISABLE_PYCONSOLE
desktop()->tabifyDockWidget( windowDock( getWindow( WT_NoteBook ) ),
windowDock( getWindow( WT_ObjectBrowser ) ) );
+#endif
loadDockWindowsState();
{
LightApp_Application::onStudyOpened( study );
+#ifndef DISABLE_PYCONSOLE
desktop()->tabifyDockWidget( windowDock( getWindow( WT_NoteBook ) ),
windowDock( getWindow( WT_ObjectBrowser ) ) );
+#endif
loadDockWindowsState();
}
}
+#ifndef DISABLE_PYCONSOLE
/*! Set SalomeApp_NoteBook pointer */
void SalomeApp_Application::setNoteBook( SalomeApp_NoteBook* theNoteBook )
{
{
return myNoteBook;
}
+#endif
/*!
* Define extra actions defined in module definition XML file.
SALOME_View* aView = dynamic_cast<SALOME_View*>( theViewModel );
- if (theList.isEmpty() || !aView || !aStudy)
+ if (theList.isEmpty() || !aStudy)
return;
for ( DataObjectList::iterator itr = theList.begin(); itr != theList.end(); ++itr ) {
LightApp_Displayer* aDisplayer = anObjModule->displayer();
if(aDisplayer) {
if( aDisplayer->canBeDisplayed(obj->entry(), theViewModel->getType()) ) {
- if(aDisplayer->IsDisplayed(obj->entry(),aView))
+ if(aView && aDisplayer->IsDisplayed(obj->entry(),aView))
anObjState = Qtx::ShownState;
else
anObjState = Qtx::HiddenState;
}
+ aStudy->setVisibilityState( obj->entry(), anObjState );
}
- aStudy->setVisibilityState( obj->entry(), anObjState );
}
}
}
void SalomeApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
LightApp_Application::defaultWindows(aMap);
+#ifndef DISABLE_PYCONSOLE
if ( !aMap.contains( WT_NoteBook ) ) {
if ( !myNoteBook ) {
aMap.insert( WT_NoteBook, Qt::LeftDockWidgetArea );
}
}
+#endif
}
/*!
void SalomeApp_Application::currentWindows(QMap<int, int>& aMap) const
{
LightApp_Application::currentWindows( aMap );
+#ifndef DISABLE_PYCONSOLE
if ( !aMap.contains( WT_NoteBook) && myNoteBook )
aMap.insert( WT_NoteBook, Qt::LeftDockWidgetArea );
+#endif
}
+#ifndef DISABLE_PYCONSOLE
//============================================================================
/*! Function : onUpdateStudy
* Purpose : Slot to update the study.
return ok;
}
+#endif
//============================================================================
/*! Function : onRestoreStudy
// load study from the temporary directory
QString command = QString( "execfile(r\"%1\")" ).arg( theDumpScript );
+#ifndef DISABLE_PYCONSOLE
PyConsole_Console* pyConsole = app->pythonConsole();
if ( pyConsole )
pyConsole->execAndWait( command );
+#endif
// remove temporary directory
QFileInfo aScriptInfo = QFileInfo( theDumpScript );
if( SalomeApp_Study* newStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) )
{
+#ifndef DISABLE_PYCONSOLE
_PTR(Study) aStudyDS = newStudy->studyDS();
app->getNoteBook()->Init( aStudyDS );
newStudy->updateFromNotebook(theStudyName, theIsStudySaved);
newStudy->Modified();
updateDesktopTitle();
updateActions();
+#endif
}
else
ok = false;
*/
void SalomeApp_Application::afterCloseDoc()
{
+#ifndef DISABLE_PYCONSOLE
// emit signal to restore study from Python script
if ( myNoteBook ) {
emit dumpedStudyClosed( myNoteBook->getDumpedStudyScript(),
myNoteBook->getDumpedStudyName(),
myNoteBook->isDumpedStudySaved() );
}
+#endif
LightApp_Application::afterCloseDoc();
}