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 = []
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)
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]
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: