Salome HOME
refs ##1096: allow empty lines in the boundary conditions dialog.
authormzn <mzn@opencascade.com>
Thu, 15 Dec 2016 08:13:19 +0000 (11:13 +0300)
committermzn <mzn@opencascade.com>
Thu, 15 Dec 2016 08:14:00 +0000 (11:14 +0300)
src/HYDROGUI/BndConditionsDialog.py

index 5156d8460bb0902e5cbc2b599a37460f625652c1..7c393be0ea271af339b916881b6370b3288e368b 100644 (file)
@@ -185,7 +185,7 @@ class BoundaryConditionsDialog(QtGui.QDialog):
         if not self.is_valid():
             return False
         
-        file_path = self.resultBndConditionsFileEdit.text()
+        file_path = self.get_output_path()
         writer = boundaryConditions.BoundaryConditionWriter(file_path)
         
         conditions = []
@@ -194,8 +194,10 @@ class BoundaryConditionsDialog(QtGui.QDialog):
             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())
-            group_name = str(self.boundaryConditionsTable.item(row_nb, 5).text())
-            conditions.append(boundaryConditions.BoundaryCondition(lihbor, liubor, livbor, litbor, group_name))
+            
+            if lihbor and liubor and livbor and litbor:
+                group_name = str(self.boundaryConditionsTable.item(row_nb, 5).text())
+                conditions.append(boundaryConditions.BoundaryCondition(lihbor, liubor, livbor, litbor, group_name))
                 
         writer.write(conditions)
                     
@@ -368,19 +370,28 @@ class BoundaryConditionsDialog(QtGui.QDialog):
         elif self.get_output_path().isEmpty():
             QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty."))
         else:
-            has_empty_cells = False
+            has_incomplete_lines = False
+            is_table_empty = True
             for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
                 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())
-                
-                if (not lihbor) or (not liubor) or (not livbor) or (not litbor):
-                    has_empty_cells = True
+               
+                has_filled_cells = True if (lihbor or liubor or livbor or litbor) else False
+
+                if has_filled_cells:
+                  is_table_empty = False
+
+                all_cells_filled  = True if (lihbor and liubor and livbor and litbor) else False
+                if has_filled_cells and (not all_cells_filled):
+                    has_incomplete_lines = True
                     break
             
-            if has_empty_cells:
-                QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s)."))
+            if is_table_empty:
+                QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table is empty."))               
+            elif has_incomplete_lines:
+                QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has incomplete line(s)."))
             else:
                 is_ok = True