Merge branch 'master' of github.com:kelvan/gotoVienna
[pywienerlinien] / wlSearch.py
index 599f065..5b5e7f9 100644 (file)
@@ -9,6 +9,7 @@ import urllib2
 
 from parseHtml import Parser
 
+from PySide.QtCore import Qt
 from PySide.QtDeclarative import QDeclarativeView
 
 def QMLModel(overview, details):
@@ -40,11 +41,12 @@ def QMLModel(overview, details):
 
 class Search:
 
-    def __init__(self, origin, destination, origin_type='stop', destination_type='stop'):
+    def __init__(self, origin, destination, origin_type='stop', destination_type='stop', parent=None):
         self.origin = origin
         self.destination = destination
         self.origin_type = origin_type
         self.destination_type = destination_type
+        self.parent = parent
         self.view = None
         self.qml_model = None
 
@@ -56,8 +58,11 @@ class Search:
 
     def open_qml(self, dtime=datetime.now()):
         p = Parser(self.get_html(dtime))
-        self.qml_model = QMLModel(p.overview, p.details)
-        self.view = QDeclarativeView()
+        self.qml_model = QMLModel(p.overview)
+        self.view = QDeclarativeView(self.parent)
+        self.view.setWindowTitle('Search results')
+        self.view.setWindowFlags(Qt.Window)
+        self.view.setAttribute(Qt.WA_Maemo5StackedWindow)
         self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
         self.view.setSource('ui/Overview.qml')
         self.view.rootObject().setProperty('model', self.qml_model)