--- /dev/null
+#!/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_())
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>gotoVienna</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="5" column="1">
+ <widget class="QPushButton" name="btnSearch">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="comboDestination">
+ <item>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Address</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>POI</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0" rowspan="2">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Origin</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" rowspan="2">
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Destination</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="editOrigin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="insertPolicy">
+ <enum>QComboBox::NoInsert</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QComboBox" name="editDestination">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="insertPolicy">
+ <enum>QComboBox::NoInsert</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="comboOrigin">
+ <item>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Address</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>POI</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuHelp">
+ <property name="title">
+ <string>&Help</string>
+ </property>
+ <addaction name="actionAbout"/>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>&Edit</string>
+ </property>
+ <addaction name="actionToggle"/>
+ </widget>
+ <addaction name="menuEdit"/>
+ <addaction name="menuHelp"/>
+ </widget>
+ <action name="actionAbout">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </action>
+ <action name="actionToggle">
+ <property name="text">
+ <string>Toggle</string>
+ </property>
+ <property name="iconText">
+ <string>Toggle</string>
+ </property>
+ <property name="toolTip">
+ <string>Toggle</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+T</string>
+ </property>
+ </action>
+ </widget>
+ <tabstops>
+ <tabstop>editOrigin</tabstop>
+ <tabstop>comboOrigin</tabstop>
+ <tabstop>editDestination</tabstop>
+ <tabstop>comboDestination</tabstop>
+ <tabstop>btnSearch</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
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">
<defs
def __iter__(self):
for detail in self.details():
yield detail
- raise IndexError()
def _parse_details(self):
if self._current_state < 0:
+++ /dev/null
-#!/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_())
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>480</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>pyWienerLinien</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="5" column="1">
- <widget class="QPushButton" name="btnSearch">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Search</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="comboDestination">
- <item>
- <property name="text">
- <string>Stop</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Address</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>POI</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0" rowspan="2">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Origin</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" rowspan="2">
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Destination</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="editOrigin">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="insertPolicy">
- <enum>QComboBox::NoInsert</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QComboBox" name="editDestination">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="insertPolicy">
- <enum>QComboBox::NoInsert</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="comboOrigin">
- <item>
- <property name="text">
- <string>Stop</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Address</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>POI</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>25</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuHelp">
- <property name="title">
- <string>&Help</string>
- </property>
- <addaction name="actionAbout"/>
- </widget>
- <widget class="QMenu" name="menuEdit">
- <property name="title">
- <string>&Edit</string>
- </property>
- <addaction name="actionToggle"/>
- </widget>
- <addaction name="menuEdit"/>
- <addaction name="menuHelp"/>
- </widget>
- <action name="actionAbout">
- <property name="text">
- <string>About</string>
- </property>
- </action>
- <action name="actionToggle">
- <property name="text">
- <string>Toggle</string>
- </property>
- <property name="iconText">
- <string>Toggle</string>
- </property>
- <property name="toolTip">
- <string>Toggle</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+T</string>
- </property>
- </action>
- </widget>
- <tabstops>
- <tabstop>editOrigin</tabstop>
- <tabstop>comboOrigin</tabstop>
- <tabstop>editDestination</tabstop>
- <tabstop>comboDestination</tabstop>
- <tabstop>btnSearch</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
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
}
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'
}
}