From f794011fac82dd8b4617d8b57e3ddb6f9104e70a Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Thu, 13 Aug 2009 21:59:59 +0000 Subject: [PATCH] GeoView : The swap is now fully fonctional. svn: r12995 --- src/DataViews/GeoView.py | 615 +++++++++++++++++++++------------------ 1 file changed, 329 insertions(+), 286 deletions(-) diff --git a/src/DataViews/GeoView.py b/src/DataViews/GeoView.py index e98d4cdb1..19592f7a8 100644 --- a/src/DataViews/GeoView.py +++ b/src/DataViews/GeoView.py @@ -68,22 +68,22 @@ NOWEB = 0 WEBKIT = 1 MOZIL = 2 -WebKit = NOWEB +TOOLKIT = NOWEB try: import webkit - WebKit = WEBKIT + TOOLKIT = WEBKIT except: pass -if WebKit == NOWEB: +if TOOLKIT == NOWEB: try: import gtkmozembed - WebKit = MOZIL + TOOLKIT = MOZIL except: pass #no interfaces present, raise Error so that options for GeoView do not show -if WebKit == NOWEB : +if TOOLKIT == NOWEB : Config.set(Config.GEOVIEW, False) raise ImportError, 'No GTK html plugin found' @@ -99,6 +99,25 @@ MOZEMBED_SUBPATH = Utils.get_empty_tempdir('mozembed_gramps') GEOVIEW_SUBPATH = Utils.get_empty_tempdir('geoview') NB_MARKERS_PER_PAGE = 200 +#------------------------------------------------------------------------- +# +# Functions +# +#------------------------------------------------------------------------- +def _alternate_map(): + """ + 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 + #------------------------------------------------------------------------- # # Renderer @@ -111,7 +130,7 @@ class Renderer(): """ def __init__(self): self.window = None - self.fct = None + self.fct = () def get_window(self): """ @@ -174,7 +193,7 @@ class Renderer(): """ raise NotImplementedError - def page_loaded(self): + def page_loaded(self, *args): """ The page is completely loaded. """ @@ -202,7 +221,7 @@ class RendererWebkit(Renderer): self.frame = self.window.get_main_frame() self.frame.connect("load-done", self.page_loaded) - def page_loaded(self, obj, status): + def page_loaded(self, *args): """ We just loaded one page in the browser. Set the button sensitivity @@ -249,7 +268,7 @@ class RendererMozilla(Renderer): self.browser = MOZIL self.handler = self.window.connect("net-stop", self.page_loaded) - def page_loaded(self, obj): + def page_loaded(self, *args): """ We just loaded one page in the browser. Set the button sensitivity @@ -305,7 +324,6 @@ class RendererMozilla(Renderer): password = uprox[0] host = uprox[1] port = int(hport[2]) - if port and host: port = str(port) prefs.write('user_pref("network.proxy') @@ -334,7 +352,6 @@ class RendererMozilla(Renderer): os.remove(MOZEMBED_SUBPATH+"/prefs.js") except: pass - pass # We don't use a proxy or the http_proxy variable is not set. #------------------------------------------------------------------------- # @@ -367,7 +384,6 @@ class HtmlView(PageView.PageView): contains the interface. This containter will be inserted into a gtk.Notebook page. """ - global WebKit self.box = gtk.VBox(False, 4) #top widget at the top self.box.pack_start(self.top_widget(), False, False, 0 ) @@ -382,10 +398,10 @@ class HtmlView(PageView.PageView): self.table.get_parent().set_shadow_type(gtk.SHADOW_NONE) self.table.set_row_spacings(1) self.table.set_col_spacings(0) - if (WebKit == WEBKIT) : + if (TOOLKIT == WEBKIT) : # We use webkit self.renderer = RendererWebkit() - elif (WebKit == MOZIL) : + elif (TOOLKIT == MOZIL) : # We use gtkmozembed self.renderer = RendererMozilla() self.table.add(self.renderer.get_window()) @@ -395,7 +411,7 @@ class HtmlView(PageView.PageView): self.renderer.fct = self.set_button_sensitivity self.renderer.show_all() #load a welcome html page - urlhelp = self.create_start_page() + urlhelp = self._create_start_page() self.open(urlhelp) return self.box @@ -549,10 +565,10 @@ class HtmlView(PageView.PageView): """ pass - def create_start_page(self): + def _create_start_page(self): """ - This command creates a default start page, and returns the URL of this - page. + This command creates a default start page, and returns the URL of + this page. """ tmpdir = GEOVIEW_SUBPATH data = """ @@ -647,10 +663,10 @@ class GeoView(HtmlView): able to access the parent container. """ self.box.disconnect(self.bootstrap_handler) - self.box.parent.connect("size-allocate", self.size_request_for_map) - self.size_request_for_map(widget.parent, event) + self.box.parent.connect("size-allocate", self._size_request_for_map) + self._size_request_for_map(widget.parent, event) - def size_request_for_map(self, widget, event, data=None): + def _size_request_for_map(self, widget, event, data=None): """ We need to resize the map """ @@ -661,7 +677,7 @@ class GeoView(HtmlView): self.external_uri() if self.need_to_resize != True: try: - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) except: pass @@ -679,34 +695,18 @@ class GeoView(HtmlView): HtmlView.set_inactive(self) self.dbstate.disconnect(self.key_active_changed) - def get_stock(self): - """ - Return the name of the stock icon to use for the display. - This assumes that this icon has already been registered with - GNOME as a stock icon. - """ - return 'gramps-geo' - - def change_map(self, usedmap): + def _change_map(self, usedmap): """ Tell the browser to change the current map. """ self.renderer.execute_script( - "javascript:mapstraction.swap(map,'"+usedmap+"')") + "javascript:swap_map('"+usedmap+"','"+usedmap+"')") 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 +724,7 @@ class GeoView(HtmlView): - ''' % alternate_map + ''' % _alternate_map() def define_actions(self): """ @@ -734,123 +734,124 @@ class GeoView(HtmlView): HtmlView._define_actions_fw_bw(self) self.forward_action.set_sensitive(False) self.back_action.set_sensitive(False) - self._add_action('OpenStreetMap', 'gramps-openstreetmap', + self._add_action('OpenStreetMap', 'gramps-geoview', _('_OpenStreetMap'), - callback=self.select_openstreetmap_map, + 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-geoview-alt', _('_Google Maps'), - callback=self.select_google_map, + 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-geoview-alt', _('_OpenLayers Maps'), - callback=self.select_openlayers_map, + 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-geoview-alt', _('_Yahoo! Maps'), - callback=self.select_yahoo_map, + 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-geoview-alt', _('_Microsoft Maps'), - callback=self.select_microsoft_map, + 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.")) + callback=self._person_places, + tip=_("Attempt to view all the places " + "where the selected people lived.")) self._add_action('FamilyMaps', 'gramps-parents-add', _('_Family'), - callback=self.family_places, + callback=self._family_places, tip=_("Attempt to view places of the selected people's family.")) self._add_action('EventMaps', 'gramps-event', _('_Event'), - callback=self.event_places, + callback=self._event_places, tip=_("Attempt to view places connected to all events.")) def goto_active_person(self, handle=None): """ Here when the GeoView page is loaded """ - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) - def all_places(self, hanle=None): + def _all_places(self, hanle=None): """ Specifies the place for the home person to display with mapstraction. """ self.displaytype = "places" - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) - def person_places(self, handle=None): + def _person_places(self, handle=None): """ Specifies the person places. """ self.displaytype = "person" - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) - def family_places(self, hanle=None): + def _family_places(self, hanle=None): """ Specifies the family places to display with mapstraction. """ self.displaytype = "family" - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) - def event_places(self, hanle=None): + def _event_places(self, hanle=None): """ Specifies all event places to display with mapstraction. """ self.displaytype = "event" - self.geo_places(self.displaytype) + self._geo_places(self.displaytype) - def geo_places(self, displaytype): + def _geo_places(self, displaytype): """ Specifies the places to display with mapstraction. """ self.external_url = False self.nbmarkers = 0 self.without = 0 - self.createmapstraction(displaytype) + self._createmapstraction(displaytype) self.open("file://"+self.htmlfile) - def select_openstreetmap_map(self,handle): + def _select_openstreetmap_map(self, handle): """ Make openstreetmap the default map. """ self.usedmap = "openstreetmap" - self.change_map("openstreetmap") + self._change_map("openstreetmap") - def select_openlayers_map(self,handle): + def _select_openlayers_map(self, handle): """ Make openstreetmap the default map. """ self.usedmap = "openlayers" - self.change_map("openlayers") + self._change_map("openlayers") - def select_google_map(self,handle): + def _select_google_map(self, handle): """ Specifies google is the default map """ self.usedmap = "google" - self.change_map("google") + self._change_map("google") - def select_yahoo_map(self,handle): + def _select_yahoo_map(self, handle): """ Make yahoo map the default map. """ self.usedmap = "yahoo" - self.change_map("yahoo") + self._change_map("yahoo") - def select_microsoft_map(self,handle): + def _select_microsoft_map(self, handle): """ Make microsoft the default map. """ self.usedmap = "microsoft" - self.change_map("microsoft") + self._change_map("microsoft") - def createpageforplaceswithoutcoord(self): + def _createpageplaceswithoutcoord(self): """ Create a page with the list of all places without coordinates page. @@ -888,7 +889,7 @@ class GeoView(HtmlView): ufd.write(end) ufd.close() - def createmapstractionpostheader(self, h3mess, h4mess, + def _createmapstractionpostheader(self, h3mess, h4mess, maxpages, curpage, ftype): """ This is needed to add infos to the header. @@ -911,10 +912,11 @@ class GeoView(HtmlView): self.yearint = ( self.yearint - ( self.yearint % modulo ) ) if self.yearint == 0: self.yearint = 10 - self.mapview.write(" var step = %s;\n" % self.yearint) - self.mapview.write(" \n") - self.mapview.write(" \n") - self.mapview.write(" \n") + self.mapview.write("\n") + self.mapview.write("\n") + self.mapview.write("\n") if maxpages > 1: message = _("There are %d markers to display. They are split up " "over %d pages of %d markers : " % (self.nbmarkers, @@ -948,10 +950,10 @@ class GeoView(HtmlView): self.mapview.write("%d" % \ ( self.without_coord_file, self.without ) ) self.mapview.write(" places without coordinates\n" ) - self.createpageforplaceswithoutcoord() + self._createpageplaceswithoutcoord() if self.displaytype != "places": - self.mapview.write("
\n") - self.mapview.write("
\n") + #self.mapview.write("
\n") + self.mapview.write(" \n") self.mapview.write(" %s\n" % ( year, year )) - self.mapview.write("
\n") + self.mapview.write(" \n") + #self.mapview.write("
\n") self.mapview.write("

%s

" % h3mess) if h4mess: self.mapview.write("

%s

" % h4mess) + margin = 10 + self.mapview.write("\n
\n" % (self.height * 0.74)) + self.mapview.write("
\n" % \ + ((self.width - margin*4), (self.height * 0.74 ))) + self.mapview.write("\n") + self.mapview.write("\n") + self.mapview.write("\n") if self.usedmap == "microsoft": - self.mapview.write(" \n") + self.mapview.write("\n") elif self.usedmap == "yahoo": - self.mapview.write(" \n") + self.mapview.write("\n") elif self.usedmap == "openlayers": - self.mapview.write(" \n") - else: # openstreetmap and google - self.mapview.write(" \n") - self.mapview.write(" \n") - def createmapstractiontrailer(self): + def _createmapstractiontrailer(self): """ Add the last directives for the html page. """ - self.mapview.write(" \n") + self.mapview.write(" setcenterandzoom(mapstraction);\n") + self.mapview.write(" setmarkers(mapstraction);\n") + self.mapview.write("\n") + self.mapview.write("\n") self.mapview.write("\n") self.mapview.close() - def create_pages(self, ptype, h3mess, h4mess): + def _set_center_and_zoom(self, ptype): """ - Do we need to create a multi-pages document ? - Do we have too many markers ? + Calculate the zoom. """ - nbmarkers = 0 - self.nbpages = 0 - pages = ( self.nbmarkers / NB_MARKERS_PER_PAGE ) + 1 - if (nbmarkers % NB_MARKERS_PER_PAGE) == 0: - try: - self.createmapstractiontrailer() - except: - pass # Select the center of the map and the zoom self.centered = False if ptype == 2: @@ -1160,7 +1200,6 @@ class GeoView(HtmlView): cent = int(mark[6]) if cent: self.centered = True - if ( signminlat == signmaxlat ): if signminlat == 1: latit = self.minlat+self.centerlat @@ -1170,7 +1209,6 @@ class GeoView(HtmlView): latit = self.maxlat-self.centerlat else: latit = self.minlat+self.centerlat - if ( signminlon == signmaxlon ): if signminlon == 1: longt = self.minlon+self.centerlon @@ -1184,12 +1222,26 @@ class GeoView(HtmlView): if latit == 0.0 and longt == 0.0: latit = 0.00000001 longt = 0.00000001 - self.mustcenter = False if latit != 0.0 or longt != 0.0: self.latit = latit self.longt = longt self.mustcenter = True + + def _create_pages(self, ptype, h3mess, h4mess): + """ + Do we need to create a multi-pages document ? + Do we have too many markers ? + """ + nbmarkers = 0 + self.nbpages = 0 + pages = ( self.nbmarkers / NB_MARKERS_PER_PAGE ) + 1 + if (nbmarkers % NB_MARKERS_PER_PAGE) == 0: + try: + self._createmapstractiontrailer() + except: + pass + self._set_center_and_zoom(ptype) for page in range(0, pages, 1): self.nbpages += 1 if ptype == 1: @@ -1206,41 +1258,42 @@ class GeoView(HtmlView): (ftype, self.nbpages) if self.nbpages == 1: self.htmlfile = filename - self.createmapstractionheader(filename) - self.createmapstractionpostheader(h3mess, h4mess, - pages, self.nbpages, ftype) + self._createmapstractionheader(filename) + self._create_needed_javascript() first = ( self.nbpages - 1 ) * NB_MARKERS_PER_PAGE last = ( self.nbpages * NB_MARKERS_PER_PAGE ) - 1 - self.create_markers(ptype, first, last) - self.createmapstractiontrailer() + self._create_markers(ptype, first, last) + self._createmapstractionpostheader(h3mess, h4mess, + pages, self.nbpages, ftype) + self._createmapstractiontrailer() if self.nbpages == 1: self.open(self.htmlfile) - def createmapstraction(self, displaytype): + def _createmapstraction(self, displaytype): """ Which kind of map are we going to create ? """ if displaytype == "places": - self.createmapstractionplaces(self.dbstate) + self._createmapstractionplaces(self.dbstate) elif displaytype == "family": - self.createmapstractionfamily(self.dbstate) + self._createmapstractionfamily(self.dbstate) elif displaytype == "person": - self.createmapstractionperson(self.dbstate) + self._createmapstractionperson(self.dbstate) elif displaytype == "event": - self.createmapstractionevents(self.dbstate) + self._createmapstractionevents(self.dbstate) else: - self.createmapstractionheader(GEOVIEW_SUBPATH+"/error.html") - self.createmapnotimplemented() - self.createmapstractiontrailer() + self._createmapstractionheader(GEOVIEW_SUBPATH+"/error.html") + self._createmapnotimplemented() + self._createmapstractiontrailer() - def append_to_places_without_coord(self, gid, place): + def _append_to_places_without_coord(self, gid, place): """ Create a list of places without coordinates. """ self.place_without_coordinates.append([gid, place]) self.without += 1 - def append_to_places_list(self, place, evttype, name, lat, + def _append_to_places_list(self, place, evttype, name, lat, longit, descr, center, year): """ Create a list of places with coordinates. @@ -1248,7 +1301,6 @@ class GeoView(HtmlView): self.place_list.append([place, name, evttype, lat, longit, descr, int(center), year]) self.nbmarkers += 1 - tfa = float(lat) tfb = float(longit) if year is not None: @@ -1258,7 +1310,6 @@ class GeoView(HtmlView): self.minyear = tfc if tfc > self.maxyear: self.maxyear = tfc - if tfa < 0.0: tfa = tfa - 0.00000001 else: @@ -1267,68 +1318,47 @@ class GeoView(HtmlView): tfb = tfb - 0.00000001 else: tfb = tfb + 0.00000001 - if self.minlat == 0.0: self.minlat = tfa if tfa < self.minlat: if tfa < 0.0: self.minlat = tfa - if self.maxlat == 0.0: self.maxlat = tfa if tfa > self.maxlat: if tfa > 0.0: self.maxlat = tfa - if self.minlon == 0.0: self.minlon = tfb if tfb < self.minlon: if tfb < 0.0: self.minlon = tfb - if self.maxlon == 0.0: self.maxlon = tfb if tfb > self.maxlon: if tfb > 0.0: self.maxlon = tfb - def isyearnotinmarker(self, allyears, yeartosearch): - """ - Find if a year is in a list. - """ - ret = 1 - for year in allyears: - if yeartosearch == year: - ret = 0 - return ret - - def create_markers(self, format, firstm, lastm): + def _create_markers(self, format, firstm, lastm): """ Create all markers for the specified person. """ - margin = 10 - self.mapview.write("
\n" % ( self.height * 0.74 )) - self.mapview.write(" \n") + self.mapview.write("\n}") + self.mapview.write("\n\n") - def createpersonmarkers(self, dbstate, person, comment): + def _createpersonmarkers(self, dbstate, person, comment): """ Create all markers for the specified person. """ @@ -1455,16 +1490,17 @@ class GeoView(HtmlView): # one string. We have coordinates when the two values # contains non null string. if ( longitude and latitude ): - self.append_to_places_list(descr, - gen.lib.EventType.BIRTH, - _nd.display(person), - latitude, longitude, - descr1, int(self.center), - birthyear) + self._append_to_places_list(descr, + gen.lib.EventType.BIRTH, + _nd.display(person), + latitude, longitude, + descr1, + int(self.center), + birthyear) self.center = False else: - self.append_to_places_without_coord(place.gramps_id, - descr) + self._append_to_places_without_coord( + place.gramps_id, descr) latitude = "" longitude = "" death_ref = person.get_death_ref() @@ -1490,18 +1526,19 @@ class GeoView(HtmlView): # one string. We have coordinates when the two values # contains non null string. if ( longitude and latitude ): - self.append_to_places_list(descr, - gen.lib.EventType.DEATH, - _nd.display(person), - latitude, longitude, - descr1, int(self.center), - deathyear) + self._append_to_places_list(descr, + gen.lib.EventType.DEATH, + _nd.display(person), + latitude, longitude, + descr1, + int(self.center), + deathyear) self.center = False else: - self.append_to_places_without_coord(place.gramps_id, - descr) + self._append_to_places_without_coord( + place.gramps_id, descr) - def createmapstractionplaces(self, dbstate): + def _createmapstractionplaces(self, dbstate): """ Create the marker for each place in the database which has a lat/lon. """ @@ -1516,7 +1553,7 @@ class GeoView(HtmlView): latitude = "" longitude = "" self.center = True - for place_handle in dbstate.iter.get_place_handles(): + for place_handle in dbstate.db.iter_place_handles(): place = dbstate.db.get_place_from_handle( place_handle) if place: descr = place.get_title() @@ -1528,23 +1565,22 @@ class GeoView(HtmlView): # one string. We have coordinates when the two values # contains non null string. if ( longitude and latitude ): - self.append_to_places_list(descr, None, - "", - latitude, longitude, - descr1, self.center, None) + self._append_to_places_list(descr, None, "", + latitude, longitude, + descr1, self.center, None) self.center = False else: - self.append_to_places_without_coord(place.gramps_id, - descr) + self._append_to_places_without_coord(place.gramps_id, + descr) if self.center: mess = _("Cannot center the map. No location with coordinates.") else: mess = "" - self.create_pages(1, - _("All places in the family tree with coordinates."), - mess) + self._create_pages(1, + _("All places in the family tree with coordinates."), + mess) - def createmapstractionevents(self, dbstate): + def _createmapstractionevents(self, dbstate): """ Create one marker for each place associated with an event in the database which has a lat/lon. @@ -1583,9 +1619,11 @@ class GeoView(HtmlView): # one string. We have coordinates when the two values # contains non null string. if ( longitude and latitude ): - person_list = [dbstate.db.get_person_from_handle(ref_handle) + person_list = [ + dbstate.db.get_person_from_handle(ref_handle) for (ref_type, ref_handle) in \ - dbstate.db.find_backlink_handles(event_handle) + dbstate.db.find_backlink_handles( + event_handle) if ref_type == 'Person' ] if person_list: @@ -1594,34 +1632,39 @@ class GeoView(HtmlView): descr = ("%(description)s%(name)s
") % { 'description' : descr, 'name' : _nd.display(person)} - descr = ("%(eventtype)s; %(place)s%(description)s" + #) % { 'eventtype': gen.lib.EventType( + descr = ("%(eventtype)s;"+ + " %(place)s%(description)s" ) % { 'eventtype': gen.lib.EventType( - event.get_type()), - 'place': place.get_title(), - 'description': descr} + event.get_type() + ), + 'place': place.get_title(), + 'description': descr} else: descr = ("%(eventtype)s; %(place)s
") % { - 'eventtype': gen.lib.EventType( - event.get_type()), - 'place': place.get_title()} - self.append_to_places_list(descr1, descr, - descr, - latitude, longitude, - descr2, self.center, - eventyear) + 'eventtype': gen.lib.EventType( + event.get_type() + ), + 'place': place.get_title()} + self._append_to_places_list(descr1, descr, + descr, + latitude, longitude, + descr2, self.center, + eventyear) self.center = False else: descr = place.get_title() - self.append_to_places_without_coord(place.gramps_id, - descr) + self._append_to_places_without_coord( + place.gramps_id, descr) if self.center: mess = _("Cannot center the map. No location with coordinates.") else: mess = "" - self.create_pages(2, _("All events in the family tree with coordinates." - ), mess) + self._create_pages(2, + _("All events in the family tree with coordinates."), + mess) - def createmapstractionfamily(self, dbstate): + def _createmapstractionfamily(self, dbstate): """ Create all markers for each people of a family in the database which has a lat/lon. @@ -1643,16 +1686,16 @@ class GeoView(HtmlView): if len(family_list) > 0: fhandle = family_list[0] # first is primary fam = dbstate.db.get_family_from_handle(fhandle) - father_handle = fam.get_father_handle() - father = dbstate.db.get_person_from_handle(father_handle) + handle = fam.get_father_handle() + father = dbstate.db.get_person_from_handle(handle) if father: comment = _("Id : Father : %s") % father.gramps_id - self.createpersonmarkers(dbstate, father, comment) - mother_handle = fam.get_mother_handle() - mother = dbstate.db.get_person_from_handle(mother_handle) + self._createpersonmarkers(dbstate, father, comment) + handle = fam.get_mother_handle() + mother = dbstate.db.get_person_from_handle(handle) if mother: comment = _("Id : Mother : %s") % mother.gramps_id - self.createpersonmarkers(dbstate, mother, comment) + self._createpersonmarkers(dbstate, mother, comment) index = 0 child_ref_list = fam.get_child_ref_list() if child_ref_list: @@ -1663,24 +1706,24 @@ class GeoView(HtmlView): comment = _("Id : Child : %(id)s %(index)d") % { 'id' : child.gramps_id, 'index': index} - self.createpersonmarkers(dbstate, child, comment) + self._createpersonmarkers(dbstate, child, comment) if self.center: mess = _("Cannot center the map. No location with coordinates.") if person is not None: - self.create_pages(3, _("The active person's family members " - "have no places with coordinates."), - mess) + self._create_pages(3, _("The active person's family members " + "have no places with coordinates."), + mess) else: - self.create_pages(3, _("No active person set."), mess) + self._create_pages(3, _("No active person set."), mess) else: mess = "" - self.create_pages(3, - ( _("All %(name)s people's family places in the " - "family tree with coordinates.") % { + self._create_pages(3, + ( _("All %(name)s people's family places in the " + "family tree with coordinates.") % { 'name' :_nd.display(person) }), - mess) + mess) - def createmapstractionperson(self, dbstate): + def _createmapstractionperson(self, dbstate): """ Create all markers for each people's event in the database which has a lat/lon. @@ -1727,28 +1770,28 @@ class GeoView(HtmlView): # one string. We have coordinates when the two values # contains non null string. if ( longitude and latitude ): - self.append_to_places_list(descr, evt, - _nd.display(person), - latitude, longitude, - descr1, self.center, - eventyear) + self._append_to_places_list(descr, evt, + _nd.display(person), + latitude, longitude, + descr1, self.center, + eventyear) self.center = False else: - self.append_to_places_without_coord( - place.gramps_id, descr) + self._append_to_places_without_coord( + place.gramps_id, descr) if self.center: mess = _("Cannot center the map. No location with coordinates.") if person is not None: - self.create_pages(4, - _("The active person has no places with coordinates."), mess) + self._create_pages(4, + _("The active person has no places with coordinates."), mess) else: - self.create_pages(4, _("No active person set."), mess) + self._create_pages(4, _("No active person set."), mess) else: mess = "" - self.create_pages(4, ( _("All event places for %s.") % - _nd.display(person) ), mess) + self._create_pages(4, ( _("All event places for %s.") % + _nd.display(person) ), mess) - def createmapnotimplemented(self): + def _createmapnotimplemented(self): """ Inform the user this work is not implemented. """