From: mpa Date: Thu, 27 Feb 2014 11:43:42 +0000 (+0400) Subject: Debug of CMake build procedure X-Git-Tag: V7_4_0a1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=68aee8800d95437a7b8ab577fad288e0d0640613;p=modules%2Fgui.git Debug of CMake build procedure --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 14be7b0be..b82a29a24 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +INCLUDE(CMakeDependentOption) + PROJECT(SalomeGUI C CXX) # Ensure a proper linker behavior: @@ -62,16 +64,19 @@ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) OPTION(SALOME_GUI_USE_OBSERVERS "Use study observers in GUI (advanced)" ON) # Advanced options: +CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF + "NOT SALOME_KERNEL_LIGHT_ONLY" ON) OPTION(SALOME_USE_VTKVIEWER "Enable VTK visualization (Mandatory in classic configurations)" ON) -OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_OCCVIEWER "Enable OCC visualization (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_GLVIEWER "Enable OpenGL visualization (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_GRAPHICSVIEW "Enable GraphicsView visualization (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON) OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON) +CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON + "SALOME_LIGHT_ONLY" ON) -MARK_AS_ADVANCED(SALOME_USE_VTKVIEWER SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW) +MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW) MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER) MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER) @@ -96,6 +101,8 @@ FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C) IF(NOT SALOME_LIGHT_ONLY) FIND_PACKAGE(SalomeOmniORB REQUIRED) FIND_PACKAGE(SalomeOmniORBPy REQUIRED) +ELSE() + ADD_DEFINITIONS("-DGUI_DISABLE_CORBA") ENDIF() IF(SALOME_BUILD_TESTS) ENABLE_TESTING() @@ -124,6 +131,9 @@ ENDIF() # OCCT FIND_PACKAGE(SalomeCAS REQUIRED) +IF(NOT SALOME_USE_OCCVIEWER) + ADD_DEFINITIONS("-DDISABLE_OCCVIEWER") +ENDIF() # Qt4 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL) @@ -135,15 +145,36 @@ FIND_PACKAGE(SalomePyQt4 REQUIRED) IF(SALOME_USE_GLVIEWER) FIND_PACKAGE(SalomeOpenGL) SALOME_LOG_OPTIONAL_PACKAGE(OpenGL SALOME_USE_GLVIEWER) +ELSE() + ADD_DEFINITIONS("-DDISABLE_GLVIEWER") ENDIF() IF(SALOME_USE_VTKVIEWER) # Required components are listed in the FindSalomeVTK.cmake file: FIND_PACKAGE(SalomeVTK 6.0) SALOME_LOG_OPTIONAL_PACKAGE(VTK SALOME_USE_VTKVIEWER) +ELSE() + ADD_DEFINITIONS("-DDISABLE_VTKVIEWER") ENDIF() IF(SALOME_USE_PLOT2DVIEWER) FIND_PACKAGE(SalomeQwt) SALOME_LOG_OPTIONAL_PACKAGE(Qwt SALOME_USE_PLOT2DVIEWER) +ELSE() + ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER") +ENDIF() +IF (NOT SALOME_USE_GRAPHICSVIEW) + ADD_DEFINITIONS("-DDISABLE_GRAPHICSVIEW") +ENDIF() +IF(SALOME_USE_PYCONSOLE) + # Build with obsolete Python module's methods + ADD_DEFINITIONS(-DCALL_OLD_METHODS) +ELSE() + ADD_DEFINITIONS("-DDISABLE_PYCONSOLE") +ENDIF() +IF(NOT SALOME_USE_QXGRAPHVIEWER) + ADD_DEFINITIONS("-DDISABLE_QXGRAPHVIEWER") +ENDIF() +IF(NOT SALOME_USE_SALOMEOBJECT) + ADD_DEFINITIONS("-DDISABLE_SALOMEOBJECT") ENDIF() # Detection summary: @@ -227,8 +258,8 @@ INCLUDE(CMakePackageConfigHelpers) # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" SET(_${PROJECT_NAME}_exposed_targets caf CAM CASCatch DDS Event LightApp LogWindow ObjBrowser OpenGLUtils - QDS qtx SalomeIDLGUI SalomePrs SalomeStyle std SUITApp suit ViewerTools ViewerData - vtkTools vtkEDFOverloads ImageComposer + QDS qtx SalomePrs SalomeStyle std SUITApp suit ViewerTools ViewerData + ImageComposer ) # SALOME object specific targets: @@ -246,7 +277,7 @@ ENDIF(SALOME_USE_GLVIEWER) # VTK specific targets: IF(SALOME_USE_VTKVIEWER) LIST(APPEND _${PROJECT_NAME}_exposed_targets - VTKViewer) + VTKViewer vtkTools vtkEDFOverloads) IF(SALOME_USE_SALOMEOBJECT) LIST(APPEND _${PROJECT_NAME}_exposed_targets SVTK) @@ -288,13 +319,22 @@ ENDIF(SALOME_USE_GRAPHICSVIEW) # Python-based packages specific targets: IF(SALOME_USE_PYCONSOLE) LIST(APPEND _${PROJECT_NAME}_exposed_targets - PyInterp PyConsole SalomePy SalomePyQtGUI SalomePyQtGUILight SalomePyQt) + PyInterp PyConsole SalomePyQtGUILight) + IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomePyQt) + ENDIF() + IF(NOT SALOME_LIGHT_ONLY) + LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomePyQtGUI) + ENDIF() + IF(SALOME_USE_VTKVIEWER) + LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomePy) + ENDIF(SALOME_USE_VTKVIEWER) ENDIF(SALOME_USE_PYCONSOLE) # CORBA specific targets: IF(NOT SALOME_LIGHT_ONLY) LIST(APPEND _${PROJECT_NAME}_exposed_targets - SalomeSession SalomeApp SalomeGuiHelpers SalomeTreeData ToolsGUI) + SalomeIDLGUI SalomeSession SalomeApp SalomeGuiHelpers SalomeTreeData ToolsGUI) ENDIF(NOT SALOME_LIGHT_ONLY) # Add all targets to the build-tree export set diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index 2d1c2ef3a..b658ac406 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -49,13 +49,18 @@ SET(GUI_DEFINITIONS "@KERNEL_DEFINITIONS@") # Options exported by the package: SET(SALOME_GUI_BUILD_DOC @SALOME_BUILD_DOC@) SET(SALOME_GUI_BUILD_TESTS @SALOME_BUILD_TESTS@) -SET(SALOME_LIGHT_ONLY @SALOME_LIGHT_ONLY@) +SET(SALOME_GUI_LIGHT_ONLY @SALOME_LIGHT_ONLY@) # Advanced options -SET(SALOME_USE_OCCVIEWER @SALOME_USE_OCCVIEWER@) -SET(SALOME_USE_GLVIEWER @SALOME_USE_GLVIEWER@) -SET(SALOME_USE_VTKVIEWER @SALOME_USE_VTKVIEWER@) -SET(SALOME_USE_PLOT2DVIEWER @SALOME_USE_PLOT2DVIEWER@) +SET(SALOME_USE_OCCVIEWER @SALOME_USE_OCCVIEWER@) +SET(SALOME_USE_GLVIEWER @SALOME_USE_GLVIEWER@) +SET(SALOME_USE_VTKVIEWER @SALOME_USE_VTKVIEWER@) +SET(SALOME_USE_PLOT2DVIEWER @SALOME_USE_PLOT2DVIEWER@) +SET(SALOME_USE_GRAPHICSVIEW @SALOME_USE_GRAPHICSVIEW@) +SET(SALOME_USE_QXGRAPHVIEWER @SALOME_USE_QXGRAPHVIEWER@) + +SET(SALOME_USE_PYCONSOLE @SALOME_USE_PYCONSOLE@) +SET(SALOME_USE_SALOMEOBJECT @SALOME_USE_SALOMEOBJECT@) # Level 1 prerequisites: SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@") diff --git a/adm_local/cmake_files/FindSalomeGUI.cmake b/adm_local/cmake_files/FindSalomeGUI.cmake index f8a425367..90e66d9e2 100644 --- a/adm_local/cmake_files/FindSalomeGUI.cmake +++ b/adm_local/cmake_files/FindSalomeGUI.cmake @@ -39,4 +39,45 @@ ENDIF() FOREACH(_res ${SalomeGUI_EXTRA_ENV}) SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeGUI_EXTRA_ENV_${_res}}") -ENDFOREACH() \ No newline at end of file +ENDFOREACH() + +#---------------------------------------------------------------------------- +# FULL_GUI is a macro useful for determining whether a GUI module +# builded in full mode +#---------------------------------------------------------------------------- +######################################################################### +# FULL_GUI() +# +# USAGE: FULL_GUI(with_corba) +# +# ARGUMENTS: +# with_corba [input] TRUE or FALSE - use CORBA for building module or no. +# +MACRO(FULL_GUI with_corba) + SET(_options) + IF(${with_corba} AND ${SALOME_GUI_LIGHT_ONLY}) + SET(_corba_message "We absolutely need a Salome GUI module with CORBA.\nPlease set option SALOME_LIGHT_ONLY to OFF when building GUI module.") + ENDIF() + + LIST(APPEND _options SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_VTKVIEWER + SALOME_USE_PLOT2DVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_QXGRAPHVIEWER + SALOME_USE_SALOMEOBJECT SALOME_USE_PYCONSOLE) + + SET(_message) + FOREACH(_option ${_options}) + IF(NOT ${_option}) + LIST(APPEND _message ${_option}) + ENDIF() + ENDFOREACH() + IF(_message) + SET(_message "We absolutely need a Salome GUI module in full mode.\nThe following options should be set to ON when building GUI module:\n${_message}\n") + IF(_corba_message) + MESSAGE(FATAL_ERROR "${_corba_message}\n${_message}") + ELSE() + MESSAGE(FATAL_ERROR "${_message}") + ENDIF() + ELSEIF(_corba_message) + MESSAGE(FATAL_ERROR "${_corba_message}") + ENDIF() + +ENDMACRO(FULL_GUI) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41937f6e9..fc55f70e9 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,7 +90,13 @@ ENDIF(SALOME_USE_GRAPHICSVIEW) ## IF(SALOME_USE_PYCONSOLE) SET(SUBDIRS_PYCONSOLE PyInterp PyConsole) - SET(SUBDIRS_PYTHON SALOME_SWIG SALOME_PY SALOME_PYQT) + SET(SUBDIRS_PYTHON SALOME_PYQT) + IF(SALOME_USE_VTKVIEWER) + LIST(APPEND SUBDIRS_PYTHON SALOME_PY) + ENDIF() + IF(SALOME_USE_SALOMEOBJECT) + LIST(APPEND SUBDIRS_PYTHON SALOME_SWIG) + ENDIF() ENDIF(SALOME_USE_PYCONSOLE) ## diff --git a/src/LightApp/CMakeLists.txt b/src/LightApp/CMakeLists.txt index fb98cbbe4..736648da9 100755 --- a/src/LightApp/CMakeLists.txt +++ b/src/LightApp/CMakeLists.txt @@ -82,36 +82,11 @@ ENDIF() # additional preprocessor / compiler flags ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${HDF5_DEFINITIONS}) -IF(NOT WIN32) - ADD_DEFINITIONS("-Wno-deprecated") -ENDIF() -IF(NOT SALOME_USE_SALOMEOBJECT) - ADD_DEFINITIONS("-DDISABLE_SALOMEOBJECT") -ENDIF() -IF (NOT SALOME_USE_GLVIEWER) - ADD_DEFINITIONS("-DDISABLE_GLVIEWER") -ENDIF() -IF (NOT SALOME_USE_GRAPHICSVIEW) - ADD_DEFINITIONS("-DDISABLE_GRAPHICSVIEW") -ENDIF() -IF(NOT SALOME_USE_OCCVIEWER) - ADD_DEFINITIONS("-DDISABLE_OCCVIEWER") -ENDIF() IF(SALOME_USE_PLOT2DVIEWER) ADD_DEFINITIONS(${QWT_DEFINITIONS}) -ELSE() - ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER") -ENDIF() -IF(NOT SALOME_USE_VTKVIEWER) - ADD_DEFINITIONS("-DDISABLE_VTKVIEWER") -ENDIF() -IF(NOT SALOME_USE_QXGRAPHVIEWER) - ADD_DEFINITIONS("-DDISABLE_QXGRAPHVIEWER") ENDIF() IF(SALOME_USE_PYCONSOLE) ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) -ELSE() - ADD_DEFINITIONS("-DDISABLE_PYCONSOLE") ENDIF() # libraries to link to diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 6a5063951..e6970b23f 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -42,6 +42,7 @@ #include "LightApp_Application.h" #include "LightApp_Module.h" #include "LightApp_DataModel.h" +#include "LightApp_DataOwner.h" #include "LightApp_Study.h" #include "LightApp_Preferences.h" #include "LightApp_PreferencesDlg.h" @@ -2206,6 +2207,9 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) // ... "Trihedron" group <> // .. "3D viewer" group <> + QString formats; + int bgId; +#ifndef DISABLE_OCCVIEWER // .. "OCC viewer" group <> int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), salomeCat ); @@ -2215,10 +2219,10 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) aValuesList.clear(); anIndicesList.clear(); txtList.clear(); - QString formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList ); + formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList ); foreach( int gid, idList ) anIndicesList << gid; // .... -> 3D viewer background - int bgId = pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), bgGroup, + bgId = pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), bgGroup, LightApp_Preferences::Background, "OCCViewer", "background" ); pref->setItemProperty( "gradient_names", aValuesList, bgId ); pref->setItemProperty( "gradient_ids", anIndicesList, bgId ); @@ -2281,7 +2285,9 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "columns", 2, occGen ); // ... -> empty frame (for layout) <> // .. "OCC viewer" group <> +#endif +#ifndef DISABLE_VTKVIEWER // .. "VTK viewer" group <> int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), salomeCat ); //viewTab @@ -2301,7 +2307,9 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) aValuesList.clear(); anIndicesList.clear(); txtList.clear(); +#ifndef DISABLE_SALOMEOBJECT formats = SVTK_Viewer::backgroundData( aValuesList, idList, txtList ); +#endif foreach( int gid, idList ) anIndicesList << gid; bgId = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen, LightApp_Preferences::Background, "VTKViewer", "background" ); @@ -2312,7 +2320,9 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId ); pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId ); pref->setItemProperty( "custom_enabled", false, bgId ); +#ifndef DISABLE_SALOMEOBJECT pref->setItemProperty( "image_formats", formats, bgId ); +#endif // .... -> speed increment int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen, LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" ); @@ -2418,6 +2428,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "step", 0.1, transPref ); // ... -> group names sub-group <> // .. "VTK viewer" group <> +#endif // .. "Plot2d viewer" group <> int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), salomeCat ); //viewTab @@ -3478,6 +3489,7 @@ void LightApp_Application::contextMenuPopup( const QString& type, QMenu* thePopu a->setShortcut( ob->shortcutKey(SUIT_DataBrowser::UpdateShortcut) ); } +#ifndef DISABLE_SALOMEOBJECT if ( selMgr && ob ) { SALOME_ListIO selected; selMgr->selectedObjects( selected ); @@ -3496,6 +3508,7 @@ void LightApp_Application::contextMenuPopup( const QString& type, QMenu* thePopu } } } +#endif selMgr->setSelectionCacheEnabled( cacheIsOn ); } diff --git a/src/LightApp/LightApp_FullScreenHelper.cxx b/src/LightApp/LightApp_FullScreenHelper.cxx index 8d5e73875..61b72ad63 100644 --- a/src/LightApp/LightApp_FullScreenHelper.cxx +++ b/src/LightApp/LightApp_FullScreenHelper.cxx @@ -28,8 +28,6 @@ #include #include -#include - #include #include diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx index 569a13d4d..41e803fab 100644 --- a/src/LightApp/LightApp_Module.cxx +++ b/src/LightApp/LightApp_Module.cxx @@ -92,6 +92,7 @@ #include #include #include +#include #include diff --git a/src/LightApp/LightApp_Plot2dSelector.cxx b/src/LightApp/LightApp_Plot2dSelector.cxx index c128219af..27b6edcf3 100755 --- a/src/LightApp/LightApp_Plot2dSelector.cxx +++ b/src/LightApp/LightApp_Plot2dSelector.cxx @@ -24,9 +24,12 @@ #include "LightApp_Application.h" #include "SUIT_SelectionMgr.h" -#include - -#include +#ifndef DISABLE_SALOMEOBJECT + #include + #ifndef DISABLE_PLOT2DVIEWER + #include + #endif +#endif /*! Constructor @@ -52,21 +55,28 @@ LightApp_Plot2dSelector::~LightApp_Plot2dSelector() */ void LightApp_Plot2dSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const { - if( !myCurEntry.isNull() ) + if( !myCurEntry.isNull() ) { +#ifndef DISABLE_SALOMEOBJECT theList.append( new LightApp_DataOwner( new SALOME_InteractiveObject(qPrintable(myCurEntry),"","") ) ); +#else + theList.append( new LightApp_DataOwner( myCurEntry ) ); +#endif + } } /*!Sets selection.*/ void LightApp_Plot2dSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) { +#ifndef DISABLE_SALOMEOBJECT SALOME_ListIO anIOList; for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin(); it != theList.end(); ++it ) { const LightApp_DataOwner* owner = dynamic_cast( (*it).operator->() ); if ( owner ) { if( !owner->IO().IsNull() ) { - anIOList.Append(owner->IO()); - } else if ( !owner->entry().isEmpty() ) { - anIOList.Append( new SALOME_InteractiveObject(qPrintable(owner->entry()),"","") ); + anIOList.Append(owner->IO()); + } + else if ( !owner->entry().isEmpty() ) { + anIOList.Append( new SALOME_InteractiveObject(qPrintable(owner->entry()),"","") ); } } } @@ -74,6 +84,7 @@ void LightApp_Plot2dSelector::setSelection( const SUIT_DataOwnerPtrList& theList if(v) v->setObjectsSelected(anIOList); +#endif } /*!On selection changed.*/ diff --git a/src/LightApp/LightApp_SelectionMgr.cxx b/src/LightApp/LightApp_SelectionMgr.cxx index 1b833f6d3..dd304ac14 100644 --- a/src/LightApp/LightApp_SelectionMgr.cxx +++ b/src/LightApp/LightApp_SelectionMgr.cxx @@ -228,6 +228,20 @@ void LightApp_SelectionMgr::selectedObjects( QStringList& theList, const QString theList = selList; } +/*! + Append selected objects. +*/ +void LightApp_SelectionMgr::setSelectedObjects( const QStringList& lst, const bool append ) +{ + SUIT_DataOwnerPtrList owners; + foreach( const QString& aValue, lst ) { + if ( !aValue.isNull() ) + owners.append( new LightApp_DataOwner( aValue ) ); + } + + setSelected( owners, append ); +} + #endif /*! diff --git a/src/LightApp/LightApp_SelectionMgr.h b/src/LightApp/LightApp_SelectionMgr.h index daea55bf3..a3c6a0d01 100644 --- a/src/LightApp/LightApp_SelectionMgr.h +++ b/src/LightApp/LightApp_SelectionMgr.h @@ -84,6 +84,7 @@ public: void selectedSubOwners( MapEntryOfMapOfInteger& theMap ); #else void selectedObjects( QStringList&, const QString& = QString(), const bool = true ) const; + void setSelectedObjects( const QStringList&, const bool = false ); #endif void clearSelectionCache(); diff --git a/src/LightApp/LightApp_ShowHideOp.cxx b/src/LightApp/LightApp_ShowHideOp.cxx index 0c82a4729..60828a584 100644 --- a/src/LightApp/LightApp_ShowHideOp.cxx +++ b/src/LightApp/LightApp_ShowHideOp.cxx @@ -143,7 +143,7 @@ void LightApp_ShowHideOp::startOperation() entries.append( entry ); } - // be sure to use real obejct entries + // be sure to use real object entries QStringList objEntries; QStringList::const_iterator it = entries.begin(), last = entries.end(); for ( ; it!=last; ++it ) diff --git a/src/Plot2d/CMakeLists.txt b/src/Plot2d/CMakeLists.txt index f634b7d00..352889926 100755 --- a/src/Plot2d/CMakeLists.txt +++ b/src/Plot2d/CMakeLists.txt @@ -25,24 +25,16 @@ INCLUDE(UseQt4Ext) INCLUDE_DIRECTORIES( ${QT_INCLUDES} ${QWT_INCLUDE_DIR} + ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) -IF(SALOME_USE_PYCONSOLE) - INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) -ENDIF() # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${PYTHON_DEFINITIONS}) -IF(SALOME_USE_PYCONSOLE) - ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) -ENDIF() # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${QWT_LIBRARY} qtx suit) -IF(SALOME_USE_PYCONSOLE) - LIST(APPEND _link_LIBRARIES ${PYTHON_LIBRARIES}) -ENDIF() +SET(_link_LIBRARIES ${QT_LIBRARIES} ${QWT_LIBRARY} ${PYTHON_LIBRARIES} qtx suit) # --- headers --- @@ -59,12 +51,8 @@ SET(_moc_HEADERS Plot2d_ViewManager.h Plot2d_ViewModel.h Plot2d_ViewWindow.h -) -IF(SALOME_USE_PYCONSOLE) - LIST(APPEND _moc_HEADERS - Plot2d_AnalyticalCurveDlg.h + Plot2d_AnalyticalCurveDlg.h ) -ENDIF() # header files / no moc processing SET(_other_HEADERS @@ -74,13 +62,9 @@ SET(_other_HEADERS Plot2d_Object.h Plot2d_PlotItems.h Plot2d_Prs.h -) -IF(SALOME_USE_PYCONSOLE) - LIST(APPEND _other_HEADERS - Plot2d_AnalyticalCurve.h - Plot2d_AnalyticalParser.h + Plot2d_AnalyticalCurve.h + Plot2d_AnalyticalParser.h ) -ENDIF() # header files / to install SET(Plot2d_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) @@ -145,14 +129,10 @@ SET(_other_SOURCES Plot2d_ViewManager.cxx Plot2d_ViewModel.cxx Plot2d_ViewWindow.cxx -) -IF(SALOME_USE_PYCONSOLE) - LIST(APPEND _other_SOURCES - Plot2d_AnalyticalCurve.cxx - Plot2d_AnalyticalCurveDlg.cxx - Plot2d_AnalyticalParser.cxx + Plot2d_AnalyticalCurve.cxx + Plot2d_AnalyticalCurveDlg.cxx + Plot2d_AnalyticalParser.cxx ) -ENDIF() # sources / to compile SET(Plot2d_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 262d3c6f0..f92e2b2bf 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -1829,25 +1829,19 @@ void Plot2d_ViewFrame::onSettings() */ void Plot2d_ViewFrame::onAnalyticalCurve() { -#ifndef DISABLE_PYCONSOLE Plot2d_AnalyticalCurveDlg dlg( this, this ); dlg.exec(); updateAnalyticalCurves(); -#endif } void Plot2d_ViewFrame::addAnalyticalCurve( Plot2d_AnalyticalCurve* theCurve) { -#ifndef DISABLE_PYCONSOLE - myAnalyticalCurves.append(theCurve); -#endif + myAnalyticalCurves.append(theCurve); } void Plot2d_ViewFrame::removeAnalyticalCurve( Plot2d_AnalyticalCurve* theCurve) { -#ifndef DISABLE_PYCONSOLE - theCurve->setAction(Plot2d_AnalyticalCurve::ActRemoveFromView); -#endif + theCurve->setAction(Plot2d_AnalyticalCurve::ActRemoveFromView); } /* @@ -1855,7 +1849,6 @@ void Plot2d_ViewFrame::removeAnalyticalCurve( Plot2d_AnalyticalCurve* theCurve) */ void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool updateView) { -#ifndef DISABLE_PYCONSOLE if(!c) return; QwtScaleDiv* div = myPlot->axisScaleDiv(QwtPlot::xBottom); c->setRangeBegin(div->lowerBound()); @@ -1895,7 +1888,6 @@ void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool upd if(updateView) myPlot->replot(); -#endif } /* @@ -1903,13 +1895,11 @@ void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool upd */ void Plot2d_ViewFrame::updateAnalyticalCurves() { -#ifndef DISABLE_PYCONSOLE AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); for( ; it != myAnalyticalCurves.end(); it++) { updateAnalyticalCurve(*it); } myPlot->replot(); -#endif } /*! @@ -1924,14 +1914,12 @@ AnalyticalCurveList Plot2d_ViewFrame::getAnalyticalCurves() const Get analytical curve by plot item. */ Plot2d_AnalyticalCurve* Plot2d_ViewFrame::getAnalyticalCurve(QwtPlotItem * theItem) { -#ifndef DISABLE_PYCONSOLE AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); for( ; it != myAnalyticalCurves.end(); it++) { if((*it)->plotItem() == theItem); return (*it); } return 0; -#endif } #endif diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index 6cc2ec711..c222b1660 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -433,7 +433,6 @@ void Plot2d_ViewWindow::createActions() mgr->registerAction( aAction, CurvSettingsId ); // 9. Analytical curves -#ifndef DISABLE_PYCONSOLE aAction = new QtxAction( tr( "TOT_PLOT2D_ANALYTICAL_CURVES" ), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ANALYTICAL_CURVES" ) ), tr( "MEN_PLOT2D_ANALYTICAL_CURVES" ), @@ -442,7 +441,6 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_ANALYTICAL_CURVES" ) ); connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onAnalyticalCurve() ) ); mgr->registerAction( aAction, AnalyticalCurveId ); -#endif // 10. Clone aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ), diff --git a/src/SALOME_PYQT/CMakeLists.txt b/src/SALOME_PYQT/CMakeLists.txt index d9390716a..4affd770e 100755 --- a/src/SALOME_PYQT/CMakeLists.txt +++ b/src/SALOME_PYQT/CMakeLists.txt @@ -18,8 +18,10 @@ # ADD_SUBDIRECTORY(SALOME_PYQT_GUILight) -ADD_SUBDIRECTORY(SalomePyQt) +IF(SALOME_USE_PLOT2DVIEWER) + ADD_SUBDIRECTORY(SalomePyQt) +ENDIF() IF(NOT SALOME_LIGHT_ONLY) ADD_SUBDIRECTORY(SALOME_PYQT_GUI) ENDIF(NOT SALOME_LIGHT_ONLY) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt index 388f14ad6..32d2cb984 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt @@ -17,7 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(${VTK_USE_FILE}) +IF(SALOME_USE_VTKVIEWER) + INCLUDE(${VTK_USE_FILE}) +ENDIF() # --- options --- @@ -42,7 +44,6 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - "-DCALL_OLD_METHODS" ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS} diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt index e28b92ca2..cf8cc6cf7 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt @@ -18,7 +18,9 @@ # INCLUDE(UsePyQt4) -INCLUDE(${VTK_USE_FILE}) +IF(SALOME_USE_VTKVIEWER) + INCLUDE(${VTK_USE_FILE}) +ENDIF() # --- options --- @@ -46,14 +48,10 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - "-DCALL_OLD_METHODS" ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS} ) -IF(SALOME_LIGHT_ONLY) - ADD_DEFINITIONS("-DGUI_DISABLE_CORBA") -ENDIF() # libraries to link to SET(_link_LIBRARIES diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx index 914c5c45a..0a90da490 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx @@ -75,7 +75,7 @@ QMutex myInitMutex; etc. is blocked. CALL_OLD_METHODS macro can be defined, for example, by adding - -DCALL_OLD_METHODS compilation option to the Makefile. + -DCALL_OLD_METHODS compilation option to the CMakeLists.txt. */ #ifdef CALL_OLD_METHODS const bool IsCallOldMethods = true; diff --git a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt index 586441088..5a914f487 100755 --- a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt +++ b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt @@ -18,7 +18,9 @@ # INCLUDE(UsePyQt4) -INCLUDE(${VTK_USE_FILE}) +IF(SALOME_USE_VTKVIEWER) + INCLUDE(${VTK_USE_FILE}) +ENDIF() # --- options --- diff --git a/src/SALOME_SWIG/CMakeLists.txt b/src/SALOME_SWIG/CMakeLists.txt index 1b71acb25..a4cb8a294 100755 --- a/src/SALOME_SWIG/CMakeLists.txt +++ b/src/SALOME_SWIG/CMakeLists.txt @@ -18,7 +18,9 @@ # INCLUDE(${SWIG_USE_FILE}) -INCLUDE(${VTK_USE_FILE}) +IF(SALOME_USE_VTKVIEWER) + INCLUDE(${VTK_USE_FILE}) +ENDIF() # --- options --- diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index 313322d66..98d11c99d 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -40,16 +40,25 @@ #include #include #include -#include -#include -#include -#include -#include - #include -#include -#include -#include + +#ifndef DISABLE_SALOMEOBJECT + #include + #include + #include +#ifndef DISABLE_OCCVIEWER + #include + #include +#endif +#ifndef DISABLE_VTKVIEWER + #include + #include +#endif +#ifndef DISABLE_PLOT2DVIEWER + #include +#endif +#endif + /*! \class SALOMEGUI_Swig @@ -613,7 +622,7 @@ public: if ( LightApp_Application* anApp = getApplication() ) { SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); + SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); if ( view ) { SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() ); myResult = !aPrs->IsNull(); @@ -641,7 +650,7 @@ void SALOMEGUI_Swig::UpdateView() if ( LightApp_Application* anApp = getApplication() ) { SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); + SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); if ( view ) view->Repaint(); } @@ -665,12 +674,20 @@ void SALOMEGUI_Swig::FitAll() if ( LightApp_Application* anApp = getApplication() ) { SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); if ( window ) { +#ifndef DISABLE_SALOMEOBJECT +#ifndef DISABLE_VTKVIEWER if ( dynamic_cast( window ) ) ( dynamic_cast( window ) )->onFitAll(); - else if ( dynamic_cast( window ) ) - ( dynamic_cast( window ) )->onFitAll(); - else if ( dynamic_cast( window ) ) +#endif +#ifndef DISABLE_PLOT2DVIEWER + if ( dynamic_cast( window ) ) ( dynamic_cast( window ) )->onFitAll(); +#endif +#endif +#ifndef DISABLE_OCCVIEWER + if ( dynamic_cast( window ) ) + ( dynamic_cast( window ) )->onFitAll(); +#endif } } } @@ -692,14 +709,22 @@ void SALOMEGUI_Swig::ResetView() if ( LightApp_Application* anApp = getApplication() ) { SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); if ( window ) { +#ifndef DISABLE_SALOMEOBJECT +#ifndef DISABLE_VTKVIEWER if ( dynamic_cast( window ) ) (dynamic_cast( window ))->onResetView(); - else if ( dynamic_cast( window ) ) - (dynamic_cast( window ))->onResetView(); - else if ( dynamic_cast( window ) ) +#endif +#ifndef DISABLE_PLOT2DVIEWER + if ( dynamic_cast( window ) ) (dynamic_cast( window ))->onFitAll(); // VSR: there is no 'ResetView' functionality for Plot2d viewer, // so we use 'FitAll' instead. +#endif +#endif +#ifndef DISABLE_OCCVIEWER + if ( dynamic_cast( window ) ) + (dynamic_cast( window ))->onResetView(); +#endif } } } @@ -738,6 +763,8 @@ static void setView( int view ) if ( LightApp_Application* anApp = getApplication() ) { SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); if ( window ) { +#ifndef DISABLE_SALOMEOBJECT +#ifndef DISABLE_VTKVIEWER if ( dynamic_cast( window ) ) { switch( myView ) { case __ViewTop: @@ -756,7 +783,10 @@ static void setView( int view ) break; } } - else if ( dynamic_cast( window ) ) { +#endif +#endif +#ifndef DISABLE_OCCVIEWER + if ( dynamic_cast( window ) ) { switch( myView ) { case __ViewTop: (dynamic_cast( window ))->onTopView(); break; @@ -774,6 +804,7 @@ static void setView( int view ) break; } } +#endif } } } diff --git a/src/SUITApp/CMakeLists.txt b/src/SUITApp/CMakeLists.txt index dd8e2def0..1262d614e 100755 --- a/src/SUITApp/CMakeLists.txt +++ b/src/SUITApp/CMakeLists.txt @@ -34,9 +34,6 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) -IF(SALOME_USE_PYCONSOLE) - ADD_DEFINITIONS("-DSUIT_ENABLE_PYTHON") -ENDIF() IF(ENABLE_TESTRECORDER) ADD_DEFINITIONS("-DENABLE_TESTRECORDER ${TESTRECORDER_DEFINITIONS}") ENDIF() diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 3edf1b160..6d44983e9 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -20,21 +20,21 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -//#if defined WIN32 -//#ifdef SUIT_ENABLE_PYTHON -//#undef SUIT_ENABLE_PYTHON +//#ifdefined WIN32 +//#ifndef DISABLE_PYCONSOLE +//#define DISABLE_PYCONSOLE //#endif //#else //#if defined WIN32 -//#ifndef SUIT_ENABLE_PYTHON +//#ifdef DISABLE_PYCONSOLE // NOTE: DO NOT DELETE THIS DEFINITION ON LINUX // or make sure Python is initialized in main() in any case // Otherwise, application based on light SALOME and using Python // are unlikely to work properly. -//#define SUIT_ENABLE_PYTHON +//#undef DISABLE_PYCONSOLE //#include //#endif // -#ifdef SUIT_ENABLE_PYTHON +#ifndef DISABLE_PYCONSOLE #include "SUITApp_init_python.hxx" #endif @@ -156,7 +156,7 @@ private: int main( int argc, char* argv[] ) { - //#ifdef SUIT_ENABLE_PYTHON + //#ifndef DISABLE_PYCONSOLE // // First of all initialize Python, as in complex multi-component applications // // someone else might initialize it some way unsuitable for light SALOME! // Py_SetProgramName( argv[0] ); @@ -272,7 +272,7 @@ int main( int argc, char* argv[] ) } } -#ifdef SUIT_ENABLE_PYTHON +#ifndef DISABLE_PYCONSOLE //...Initialize python int _argc = 1; char* _argv[] = {(char*)""}; diff --git a/src/SalomeApp/CMakeLists.txt b/src/SalomeApp/CMakeLists.txt index fe73b00e7..65f278da4 100755 --- a/src/SalomeApp/CMakeLists.txt +++ b/src/SalomeApp/CMakeLists.txt @@ -23,7 +23,9 @@ IF(SALOME_BUILD_TESTS) ENDIF() INCLUDE(UseQt4Ext) -INCLUDE(${VTK_USE_FILE}) +IF(SALOME_USE_VTKVIEWER) + INCLUDE(${VTK_USE_FILE}) +ENDIF() # --- options --- @@ -33,7 +35,6 @@ INCLUDE_DIRECTORIES( ${QT_INCLUDES} ${QWT_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} - ${PYTHON_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} ${OMNIORB_INCLUDE_DIR} ${PROJECT_BINARY_DIR}/idl @@ -44,8 +45,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/OBJECT ${PROJECT_SOURCE_DIR}/src/ObjBrowser ${PROJECT_SOURCE_DIR}/src/Prs - ${PROJECT_SOURCE_DIR}/src/PyConsole - ${PROJECT_SOURCE_DIR}/src/PyInterp ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/STD ${PROJECT_SOURCE_DIR}/src/SUIT @@ -55,6 +54,14 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/VTKViewer ) +IF(SALOME_USE_PYCONSOLE) + INCLUDE_DIRECTORIES( + ${PYTHON_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/PyConsole + ${PROJECT_SOURCE_DIR}/src/PyInterp + ) +ENDIF() + # additional preprocessor / compiler flags ADD_DEFINITIONS( ${QT_DEFINITIONS} @@ -62,20 +69,56 @@ ADD_DEFINITIONS( ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} - ${PYTHON_DEFINITIONS} ) +IF(SALOME_USE_PYCONSOLE) + ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) +ENDIF() + # libraries to link to SET(_link_LIBRARIES ${CAS_KERNEL} ${QT_LIBRARIES} ${PYTHON_LIBRARIES} ${KERNEL_OpUtil} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDSClient} ${KERNEL_TOOLSDS} - CASCatch suit std CAM ObjBrowser SalomePrs PyInterp PyConsole Event - GLViewer Plot2d OCCViewer VTKViewer SalomeObject SPlot2d SOCC SVTK - LogWindow LightApp SalomePrs ToolsGUI SalomeSession + CASCatch suit std CAM ObjBrowser SalomePrs Event + LogWindow LightApp SalomePrs ToolsGUI ) +IF(SALOME_USE_VTKVIEWER) + LIST(APPEND _link_LIBRARIES VTKViewer SVTK) +ENDIF() + +IF(SALOME_USE_PYCONSOLE) + LIST(APPEND _link_LIBRARIES PyInterp PyConsole) +ENDIF() + +IF(SALOME_USE_GLVIEWER) + LIST(APPEND _link_LIBRARIES GLViewer) +ENDIF() + +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _link_LIBRARIES Plot2d) + IF(SALOME_USE_SALOMEOBJECT) + LIST(APPEND _link_LIBRARIES SPlot2d) + ENDIF(SALOME_USE_SALOMEOBJECT) +ENDIF(SALOME_USE_PLOT2DVIEWER) + +IF(SALOME_USE_OCCVIEWER) + LIST(APPEND _link_LIBRARIES OCCViewer) + IF(SALOME_USE_SALOMEOBJECT) + LIST(APPEND _link_LIBRARIES SOCC) + ENDIF(SALOME_USE_SALOMEOBJECT) +ENDIF() + +IF(SALOME_USE_SALOMEOBJECT) + LIST(APPEND _link_LIBRARIES SalomeObject) +ENDIF() + +IF(NOT SALOME_LIGHT_ONLY) + LIST(APPEND _link_LIBRARIES SalomeSession) +ENDIF() + # --- headers --- # header files / to be processed by moc @@ -89,11 +132,14 @@ SET(_moc_HEADERS SalomeApp_ListView.h SalomeApp_LoadStudiesDlg.h SalomeApp_Module.h - SalomeApp_NoteBook.h SalomeApp_Study.h SalomeApp_StudyPropertiesDlg.h ) +IF(SALOME_USE_PYCONSOLE) + LIST(APPEND _moc_HEADERS SalomeApp_NoteBook.h) +ENDIF() + # header files / no moc processing SET(_other_HEADERS SalomeApp.h @@ -102,12 +148,15 @@ SET(_other_HEADERS SalomeApp_ExceptionHandler.h SalomeApp_Filter.h SalomeApp_ImportOperation.h - SalomeApp_PyInterp.h SalomeApp_Tools.h SalomeApp_TypeFilter.h SalomeApp_VisualState.h ) +IF(SALOME_USE_PYCONSOLE) + LIST(APPEND _other_HEADERS SalomeApp_PyInterp.h) +ENDIF() + # header files / to install SET(SalomeApp_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) @@ -148,8 +197,6 @@ SET(_other_SOURCES SalomeApp_ListView.cxx SalomeApp_LoadStudiesDlg.cxx SalomeApp_Module.cxx - SalomeApp_NoteBook.cxx - SalomeApp_PyInterp.cxx SalomeApp_Study.cxx SalomeApp_StudyPropertiesDlg.cxx SalomeApp_Tools.cxx @@ -157,6 +204,10 @@ SET(_other_SOURCES SalomeApp_VisualState.cxx ) +IF(SALOME_USE_PYCONSOLE) + LIST(APPEND _other_SOURCES SalomeApp_PyInterp.cxx SalomeApp_NoteBook.cxx) +ENDIF() + # sources / to compile SET(SalomeApp_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 7e3a64966..3291a9a08 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -25,14 +25,20 @@ // 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 -#include + // 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 + #ifndef DISABLE_PYCONSOLE + #include + #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 + #include "SalomeApp_NoteBook.h" +#endif #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" #include "SalomeApp_DataModel.h" @@ -40,8 +46,6 @@ #include "SalomeApp_VisualState.h" #include "SalomeApp_StudyPropertiesDlg.h" #include "SalomeApp_LoadStudiesDlg.h" -#include "SalomeApp_NoteBook.h" - #include "SalomeApp_ExitDlg.h" #include @@ -75,7 +79,6 @@ // temporary commented //#include -#include #include #include @@ -238,6 +241,7 @@ void SalomeApp_Application::start() updateObjectBrowser(true); } +#ifndef DISABLE_PYCONSOLE // import/execute python scripts if ( pyfiles.count() > 0 && activeStudy() ) { SalomeApp_Study* appStudy = dynamic_cast( activeStudy() ); @@ -274,6 +278,7 @@ void SalomeApp_Application::start() } } } +#endif } else { LightApp_Application::start(); SALOME_EventFilter::Init(); @@ -368,6 +373,8 @@ void SalomeApp_Application::createActions() createExtraActions(); +#ifndef DISABLE_PYCONSOLE +#ifndef DISABLE_SALOMEOBJECT // import Python module that manages SALOME plugins PyGILState_STATE gstate = PyGILState_Ensure(); PyObjWrapper pluginsmanager = PyImport_ImportModule((char*)"salome_pluginsmanager"); @@ -376,6 +383,8 @@ void SalomeApp_Application::createActions() PyErr_Print(); PyGILState_Release(gstate); // end of SALOME plugins loading +#endif +#endif } @@ -476,10 +485,12 @@ void SalomeApp_Application::onNewWithScript() QString command = QString("execfile(r\"%1\")").arg(aFile); +#ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = pythonConsole(); if ( pyConsole ) pyConsole->exec( command ); +#endif } } @@ -711,9 +722,11 @@ SUIT_Study* SalomeApp_Application::createNewStudy() 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; } @@ -901,10 +914,12 @@ void SalomeApp_Application::onLoadScript( ) { QString command = QString("execfile(r\"%1\")").arg(aFile); +#ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = pythonConsole(); if ( pyConsole ) pyConsole->exec( command ); +#endif } } @@ -966,7 +981,11 @@ QString SalomeApp_Application::getFileFilter() const 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(); @@ -1029,6 +1048,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag ) */ } } +#ifndef DISABLE_PYCONSOLE else if ( flag == WT_PyConsole ) { PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), new SalomeApp_PyInterp() ); @@ -1052,6 +1072,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag ) } wid = getNoteBook(); } +#endif return wid; } @@ -1497,7 +1518,7 @@ SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type) } -/*!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; @@ -1543,8 +1564,10 @@ void SalomeApp_Application::onStudyCreated( SUIT_Study* study ) { LightApp_Application::onStudyCreated( study ); +#ifndef DISABLE_PYCONSOLE desktop()->tabifyDockWidget( windowDock( getWindow( WT_NoteBook ) ), windowDock( getWindow( WT_ObjectBrowser ) ) ); +#endif loadDockWindowsState(); @@ -1572,8 +1595,10 @@ void SalomeApp_Application::onStudyOpened( SUIT_Study* study ) { LightApp_Application::onStudyOpened( study ); +#ifndef DISABLE_PYCONSOLE desktop()->tabifyDockWidget( windowDock( getWindow( WT_NoteBook ) ), windowDock( getWindow( WT_ObjectBrowser ) ) ); +#endif loadDockWindowsState(); @@ -1707,6 +1732,7 @@ void SalomeApp_Application::objectBrowserColumnsVisibility() } } +#ifndef DISABLE_PYCONSOLE /*! Set SalomeApp_NoteBook pointer */ void SalomeApp_Application::setNoteBook( SalomeApp_NoteBook* theNoteBook ) { @@ -1718,6 +1744,7 @@ SalomeApp_NoteBook* SalomeApp_Application::getNoteBook() const { return myNoteBook; } +#endif /*! * Define extra actions defined in module definition XML file. @@ -1927,11 +1954,13 @@ bool SalomeApp_Application::renameObject( const QString& entry, const QString& n void SalomeApp_Application::defaultWindows( QMap& aMap ) const { LightApp_Application::defaultWindows(aMap); +#ifndef DISABLE_PYCONSOLE if ( !aMap.contains( WT_NoteBook ) ) { if ( !myNoteBook ) { aMap.insert( WT_NoteBook, Qt::LeftDockWidgetArea ); } } +#endif } /*! @@ -1941,10 +1970,13 @@ void SalomeApp_Application::defaultWindows( QMap& aMap ) const void SalomeApp_Application::currentWindows(QMap& 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. @@ -2045,6 +2077,7 @@ bool SalomeApp_Application::updateStudy() return ok; } +#endif //============================================================================ /*! Function : onRestoreStudy @@ -2066,9 +2099,11 @@ bool SalomeApp_Application::onRestoreStudy( const QString& theDumpScript, // 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 ); @@ -2082,12 +2117,14 @@ bool SalomeApp_Application::onRestoreStudy( const QString& theDumpScript, if( SalomeApp_Study* newStudy = dynamic_cast( 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; @@ -2100,11 +2137,13 @@ bool SalomeApp_Application::onRestoreStudy( const QString& theDumpScript, */ 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(); } diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 185ac65b8..88f577dcc 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -48,7 +48,9 @@ class LightApp_Preferences; class SalomeApp_Study; -class SalomeApp_NoteBook; +#ifndef DISABLE_PYCONSOLE + class SalomeApp_NoteBook; +#endif class SUIT_Desktop; class SUIT_ViewModel; @@ -110,9 +112,11 @@ public: virtual bool useStudy( const QString& ); virtual void updateDesktopTitle(); virtual void currentWindows( QMap& ) const; - + +#ifndef DISABLE_PYCONSOLE virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook); virtual SalomeApp_NoteBook* getNoteBook() const; +#endif //! update visibility state of objects void updateVisibilityState( DataObjectList& theList, @@ -132,7 +136,9 @@ public slots: virtual void onCopy(); virtual void onPaste(); void onSaveGUIState();// called from VISU +#ifndef DISABLE_PYCONSOLE void onUpdateStudy(); // called from NoteBook +#endif bool onRestoreStudy( const QString& theDumpScript, const QString& theStudyName, bool theIsStudySaved ); @@ -171,7 +177,9 @@ protected: void objectBrowserColumnsVisibility(); +#ifndef DISABLE_PYCONSOLE bool updateStudy(); +#endif virtual void afterCloseDoc(); @@ -196,7 +204,9 @@ private: void createExtraActions(); private: +#ifndef DISABLE_PYCONSOLE QPointer myNoteBook; +#endif QMap myExtActions; // Map bool myIsSiman; // application corresponds to the siman study flag diff --git a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx index 541ff7044..eb9b2c957 100644 --- a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx @@ -20,8 +20,11 @@ // File: SalomeApp_DoubleSpinBox.cxx // Author: Oleg UVAROV // -#include // this include must be first (see PyInterp_base.h)! -#include + +#ifndef DISABLE_PYCONSOLE + #include // this include must be first (see PyInterp_base.h)! + #include +#endif #include "SalomeApp_DoubleSpinBox.h" #include "SalomeApp_Application.h" @@ -434,6 +437,7 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons { if( studyDS->IsString( aName ) ) { +#ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = app->pythonConsole(); PyConsole_Interp* pyInterp = pyConsole->getInterp(); PyLockWrapper aLock = pyInterp->GetLockWrapper(); @@ -448,6 +452,7 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons { return IncorrectType; } +#endif } value = studyDS->GetReal( aName ); return Found; diff --git a/src/SalomeApp/SalomeApp_IntSpinBox.cxx b/src/SalomeApp/SalomeApp_IntSpinBox.cxx index 6ced85db8..4460cd446 100644 --- a/src/SalomeApp/SalomeApp_IntSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_IntSpinBox.cxx @@ -20,8 +20,11 @@ // File: SalomeApp_IntSpinBox.cxx // Author: Oleg UVAROV // -#include //this include must be first (see PyInterp_base.h)! -#include + +#ifndef DISABLE_PYCONSOLE + #include //this include must be first (see PyInterp_base.h)! + #include +#endif #include "SalomeApp_IntSpinBox.h" #include "SalomeApp_Application.h" @@ -382,6 +385,7 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr { if( studyDS->IsString( aName ) ) { +#ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = app->pythonConsole(); PyConsole_Interp* pyInterp = pyConsole->getInterp(); PyLockWrapper aLock = pyInterp->GetLockWrapper(); @@ -396,6 +400,7 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr { return IncorrectType; } +#endif } value = studyDS->GetInteger( aName ); return Found; diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 2427203b3..06ab38203 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -334,11 +334,13 @@ public: } 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 @@ -402,10 +404,12 @@ SalomeApp_Study::~SalomeApp_Study() } } +#ifndef DISABLE_PYCONSOLE void SalomeApp_Study::onNoteBookVarUpdate( QString theVarName) { emit notebookVarUpdated( theVarName ); } +#endif /*! Gets study id. @@ -1150,6 +1154,7 @@ void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, const bo } } +#ifndef DISABLE_PYCONSOLE /*! Mark the study as saved in the file \param theFileName - the name of file @@ -1160,6 +1165,7 @@ void SalomeApp_Study::updateFromNotebook( const QString& theFileName, bool isSav studyDS()->Name(theFileName.toStdString()); setIsSaved( isSaved ); } +#endif LightApp_DataObject* SalomeApp_Study::findObjectByEntry( const QString& theEntry ) { diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index ff91d422a..e45377007 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -83,7 +83,9 @@ public: void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint); virtual void restoreState(int savePoint); +#ifndef DISABLE_PYCONSOLE void updateFromNotebook(const QString&, bool); +#endif virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry ); @@ -106,7 +108,9 @@ protected: SUIT_DataObject* theParent ) const; protected slots: virtual void updateModelRoot( const CAM_DataModel* ); +#ifndef DISABLE_PYCONSOLE void onNoteBookVarUpdate( QString theVarName ); +#endif private: QString newStudyName() const; @@ -115,8 +119,10 @@ private: _PTR(Study) myStudyDS; Observer_i* myObserver; +#ifndef DISABLE_PYCONSOLE signals: void notebookVarUpdated( QString theVarName ); +#endif }; #ifdef WIN32 diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 2bd6af601..460f13136 100755 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -17,11 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(SUBDIRS - vtkEDFOverloads - dlgfactory -) -FOREACH(dir ${SUBDIRS}) - ADD_SUBDIRECTORY(${dir}) -ENDFOREACH(dir ${SUBDIRS}) - +ADD_SUBDIRECTORY(dlgfactory) + +IF(SALOME_USE_VTKVIEWER) + ADD_SUBDIRECTORY(vtkEDFOverloads) +ENDIF()