From: mzn Date: Thu, 15 Dec 2016 08:13:19 +0000 (+0300) Subject: refs ##1096: allow empty lines in the boundary conditions dialog. X-Git-Tag: SH_V2_2_0~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ba8aa0c423007230f69566850ff6b10fe460036;p=modules%2Fhydrosolver.git refs ##1096: allow empty lines in the boundary conditions dialog. --- 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