2008-03-07 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/QuickReports.py: optionally pass in kwargs * src/plugins/DefaultGramplets.py: added generation summary to pedigree * src/plugins/FilterByName.py: new filter "people by list" * src/DataViews/GrampletView.py: handle "people by list" links svn: r10211
This commit is contained in:
parent
0a71655918
commit
52e250979b
@ -1,3 +1,9 @@
|
|||||||
|
2008-03-07 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
|
* src/QuickReports.py: optionally pass in kwargs
|
||||||
|
* src/plugins/DefaultGramplets.py: added generation summary to pedigree
|
||||||
|
* src/plugins/FilterByName.py: new filter "people by list"
|
||||||
|
* src/DataViews/GrampletView.py: handle "people by list" links
|
||||||
|
|
||||||
2008-03-07 Peter Landgren <peter.talken@telia.com>
|
2008-03-07 Peter Landgren <peter.talken@telia.com>
|
||||||
* src/GrampsCfg.py
|
* src/GrampsCfg.py
|
||||||
* src/Config/_GrampsConfigKeys.py
|
* src/Config/_GrampsConfigKeys.py
|
||||||
|
@ -436,6 +436,14 @@ class Gramplet(object):
|
|||||||
self.gui.uistate,
|
self.gui.uistate,
|
||||||
'filterbyname',
|
'filterbyname',
|
||||||
handle)
|
handle)
|
||||||
|
elif link_type == 'PersonList':
|
||||||
|
if event.button == 1: # left mouse
|
||||||
|
if event.type == gtk.gdk._2BUTTON_PRESS: # double
|
||||||
|
run_quick_report_by_name(self.gui.dbstate,
|
||||||
|
self.gui.uistate,
|
||||||
|
'filterbyname',
|
||||||
|
'list of people',
|
||||||
|
handles=handle)
|
||||||
return True
|
return True
|
||||||
return False # did not handle event
|
return False # did not handle event
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ def by_menu_name(first, second):
|
|||||||
def make_quick_report_callback(lst, category, dbstate, uistate, handle):
|
def make_quick_report_callback(lst, category, dbstate, uistate, handle):
|
||||||
return lambda x: run_report(dbstate, uistate, category, handle, lst[0])
|
return lambda x: run_report(dbstate, uistate, category, handle, lst[0])
|
||||||
|
|
||||||
def run_quick_report_by_name(dbstate, uistate, report_name, handle):
|
def run_quick_report_by_name(dbstate, uistate, report_name, handle, **kwargs):
|
||||||
from PluginUtils import quick_report_list
|
from PluginUtils import quick_report_list
|
||||||
# [0] - function
|
# [0] - function
|
||||||
# [1] - translated name
|
# [1] - translated name
|
||||||
@ -121,7 +121,7 @@ def run_quick_report_by_name(dbstate, uistate, report_name, handle):
|
|||||||
report = item
|
report = item
|
||||||
break
|
break
|
||||||
if report:
|
if report:
|
||||||
run_report(dbstate, uistate, report[2], handle, report[0])
|
run_report(dbstate, uistate, report[2], handle, report[0], **kwargs)
|
||||||
else:
|
else:
|
||||||
raise AttributeError, ("No such quick report '%s'" % report_name)
|
raise AttributeError, ("No such quick report '%s'" % report_name)
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ def run_quick_report_by_name_direct(report_name, database, document, handle):
|
|||||||
else:
|
else:
|
||||||
raise AttributeError, ("No such quick report '%s'" % report_name)
|
raise AttributeError, ("No such quick report '%s'" % report_name)
|
||||||
|
|
||||||
def run_report(dbstate, uistate, category, handle,func):
|
def run_report(dbstate, uistate, category, handle, func, **kwargs):
|
||||||
from docgen import TextBufDoc
|
from docgen import TextBufDoc
|
||||||
from Simple import make_basic_stylesheet
|
from Simple import make_basic_stylesheet
|
||||||
|
|
||||||
@ -177,6 +177,6 @@ def run_report(dbstate, uistate, category, handle,func):
|
|||||||
obj = handle
|
obj = handle
|
||||||
if obj:
|
if obj:
|
||||||
d.open("")
|
d.open("")
|
||||||
func(dbstate.db, d, obj)
|
func(dbstate.db, d, obj, **kwargs)
|
||||||
d.close()
|
d.close()
|
||||||
|
|
||||||
|
@ -521,10 +521,16 @@ class PedigreeGramplet(Gramplet):
|
|||||||
self.link(name_displayer.display_name(person.get_primary_name()),
|
self.link(name_displayer.display_name(person.get_primary_name()),
|
||||||
'Person', person.handle)
|
'Person', person.handle)
|
||||||
self.append_text("\n")
|
self.append_text("\n")
|
||||||
|
if generation not in self._generations:
|
||||||
|
self._generations[generation] = []
|
||||||
|
self._generations[generation].append(handle)
|
||||||
elif what == "a":
|
elif what == "a":
|
||||||
self.append_text("o------")
|
self.append_text("o------")
|
||||||
self.render_text("<b>%s</b>" % name_displayer.display_name(person.get_primary_name()))
|
self.render_text("<b>%s</b>" % name_displayer.display_name(person.get_primary_name()))
|
||||||
self.append_text("\n")
|
self.append_text("\n")
|
||||||
|
if generation not in self._generations:
|
||||||
|
self._generations[generation] = []
|
||||||
|
self._generations[generation].append(handle)
|
||||||
elif what == "m":
|
elif what == "m":
|
||||||
if len(family_list) > 0:
|
if len(family_list) > 0:
|
||||||
family = self.dbstate.db.get_family_from_handle(family_list[0])
|
family = self.dbstate.db.get_family_from_handle(family_list[0])
|
||||||
@ -541,6 +547,7 @@ class PedigreeGramplet(Gramplet):
|
|||||||
Generator which will be run in the background.
|
Generator which will be run in the background.
|
||||||
"""
|
"""
|
||||||
self._boxes = [0] * self.max_generations
|
self._boxes = [0] * self.max_generations
|
||||||
|
self._generations = {}
|
||||||
self.set_text("")
|
self.set_text("")
|
||||||
active_person = self.dbstate.get_active_person()
|
active_person = self.dbstate.get_active_person()
|
||||||
if not active_person:
|
if not active_person:
|
||||||
@ -548,8 +555,26 @@ class PedigreeGramplet(Gramplet):
|
|||||||
#no wrap in Gramplet
|
#no wrap in Gramplet
|
||||||
self.no_wrap()
|
self.no_wrap()
|
||||||
self.process_person(active_person.handle, 1, "f") # father
|
self.process_person(active_person.handle, 1, "f") # father
|
||||||
self.process_person(active_person.handle, 0, "a") # active
|
self.process_person(active_person.handle, 0, "a") # active #FIXME: should be 1?
|
||||||
self.process_person(active_person.handle, 1, "m") # mother
|
self.process_person(active_person.handle, 1, "m") # mother
|
||||||
|
gens = self._generations.keys()
|
||||||
|
gens.sort()
|
||||||
|
self.append_text(_("\nBreakdown by generation:\n"))
|
||||||
|
all = [active_person.handle]
|
||||||
|
for g in gens:
|
||||||
|
count = len(self._generations[g])
|
||||||
|
handles = self._generations[g]
|
||||||
|
self.append_text(" ")
|
||||||
|
if g == 0:
|
||||||
|
self.link(_("Generation 1"), 'PersonList', handles)
|
||||||
|
self.append_text(_(" has 1 of 1 individual (100.00% complete)\n"))
|
||||||
|
else:
|
||||||
|
all.extend(handles)
|
||||||
|
self.link(_("Generation %d") % g, 'PersonList', handles)
|
||||||
|
self.append_text(_(" has %d of %d individuals (%.2f%% complete)\n") %
|
||||||
|
(count, 2**(g-1), float(count)/2**(g-1) * 100))
|
||||||
|
self.link(_("All generations"), 'PersonList', all)
|
||||||
|
self.append_text(_(" have %d individuals\n") % len(all))
|
||||||
self.append_text("", scroll_to="begin")
|
self.append_text("", scroll_to="begin")
|
||||||
|
|
||||||
class StatsGramplet(Gramplet):
|
class StatsGramplet(Gramplet):
|
||||||
|
@ -33,7 +33,7 @@ import DateHandler
|
|||||||
import posixpath
|
import posixpath
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
def run(database, document, filter_name):
|
def run(database, document, filter_name, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Loops through the families that the person is a child in, and display
|
Loops through the families that the person is a child in, and display
|
||||||
the information about the other children.
|
the information about the other children.
|
||||||
@ -199,6 +199,14 @@ def run(database, document, filter_name):
|
|||||||
matches += 1
|
matches += 1
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
elif (filter_name == 'list of people'):
|
||||||
|
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||||
|
people = kwargs["handles"]
|
||||||
|
for person_handle in people:
|
||||||
|
person = database.get_person_from_handle(person_handle)
|
||||||
|
stab.row(person, sdb.birth_date_obj(person),
|
||||||
|
str(person.get_primary_name().get_type()))
|
||||||
|
matches += 1
|
||||||
else:
|
else:
|
||||||
raise AttributeError, ("invalid filter name: '%s'" % filter_name)
|
raise AttributeError, ("invalid filter name: '%s'" % filter_name)
|
||||||
sdoc.paragraph(_("Filter matched %d records.") % matches)
|
sdoc.paragraph(_("Filter matched %d records.") % matches)
|
||||||
|
Loading…
Reference in New Issue
Block a user