"""Check if the input data is valid"""
def is_valid(self):
- is_ok = False
+ is_ok = True
if self.boundaryConditionsTable.rowCount() < 1:
QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Boundary conditions list is empty."))
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 = True
for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
+ has_empty_cells = True
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())
- #print "valid: ", lihbor, liubor, livbor, litbor
- if lihbor and liubor and livbor and litbor:
+ #print "test valid: ", lihbor, liubor, livbor, litbor
+ if (lihbor != '') and (liubor != '') and (livbor != '') and (litbor != '') :
has_empty_cells = False # Full lines are OK
#print "valid: full line"
- if (not lihbor) and (not liubor) and (not livbor) and (not litbor):
+ if (lihbor == '') and (liubor == '') and (livbor == '') and (litbor == ''):
has_empty_cells = False # Empty lines are OK
#print "valid: empty line"
- if has_empty_cells:
- QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s)."))
- else:
- is_ok = True
+ if has_empty_cells:
+ #print "not valid!"
+ QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s)."))
+ is_ok = False
+ break
return is_ok