From: ouv Date: Mon, 10 Nov 2008 17:11:09 +0000 (+0000) Subject: Dump Python extension X-Git-Tag: TG_DumpPython_Extension_2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7730fea77b9e0fa1add5a4a13a68cafff97b1c9a;p=modules%2Fsmesh.git Dump Python extension --- diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 1facdfa59..f22331a4a 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -216,7 +216,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() break; case QVariant::Double: { - QtxDoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 ); + SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 ); sb->setObjectName( (*anIt).myName ); attuneStdWidget( sb, i ); sb->setValue( (*anIt).myValue.toDouble() ); @@ -276,9 +276,9 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par params.append( item ); } - else if( (*anIt)->inherits( "QtxDoubleSpinBox" ) ) + else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) { - QtxDoubleSpinBox* sb = ( QtxDoubleSpinBox* )( *anIt ); + SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); item.myValue = sb->value(); params.append( item ); } @@ -402,25 +402,24 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi return false; } -bool SMESHGUI_GenericHypothesisCreator::checkParams() const +bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const { + bool ok = true; 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; + ok = sb->isValid( msg, true ) && ok; } else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) { SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); - if( !sb->isValid() ) - return false; + ok = sb->isValid( msg, true ) && ok; } } - return true; + return ok; } void SMESHGUI_GenericHypothesisCreator::onReject() @@ -503,9 +502,13 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f ) void SMESHGUI_HypothesisDlg::accept() { - if ( myCreator && !myCreator->checkParams() ) + QString msg; + if ( myCreator && !myCreator->checkParams( msg ) ) { - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), tr( "SMESH_INCORRECT_INPUT" ) ); + QString str( tr( "SMESH_INCORRECT_INPUT" ) ); + if ( !msg.isEmpty() ) + str += "\n" + msg; + SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); return; } QtxDialog::accept(); diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 043f26024..8749450aa 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; + virtual bool checkParams( QString& ) const; virtual void onReject(); virtual QString helpPage() const; diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 397040d25..7342bf0b8 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -77,9 +77,9 @@ StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator() { } -bool StdMeshersGUI_NbSegmentsCreator::checkParams() const +bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const { - if( !SMESHGUI_GenericHypothesisCreator::checkParams() ) + if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) return false; NbSegmentsHypothesisData data_old, data_new; diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index fd50e55ad..364679933 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -61,7 +61,7 @@ public: StdMeshersGUI_NbSegmentsCreator(); virtual ~StdMeshersGUI_NbSegmentsCreator(); - virtual bool checkParams() const; + virtual bool checkParams( QString& ) const; protected: virtual QFrame* buildFrame(); diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 203e5f739..5efe23ee7 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -338,9 +338,9 @@ namespace { */ //================================================================================ -bool StdMeshersGUI_StdHypothesisCreator::checkParams() const +bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const { - if( !SMESHGUI_GenericHypothesisCreator::checkParams() ) + if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) return false; // check if object reference parameter is set, as it has no default value diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h index 501e7aa91..f62c9590e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h @@ -40,7 +40,7 @@ public: StdMeshersGUI_StdHypothesisCreator( const QString& ); virtual ~StdMeshersGUI_StdHypothesisCreator(); - virtual bool checkParams() const; + virtual bool checkParams( QString& ) const; protected: virtual QFrame* buildFrame ();