Do not crash when editing relations containing None
This commit is contained in:
parent
5869f5d421
commit
ff9f0c10b6
@ -52,13 +52,13 @@ class creatorForm(QtWidgets.QDialog):
|
||||
|
||||
for i in rel.content:
|
||||
self.table.insertRow(self.table.rowCount())
|
||||
for j in range(len(i)):
|
||||
for j, value in enumerate(i):
|
||||
if value is None:
|
||||
raise Exception('Relation contains a None value and cannot be edited from the GUI')
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
item.setText(i[j])
|
||||
item.setText(str(value))
|
||||
self.table.setItem(self.table.rowCount() - 1, j, item)
|
||||
|
||||
pass
|
||||
|
||||
def setup_empty(self):
|
||||
self.table.insertColumn(0)
|
||||
self.table.insertColumn(0)
|
||||
|
@ -312,9 +312,15 @@ class relForm(QtWidgets.QMainWindow):
|
||||
def editRelation(self):
|
||||
from relational_gui import creator
|
||||
for i in self.ui.lstRelations.selectedItems():
|
||||
result = creator.edit_relation(
|
||||
self.user_interface.get_relation(i.text())
|
||||
)
|
||||
try:
|
||||
result = creator.edit_relation(
|
||||
self.user_interface.get_relation(i.text())
|
||||
)
|
||||
except Exception as e:
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self, QtWidgets.QApplication.translate("Form", "Error"), str(e)
|
||||
)
|
||||
return
|
||||
if result != None:
|
||||
self.user_interface.set_relation(i.text(), result)
|
||||
self.updateRelations()
|
||||
|
Loading…
x
Reference in New Issue
Block a user