debugging UI problems to get the main application running

This commit is contained in:
Sebastian Wehling-Benatelli 2014-11-06 15:07:05 +01:00
parent 013c948b33
commit 86803cdff0
3 changed files with 25 additions and 13 deletions

View File

@ -26,6 +26,7 @@ import sys
from PySide.QtCore import * from PySide.QtCore import *
from PySide.QtGui import * from PySide.QtGui import *
from obspy.core import (read, UTCDateTime) from obspy.core import (read, UTCDateTime)
from pylot import *
from pylot.core.util import _getVersionString from pylot.core.util import _getVersionString
from pylot.core.read import (Data, from pylot.core.read import (Data,
FilterOptions) FilterOptions)
@ -46,13 +47,17 @@ class MainWindow(QMainWindow):
def __init__(self, parent=None): def __init__(self, parent=None):
super(MainWindow, self).__init__(parent) super(MainWindow, self).__init__(parent)
# initialize filter parameter
filterOptionsP = FILTERDEFAULTS['P'] filterOptionsP = FILTERDEFAULTS['P']
filterOptionsS = FILTERDEFAULTS['S'] filterOptionsS = FILTERDEFAULTS['S']
self.filterOptionsP = FilterOptions(**filterOptionsP) self.filterOptionsP = FilterOptions(**filterOptionsP)
self.filterOptionsS = FilterOptions(**filterOptionsS) self.filterOptionsS = FilterOptions(**filterOptionsS)
# initialize data
self.data = None
self.loadData() self.loadData()
self.updateFilterOptions() self.updateFilterOptions()
self.startTime = min([tr.stats.starttime for tr in self.data])
self.setupUi() self.setupUi()
@ -63,9 +68,9 @@ class MainWindow(QMainWindow):
self.data = Data() self.data = Data()
def setupUi(self): def setupUi(self):
self.setWindowIcon(QIcon("PyLoT.ico")) self.setWindowIcon(QIcon(":/pylot.ico"))
xlab = 'time since {0}'.format() xlab = self.startTime.strftime('seconds since %d %b %Y %H:%M:%S (%Z)')
plottitle = self._getCurrentPlotType() plottitle = self._getCurrentPlotType()
# create central matplotlib figure widget # create central matplotlib figure widget
@ -74,9 +79,9 @@ class MainWindow(QMainWindow):
ylabel=None, ylabel=None,
title=plottitle) title=plottitle)
filterDockWidget = FilterOptionsDialog(titleString="Filter Options", filterDlg = FilterOptionsDialog(titleString="Filter Options",
parent=self, parent=self,
filterOptions=filteroptions) filterOptions=self.filteroptions)
self.eventLabel = QLabel() self.eventLabel = QLabel()
self.eventLabel.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.eventLabel.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
@ -86,6 +91,7 @@ class MainWindow(QMainWindow):
status.showMessage("Ready", 5000) status.showMessage("Ready", 5000)
statLayout = self.layoutStationButtons(self.numStations) statLayout = self.layoutStationButtons(self.numStations)
dataLayout = MPLWidget()
maingrid = QGridLayout() maingrid = QGridLayout()
maingrid.setSpacing(10) maingrid.setSpacing(10)
@ -96,12 +102,18 @@ class MainWindow(QMainWindow):
def plotData(self): def plotData(self):
self.data.plotData(self.DataPlot) self.data.plotData(self.DataPlot)
def adjustFilterOptions(self):
filterDlg = FilterOptionsDialog(titleString="Filter Options",
parent=self,
filterOptions=self.filteroptions)
filterDlg.connect()
def updateFilterOptions(self): def updateFilterOptions(self):
try: try:
self.filteroptions = [self.filterOptionsP self.filteroptions = [self.filterOptionsP
if not self.seismicPhase == 'S' if not self.seismicPhase == 'S'
else self.filterOptionsS] else self.filterOptionsS]
except e: except Exception, e:
self.updateStatus('Error: %s' % e + ' ... no filteroptions loaded') self.updateStatus('Error: %s' % e + ' ... no filteroptions loaded')
else: else:
self.updateStatus('Filteroptions succesfully loaded ...') self.updateStatus('Filteroptions succesfully loaded ...')
@ -111,16 +123,16 @@ class MainWindow(QMainWindow):
def layoutStationButtons(self, numStations): def layoutStationButtons(self, numStations):
layout = QVBoxLayout() layout = QVBoxLayout()
stationButtons = []
for n in range(numStations): for n in range(numStations):
tr = data.select(component=self.dispOptions.comp) tr = self.data.select(component=self.dispOptions.comp)
try: try:
stationButtons[n] = QPushButton('%s'.format( stationButtons[n] = QPushButton('%s'.format(
tr[n].stats.station)) tr[n].stats.station))
except IndexError: except IndexError:
error = QErrorMessage(self) error = QErrorMessage(self)
errorString = QString() errorString = '''Number of stations does not match number of
errorString.setText('''Number of stations does not match number traces!'''
of traces!''')
error.showMessage(errorString) error.showMessage(errorString)
self.__del__() self.__del__()
layout.addWidget(stationButtons) layout.addWidget(stationButtons)
@ -136,7 +148,7 @@ class MainWindow(QMainWindow):
def main(): def main():
# create th Qt application # create the Qt application
pylot_app = QApplication(sys.argv) pylot_app = QApplication(sys.argv)
# set Application Information # set Application Information

View File

@ -1 +1 @@
0.1a1 7fd1-dirty

View File

@ -4,13 +4,13 @@
exporting these as numerous standard phase format and localize the corresponding exporting these as numerous standard phase format and localize the corresponding
seismic event with external software as, e.g.:</p> seismic event with external software as, e.g.:</p>
<ul type="circle"> <ul type="circle">
<li><a href="http://alomax.free.fr/nlloc/">NonLinLoc</a></li> <li><a href="http://alomax.free.fr/nlloc/index.html">NonLinLoc</a></li>
<li>HypoInvers</li> <li>HypoInvers</li>
<li>HypoSat</li> <li>HypoSat</li>
<li>whatever you want ...</li> <li>whatever you want ...</li>
</ul> </ul>
<p>Read more on the <p>Read more on the
<a href="https://ariadne.geophysik.rub.de/trac/PyLoT/wiki">PyLoT WikiPage</a>.</p> <a href="https://ariadne.geophysik.rub.de/trac/PyLoT/wiki/">PyLoT WikiPage</a>.</p>
<p>Bug reports are very much appreciated and can also be delivered on our <p>Bug reports are very much appreciated and can also be delivered on our
<a href="https://ariadne.geophysik.rub.de/trac/PyLoT">PyLoT TracPage</a> after <a href="https://ariadne.geophysik.rub.de/trac/PyLoT">PyLoT TracPage</a> after
successful registration.</p> successful registration.</p>