add menu option for selecting the active person in geo view

This commit is contained in:
Michael Becker 2023-05-04 08:00:51 -04:00
parent 8de745c30a
commit bc0c627fdf
2 changed files with 51 additions and 2 deletions

28
gramps/plugins/view/geoclose.py Normal file → Executable file
View File

@ -204,7 +204,6 @@ class GeoClose(GeoGraphyView):
('geography.center-lat', 0.0),
('geography.center-lon', 0.0),
('geography.use-keypad', True),
('geography.personal-map', ""),
('geography.map_service', constants.OPENSTREETMAP),
('geography.max_places', 5000),
@ -247,6 +246,14 @@ class GeoClose(GeoGraphyView):
self.add_item = None
self.newmenu = None
self.config_meeting_slider = None
self.dbstate.connect('database-changed', self.reset_change_db)
def reset_change_db(self, dummy_dbase):
"""
Used to reset the family reference
"""
self.refperson = None
def get_title(self):
"""
@ -388,6 +395,17 @@ class GeoClose(GeoGraphyView):
self.refperson = sel.run()
self.goto_handle(None)
def select_person2(self, *obj):
"""
Open a selection box to choose the secondary person.
"""
selectperson = SelectorFactory('Person')
sel = selectperson(self.dbstate, self.uistate, self.track,
_("Select the person which will be our active."),
skip=self.skip_list)
self.uistate.set_active(sel.run().get_handle(), 'Person')
self.goto_handle(None)
def build_tree(self):
"""
This is called by the parent class when the view becomes visible. Since
@ -569,6 +587,7 @@ class GeoClose(GeoGraphyView):
"""
self.newmenu = Gtk.Menu()
menu = self.newmenu
menu.set_title("person")
events = []
message = ""
oldplace = ""
@ -613,6 +632,7 @@ class GeoClose(GeoGraphyView):
menu.append(add_item)
self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message)
itemoption.show()
add_item.set_submenu(itemoption)
modify = Gtk.MenuItem(label=_("Edit Event"))
@ -642,6 +662,12 @@ class GeoClose(GeoGraphyView):
add_item.connect("activate", self.select_person)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(
label=_("Choose the new active person"))
add_item.connect("activate", self.select_person2)
add_item.show()
menu.append(add_item)
return
def get_default_gramplets(self):

25
gramps/plugins/view/geofamclose.py Normal file → Executable file
View File

@ -203,7 +203,6 @@ class GeoFamClose(GeoGraphyView):
('geography.center-lat', 0.0),
('geography.center-lon', 0.0),
('geography.use-keypad', True),
('geography.personal-map', ""),
('geography.map_service', constants.OPENSTREETMAP),
('geography.max_places', 5000),
@ -244,6 +243,13 @@ class GeoFamClose(GeoGraphyView):
self.cal = config.get('preferences.calendar-format-report')
self.no_show_places_in_status_bar = False
self.config_meeting_slider = None
self.dbstate.connect('database-changed', self.reset_change_db)
def reset_change_db(self, dummy_dbase):
"""
Used to reset the family reference
"""
self.reffamily = None
def get_title(self):
"""
@ -382,6 +388,15 @@ class GeoFamClose(GeoGraphyView):
self.reffamily = sel.run()
self.goto_handle(None)
def select_family2(self, *obj):
"""
Open a selection box to choose the secondary family.
"""
select_family = SelectorFactory('Family')
sel = select_family(self.dbstate, self.uistate)
self.uistate.set_active(sel.run().get_handle(), 'Family')
self.goto_handle(None)
def build_tree(self):
"""
This is called by the parent class when the view becomes visible. Since
@ -759,6 +774,7 @@ class GeoFamClose(GeoGraphyView):
"""
self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("family")
events = []
message = ""
oldplace = ""
@ -802,6 +818,7 @@ class GeoFamClose(GeoGraphyView):
menu.append(add_item)
self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message)
itemoption.show()
add_item.set_submenu(itemoption)
modify = Gtk.MenuItem(label=_("Edit Event"))
@ -831,6 +848,12 @@ class GeoFamClose(GeoGraphyView):
add_item.connect("activate", self.select_family)
add_item.show()
menu.append(add_item)
add_item = Gtk.MenuItem(
label=_("Choose the new active family"))
add_item.connect("activate", self.select_family2)
add_item.show()
menu.append(add_item)
return
def get_default_gramplets(self):