Extend history functionality (back/forward) and active-changed signals to all primary objects

svn: r14023
This commit is contained in:
Nick Hall
2010-01-10 19:19:33 +00:00
parent 141100fdbf
commit b503fa2e25
42 changed files with 552 additions and 767 deletions

View File

@ -433,7 +433,8 @@ class GuiPersonOption(gtk.HBox):
self.pack_start(pevt, False)
self.pack_end(person_button, False)
person = self.__dbstate.get_active_person()
person_handle = self.__uistate.get_active('Person')
person = self.__dbstate.db.get_person_from_handle(person_handle)
if not person:
person = self.__db.get_default_person()
self.__update_person(person)
@ -461,7 +462,8 @@ class GuiPersonOption(gtk.HBox):
rfilter.add_rule(Rules.Person.HasIdOf([gid]))
# Add the selected person if one exists.
active_person = self.__dbstate.get_active_person()
person_handle = self.__uistate.get_active('Person')
active_person = self.__dbstate.db.get_person_from_handle(person_handle)
if active_person:
gid = active_person.get_gramps_id()
rfilter.add_rule(Rules.Person.HasIdOf([gid]))
@ -540,7 +542,8 @@ class GuiFamilyOption(gtk.HBox):
family_list = []
# First try the family of the active person
person = self.__dbstate.get_active_person()
person_handle = self.__uistate.get_active('Person')
person = self.__dbstate.db.get_person_from_handle(person_handle)
if person:
family_list = person.get_family_handle_list()

View File

@ -74,7 +74,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
reports. This is used to build the selection tree on the left
hand side of the dialog box.
"""
self.active = state.active
self.active = uistate.get_active('Person')
self.imap = {}
self.msg = msg
self.content = content
@ -238,7 +238,9 @@ class PluginDialog(ManagedWindow.ManagedWindow):
return
if pdata.ptype == REPORT:
report(self.state, self.uistate, self.state.active,
active_handle = self.uistate.get_active('Person')
report(self.state, self.uistate,
self.state.db.get_person_from_handle(active_handle),
eval('mod.' + pdata.reportclass),
eval('mod.' + pdata.optionclass),
pdata.name, pdata.id,

View File

@ -482,7 +482,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
except Errors.WindowActiveError:
pass
else:
self.dbstate.change_active_person(person)
self.uistate.set_active(person_handle, 'Person')
return True # handled event
return False # did not handle event

View File

@ -76,7 +76,6 @@ class Tool(object):
def __init__(self, dbstate, options_class, name):
from PluginUtils import MenuToolOptions
self.db = dbstate.db
self.person = dbstate.active
try:
if issubclass(options_class, MenuToolOptions):
# FIXME: pass in person_id
@ -125,9 +124,9 @@ class ActivePersonTool(Tool):
for tools that depend on active person.
"""
def __init__(self, dbstate, options_class, name):
def __init__(self, dbstate, uistate, options_class, name):
if not dbstate.get_active_person():
if not uistate.get_active('Person'):
from QuestionDialog import ErrorDialog
ErrorDialog(_('Active person has not been set'),