MainWindow.setTabOrder(self.comboDestination, self.btnSearch)
def retranslateUi(self, MainWindow):
- MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "pyWienerLinien", None, QtGui.QApplication.UnicodeUTF8))
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "gotoVienna", None, QtGui.QApplication.UnicodeUTF8))
self.btnSearch.setText(QtGui.QApplication.translate("MainWindow", "Search", None, QtGui.QApplication.UnicodeUTF8))
self.comboDestination.setItemText(0, QtGui.QApplication.translate("MainWindow", "Stop", None, QtGui.QApplication.UnicodeUTF8))
self.comboDestination.setItemText(1, QtGui.QApplication.translate("MainWindow", "Address", None, QtGui.QApplication.UnicodeUTF8))
import sys
import os.path
import webbrowser
-from PySide.QtCore import SIGNAL, QTranslator, QObject
+from PySide.QtCore import SIGNAL, QTranslator, QObject, Qt
from PySide.QtGui import QApplication, QMainWindow
from Ui_Qt import Ui_MainWindow
from wlSearch import Search
def __init__(self):
QMainWindow.__init__(self)
+ self.setAttribute(Qt.WA_Maemo5StackedWindow)
# _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 = Search(origin, destination, \
origin_type=self.types[self.comboOrigin.currentIndex()], \
- destination_type=self.types[self.comboDestination.currentIndex()])
+ destination_type=self.types[self.comboDestination.currentIndex()], \
+ parent=self)
self._s.open_qml()
return True
Text {
id: dauer
color: row.textColor
- text: 'Dauer: ' + modelData.duration + ' (' + modelData.change + ' x umsteigen)'
+ text: 'Dauer: ' + modelData.duration + ((modelData.change > 0)?(' (' + modelData.change + ' x umsteigen)'):'')
font.pixelSize: 17
anchors.left: time_from.right
anchors.top: parent.top
from parseHtml import Parser
+from PySide.QtCore import Qt
from PySide.QtDeclarative import QDeclarativeView
def QMLModel(overview):
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
def open_qml(self, dtime=datetime.now()):
p = Parser(self.get_html(dtime))
self.qml_model = QMLModel(p.overview)
- self.view = QDeclarativeView()
+ 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)