1
0
forked from IPKM/nmreval

graph keys were not deleted in tabs because of tab switching; closes #150

This commit is contained in:
Dominik Demuth 2023-11-22 18:30:17 +01:00
parent 929bb80f2f
commit c7a21c72f2

View File

@ -371,26 +371,28 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
val_figure = self.valuewidget.connected_figure
self.valuewidget.remove_graph()
_remove_pts = False
_remove_t1 = False
w = None
for w in self.area.subWindowList():
wdgt = w.widget()
if wdgt.id == gid:
wdgt.disconnect()
wdgt.scene.disconnect()
if wdgt == self.current_graph_widget:
if self.ptsselectwidget.connected_figure == gid:
self.ptsselectwidget.connected_figure = None
for line in self.ptsselectwidget.pts_lines:
self.current_graph_widget.remove_external(line)
# TODO: removing tabs creates an unholy mess because it calls toggle_tabs
self.tabWidget.removeTab(self.tabWidget.indexOf(self.ptsselectwidget))
_remove_pts = True
if self.t1tauwidget.connected_figure == gid:
self.t1tauwidget.connected_figure = None
self.current_graph_widget.add_external(self.t1tauwidget.min_pos)
self.current_graph_widget.add_external(self.t1tauwidget.parabola)
self.tabWidget.removeTab(self.tabWidget.indexOf(self.t1tauwidget))
_remove_t1 = True
if self.fit_dialog.connected_figure == gid:
self.fit_dialog.connected_figure = None
@ -417,6 +419,11 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
break
if _remove_t1:
self.tabWidget.removeTab(self.tabWidget.indexOf(self.t1tauwidget))
if _remove_pts:
self.tabWidget.removeTab(self.tabWidget.indexOf(self.ptsselectwidget))
if w is not None:
self.area.removeSubWindow(w)
w.close()