From 1c41b04d3d22663db4b728a52c9f1a42218a4fac Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Sat, 8 Aug 2009 21:31:21 +0000 Subject: [PATCH] GeoView : Update mapstraction to version 215. Switch between maps works. svn: r12928 --- src/DataViews/GeoView.py | 74 +++++++++-------- src/mapstraction/mapstraction.js | 131 +++++++++++++++++++++---------- 2 files changed, 131 insertions(+), 74 deletions(-) diff --git a/src/DataViews/GeoView.py b/src/DataViews/GeoView.py index 3de1a39b2..51f3367e1 100644 --- a/src/DataViews/GeoView.py +++ b/src/DataViews/GeoView.py @@ -692,21 +692,27 @@ class GeoView(HtmlView): Ask to the browser to change the current map. """ self.renderer.execute_script( - "javascript:mapstraction.swap(map,'"+usedmap+"')") + "javascript:mapstraction.swap('"+usedmap+"','"+usedmap+"')") + + def _alternate_map(self): + """ + return the alternate name of the map provider. + """ + if Config.get(Config.GEOVIEW_GOOGLEMAPS): + alternate_map = "google" + elif Config.get(Config.GEOVIEW_OPENLAYERS): + alternate_map = "openlayers" + elif Config.get(Config.GEOVIEW_YAHOO): + alternate_map = "yahoo" + elif Config.get(Config.GEOVIEW_MICROSOFT): + alternate_map = "microsoft" + return alternate_map def ui_definition(self): """ Specifies the UIManager XML code that defines the menus and buttons associated with the interface. """ - if Config.get(Config.GEOVIEW_GOOGLEMAPS): - alternate_map = "GoogleMaps" - elif Config.get(Config.GEOVIEW_OPENLAYERS): - alternate_map = "OpenLayersMaps" - elif Config.get(Config.GEOVIEW_YAHOO): - alternate_map = "YahooMaps" - elif Config.get(Config.GEOVIEW_MICROSOFT): - alternate_map = "MicrosoftMaps" return ''' @@ -724,7 +730,7 @@ class GeoView(HtmlView): - ''' % alternate_map + ''' % self._alternate_map() def define_actions(self): """ @@ -739,28 +745,28 @@ class GeoView(HtmlView): callback=self.select_openstreetmap_map, tip=_("Select OpenStreetMap Maps")) if Config.get(Config.GEOVIEW_GOOGLEMAPS): - self._add_action('GoogleMaps', 'gramps-alternate-map', + self._add_action('google', 'gramps-alternate-map', _('_Google Maps'), callback=self.select_google_map, tip=_("Select Google Maps.")) elif Config.get(Config.GEOVIEW_OPENLAYERS): - self._add_action('OpenLayersMaps', 'gramps-alternate-map', + self._add_action('openlayers', 'gramps-alternate-map', _('_OpenLayers Maps'), callback=self.select_openlayers_map, tip=_("Select OpenLayers Maps.")) elif Config.get(Config.GEOVIEW_YAHOO): - self._add_action('YahooMaps', 'gramps-alternate-map', + self._add_action('yahoo', 'gramps-alternate-map', _('_Yahoo! Maps'), callback=self.select_yahoo_map, tip=_("Select Yahoo Maps.")) elif Config.get(Config.GEOVIEW_MICROSOFT): - self._add_action('MicrosoftMaps', 'gramps-alternate-map', + self._add_action('microsoft', 'gramps-alternate-map', _('_Microsoft Maps'), callback=self.select_microsoft_map, tip=_("Select Microsoft Maps")) self._add_action('AllPlacesMaps', gtk.STOCK_HOME, _('_All Places'), - callback=self.all_places, - tip=_("Attempt to view all places in the family tree.")) + callback=self.all_places, + tip=_("Attempt to view all places in the family tree.")) self._add_action('PersonMaps', 'gramps-person', _('_Person'), callback=self.person_places, tip=_("Attempt to view all the places where the selected people lived.")) @@ -988,28 +994,28 @@ class GeoView(HtmlView): self.mapview.write(" src=\"file://"+const.ROOT_DIR+"/") self.mapview.write("mapstraction/mapstraction.js\">\n") self.mapview.write(" \n") - if self.usedmap == "microsoft": + self.mapview.write(" \n") + alternatemap = self._alternate_map() + if alternatemap == "microsoft": self.mapview.write(" \n") - elif self.usedmap == "yahoo": + elif alternatemap == "yahoo": self.mapview.write(" \n") - elif self.usedmap == "openlayers": + elif alternatemap == "openlayers": self.mapview.write(" \n") - else: # openstreetmap and google - self.mapview.write(" \n") self.mapview.write("