Salome HOME
fix test boundary condition dialog
authorPaul RASCLE <paul.rascle@edf.fr>
Tue, 4 Apr 2017 19:30:56 +0000 (21:30 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 4 Apr 2017 19:30:56 +0000 (21:30 +0200)
src/HYDROGUI/BndConditionsDialog.py

index 81884e8f919fea7196ad385a88b6289c6e1db174..d885d921284cee9a9a62e556a6e20f0b786e89ef 100755 (executable)
@@ -385,31 +385,32 @@ class BoundaryConditionsDialog(QDialog):
 
     """Check if the input data is valid"""
     def is_valid(self):
-        is_ok = False
+        is_ok = True
 
         if self.boundaryConditionsTable.rowCount() < 1:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Boundary conditions list is empty."))
         elif len(self.get_output_path())==0:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty."))
         else:
-            has_empty_cells = True
             for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
+                has_empty_cells = True
                 lihbor = str(self.boundaryConditionsTable.item(row_nb, 1).text())
                 liubor = str(self.boundaryConditionsTable.item(row_nb, 2).text())
                 livbor = str(self.boundaryConditionsTable.item(row_nb, 3).text())
                 litbor = str(self.boundaryConditionsTable.item(row_nb, 4).text())
-                #print "valid: ", lihbor, liubor, livbor, litbor
-                if lihbor and liubor and livbor and litbor:
+                #print "test valid: ", lihbor, liubor, livbor, litbor
+                if (lihbor != '') and (liubor != '')  and (livbor != '')  and (litbor != '') :
                     has_empty_cells = False # Full lines are OK
                     #print "valid: full line"
-                if (not lihbor) and (not liubor) and (not livbor) and (not litbor):
+                if (lihbor == '') and (liubor == '') and (livbor == '') and (litbor == ''):
                     has_empty_cells = False # Empty lines are OK
                     #print "valid: empty line"
 
-            if has_empty_cells:
-                QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s)."))
-            else:
-                is_ok = True
+                if has_empty_cells:
+                    #print "not valid!"
+                    QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s)."))
+                    is_ok = False
+                    break
 
         return is_ok