WIP: working on saving filter options as part of project

This commit is contained in:
Marcel Paffrath 2017-05-31 16:25:46 +02:00
parent 62fa3ad8b1
commit cd612def81
3 changed files with 13 additions and 7 deletions

View File

@ -1314,7 +1314,7 @@ class MainWindow(QMainWindow):
self.adjustFilterOptions()
else:
self.get_data().resetWFData()
self.plotWaveformData()
self.plotWaveformDataThread()
self.drawPicks()
self.draw()
@ -1328,11 +1328,11 @@ class MainWindow(QMainWindow):
if self.filterAction.isChecked():
kwargs = self.getFilterOptions().parseFilterOptions()
self.pushFilterWF(kwargs)
self.plotWaveformData()
self.plotWaveformDataThread()
def getFilterOptions(self):
try:
return self.filteroptions[self.getSeismicPhase()]
return self.project.filteroptions[self.getSeismicPhase()]
except AttributeError as e:
print(e)
return FilterOptions(None, None, None)
@ -1341,10 +1341,12 @@ class MainWindow(QMainWindow):
return self.filteroptions
def setFilterOptions(self, filterOptions, seismicPhase=None):
if not self.project:
return
if seismicPhase is None:
self.getFilters()[self.getSeismicPhase()] = filterOptions
self.project.filteroptions[self.getSeismicPhase()] = filterOptions
else:
self.getFilters()[seismicPhase] = filterOptions
self.project.filteroptions[seismicPhase] = filterOptions
def updateFilterOptions(self):
try:
@ -2147,6 +2149,10 @@ class Project(object):
def __init__(self):
self.eventlist = []
self.location = None
self.filteroptions = {
'P': FilterOptions(),
'S': FilterOptions()
}
self.dirty = False
self._table = None

View File

@ -1 +1 @@
02a5-dirty
62fa-dirty

View File

@ -2399,7 +2399,7 @@ class FilterOptionsDialog(QDialog):
"""
super(FilterOptionsDialog, self).__init__()
if parent is not None and parent.getFilterOptions():
if parent is not None and parent.getFilters():
self.filterOptions = parent.getFilterOptions()
elif filterOptions is not None:
self.filterOptions = FilterOptions(filterOptions)