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

View File

@ -131,7 +131,6 @@ class Worker(QRunnable):
try: try:
result = self.fun(self.args) result = self.fun(self.args)
except: except:
#traceback.print_exc()
exctype, value = sys.exc_info ()[:2] exctype, value = sys.exc_info ()[:2]
print(exctype, value, traceback.format_exc()) print(exctype, value, traceback.format_exc())
self.signals.error.emit ((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): def __init__(self, parent, options):
MultiEventWidget.__init__(self, options, parent, 1) MultiEventWidget.__init__(self, options, parent, 1)
self.events2plot = {}
self.connect_buttons() self.connect_buttons()
self.init_plot_layout() self.init_plot_layout()
self.init_log_layout() self.init_log_layout()
@ -2365,6 +2366,9 @@ class AutoPickWidget(MultiEventWidget):
self.main_layout.setStretch(1, 1) self.main_layout.setStretch(1, 1)
def reinitEvents2plot(self): def reinitEvents2plot(self):
for eventID, eventDict in self.events2plot.items():
for widget_key, widget in eventDict.items():
widget.setParent(None)
self.events2plot = {} self.events2plot = {}
self.eventbox.clear() self.eventbox.clear()
self.refresh_plot_tabs() self.refresh_plot_tabs()