6 from PySide.QtCore import SIGNAL
7 from PySide.QtGui import QApplication, QMainWindow
8 from Ui_Qt import Ui_MainWindow
9 from wlSearch import Search
10 from history import History
14 class WienerLinienQt(QMainWindow, Ui_MainWindow):
15 types = ('stop', 'address', 'poi')
18 QMainWindow.__init__(self)
19 # _s is used to keep a reference to the Search object, so it does
20 # not get destroyed when it falls out of scope (the QML view is
21 # destroyed as soon as the Search object is destroyed!)
24 self.connect(self.btnSearch, SIGNAL("clicked()"), self.search)
26 self.history = History(settings.hist_file)
27 self.editOrigin.addItems(self.history)
28 self.editDestination.addItems(self.history)
31 origin = self.editOrigin.currentText()
32 destination = self.editDestination.currentText()
34 self.history.insert(0, origin)
35 self.history.insert(0, destination)
37 if not origin in self.history:
38 self.editOrigin.insertItems(0, origin)
39 self.editDestination.insertItems(0, origin)
41 if not destination in self.history:
42 self.editOrigin.insertItems(0, destination)
43 self.editDestination.insertItems(0, destination)
45 if not origin and destination:
46 self.btnSearch.setText("Search - Missing input")
48 self._s = Search(origin, destination, \
49 origin_type=self.types[self.comboOrigin.currentIndex()], \
50 destination_type=self.types[self.comboDestination.currentIndex()])
55 if __name__ == "__main__":
56 app = QApplication(sys.argv)