Salome HOME
Dump Python Extension TG_DumpPython_Extension_1
authorouv <ouv@opencascade.com>
Sat, 1 Nov 2008 14:41:52 +0000 (14:41 +0000)
committerouv <ouv@opencascade.com>
Sat, 1 Nov 2008 14:41:52 +0000 (14:41 +0000)
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_SpinBox.cxx
src/SMESHGUI/SMESH_msg_en.ts
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx

index 11500d302878a98b07a1930db7e77db2c82b3d94..1facdfa59bab93c5e00077947a76350b7d6bd155 100644 (file)
@@ -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();
 }
 
index c46be7f34b8d904b967006c40b63e84976df04d5..043f2602470b7ff5b8fe386b987b41dc73b763ef 100644 (file)
@@ -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;
 
index 1c06b2ea61446b102795931f5a5ae050479b106e..11e24bbdf4aad2c619f5d1e8945a5536dda6c02e 100644 (file)
@@ -115,4 +115,5 @@ void SMESHGUI_SpinBox::RangeStepAndValidator( double min,
   //                        see QtxDoubleSpinBox::mapValueToText( double v )
   setRange( min, max );
   setSingleStep( step );
+  setDefaultValue( min );
 }
index da59f429b1fc48849508f5920ef4e3799bb72654..e54ada5e11f627323cd59d59a860beea5ae57c4b 100644 (file)
@@ -1217,6 +1217,10 @@ Are you sure want to export to MED 2.1 ?</translation>
             <source>SMESH_ID_NODES</source>
             <translation>Id Nodes</translation>
         </message>
+        <message>
+            <source>SMESH_INCORRECT_INPUT</source>
+            <translation>Incorrect input data!</translation>
+        </message>
         <message>
             <source>SMESH_INFORMATION</source>
             <translation>Information</translation>
index 928611d8a133e401bdbeac9340778f2d636344bb..397040d25cb110db0a0e9bc2ad4537f44534b47c 100644 (file)
@@ -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 );
index 499b9bf289c5183d1cce8294ae60f5b0a4181c0f..203e5f739d59078e5eafa322a3b3411488ab4cb1 100644 (file)
@@ -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" ))