From 6ae3c2c26f6e42a48246e314ab92c36656f7c667 Mon Sep 17 00:00:00 2001 From: mpa Date: Thu, 11 Jun 2015 16:21:30 +0300 Subject: [PATCH] CMake improvement: usage of SALOME_GUI_MODE() macro --- CMakeLists.txt | 4 +++- doc/salome/gui/SMESH/input/1d_meshing_hypo.doc | 1 + doc/salome/gui/SMESH/input/mesh_infos.doc | 2 ++ src/OBJECT/CMakeLists.txt | 9 +++++++-- src/SMESHGUI/SMESHGUI.cxx | 10 ++++++---- src/SMESHGUI/SMESHGUI_MeshInfo.cxx | 16 ++++++++++++++++ src/SMESHGUI/SMESHGUI_MeshInfo.h | 8 +++++++- src/StdMeshersGUI/CMakeLists.txt | 14 ++++++++++++-- .../StdMeshersGUI_NbSegmentsCreator.cxx | 14 ++++++++++++-- .../StdMeshersGUI_NbSegmentsCreator.h | 6 +++++- 10 files changed, 71 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 521b379cd..23e5a97c4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,9 @@ IF(SALOME_BUILD_GUI) IF(EXISTS ${GUI_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") FIND_PACKAGE(SalomeGUI) - FULL_GUI(TRUE) #check whether GUI builded in full mode and with CORBA + SALOME_GUI_WITH_CORBA() #check whether GUI builded with CORBA + SALOME_GUI_MODE(SALOME_USE_VTKVIEWER SALOME_USE_SALOMEOBJECT + OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_PYCONSOLE) ## ## Prerequisites From GUI: ## diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 2ab53e44d..336ca5ddd 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -245,6 +245,7 @@ negative. \ref tui_deflection_1d "Defining Number of Segments" hypothesis operation. +\note The plot functionality is available only if GUI module is builded with Plot 2D Viewer (set option SALOME_USE_PLOT2DVIEWER to ON when building GUI module).
\anchor start_and_end_length_anchor diff --git a/doc/salome/gui/SMESH/input/mesh_infos.doc b/doc/salome/gui/SMESH/input/mesh_infos.doc index 8ead995f0..8222f1764 100644 --- a/doc/salome/gui/SMESH/input/mesh_infos.doc +++ b/doc/salome/gui/SMESH/input/mesh_infos.doc @@ -152,6 +152,8 @@ button. Also, values are automatically computed if the number of nodes / elements does not exceed the "Automatic controls compute limit" set via the "Mesh information" preferences (zero value means that there is no limit). +\note The plot functionality is available only if GUI module is builded with Plot 2D Viewer (set option SALOME_USE_PLOT2DVIEWER to ON when building GUI module). + The button \b "Dump" allows printing the information displayed in the dialog box to a .txt file. diff --git a/src/OBJECT/CMakeLists.txt b/src/OBJECT/CMakeLists.txt index d9597de66..859e3da5a 100644 --- a/src/OBJECT/CMakeLists.txt +++ b/src/OBJECT/CMakeLists.txt @@ -61,13 +61,18 @@ SET(_link_LIBRARIES ${GUI_qtx} ${GUI_suit} ${GUI_std} - ${GUI_Plot2d} - ${GUI_SPlot2d} SMESHClient SMDS SMESHControls ) +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _link_LIBRARIES + ${GUI_Plot2d} + ${GUI_SPlot2d} + ) +ENDIF() + # --- headers --- # header files / no moc processing diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 209312859..5e507fc13 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -120,8 +120,6 @@ #include -#include - #include #include #include @@ -4768,14 +4766,15 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) // import Python module that manages SMESH plugins (need to be here because SalomePyQt API uses active module) PyGILState_STATE gstate = PyGILState_Ensure(); - PyObjWrapper pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager"); + PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager"); if ( !pluginsmanager ) { PyErr_Print(); } else { - PyObjWrapper result = PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toUtf8().data(),tr("SMESH_PLUGINS_OTHER").toUtf8().data()); + PyObject* result = PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toUtf8().data(),tr("SMESH_PLUGINS_OTHER").toUtf8().data()); if ( !result ) PyErr_Print(); + Py_XDECREF(result); } PyGILState_Release(gstate); // end of SMESH plugins loading @@ -4801,6 +4800,7 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) connectView( wnd ); } + Py_XDECREF(pluginsmanager); return res; } @@ -4885,7 +4885,9 @@ void SMESHGUI::windows( QMap& aMap ) const { aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); aMap.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea ); +#ifndef DISABLE_PYCONSOLE aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +#endif } void SMESHGUI::viewManagers( QStringList& list ) const diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 1cc3df96a..4d834c905 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -3414,6 +3414,11 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myButtons[4]->setEnabled( true ); myButtons[5]->setEnabled( true ); } +#ifdef DISABLE_PLOT2DVIEWER + myMainLayout->setRowStretch(11,0); + for( int i=22; i<=24; i++) + myMainLayout->itemAt(i)->widget()->setVisible( false ); +#endif } else { myMainLayout->setRowStretch(11,0); @@ -3436,6 +3441,11 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myButtons[7]->setEnabled( true ); myButtons[8]->setEnabled( true ); } +#ifdef DISABLE_PLOT2DVIEWER + myMainLayout->setRowStretch(16,0); + for( int i=32; i<=34; i++) + myMainLayout->itemAt(i)->widget()->setVisible( false ); +#endif } else { myMainLayout->setRowStretch(16,0); @@ -3515,6 +3525,7 @@ void SMESHGUI_CtrlInfo::computeOverConstrainedVolumesInfo() void SMESHGUI_CtrlInfo::computeAspectRatio() { +#ifndef DISABLE_PLOT2DVIEWER myButtons[5]->setEnabled( false ); if ( myObject->_is_nil() ) return; @@ -3528,10 +3539,12 @@ void SMESHGUI_CtrlInfo::computeAspectRatio() myPlot->replot(); } delete aHistogram; +#endif } void SMESHGUI_CtrlInfo::computeAspectRatio3D() { +#ifndef DISABLE_PLOT2DVIEWER myButtons[8]->setEnabled( false ); if ( myObject->_is_nil() ) return; @@ -3545,6 +3558,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio3D() myPlot3D->replot(); } delete aHistogram; +#endif } /*! @@ -3574,6 +3588,7 @@ void SMESHGUI_CtrlInfo::setTolerance( double theTolerance ) myWidgets[2]->setText(""); } +#ifndef DISABLE_PLOT2DVIEWER Plot2d_Histogram* SMESHGUI_CtrlInfo::getHistogram( SMESH::NumericalFunctor_ptr aNumFun ) { SMESH::SMESH_Mesh_var mesh = myObject->GetMesh(); @@ -3603,6 +3618,7 @@ Plot2d_Histogram* SMESHGUI_CtrlInfo::getHistogram( SMESH::NumericalFunctor_ptr a } return aHistogram; } +#endif void SMESHGUI_CtrlInfo::saveInfo( QTextStream &out ) { out << QString( 20, '-' ) << "\n"; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.h b/src/SMESHGUI/SMESHGUI_MeshInfo.h index 5b00585aa..357f269ca 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.h @@ -28,7 +28,11 @@ #include "SMESH_SMESHGUI.hxx" #include "SMESH_ControlsDef.hxx" -#include +#ifndef DISABLE_PLOT2DVIEWER + #include +#else + #include +#endif #include #include @@ -310,7 +314,9 @@ private: QwtPlot* createPlot( QWidget* ); void setFontAttributes( QWidget* ); void clearInternal(); +#ifndef DISABLE_PLOT2DVIEWER Plot2d_Histogram* getHistogram( SMESH::NumericalFunctor_ptr functor ); +#endif void computeNb( int ft, int iBut, int iWdg ); private slots: diff --git a/src/StdMeshersGUI/CMakeLists.txt b/src/StdMeshersGUI/CMakeLists.txt index be0c2a4dd..9db3c64c0 100644 --- a/src/StdMeshersGUI/CMakeLists.txt +++ b/src/StdMeshersGUI/CMakeLists.txt @@ -72,7 +72,6 @@ SET(_link_LIBRARIES # header files / to be processed by moc SET(_moc_HEADERS StdMeshersGUI_StdHypothesisCreator.h - StdMeshersGUI_DistrPreview.h StdMeshersGUI_DistrTable.h StdMeshersGUI_NbSegmentsCreator.h StdMeshersGUI_ObjectReferenceParamWdg.h @@ -85,6 +84,12 @@ SET(_moc_HEADERS StdMeshersGUI_PropagationHelperWdg.h ) +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _moc_HEADERS + StdMeshersGUI_DistrPreview.h + ) +ENDIF() + # header files / no moc processing SET(_other_HEADERS SMESH_StdMeshersGUI.hxx @@ -102,7 +107,6 @@ QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) SET(_other_SOURCES StdMeshersGUI.cxx StdMeshersGUI_StdHypothesisCreator.cxx - StdMeshersGUI_DistrPreview.cxx StdMeshersGUI_DistrTable.cxx StdMeshersGUI_NbSegmentsCreator.cxx StdMeshersGUI_ObjectReferenceParamWdg.cxx @@ -115,6 +119,12 @@ SET(_other_SOURCES StdMeshersGUI_PropagationHelperWdg.cxx ) +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _other_SOURCES + StdMeshersGUI_DistrPreview.cxx + ) +ENDIF() + # sources / to compile SET(StdMeshersGUI_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 0d86a141a..fa4eb1dcc 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -25,7 +25,9 @@ // SMESH includes // #include "StdMeshersGUI_NbSegmentsCreator.h" -#include "StdMeshersGUI_DistrPreview.h" +#ifndef DISABLE_PLOT2DVIEWER + #include "StdMeshersGUI_DistrPreview.h" +#endif #include "StdMeshersGUI_DistrTable.h" #include "StdMeshersGUI_PropagationHelperWdg.h" #include "StdMeshersGUI_SubShapeSelectorWdg.h" @@ -64,7 +66,9 @@ StdMeshersGUI_NbSegmentsCreator::StdMeshersGUI_NbSegmentsCreator() myDistr( 0 ), myScale( 0 ), myTable( 0 ), +#ifndef DISABLE_PLOT2DVIEWER myPreview( 0 ), +#endif myExpr( 0 ), myConvBox( 0 ), myConv( 0 ), @@ -179,12 +183,14 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() // c) table myTable = new StdMeshersGUI_DistrTableFrame( GroupC1 ); + myTable->setMinimumHeight(220); myDistLayout->addWidget( myTable, 1, 0, 2, 1 ); +#ifndef DISABLE_PLOT2DVIEWER // d) preview myPreview = new StdMeshersGUI_DistrPreview( GroupC1, h.in() ); - myPreview->setMinimumHeight(220); myDistLayout->addWidget( myPreview, 1, 1, 2, 1 ); +#endif // 5) conversion (radiogroup) myConvBox = new QGroupBox( tr( "SMESH_CONV_MODE" ), GroupC1 ); @@ -449,7 +455,9 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() myDirectionWidget->ShowPreview( distr!=0 ); bool isFunc = distr==2 || distr==3; +#ifndef DISABLE_PLOT2DVIEWER myPreview->setShown( isFunc ); +#endif myConvBox->setShown( isFunc ); myTable->setShown( distr==2 ); @@ -457,6 +465,7 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() myLExpr->setShown( distr==3 ); myInfo->setShown( distr==3); +#ifndef DISABLE_PLOT2DVIEWER //change of preview int nbSeg = myNbSeg->value(); if( distr==2 ) //preview for table-described function @@ -470,6 +479,7 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() if( isFunc ) myPreview->setConversion( StdMeshersGUI_DistrPreview::Conversion( myConv->checkedId() ) ); +#endif if ( (QtxComboBox*)sender() == myDistr && dlg() ) { QApplication::instance()->processEvents(); diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index f39b2feb9..99c235e4a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -39,7 +39,9 @@ class SalomeApp_IntSpinBox; class QtxComboBox; class SMESHGUI_SpinBox; class StdMeshersGUI_DistrTableFrame; -class StdMeshersGUI_DistrPreview; +#ifndef DISABLE_PLOT2DVIEWER + class StdMeshersGUI_DistrPreview; +#endif class QLineEdit; class QButtonGroup; class QGroupBox; @@ -86,7 +88,9 @@ private: QtxComboBox* myDistr; SMESHGUI_SpinBox* myScale; StdMeshersGUI_DistrTableFrame* myTable; +#ifndef DISABLE_PLOT2DVIEWER StdMeshersGUI_DistrPreview* myPreview; +#endif QLineEdit *myName, *myExpr; QGroupBox* myConvBox; QButtonGroup* myConv; -- 2.39.2