-#!/usr/env/python
+#!/usr/bin/env python
"""Public transport information for Vienna"""
__author__ = 'kelvan <kelvan@logic.at>'
-__version__ = '0.8.2'
-__website__ = 'https://github.com/kelvan/gotoVienna/'
+__version__ = '0.9.0'
+__website__ = 'http://tinyurl.com/gotoVienna'
__license__ = 'GNU General Public License v3 or later'
from datetime import datetime
import threading
from datetime import time
+class AboutInfo(QObject):
+ def __init__(self):
+ QObject.__init__(self)
+
+ @Slot(result=unicode)
+ def getAppName(self):
+ return u'gotoVienna %s' % __version__
+
+ @Slot(result=unicode)
+ def getWebsiteURL(self):
+ return __website__
+
+ @Slot(result=unicode)
+ def getCopyright(self):
+ return 'Copyright 2011, 2012 %s' % __author__
+
+ @Slot(result=unicode)
+ def getLicense(self):
+ return __license__
+
class GotoViennaListModel(QAbstractListModel):
def __init__(self, objects=None):
QAbstractListModel.__init__(self)
@Slot(str)
def load_departures(self, url):
def load_async():
- self.current_departures = map(self.map_departure, self.itip.get_departures(url))
- print self.current_departures
+ self.current_departures = map(self.map_departure, \
+ self.itip.get_departures(url))
+ #print self.current_departures
self.departuresLoaded.emit()
threading.Thread(target=load_async).start()
-
+
@Slot(str)
def load_station_departures(self, station):
def load_async():
- self.current_departures = map(self.map_departure, self.itip.get_departures_by_station(station))
- print self.current_departures
+ self.current_departures = map(self.map_departure, \
+ sort_departures(self.itip.get_departures_by_station(station)))
+ #print self.current_departures
self.departuresLoaded.emit()
threading.Thread(target=load_async).start()
-
+
@Slot(float, float)
def load_nearby_departures(self, lat, lon):
def load_async():
for station in stations:
print station
try:
- self.current_departures += map(self.map_departure, self.itip.get_departures_by_station(station))
+ self.current_departures += self.itip.get_departures_by_station(station)
except Exception as e:
print e.message
- print self.current_departures
+ self.current_departures = map(self.map_departure, \
+ sort_departures(self.current_departures))
+ #print self.current_departures
except Exception as e:
print e.message
-
+
print 'loaded'
self.departuresLoaded.emit()
view = QDeclarativeView()
+ aboutInfo = AboutInfo()
+
# instantiate the Python object
itip = Gui()
# expose the object to QML
context = view.rootContext()
context.setContextProperty('itip', itip)
+ context.setContextProperty('aboutInfo', aboutInfo)
if os.path.abspath(__file__).startswith('/usr/bin/'):
# Assume system-wide installation, QML from /usr/share/