Salome HOME
CMake improvement: usage of SALOME_GUI_MODE() macro
authormpa <mpa@opencascade.com>
Thu, 11 Jun 2015 13:21:30 +0000 (16:21 +0300)
committermpa <mpa@opencascade.com>
Thu, 11 Jun 2015 13:21:30 +0000 (16:21 +0300)
CMakeLists.txt
doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
doc/salome/gui/SMESH/input/mesh_infos.doc
src/OBJECT/CMakeLists.txt
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/StdMeshersGUI/CMakeLists.txt
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h

index 521b379cde3f20aa7fe18d842421e9bbaa66bd5a..23e5a97c4c9252b111587a2e471df67ccf9254b0 100755 (executable)
@@ -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:
     ##
index 2ab53e44db9639ddb99279c3d31b8e2107fe886e..336ca5ddd8baad2cca71762f6ae7e765f432e016 100644 (file)
@@ -245,6 +245,7 @@ negative</b>.
 \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).
 
 <br>
 \anchor start_and_end_length_anchor
index 8ead995f07ffe38d497b3246efa6c686d6860696..8222f1764affd920a3728ef928d401e2350c8bd3 100644 (file)
@@ -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.
 
index d9597de660f021c714dac63f579dc1cf7fb646e5..859e3da5a5d46b2be29d089d7766bfd2f8ecc042 100644 (file)
@@ -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
index 2093128590cd08e47ec259cf4c3bad0451544b80..5e507fc1387af53529d8020db0fe85d4235a7798 100644 (file)
 
 #include <VTKViewer_Algorithm.h>
 
-#include <PyInterp_Interp.h>
-
 #include <SUIT_Desktop.h>
 #include <SUIT_FileDlg.h>
 #include <SUIT_MessageBox.h>
@@ -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<int, int>& 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
index 1cc3df96a30de8497c48b9dda8fc9c0547e2b74d..4d834c90560a47ab24b774dbf283c74aca3a4b01 100644 (file)
@@ -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";
index 5b00585aa01044b362cb09fd4694cef055d70055..357f269ca276aec5ab41990f2128a5d4ce9b638e 100644 (file)
 #include "SMESH_SMESHGUI.hxx"
 #include "SMESH_ControlsDef.hxx"
 
-#include <Plot2d_Histogram.h>
+#ifndef DISABLE_PLOT2DVIEWER
+  #include <Plot2d_Histogram.h>
+#else
+  #include <qwt_plot.h>
+#endif
 
 #include <QFrame>
 #include <QDialog>
@@ -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:
index be0c2a4dd6698d69992eb2173f4678febe78be9d..9db3c64c0ba7b09d86e71192f9c52c9a2c769ce7 100644 (file)
@@ -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})
 
index 0d86a141a936f791c0bd747c00e84fe178d4e626..fa4eb1dcc19f93aba7715d911075fc99ce650bb5 100644 (file)
@@ -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();
index f39b2feb9c2089939249f22eba6eb2deb2a7be74..99c235e4ac6067782a411b9c3ccea78de9478188 100644 (file)
@@ -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;