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

@@ -41,7 +41,8 @@ class AttributesGramplet(Gramplet):
def main(self): # return false finishes
self.set_text("")
active_person = self.dbstate.get_active_person()
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
if not active_person:
return
name = name_displayer.display(active_person)

View File

@@ -57,11 +57,12 @@ class DescendantGramplet(Gramplet):
self.update()
def main(self):
if self.dbstate.get_active_person() is None:
active_handle = self.get_active('Person')
if not active_handle:
self.set_text(_("No Active Person selected."))
return
self.set_text("")
self.center_person = self.dbstate.get_active_person()
self.center_person = self.dbstate.db.get_person_from_handle(active_handle)
name = name_displayer.display(self.center_person)
title = _("Descendants of %s") % name
self.append_text(title)

View File

@@ -613,7 +613,8 @@ class FanChartGramplet(Gramplet):
data.
"""
self.gui.fan.reset_generations()
person = self.dbstate.get_active_person()
active_handle = self.get_active('Person')
person = self.dbstate.db.get_person_from_handle(active_handle)
if not person:
name = None
else:
@@ -657,10 +658,10 @@ class FanChartGramplet(Gramplet):
parent += 1
self.gui.fan.queue_draw()
def on_childmenu_changed(self, obj,person_handle):
def on_childmenu_changed(self, obj, person_handle):
"""Callback for the pulldown menu selection, changing to the person
attached with menu item."""
self.dbstate.change_active_handle(person_handle)
self.set_active('Person', person_handle)
return True
def edit_person_cb(self, obj,person_handle):

View File

@@ -229,7 +229,8 @@ class PedigreeGramplet(Gramplet):
self._boxes = [0] * (self.max_generations + 1)
self._generations = {}
self.gui.buffer.set_text("")
active_person = self.dbstate.get_active_person()
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
if not active_person:
return False
#no wrap in Gramplet

View File

@@ -53,12 +53,12 @@ class QuickViewGramplet(Gramplet):
qv_option = self.get_option(_("Quick Views"))
quick_view = qv_option.get_value()
if quick_type == CATEGORY_QR_PERSON:
active = self.dbstate.get_active_person()
if active:
active_handle = self.get_active('Person')
if active_handle:
run_quick_report_by_name(self.gui.dbstate,
self.gui.uistate,
quick_view,
active.handle,
active_handle,
container=self.gui.textview)
else:
active_list = []

View File

@@ -63,7 +63,8 @@ class RelativesGramplet(Gramplet):
"""
self.set_text("")
database = self.dbstate.db
active_person = self.dbstate.get_active_person()
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
if not active_person:
return
name = name_displayer.display(active_person)