make GUI working even without actual data

This commit is contained in:
Sebastian Wehling-Benatelli 2014-11-26 08:48:42 +01:00
parent 4bb03d6418
commit 4b7bfc6aa9
2 changed files with 19 additions and 10 deletions

View File

@ -10,8 +10,7 @@ from pylot.core.util import fnConstructor
class Data(object):
'''
Data container class providing ObSpy-Stream and -Event instances as
variables.
Data container with attributes wfdata holding ~obspy.core.stream.
:type parent: PySide.QtGui.QWidget object, optional
:param parent: A PySide.QtGui.QWidget object utilized when
@ -75,6 +74,12 @@ class Data(object):
pass #axes = widget.axes
def getEventID(self):
try:
return self.evtdata.get('resource_id').id
except:
return 'smi:bug/pylot/1234'
class GenericDataStructure(object):
'''
@ -104,7 +109,7 @@ class GenericDataStructure(object):
class SeiscompDataStructure(object):
'''
Dictionary containing the data acces information for an SDS data archive:
Dictionary containing the data access information for an SDS data archive:
:param str dataType: Desired data type. Default: ``'waveform'``
:param sdate, edate: Either date string or an instance of

View File

@ -13,11 +13,15 @@ from PySide.QtGui import (QVBoxLayout,
def layoutStationButtons(data, comp):
layout = QVBoxLayout()
stationButtons = []
try:
st = data.select(component=comp)
numStations = len(st)
for n in range(numStations):
stationButtons[n] = QPushButton('%s'.format(
st[n].stats.station))
layout.addWidget(stationButtons)
stat = st[n].stats.station
stationButtons.append(QPushButton('%s'.format(stat)))
except:
for n in range(5):
stationButtons.append(QPushButton('ST%02d'.format(n)))
for button in stationButtons:
layout.addWidget(button)
return layout