From 7be129244127c118aadbaadffe0b4728ef2dc55c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 19 Aug 2003 12:39:05 +0000 Subject: [PATCH] * src/gramps_main.py (build_backhistmenu,build_fwdhistmenu): Limit of 20 for the Back/Forward history menus. Add hotkeys for these menus. svn: r2025 --- gramps2/ChangeLog | 5 ++++ gramps2/src/gramps_main.py | 47 +++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index cd878e7c1..6f116c543 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2003-08-19 Alex Roitman + * src/gramps_main.py (build_backhistmenu,build_fwdhistmenu): + Limit of 20 for the Back/Forward history menus. + Add hotkeys for these menus. + 2003-08-18 Alex Roitman * src/preferences.glade: Provide hotkeys for the new default view options. diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index e055f0fa3..098670608 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -478,18 +478,19 @@ class Gramps: num = 0 haveit = [] for pid in pids: - 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 + if num >= 10: + break + 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) @@ -502,9 +503,16 @@ class Gramps: pids.reverse() num = 1 for pid in pids: + if num <= 10: + f,r = divmod(num,10) + hotkey = "_%d" % r + elif num <= 20: + hotkey = "_%s" % chr(ord('a')+num-11) + elif num >= 21: + break person = self.db.getPerson(pid) - item = gtk.MenuItem("%s [%s]" % - (person.getPrimaryName().getName(),pid)) + item = gtk.MenuItem("%s. %s [%s]" % + (hotkey,person.getPrimaryName().getName(),pid)) item.connect("activate",self.back_clicked,num) item.show() backhistmenu.append(item) @@ -523,9 +531,16 @@ class Gramps: pids = self.history[self.hindex+1:] num = 1 for pid in pids: + if num <= 10: + f,r = divmod(num,10) + hotkey = "_%d" % r + elif num <= 20: + hotkey = "_%s" % chr(ord('a')+num-11) + elif num >= 21: + break person = self.db.getPerson(pid) - item = gtk.MenuItem("%s [%s]" % - (person.getPrimaryName().getName(),pid)) + item = gtk.MenuItem("%s. %s [%s]" % + (hotkey,person.getPrimaryName().getName(),pid)) item.connect("activate",self.fwd_clicked,num) item.show() fwdhistmenu.append(item)