make GUI working even without actual data

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

View File

@@ -13,11 +13,15 @@ from PySide.QtGui import (QVBoxLayout,
def layoutStationButtons(data, comp):
layout = QVBoxLayout()
stationButtons = []
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)
try:
st = data.select(component=comp)
numStations = len(st)
for n in range(numStations):
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