code clean up

This commit is contained in:
Sebastian Wehling-Benatelli 2015-01-29 08:53:01 +01:00
parent 9dc5b57ee0
commit 36675d4a92

View File

@ -64,18 +64,20 @@ class MainWindow(QMainWindow):
settings.setValue("user/Login", os.getlogin()) settings.setValue("user/Login", os.getlogin())
settings.sync() settings.sync()
self.recentEvents = settings.value("data/recentEvents", []) self.recentEvents = settings.value("data/recentEvents", [])
self.dataStructure = settings.value("data/structure", None)
self.setWindowTitle("PyLoT - do seismic processing the python way") self.setWindowTitle("PyLoT - do seismic processing the python way")
self.setWindowIcon(QIcon(":/icon.ico")) self.setWindowIcon(QIcon(":/icon.ico"))
self.seismicPhase = str(settings.value("phase", "P")) self.seismicPhase = str(settings.value("phase", "P"))
if settings.value("data/dataRoot", None) is None: if settings.value("data/dataRoot", None) is None:
dirname = QFileDialog().getExistingDirectory(caption = 'Choose data root ...') dirname = QFileDialog().getExistingDirectory(
caption='Choose data root ...')
settings.setValue("data/dataRoot", dirname) settings.setValue("data/dataRoot", dirname)
settings.sync() settings.sync()
# initialize filter parameter # initialize filter parameter
filterOptionsP = FILTERDEFAULTS['P'] filterOptionsP = FILTERDEFAULTS['P']
filterOptionsS = FILTERDEFAULTS['S'] filterOptionsS = FILTERDEFAULTS['S']
# print filterOptionsP, "\n", filterOptionsS
self.filterOptionsP = FilterOptions(**filterOptionsP) self.filterOptionsP = FilterOptions(**filterOptionsP)
self.filterOptionsS = FilterOptions(**filterOptionsS) self.filterOptionsS = FilterOptions(**filterOptionsS)
@ -84,9 +86,9 @@ class MainWindow(QMainWindow):
self.dirty = False self.dirty = False
self.loadData() self.loadData()
self.updateFilterOptions() self.updateFilterOptions()
# print self.filteroptions
try: try:
self.startTime = min([tr.stats.starttime for tr in self.data.wfdata]) self.startTime = min(
[tr.stats.starttime for tr in self.data.wfdata])
except: except:
self.startTime = UTCDateTime() self.startTime = UTCDateTime()
@ -389,11 +391,13 @@ class MainWindow(QMainWindow):
self.statusBar().showMessage(message, 5000) self.statusBar().showMessage(message, 5000)
if self.getData() is not None: if self.getData() is not None:
if not self.getData().isNew(): if not self.getData().isNew():
self.setWindowTitle("PyLoT - processing event %s[*]" % self.getData().getID()) self.setWindowTitle(
"PyLoT - processing event %s[*]" % self.getData().getID())
elif self.getData().isNew(): elif self.getData().isNew():
self.setWindowTitle("PyLoT - New event [*]") self.setWindowTitle("PyLoT - New event [*]")
else: else:
self.setWindowTitle("PyLoT - seismic processing the python way[*]") self.setWindowTitle(
"PyLoT - seismic processing the python way[*]")
self.setWindowTitle("PyLoT - seismic processing the python way[*]") self.setWindowTitle("PyLoT - seismic processing the python way[*]")
self.setWindowModified(self.dirty) self.setWindowModified(self.dirty)
@ -422,7 +426,8 @@ class MainWindow(QMainWindow):
def helpHelp(self): def helpHelp(self):
if checkurl(): if checkurl():
form = HelpForm('https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki') form = HelpForm(
'https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki')
else: else:
form = HelpForm(':/help.html') form = HelpForm(':/help.html')
form.show() form.show()
@ -445,5 +450,6 @@ def main():
pylot_form.show() pylot_form.show()
pylot_app.exec_() pylot_app.exec_()
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())