sigurdga / maps

Maps for Gnome and Ubuntu — not an official version
GNU General Public License v3.0
7 stars 1 forks source link

"Directions" don't have a scroolbar #6

Closed Agno94 closed 11 years ago

Agno94 commented 11 years ago

You can't see all directions because there aren't a scroolbar

I attach an example:

Screenshot

$: apt-cache policy maps maps: Installato: 12.07.4 Candidato: 12.07.4 Tabella versione: *\ 12.07.4 0 100 /var/lib/dpkg/status

Agno94 commented 11 years ago

This is a patch that solves the problems:

diff -Naur maps_prev/maps/map_window.py maps_next/maps/map_window.py
--- maps_prev/maps/map_window.py    2012-07-13 18:46:02.000000000 +0200
+++ maps_next/maps/map_window.py    2013-10-19 19:21:52.617047290 +0200
@@ -14,6 +14,7 @@
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 ### END LICENSE

+
 from gi.repository import Gtk, Gdk, GdkPixbuf, Champlain

 from maps.searcher import Searcher, Guide, ResultView
@@ -169,7 +170,12 @@

         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)

         ############
@@ -197,7 +203,10 @@
         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
@@ -431,7 +440,7 @@
         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()

@@ -442,23 +451,23 @@
             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"
@@ -467,7 +476,7 @@
         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):
diff -Naur maps_prev/maps/searcher.py maps_next/maps/searcher.py
--- maps_prev/maps/searcher.py  2012-07-13 18:46:02.000000000 +0200
+++ maps_next/maps/searcher.py  2013-10-19 19:21:54.989047308 +0200
@@ -18,7 +18,8 @@
 import json
 import os

-from gi.repository import Champlain, GdkPixbuf
+from gi.repository import Gtk, Champlain, GdkPixbuf

 class IconDownloader(object):

@@ -53,9 +54,11 @@
         self.directionstore = directionstore
         self.directionmarkers = directionmarkers

-    def show(self, text=""):
+    def show(self, text="", widget=1): # "widget"=1 show directions "widget"=2 show search results
         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()

Here the result :

screen_postpatch

Agno94 commented 11 years ago

I made a mistake: You also have to change (in "map_window.py", line 437 after the patch) the function on_search_clicked(..) in:

    def on_search_clicked(self, widget, searchfield, resultview):
        marker_layer = resultview.marker_layer
        searcher = Searcher(marker_layer, resultview.liststore)
        text = searchfield.get_text()
        searcher.search(text)
        resultview.show("Results for: %s" % text, 2) ## 2 -> show search results

        marker_layer.show()
sigurdga commented 11 years ago

Thank you very much!

I hope to have a few hours to spend on this near the end of the week.

sigurdga commented 11 years ago

I will release a new version pretty soon, and this will be part of it. Thank you for giving me a patch.