From: ouv Date: Sat, 1 Nov 2008 14:41:52 +0000 (+0000) Subject: Dump Python Extension X-Git-Tag: TG_DumpPython_Extension_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eddb6b8f48873aa3af1533fad7a333ea836cd231;p=modules%2Fsmesh.git Dump Python Extension --- diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 11500d302..1facdfa59 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -402,6 +402,27 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi return false; } +bool SMESHGUI_GenericHypothesisCreator::checkParams() const +{ + ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end(); + for( ; anIt!=aLast; anIt++ ) + { + if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) ) + { + SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt ); + if( !sb->isValid() ) + return false; + } + else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) + { + SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); + if( !sb->isValid() ) + return false; + } + } + return true; +} + void SMESHGUI_GenericHypothesisCreator::onReject() { } @@ -483,7 +504,10 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f ) void SMESHGUI_HypothesisDlg::accept() { if ( myCreator && !myCreator->checkParams() ) + { + SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), tr( "SMESH_INCORRECT_INPUT" ) ); return; + } QtxDialog::accept(); } diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index c46be7f34..043f26024 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -55,7 +55,7 @@ public: void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget* ); - virtual bool checkParams() const = 0; + virtual bool checkParams() const; virtual void onReject(); virtual QString helpPage() const; diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.cxx b/src/SMESHGUI/SMESHGUI_SpinBox.cxx index 1c06b2ea6..11e24bbdf 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.cxx +++ b/src/SMESHGUI/SMESHGUI_SpinBox.cxx @@ -115,4 +115,5 @@ void SMESHGUI_SpinBox::RangeStepAndValidator( double min, // see QtxDoubleSpinBox::mapValueToText( double v ) setRange( min, max ); setSingleStep( step ); + setDefaultValue( min ); } diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index da59f429b..e54ada5e1 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -1217,6 +1217,10 @@ Are you sure want to export to MED 2.1 ? SMESH_ID_NODES Id Nodes + + SMESH_INCORRECT_INPUT + Incorrect input data! + SMESH_INFORMATION Information diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 928611d8a..397040d25 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -79,6 +79,9 @@ StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator() bool StdMeshersGUI_NbSegmentsCreator::checkParams() const { + if( !SMESHGUI_GenericHypothesisCreator::checkParams() ) + return false; + NbSegmentsHypothesisData data_old, data_new; readParamsFromHypo( data_old ); readParamsFromWidgets( data_new ); diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 499b9bf28..203e5f739 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -340,6 +340,9 @@ namespace { bool StdMeshersGUI_StdHypothesisCreator::checkParams() const { + if( !SMESHGUI_GenericHypothesisCreator::checkParams() ) + return false; + // check if object reference parameter is set, as it has no default value bool ok = true; if ( hypType().startsWith("ProjectionSource" ))