if not self.is_valid():
return False
- file_path = self.resultBndConditionsFileEdit.text()
+ file_path = self.get_output_path()
writer = boundaryConditions.BoundaryConditionWriter(file_path)
conditions = []
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)
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