CMake improvement: usage of SALOME_GUI_MODE() macro

This commit is contained in:
mpa 2015-06-11 16:21:30 +03:00
parent 5c19bc1e16
commit 6ae3c2c26f
10 changed files with 71 additions and 13 deletions

View File

@ -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:
##

View 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

View 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.

View 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

View File

@ -120,8 +120,6 @@
#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

View 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";

View File

@ -28,7 +28,11 @@
#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:

View 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})

View 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();

View 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;