From: Florian Schweikert Date: Sun, 1 May 2011 22:36:08 +0000 (+0200) Subject: renamed project X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=87ac18f819df62a9d5ff42ae48bb1fb5735df551;p=pywienerlinien renamed project --- diff --git a/gotoVienna.py b/gotoVienna.py new file mode 100644 index 0000000..19b1576 --- /dev/null +++ b/gotoVienna.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +import sys +import os.path +import webbrowser +from PySide.QtCore import SIGNAL, QTranslator, QObject +from PySide.QtGui import QApplication, QMainWindow +from Ui_Qt import Ui_MainWindow +from wlSearch import Search +from history import History +import settings + + +class WienerLinienQt(QMainWindow, Ui_MainWindow): + types = ('stop', 'address', 'poi') + + def __init__(self): + QMainWindow.__init__(self) + # _s is used to keep a reference to the Search object, so it does + # not get destroyed when it falls out of scope (the QML view is + # destroyed as soon as the Search object is destroyed!) + self._s = None + self.setupUi(self) + self.connect(self.btnSearch, SIGNAL("clicked()"), self.search) + self.connect(self.actionToggle, SIGNAL("activated()"), self.toggle) + + self.history = History(settings.hist_file) + self.editOrigin.addItems(self.history) + self.editDestination.addItems(self.history) + + self.editOrigin.clearEditText() + self.editDestination.clearEditText() + + def search(self): + origin = self.editOrigin.currentText() + destination = self.editDestination.currentText() + + if not (origin and destination): + self.btnSearch.setText(self.btnSearch.tr("Search - Missing input")) + return False + + self.history.insert(0, origin) + self.history.insert(0, destination) + + if not origin in self.history: + self.editOrigin.insertItems(0, origin) + self.editDestination.insertItems(0, origin) + + if not destination in self.history: + self.editOrigin.insertItems(0, destination) + self.editDestination.insertItems(0, destination) + + self._s = Search(origin, destination, \ + origin_type=self.types[self.comboOrigin.currentIndex()], \ + destination_type=self.types[self.comboDestination.currentIndex()]) + self._s.open_qml() + return True + + def toggle(self): + eo = self.editOrigin.currentText() + ed = self.editDestination.currentText() + self.editOrigin.setEditText(ed) + self.editDestination.setEditText(eo) + + co = self.comboOrigin.currentIndex() + cd = self.comboDestination.currentIndex() + self.comboOrigin.setCurrentIndex(cd) + self.comboDestination.setCurrentIndex(co) + +if __name__ == "__main__": + app = QApplication(sys.argv) + t = QTranslator() + t.load('', directory='lang', suffix='po') + app.installTranslator(t) + w = WienerLinienQt() + w.show() + sys.exit(app.exec_()) diff --git a/gotoVienna.ui b/gotoVienna.ui new file mode 100644 index 0000000..8e52ac7 --- /dev/null +++ b/gotoVienna.ui @@ -0,0 +1,188 @@ + + + MainWindow + + + + 0 + 0 + 800 + 480 + + + + gotoVienna + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + Search + + + + + + + + Stop + + + + + Address + + + + + POI + + + + + + + + + 0 + 0 + + + + Origin + + + + + + + + 0 + 0 + + + + Destination + + + + + + + + 0 + 0 + + + + true + + + QComboBox::NoInsert + + + + + + + + 0 + 0 + + + + true + + + QComboBox::NoInsert + + + + + + + + Stop + + + + + Address + + + + + POI + + + + + + + + + + 0 + 0 + 800 + 25 + + + + + &Help + + + + + + &Edit + + + + + + + + + About + + + + + Toggle + + + Toggle + + + Toggle + + + Ctrl+T + + + + + editOrigin + comboOrigin + editDestination + comboDestination + btnSearch + + + + diff --git a/logo.svg b/logo.svg index dbef084..58f9914 100644 --- a/logo.svg +++ b/logo.svg @@ -15,7 +15,7 @@ version="1.1" inkscape:version="0.48.0 r9654" sodipodi:docname="logo.svg" - inkscape:export-filename="/home/kelvan/workspace/python/pyqt/pyWienerLinien/logo.png" + inkscape:export-filename="logo.png" inkscape:export-xdpi="100" inkscape:export-ydpi="100"> - - MainWindow - - - - 0 - 0 - 800 - 480 - - - - pyWienerLinien - - - - - 0 - 0 - - - - - - - - 0 - 0 - - - - Search - - - - - - - - Stop - - - - - Address - - - - - POI - - - - - - - - - 0 - 0 - - - - Origin - - - - - - - - 0 - 0 - - - - Destination - - - - - - - - 0 - 0 - - - - true - - - QComboBox::NoInsert - - - - - - - - 0 - 0 - - - - true - - - QComboBox::NoInsert - - - - - - - - Stop - - - - - Address - - - - - POI - - - - - - - - - - 0 - 0 - 800 - 25 - - - - - &Help - - - - - - &Edit - - - - - - - - - About - - - - - Toggle - - - Toggle - - - Toggle - - - Ctrl+T - - - - - editOrigin - comboOrigin - editDestination - comboDestination - btnSearch - - - - diff --git a/ui/Details.qml b/ui/Details.qml new file mode 100644 index 0000000..e69de29 diff --git a/ui/Overview.qml b/ui/Overview.qml index cfdc638..9b44e37 100644 --- a/ui/Overview.qml +++ b/ui/Overview.qml @@ -64,6 +64,16 @@ Rectangle { anchors.topMargin: 20 font.pixelSize: 30 } + + Text { + id: detailsList + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: detailsTitle.buttom + horizontalAlignment: Text.AlignLeft + font.pixelSize: 20 + } MouseArea { anchors.fill: parent @@ -72,7 +82,8 @@ Rectangle { } function showDetails(details) { - detailsTitle.text = 'FIXME - show details for ' + details.time_from + detailsTitle.text = 'Details for ' + details.time_from + '-' + details.time_to + detailsList.text = 'Station: ' + details.details[0].station lv.state = 'details' } }