From: Paul RASCLE Date: Wed, 29 Mar 2017 15:08:23 +0000 (+0200) Subject: fix boundary condition dialog X-Git-Tag: Salome_8_3_Hydro_2_0rc1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8d63aa71e35d1b2dad5000fa5d42675d860f2b0;p=modules%2Fhydrosolver.git fix boundary condition dialog --- diff --git a/src/HYDROGUI/BndConditionsDialog.py b/src/HYDROGUI/BndConditionsDialog.py index 4baad5b..9cc7dfc 100755 --- a/src/HYDROGUI/BndConditionsDialog.py +++ b/src/HYDROGUI/BndConditionsDialog.py @@ -186,9 +186,14 @@ class BoundaryConditionsDialog(QDialog): def on_apply(self): # Save boundary conditions file if not self.is_valid(): + print 'Not valid' return False - file_path = self.resultBndConditionsFileEdit.text() + if self.sameAsInputCB.isChecked(): + file_path = self.bndConditionsFileEdit.text() + else: + file_path = self.resultBndConditionsFileEdit.text() + print 'File path:', file_path writer = boundaryConditions.BoundaryConditionWriter(file_path) conditions = [] @@ -198,7 +203,8 @@ class BoundaryConditionsDialog(QDialog): 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 != "": + conditions.append(boundaryConditions.BoundaryCondition(lihbor, liubor, livbor, litbor, group_name)) writer.write(conditions) @@ -260,12 +266,9 @@ class BoundaryConditionsDialog(QDialog): if preset and self.presets.has_key(preset): values = self.presets[preset] - row_nb, is_ok = combo.property(ROW_PROPERTY_NAME).toInt() - - if is_ok and row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount(): - #row_nb = combo.property(ROW_PROPERTY_NAME) + row_nb = combo.property(ROW_PROPERTY_NAME) - #if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount(): + if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount(): lihbor = values[0] liubor = values[1] livbor = values[2] @@ -375,15 +378,17 @@ class BoundaryConditionsDialog(QDialog): 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 = False + has_empty_cells = 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 + if lihbor and liubor and livbor and litbor: + has_empty_cells = False # Full lines are OK + if (not lihbor) and (not liubor) and (not livbor) and (not litbor): + has_empty_cells = False # Empty lines are OK break if has_empty_cells: diff --git a/tests/data/bnd_conditions_presets.txt b/tests/data/bnd_conditions_presets.txt index eb9a37b..25b07c6 100644 --- a/tests/data/bnd_conditions_presets.txt +++ b/tests/data/bnd_conditions_presets.txt @@ -1,4 +1,3 @@ Closed boundaries/walls,2,2,2,2 -Incident waves,1,1,1,* -Free T,*,*,*,4 - +Imposed flow rate,4,5,5,5 +Imposed water level,5,4,4,4