improve performance for show/hide graphs

This commit is contained in:
Dominik Demuth
2023-09-19 16:32:54 +02:00
parent c5706084bf
commit ea62a05bd3
4 changed files with 38 additions and 25 deletions

View File

@ -177,9 +177,9 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
if isinstance(name, str):
name = [name]
plots = [plots]
toplevel = len(self.sets)
self.listWidget.blockSignals(True)
for (real_plot, imag_plot, err_plot), n in zip(plots, name):
toplevel = len(self.sets)
self.sets.append(n)
if real_plot:
@ -199,7 +199,16 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
list_item.setCheckState(QtCore.Qt.Checked)
self.listWidget.addItem(list_item)
self.show_item(name)
toplevel += 1
self.listWidget.blockSignals(False)
if len(name) < 200:
self.show_item(name)
else:
QtWidgets.QMessageBox.warning(self, 'Display disabled',
'If more than 200 sets are added at once, they are not displayed to avoid major performance issues.\n'
'Building the data tree may still take some time, the checkmark on the left is invalid.\n'
'Please display them manually in smaller batches, thank you!')
def remove(self, name: str | list):
if isinstance(name, str):