3 """Public transport information for Vienna"""
5 __author__ = 'kelvan <kelvan@logic.at>'
7 __website__ = 'https://github.com/kelvan/gotoVienna/'
8 __license__ = 'GNU General Public License v3 or later'
10 from PySide import QtCore, QtGui, QtDeclarative
11 from gotovienna.utils import *
12 from gotovienna.realtime import *
19 class Gui(QtCore.QObject):
20 @QtCore.Slot(str, str)
21 def search(self, line, station):
23 station = station.decode('utf-8')
28 if not line in itip.lines:
32 stations = sorted(itip.get_stations(line).items())
34 headers, stations = zip(*stations)
37 details = [(direction, name, url) for direction, stops in stations
38 for name, url in stops if match_station(station, name)]
40 except urllib2.URLError as e:
44 if __name__ == '__main__':
45 app = QtGui.QApplication(sys.argv)
47 view = QtDeclarative.QDeclarativeView()
49 # instantiate the Python object
52 # expose the object to QML
53 context = view.rootContext()
54 context.setContextProperty("itip", itip)
56 if os.path.abspath(__file__).startswith('/usr/bin/'):
57 # Assume system-wide installation, QML from /usr/share/
58 view.setSource('/usr/share/gotovienna/qml/main.qml')
60 # Assume test from source directory, use relative path
61 view.setSource(os.path.join(os.path.dirname(__file__), 'qml/main.qml'))