From ed0fd7f134794cc220782b3f530a1aed621c7ff8 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 17 Aug 2003 16:07:06 +0000 Subject: [PATCH] * src/gramps_main.py: Better behavior for the history menu. svn: r2019 --- ChangeLog | 3 +++ src/gramps_main.py | 32 ++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6751a1f72..cfb7c7df5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2003-08-17 Alex Roitman + * src/gramps_main.py: Better behavior for the history menu. + 2003-08-16 Alex Roitman * src/gramps_main.py: Functional history submenu of the Go menu. diff --git a/src/gramps_main.py b/src/gramps_main.py index 71e986f48..283bbd75a 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -130,6 +130,7 @@ class Gramps: # a GrampsXML or GrampsZODB self.history = [] + self.mhistory = [] self.hindex = -1 self.db = RelLib.GrampsDB() @@ -465,24 +466,27 @@ class Gramps: self.edit_button.set_sensitive(val) def redraw_histmenu(self): - """Create the pulldown history menu""" + """Create the history submenu of the Go 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 = self.mhistory[:] pids.reverse() num = 0 + haveit = [] 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 + if num < 10: + if pid not in haveit: + haveit.append(pid) + 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) @@ -493,6 +497,7 @@ class Gramps: self.active_person = self.db.getPerson(self.history[self.hindex]) self.modify_statusbar() self.update_display(0) + self.mhistory.append(self.history[self.hindex]) self.redraw_histmenu() self.set_buttons(1) if self.hindex == 0: @@ -518,6 +523,7 @@ class Gramps: self.active_person = self.db.getPerson(self.history[self.hindex]) self.modify_statusbar() self.update_display(0) + self.mhistory.append(self.history[self.hindex]) self.redraw_histmenu() self.set_buttons(1) if self.hindex == len(self.history)-1: @@ -881,6 +887,7 @@ class Gramps: const.familyRelations = const.init_family_relation_list() self.history = [] + self.mhistory = [] self.hindex = -1 self.clear_person_tabs() @@ -1531,6 +1538,7 @@ class Gramps: self.fwdbtn.set_sensitive(0) self.forward.set_sensitive(0) self.history.append(person.getId()) + self.mhistory.append(person.getId()) self.hindex += 1 self.redraw_histmenu()