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): class Data(object):
''' '''
Data container class providing ObSpy-Stream and -Event instances as Data container with attributes wfdata holding ~obspy.core.stream.
variables.
:type parent: PySide.QtGui.QWidget object, optional :type parent: PySide.QtGui.QWidget object, optional
:param parent: A PySide.QtGui.QWidget object utilized when :param parent: A PySide.QtGui.QWidget object utilized when
@ -75,6 +74,12 @@ class Data(object):
pass #axes = widget.axes pass #axes = widget.axes
def getEventID(self):
try:
return self.evtdata.get('resource_id').id
except:
return 'smi:bug/pylot/1234'
class GenericDataStructure(object): class GenericDataStructure(object):
''' '''
@ -104,7 +109,7 @@ class GenericDataStructure(object):
class SeiscompDataStructure(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 str dataType: Desired data type. Default: ``'waveform'``
:param sdate, edate: Either date string or an instance of :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): def layoutStationButtons(data, comp):
layout = QVBoxLayout() layout = QVBoxLayout()
stationButtons = [] stationButtons = []
st = data.select(component=comp) try:
numStations = len(st) st = data.select(component=comp)
for n in range(numStations): numStations = len(st)
stationButtons[n] = QPushButton('%s'.format( for n in range(numStations):
st[n].stats.station)) stat = st[n].stats.station
layout.addWidget(stationButtons) 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 return layout