3 from PySide import QtCore, QtGui, QtDeclarative
4 from gotovienna.utils import *
5 from gotovienna.realtime import *
12 class Gui(QtCore.QObject):
13 @QtCore.Slot(str, str)
14 def search(self, line, station):
16 station = station.decode('utf-8')
21 if not line in itip.lines:
25 stations = sorted(itip.get_stations(line).items())
27 headers, stations = zip(*stations)
30 details = [(direction, name, url) for direction, stops in stations
31 for name, url in stops if match_station(station, name)]
33 except urllib2.URLError as e:
37 if __name__ == '__main__':
38 app = QtGui.QApplication(sys.argv)
40 view = QtDeclarative.QDeclarativeView()
42 # instantiate the Python object
45 # expose the object to QML
46 context = view.rootContext()
47 context.setContextProperty("itip", itip)
49 view.setSource(os.path.join(os.path.dirname(__file__), 'qml/main.qml'))