renamed project
authorFlorian Schweikert <kelvan@logic.at>
Sun, 1 May 2011 22:36:08 +0000 (00:36 +0200)
committerFlorian Schweikert <kelvan@logic.at>
Sun, 1 May 2011 22:36:08 +0000 (00:36 +0200)
gotoVienna.py [new file with mode: 0644]
gotoVienna.ui [new file with mode: 0644]
logo.svg
parseHtml.py
pyWienerLinien.py [deleted file]
pyWienerLinien.ui [deleted file]
ui/Details.qml [new file with mode: 0644]
ui/Overview.qml

diff --git a/gotoVienna.py b/gotoVienna.py
new file mode 100644 (file)
index 0000000..19b1576
--- /dev/null
@@ -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 (file)
index 0000000..8e52ac7
--- /dev/null
@@ -0,0 +1,188 @@
+<?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>&amp;Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>&amp;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>
index dbef084..58f9914 100644 (file)
--- 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">
   <defs
index 498d41d..a3f8a33 100644 (file)
@@ -25,7 +25,6 @@ class Parser:
     def __iter__(self):
         for detail in self.details():
             yield detail
-        raise IndexError()
 
     def _parse_details(self):
         if self._current_state < 0:
diff --git a/pyWienerLinien.py b/pyWienerLinien.py
deleted file mode 100644 (file)
index 19b1576..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/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/pyWienerLinien.ui b/pyWienerLinien.ui
deleted file mode 100644 (file)
index 8f1e0bd..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-<?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>&amp;Help</string>
-    </property>
-    <addaction name="actionAbout"/>
-   </widget>
-   <widget class="QMenu" name="menuEdit">
-    <property name="title">
-     <string>&amp;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>
diff --git a/ui/Details.qml b/ui/Details.qml
new file mode 100644 (file)
index 0000000..e69de29
index cfdc638..9b44e37 100644 (file)
@@ -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'
         }
     }