Merge pull request #1181 from zradoslav/geoui-cleanup

This commit is contained in:
Nick Hall 2022-03-11 23:50:19 +00:00
commit 072dc49e6c
6 changed files with 15 additions and 53 deletions

View File

@ -183,7 +183,6 @@ class GeoGraphyView(OsmGps, NavigationView):
self.place_list_ref = []
self.select_fct = None
self.geo_mainmap = None
self.reloadtiles = None
theme = Gtk.IconTheme.get_default()
self.geo_mainmap = theme.load_surface('gramps-geo-mainmap', 48, 1,
None, 0)
@ -208,8 +207,6 @@ class GeoGraphyView(OsmGps, NavigationView):
self.menu = None
self.mark = None
self.path_entry = None
self.changemap = None
self.clearmap = None
self.nbplaces = 0
self.nbmarkers = 0
self.place_without_coordinates = []
@ -401,7 +398,6 @@ class GeoGraphyView(OsmGps, NavigationView):
title = _('Add cross hair')
add_item = Gtk.MenuItem(label=title)
add_item.connect("activate", self.config_crosshair, event, lat, lon)
add_item.show()
menu.append(add_item)
if config.get("geography.lock"):
@ -411,73 +407,59 @@ class GeoGraphyView(OsmGps, NavigationView):
add_item = Gtk.MenuItem(label=title)
add_item.connect("activate", self.config_zoom_and_position,
event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Add place"))
add_item.connect("activate", self.add_place, event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Link place"))
add_item.connect("activate", self.link_place, event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Add place from kml"))
add_item.connect("activate", self.add_place_from_kml, event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Center here"))
add_item.connect("activate", self.set_center, event, lat, lon)
add_item.show()
menu.append(add_item)
# Add specific module menu
self.add_specific_menu(menu, event, lat, lon)
# Add a separator line
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
map_name = constants.MAP_TITLE[config.get("geography.map_service")]
title = _("Replace '%(map)s' by =>") % {'map': map_name}
add_item = Gtk.MenuItem(label=title)
add_item.show()
menu.append(add_item)
self.changemap = Gtk.Menu()
changemap = self.changemap
changemap.show()
changemap = Gtk.Menu()
add_item.set_submenu(changemap)
# show in the map menu all available providers
for my_map in constants.MAP_TYPE:
changemapitem = Gtk.MenuItem(label=constants.MAP_TITLE[my_map])
changemapitem.show()
changemapitem = Gtk.CheckMenuItem(label=constants.MAP_TITLE[my_map])
changemapitem.set_active(constants.MAP_TITLE[my_map] == map_name)
changemapitem.connect("activate", self.change_map, my_map)
changemap.append(changemapitem)
reload_text = _("Reload all visible tiles for '%(map)s'.") % {
'map': map_name}
self.reloadtiles = Gtk.MenuItem(label=reload_text)
reloadtiles = self.reloadtiles
'map' : map_name}
reloadtiles = Gtk.MenuItem(label=reload_text)
reloadtiles.connect("activate", self.reload_visible_tiles)
reloadtiles.show()
menu.append(reloadtiles)
clear_text = _("Clear the '%(map)s' tiles cache.") % {
'map': map_name}
self.clearmap = Gtk.MenuItem(label=clear_text)
clearmap = self.clearmap
'map' : map_name}
clearmap = Gtk.MenuItem(label=clear_text)
clearmap.connect("activate", self.clear_map,
constants.TILES_PATH[config.get(
"geography.map_service")])
clearmap.show()
menu.append(clearmap)
menu.show()
menu.show_all()
menu.popup(None, None, None,
None, event.button, event.time)
return 1

View File

@ -648,13 +648,10 @@ class GeoClose(GeoGraphyView):
"""
Add specific entry to the navigation menu.
"""
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
add_item = Gtk.MenuItem(
label=_("Choose and bookmark the new reference person"))
add_item.connect("activate", self.select_person)
add_item.show()
menu.append(add_item)
return

View File

@ -450,26 +450,20 @@ class GeoEvents(GeoGraphyView):
"""
Add specific entry to the navigation menu.
"""
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
add_item = Gtk.MenuItem(label=_("Show all events"))
add_item.connect("activate", self.show_all_events, event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Centering on Place"))
add_item.show()
menu.append(add_item)
self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.show()
add_item.set_submenu(itemoption)
oldplace = ""
for mark in self.sort:
if mark[0] != oldplace:
oldplace = mark[0]
modify = Gtk.MenuItem(label=mark[0])
modify.show()
modify.connect("activate", self.goto_place,
float(mark[3]), float(mark[4]))
itemoption.append(modify)

View File

@ -831,13 +831,10 @@ class GeoFamClose(GeoGraphyView):
"""
Add specific entry to the navigation menu.
"""
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
add_item = Gtk.MenuItem(
label=_("Choose and bookmark the new reference family"))
add_item.connect("activate", self.select_family)
add_item.show()
menu.append(add_item)
return

View File

@ -577,12 +577,9 @@ class GeoPerson(GeoGraphyView):
"""
Add specific entry to the navigation menu.
"""
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
add_item = Gtk.MenuItem(label=_("Animate"))
add_item.connect("activate", self.animate, self.sort, 0, 0)
add_item.show()
menu.append(add_item)
return

View File

@ -539,26 +539,21 @@ class GeoPlaces(GeoGraphyView):
"""
Add specific entry to the navigation menu.
"""
add_item = Gtk.MenuItem()
add_item.show()
menu.append(add_item)
menu.append(Gtk.SeparatorMenuItem())
add_item = Gtk.MenuItem(label=_("Show all places"))
add_item.connect("activate", self.show_all_places, event, lat, lon)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(label=_("Centering on Place"))
add_item.show()
menu.append(add_item)
self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.show()
add_item.set_submenu(itemoption)
oldplace = ""
for mark in self.sort:
if mark[0] != oldplace:
oldplace = mark[0]
modify = Gtk.MenuItem(label=mark[0])
modify.show()
modify.connect("activate", self.goto_place,
float(mark[3]), float(mark[4]))
itemoption.append(modify)