From 9ba8aa0c423007230f69566850ff6b10fe460036 Mon Sep 17 00:00:00 2001 From: mzn Date: Thu, 15 Dec 2016 11:13:19 +0300 Subject: [PATCH] refs ##1096: allow empty lines in the boundary conditions dialog. --- src/HYDROGUI/BndConditionsDialog.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/HYDROGUI/BndConditionsDialog.py b/src/HYDROGUI/BndConditionsDialog.py index 5156d84..7c393be 100644 --- a/src/HYDROGUI/BndConditionsDialog.py +++ b/src/HYDROGUI/BndConditionsDialog.py @@ -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 -- 2.39.2