8 from PySide import QtCore, QtGui
9 from Ui_Qt import Ui_MainWindow
10 from wlSearch import Search
11 from history import History
15 class WienerLinienQt(QtGui.QMainWindow, Ui_MainWindow):
16 types = ('stop', 'address', 'poi')
19 QtGui.QMainWindow.__init__(self)
21 self.connect(self.btnSearch, QtCore.SIGNAL("clicked()"), self.search)
23 self.history = History(settings.hist_file)
24 self.editOrigin.addItems(self.history)
25 self.editDestination.addItems(self.history)
28 origin = self.editOrigin.currentText()
29 destination = self.editDestination.currentText()
31 self.history.insert(0, origin)
32 self.history.insert(0, destination)
34 self.editOrigin.insertItems(1, self.history)
35 self.editDestination.insertItems(1, self.history)
37 if not origin and destination:
38 self.btnSearch.setText("Search - Missing input")
40 s = Search(origin, destination, \
41 origin_type=self.types[self.comboOrigin.currentIndex()], \
42 destination_type=self.types[self.comboDestination.currentIndex()])
45 except webbrowser.Error:
46 self.btnSearch.setText("Error starting webbrowser")
48 self.btnSearch.setText("Search - Opening webbrowser")
52 if __name__ == "__main__":
53 app = QtGui.QApplication(sys.argv)