From 903e87e1e170c8cc47abf1e8a9229c06c9e8d4ce Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Fri, 13 Feb 2015 11:12:47 +0100 Subject: [PATCH] usage of DATASTRUCTURE modified --- QtPyLoT.py | 4 +++- pylot/core/util/structure.py | 3 ++- pylot/core/util/widgets.py | 18 ++++++------------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index f349c2b5..d8a90102 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -44,6 +44,7 @@ from pylot.core.util import (FilterOptionsDialog, MPLWidget, PropertiesDlg, HelpForm) +from pylot.core.util.structure import DATASTRUCTURE # Version information @@ -64,7 +65,8 @@ class MainWindow(QMainWindow): settings.setValue("user/Login", os.getlogin()) settings.sync() self.recentEvents = settings.value("data/recentEvents", []) - self.dataStructure = settings.value("data/structure", None) + self.dataStructure = DATASTRUCTURE[ + settings.value("data/Structure", None)]() self.setWindowTitle("PyLoT - do seismic processing the python way") self.setWindowIcon(QIcon(":/icon.ico")) self.seismicPhase = str(settings.value("phase", "P")) diff --git a/pylot/core/util/structure.py b/pylot/core/util/structure.py index 36e35b60..34c6aaaf 100644 --- a/pylot/core/util/structure.py +++ b/pylot/core/util/structure.py @@ -8,4 +8,5 @@ Created on Wed Jan 26 17:47:25 2015 from pylot.core.read import SeiscompDataStructure, PilotDataStructure -DATASTRUCTURE = {'PILOT':PilotDataStructure, 'SeisComP':SeiscompDataStructure} +DATASTRUCTURE = {'PILOT':PilotDataStructure, 'SeisComP':SeiscompDataStructure, + None:None} diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 76e25376..65c5406d 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -162,15 +162,15 @@ class InputsTab(PropTab): from pylot.core.util.structure import DATASTRUCTURE - datastruct = DATASTRUCTURE.keys() - self.structureSelect.addItems(datastruct) - self.updateWidget(DATASTRUCTURE) + self.structureSelect.addItems(DATASTRUCTURE.keys()) layout = QGridLayout() layout.addWidget(dataDirLabel, 0, 0) layout.addWidget(self.dataDirEdit, 0, 1) layout.addWidget(fullNameLabel, 1, 0) layout.addWidget(self.fullNameEdit, 1, 1) + layout.addWidget(structureLabel, 2, 0) + layout.addWidget(self.structureSelect, 2, 1) self.setLayout(layout) @@ -178,15 +178,9 @@ class InputsTab(PropTab): values = {} values["data/dataRoot"] = self.dataDirEdit.text() values["user/FullName"] = self.fullNameEdit.text() + values["data/Structure"] = self.structureSelect.currentText() return values - def updateWidget(self, structure): - key = self.structureSelect.currentText() - structure = structure[key] - structure().getFields().keys() - - - class OutputsTab(PropTab): @@ -351,7 +345,7 @@ class FilterOptionsDialog(QDialog): self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel) - + grid = QGridLayout() grid.addWidget(self.freqGroupBox, 0, 2, 1, 2) grid.addLayout(self.selectTypeLayout, 1, 2, 1, 2) @@ -392,7 +386,7 @@ class FilterOptionsDialog(QDialog): freq.append(self.freqmaxSpinBox.value()) self.filterOptions.freq = freq self.filterOptions.order = self.orderSpinBox.value() - + def getFilterOptions(self): return self.filterOptions