def on_directions_clicked(self, widget, fromfield, tofield, resultview, marker_layer, directionlist): if fromfield.marker and tofield.marker: # do directions lookup guide = Guide(self.application, marker_layer, directionlist.get_model()) error = guide.search(fromfield.get_marker(), tofield.get_marker()) if not error: marker_layer.show() resultview.show("Directions", 1) ## 1 -> show directions directionlist.show() else: resultview.show(error, 1) ## 1 -> show directions else: marker_layer = resultview.marker_layer if tofield.get_text() and not tofield.get_marker(): searcher = Searcher(marker_layer, resultview.liststore) text = tofield.get_text() searcher.search(text) resultview.show("Possible destination locations named: %s" % text, 2) ## 2 -> show search results marker_layer.show() elif fromfield.get_text() and not fromfield.get_marker(): searcher = Searcher(marker_layer, resultview.liststore) text = fromfield.get_text() searcher.search(text) resultview.show("Possible departure locations named: %s" % text, 2) ## 2 -> show search results marker_layer.show() else: print "Invalid search"
def on_test_directions(self, widget, marker_layer, resultview, directionlist): guide = Guide(self.application, marker_layer, directionlist.get_model()) guide.search(1,1) marker_layer.show() resultview.show("Directions", 1) ## 1 -> show directions directionlist.show()