* src/gramps_main.py: Better behavior for the history menu.
svn: r2019
This commit is contained in:
parent
e6ce232335
commit
ed0fd7f134
@ -1,3 +1,6 @@
|
|||||||
|
2003-08-17 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* src/gramps_main.py: Better behavior for the history menu.
|
||||||
|
|
||||||
2003-08-16 Alex Roitman <shura@alex.neuro.umn.edu>
|
2003-08-16 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/gramps_main.py: Functional history submenu of the Go menu.
|
* src/gramps_main.py: Functional history submenu of the Go menu.
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ class Gramps:
|
|||||||
# a GrampsXML or GrampsZODB
|
# a GrampsXML or GrampsZODB
|
||||||
|
|
||||||
self.history = []
|
self.history = []
|
||||||
|
self.mhistory = []
|
||||||
self.hindex = -1
|
self.hindex = -1
|
||||||
|
|
||||||
self.db = RelLib.GrampsDB()
|
self.db = RelLib.GrampsDB()
|
||||||
@ -465,24 +466,27 @@ class Gramps:
|
|||||||
self.edit_button.set_sensitive(val)
|
self.edit_button.set_sensitive(val)
|
||||||
|
|
||||||
def redraw_histmenu(self):
|
def redraw_histmenu(self):
|
||||||
"""Create the pulldown history menu"""
|
"""Create the history submenu of the Go menu"""
|
||||||
self.hist_gomenuitem.remove_submenu()
|
self.hist_gomenuitem.remove_submenu()
|
||||||
if len(self.history) > 0:
|
if len(self.history) > 0:
|
||||||
self.histmenu = gtk.Menu()
|
self.histmenu = gtk.Menu()
|
||||||
start = max(self.hindex-9,0)
|
pids = self.mhistory[:]
|
||||||
pids = self.history[start:self.hindex+1]
|
|
||||||
pids.reverse()
|
pids.reverse()
|
||||||
num = 0
|
num = 0
|
||||||
|
haveit = []
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
person = self.db.getPerson(pid)
|
if num < 10:
|
||||||
item = gtk.MenuItem("_%d. %s [%s]" %
|
if pid not in haveit:
|
||||||
(num,person.getPrimaryName().getName(),pid))
|
haveit.append(pid)
|
||||||
item.connect("activate",self.bookmark_callback,person)
|
person = self.db.getPerson(pid)
|
||||||
item.show()
|
item = gtk.MenuItem("_%d. %s [%s]" %
|
||||||
self.histmenu.append(item)
|
(num,person.getPrimaryName().getName(),pid))
|
||||||
self.hist_gomenuitem.set_submenu(self.histmenu)
|
item.connect("activate",self.bookmark_callback,person)
|
||||||
self.hist_gomenuitem.set_sensitive(1)
|
item.show()
|
||||||
num = num + 1
|
self.histmenu.append(item)
|
||||||
|
self.hist_gomenuitem.set_submenu(self.histmenu)
|
||||||
|
self.hist_gomenuitem.set_sensitive(1)
|
||||||
|
num = num + 1
|
||||||
else:
|
else:
|
||||||
self.hist_gomenuitem.set_sensitive(0)
|
self.hist_gomenuitem.set_sensitive(0)
|
||||||
|
|
||||||
@ -493,6 +497,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.mhistory.append(self.history[self.hindex])
|
||||||
self.redraw_histmenu()
|
self.redraw_histmenu()
|
||||||
self.set_buttons(1)
|
self.set_buttons(1)
|
||||||
if self.hindex == 0:
|
if self.hindex == 0:
|
||||||
@ -518,6 +523,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.mhistory.append(self.history[self.hindex])
|
||||||
self.redraw_histmenu()
|
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:
|
||||||
@ -881,6 +887,7 @@ class Gramps:
|
|||||||
const.familyRelations = const.init_family_relation_list()
|
const.familyRelations = const.init_family_relation_list()
|
||||||
|
|
||||||
self.history = []
|
self.history = []
|
||||||
|
self.mhistory = []
|
||||||
self.hindex = -1
|
self.hindex = -1
|
||||||
|
|
||||||
self.clear_person_tabs()
|
self.clear_person_tabs()
|
||||||
@ -1531,6 +1538,7 @@ class Gramps:
|
|||||||
self.fwdbtn.set_sensitive(0)
|
self.fwdbtn.set_sensitive(0)
|
||||||
self.forward.set_sensitive(0)
|
self.forward.set_sensitive(0)
|
||||||
self.history.append(person.getId())
|
self.history.append(person.getId())
|
||||||
|
self.mhistory.append(person.getId())
|
||||||
self.hindex += 1
|
self.hindex += 1
|
||||||
self.redraw_histmenu()
|
self.redraw_histmenu()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user