Skip to content

Commit

Permalink
Agno97 has provided scrollbars to the search results!
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
sigurdga committed Oct 24, 2013
1 parent c3aae95 commit 722cc41
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
24 changes: 16 additions & 8 deletions maps/map_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ def __init__(self, application, mapwidget):

searchview = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
searchview.pack_start(searchheader, False, False, 0)
searchview.pack_end(searchlist, True, True, 0)

swH_search = Gtk.ScrolledWindow() ## ADD THE SCROLLBAR
swH_search.set_vexpand(False)
swH_search.add(searchlist)
searchview.pack_end(swH_search, True, True, 0)

vpaned.pack1(searchview)

############
Expand Down Expand Up @@ -197,7 +202,10 @@ def __init__(self, application, mapwidget):
directionlist.append_column(column_time)
directionlist.append_column(column_distance)

searchview.pack_end(directionlist, True, True, 0)
swH_direction = Gtk.ScrolledWindow() ## ADD THE SCROLLBAR
swH_direction.set_vexpand(False)
swH_direction.add(directionlist)
searchview.pack_end(swH_direction, True, True, 0)

########
# Places
Expand Down Expand Up @@ -431,7 +439,7 @@ def on_search_clicked(self, widget, searchfield, resultview):
searcher = Searcher(marker_layer, resultview.liststore)
text = searchfield.get_text()
searcher.search(text)
resultview.show("Results for: %s" % text)
resultview.show("Results for: %s" % text, 2) ## 2 -> show search results

marker_layer.show()

Expand All @@ -442,23 +450,23 @@ def on_directions_clicked(self, widget, fromfield, tofield, resultview, marker_l
error = guide.search(fromfield.get_marker(), tofield.get_marker())
if not error:
marker_layer.show()
resultview.show("Directions")
resultview.show("Directions", 1) ## 1 -> show directions
directionlist.show()
else:
resultview.show(error)
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)
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)
resultview.show("Possible departure locations named: %s" % text, 2) ## 2 -> show search results
marker_layer.show()
else:
print "Invalid search"
Expand All @@ -467,7 +475,7 @@ 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")
resultview.show("Directions", 1) ## 1 -> show directions
directionlist.show()

def add_filters(self, dialog):
Expand Down
4 changes: 3 additions & 1 deletion maps/searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ def __init__(self, label, widget, liststore, marker_layer, directionstore, direc
self.directionstore = directionstore
self.directionmarkers = directionmarkers

def show(self, text=""):
def show(self, text="", widget=1):
self.label.set_text(text)
self.widget.show()
self.widget.get_children()[widget].show()
self.widget.get_children()[3-widget].hide()
self.marker_layer.show()
self.directionmarkers.show()

Expand Down

0 comments on commit 722cc41

Please sign in to comment.