[update] apw saved, proper deletion of figures

This commit is contained in:
Marcel Paffrath 2017-09-18 14:44:18 +02:00
parent 6acb0ad580
commit 0949a6deac
3 changed files with 19 additions and 14 deletions

View File

@ -127,6 +127,7 @@ class MainWindow(QMainWindow):
self.project = Project()
self.project.parameter = self._inputs
self.tap = None
self.apw = None
self.paraBox = None
self.array_map = None
self._metadata = None
@ -1117,7 +1118,7 @@ class MainWindow(QMainWindow):
'''
# if pick widget is open, refresh tooltips as well
if hasattr(self, 'apw'):
if self.apw:
self.apw.refresh_tooltips()
if hasattr(self, 'cmpw'):
self.cmpw.refresh_tooltips()
@ -2093,20 +2094,21 @@ class MainWindow(QMainWindow):
"No autoPyLoT output declared!")
return
# init event selection options for autopick
self.pickoptions =[('current event', self.get_current_event, None),
('tune events', self.get_ref_events, self._style['ref']['rgba']),
('test events', self.get_test_events, self._style['test']['rgba']),
('all (picked) events', self.get_manu_picked_events, None),
('all events', self.get_all_events, None)]
if not self.apw:
# init event selection options for autopick
self.pickoptions =[('current event', self.get_current_event, None),
('tune events', self.get_ref_events, self._style['ref']['rgba']),
('test events', self.get_test_events, self._style['test']['rgba']),
('all (picked) events', self.get_manu_picked_events, None),
('all events', self.get_all_events, None)]
self.listWidget = QListWidget()
self.setDirty(True)
self.apw = AutoPickWidget(self, self.pickoptions)
self.apw.insert_log_widget(self.listWidget)
self.apw.refresh_tooltips()
self.listWidget = QListWidget()
self.setDirty(True)
self.apw = AutoPickWidget(self, self.pickoptions)
self.apw.insert_log_widget(self.listWidget)
self.apw.refresh_tooltips()
self.apw.start.connect(self.start_autopick)
self.apw.start.connect(self.start_autopick)
self.apw.show()
def start_autopick(self):

View File

@ -131,7 +131,6 @@ class Worker(QRunnable):
try:
result = self.fun(self.args)
except:
#traceback.print_exc()
exctype, value = sys.exc_info ()[:2]
print(exctype, value, traceback.format_exc())
self.signals.error.emit ((exctype, value, traceback.format_exc ()))

View File

@ -2298,6 +2298,7 @@ class AutoPickWidget(MultiEventWidget):
def __init__(self, parent, options):
MultiEventWidget.__init__(self, options, parent, 1)
self.events2plot = {}
self.connect_buttons()
self.init_plot_layout()
self.init_log_layout()
@ -2365,6 +2366,9 @@ class AutoPickWidget(MultiEventWidget):
self.main_layout.setStretch(1, 1)
def reinitEvents2plot(self):
for eventID, eventDict in self.events2plot.items():
for widget_key, widget in eventDict.items():
widget.setParent(None)
self.events2plot = {}
self.eventbox.clear()
self.refresh_plot_tabs()