data list in QEvalDialog uses current names instead of stored

This commit is contained in:
Dominik Demuth 2023-04-19 19:43:04 +02:00
parent efd5b34b13
commit eba7869c4d

View File

@ -37,13 +37,12 @@ class QEvalDialog(QtWidgets.QDialog, Ui_CalcDialog):
tmp.append(self.listWidget.takeItem(0)) tmp.append(self.listWidget.takeItem(0))
for set_id, name in data: for set_id, name in data:
# search if set was used before # search if set was used before
new_one = True new_one = True
for i in range(len(tmp)): for i in range(len(tmp)):
w = tmp[i] w = tmp[i]
if w.data(QtCore.Qt.UserRole) == set_id: if w.data(QtCore.Qt.UserRole) == set_id:
w.setText(name)
self.listWidget.addItem(w) self.listWidget.addItem(w)
tmp.pop(i) tmp.pop(i)
new_one = False new_one = False
@ -60,7 +59,7 @@ class QEvalDialog(QtWidgets.QDialog, Ui_CalcDialog):
while len(tmp): while len(tmp):
# delete remaining ListWidgetItems # delete remaining ListWidgetItems
w = tmp.pop() w = tmp.pop()
w.deleteLater() del w
def set_graphs(self, graphs: list): def set_graphs(self, graphs: list):
self.graph_comboBox.clear() self.graph_comboBox.clear()