saving picks in events as part of project

This commit is contained in:
Marcel Paffrath 2017-04-19 16:51:19 +02:00
parent f935da8296
commit 227faf14c2
2 changed files with 27 additions and 8 deletions

View File

@ -522,6 +522,11 @@ class MainWindow(QMainWindow):
self.drawPicks(picktype=type) self.drawPicks(picktype=type)
self.draw() self.draw()
def getCurrentEvent(self):
for event in self.project.eventlist:
if event.path == self.eventBox.currentText():
return event
def getLastEvent(self): def getLastEvent(self):
return self.recentfiles[0] return self.recentfiles[0]
@ -609,6 +614,7 @@ class MainWindow(QMainWindow):
def fill_eventbox(self, eventlist): def fill_eventbox(self, eventlist):
model = self.eventBox.model() model = self.eventBox.model()
for event in self.project.eventlist: for event in self.project.eventlist:
event = event.path
item = QtGui.QStandardItem(str(event)) item = QtGui.QStandardItem(str(event))
# if ref: set different color e.g. # if ref: set different color e.g.
#item.setBackground(QtGui.QColor('teal')) #item.setBackground(QtGui.QColor('teal'))
@ -791,11 +797,14 @@ class MainWindow(QMainWindow):
if hasattr(self.project, 'eventlist'): if hasattr(self.project, 'eventlist'):
if len(self.project.eventlist) > 0: if len(self.project.eventlist) > 0:
if self._eventChanged: if self._eventChanged:
self.loadWaveformDataThread() self.newWFplot()
self._eventChanged = False
if self.tabs.currentIndex() == 1: if self.tabs.currentIndex() == 1:
self.refresh_array_map() self.refresh_array_map()
def newWFplot(self):
self.loadWaveformDataThread()
self._eventChanged = False
def loadWaveformDataThread(self): def loadWaveformDataThread(self):
wfd_thread = Thread(self, self.loadWaveformData, progressText='Reading data input...') wfd_thread = Thread(self, self.loadWaveformData, progressText='Reading data input...')
wfd_thread.finished.connect(self.plotWaveformDataThread) wfd_thread.finished.connect(self.plotWaveformDataThread)
@ -838,6 +847,13 @@ class MainWindow(QMainWindow):
self.openautopicksaction.setEnabled(True) self.openautopicksaction.setEnabled(True)
self.loadpilotevent.setEnabled(True) self.loadpilotevent.setEnabled(True)
self.saveEventAction.setEnabled(True) self.saveEventAction.setEnabled(True)
event = self.getCurrentEvent()
if event.picks:
self.picks = event.picks
self.drawPicks(picktype='manual')
if event.autopicks:
self.autopicks = event.autopicks
self.drawPicks(picktype='auto')
self.draw() self.draw()
def clearWaveformDataPlot(self): def clearWaveformDataPlot(self):
@ -1071,8 +1087,10 @@ class MainWindow(QMainWindow):
def updatePicks(self, type='manual'): def updatePicks(self, type='manual'):
picks = picksdict_from_picks(evt=self.get_data(type).get_evt_data()) picks = picksdict_from_picks(evt=self.get_data(type).get_evt_data())
if type == 'manual': if type == 'manual':
self.getCurrentEvent().addPicks(picks)
self.picks.update(picks) self.picks.update(picks)
elif type == 'auto': elif type == 'auto':
self.getCurrentEvent().addAutopicks(picks)
self.autopicks.update(picks) self.autopicks.update(picks)
self.check4Comparison() self.check4Comparison()
@ -1438,8 +1456,9 @@ class Project(object):
if len(eventlist) == 0: if len(eventlist) == 0:
return return
for item in eventlist: for item in eventlist:
if not item in self.eventlist: event = Event(item)
self.eventlist.append(item) if not event in self.eventlist:
self.eventlist.append(event)
self.setDirty() self.setDirty()
def setDirty(self): def setDirty(self):
@ -1483,12 +1502,12 @@ class Project(object):
return project return project
class event(object): class Event(object):
''' '''
Pickable class containing information on a single event. Pickable class containing information on a single event.
''' '''
def __init__(self, eventPath): def __init__(self, path):
self.eventPath = eventPath self.path = path
self.autopicks = None self.autopicks = None
self.picks = None self.picks = None

View File

@ -1 +1 @@
8057-dirty f935-dirty