* src/gramps_main.py: Functional history submenu of the Go menu.

svn: r2018
This commit is contained in:
Alex Roitman 2003-08-17 04:01:52 +00:00
parent ebdc5fbcc3
commit e6ce232335
2 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2003-08-16 Alex Roitman <shura@alex.neuro.umn.edu>
* src/gramps_main.py: Functional history submenu of the Go menu.
2003-08-16 Don Allingham <dallingham@users.sourceforge.net> 2003-08-16 Don Allingham <dallingham@users.sourceforge.net>
* configure.in: removal of intl.c/intl22.so * configure.in: removal of intl.c/intl22.so
* src/gramps.py: handling of i18n without the use of intl * src/gramps.py: handling of i18n without the use of intl

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2003 Donald N. Allinghamg # Copyright (C) 2000-2003 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -131,7 +131,7 @@ class Gramps:
self.history = [] self.history = []
self.hindex = -1 self.hindex = -1
self.db = RelLib.GrampsDB() self.db = RelLib.GrampsDB()
self.db.set_iprefix(GrampsCfg.iprefix) self.db.set_iprefix(GrampsCfg.iprefix)
self.db.set_oprefix(GrampsCfg.oprefix) self.db.set_oprefix(GrampsCfg.oprefix)
@ -378,6 +378,8 @@ class Gramps:
self.fwdbtn = self.gtop.get_widget('fwd_btn') self.fwdbtn = self.gtop.get_widget('fwd_btn')
self.back = self.gtop.get_widget('back') self.back = self.gtop.get_widget('back')
self.forward = self.gtop.get_widget('forward') self.forward = self.gtop.get_widget('forward')
self.hist_gomenuitem = self.gtop.get_widget("history1")
self.histmenu = None
self.gtop.signal_autoconnect({ self.gtop.signal_autoconnect({
"on_back_clicked" : self.back_clicked, "on_back_clicked" : self.back_clicked,
@ -462,6 +464,28 @@ class Gramps:
self.remove_button.set_sensitive(val) self.remove_button.set_sensitive(val)
self.edit_button.set_sensitive(val) self.edit_button.set_sensitive(val)
def redraw_histmenu(self):
"""Create the pulldown history menu"""
self.hist_gomenuitem.remove_submenu()
if len(self.history) > 0:
self.histmenu = gtk.Menu()
start = max(self.hindex-9,0)
pids = self.history[start:self.hindex+1]
pids.reverse()
num = 0
for pid in pids:
person = self.db.getPerson(pid)
item = gtk.MenuItem("_%d. %s [%s]" %
(num,person.getPrimaryName().getName(),pid))
item.connect("activate",self.bookmark_callback,person)
item.show()
self.histmenu.append(item)
self.hist_gomenuitem.set_submenu(self.histmenu)
self.hist_gomenuitem.set_sensitive(1)
num = num + 1
else:
self.hist_gomenuitem.set_sensitive(0)
def back_clicked(self,obj): def back_clicked(self,obj):
if self.hindex > 0: if self.hindex > 0:
try: try:
@ -469,6 +493,7 @@ class Gramps:
self.active_person = self.db.getPerson(self.history[self.hindex]) self.active_person = self.db.getPerson(self.history[self.hindex])
self.modify_statusbar() self.modify_statusbar()
self.update_display(0) self.update_display(0)
self.redraw_histmenu()
self.set_buttons(1) self.set_buttons(1)
if self.hindex == 0: if self.hindex == 0:
self.backbtn.set_sensitive(0) self.backbtn.set_sensitive(0)
@ -493,6 +518,7 @@ class Gramps:
self.active_person = self.db.getPerson(self.history[self.hindex]) self.active_person = self.db.getPerson(self.history[self.hindex])
self.modify_statusbar() self.modify_statusbar()
self.update_display(0) self.update_display(0)
self.redraw_histmenu()
self.set_buttons(1) self.set_buttons(1)
if self.hindex == len(self.history)-1: if self.hindex == len(self.history)-1:
self.fwdbtn.set_sensitive(0) self.fwdbtn.set_sensitive(0)
@ -1506,6 +1532,8 @@ class Gramps:
self.forward.set_sensitive(0) self.forward.set_sensitive(0)
self.history.append(person.getId()) self.history.append(person.getId())
self.hindex += 1 self.hindex += 1
self.redraw_histmenu()
if self.hindex > 0: if self.hindex > 0:
self.backbtn.set_sensitive(1) self.backbtn.set_sensitive(1)
self.back.set_sensitive(1) self.back.set_sensitive(1)