Implement iter_people_handles methods and begin to use them
svn: r12760
This commit is contained in:
parent
40d0605a63
commit
f7454de7fd
src
PluginUtils
gen/proxy
plugins
Records.py
drawreport
export
ExportCd.pyExportCsv.pyExportFtree.pyExportGedcom.pyExportGeneWeb.pyExportPkg.pyExportVCalendar.pyExportVCard.py
gramplet
graph
quickview
textreport
tool
CalculateEstimatedDates.pyChangeNames.pyEventCmp.pyEventNames.pyFindDupes.pyNotRelated.pyPatchNames.pySortEvents.pySoundGen.pyVerify.py
webreport
@ -111,7 +111,7 @@ class LastNameDialog(ManagedWindow.ManagedWindow):
|
||||
progress = ProgressMeter(_('Finding Surnames'))
|
||||
progress.set_pass(_('Finding surnames'),
|
||||
database.get_number_of_people())
|
||||
for person_handle in database.get_person_handles(False):
|
||||
for person_handle in database.iter_person_handles():
|
||||
progress.step()
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
key = person.get_primary_name().get_surname()
|
||||
|
@ -608,6 +608,13 @@ class DbBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def iter_person_handles(self):
|
||||
"""
|
||||
Return an iterator over database handles, one handle for each Person in
|
||||
the database. If sort_handles is True, the list is sorted by surnames
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_place_handles(self, sort_handles=True):
|
||||
"""
|
||||
Return a list of database handles, one handle for each Place in
|
||||
@ -1267,7 +1274,7 @@ class DbBase(object):
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = [i for i in find_backlink_handles(handle)]
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
|
||||
raise NotImplementedError
|
||||
|
@ -281,6 +281,14 @@ class FilterProxyDb(ProxyDbBase):
|
||||
# FIXME: plist is not a sorted list of handles
|
||||
return list(self.plist)
|
||||
|
||||
def iter_person_handles(self):
|
||||
"""
|
||||
Return an iterator over database handles, one handle for each Person in
|
||||
the database. If sort_handles is True, the list is sorted by surnames
|
||||
"""
|
||||
# FIXME: plist is not a sorted list of handles
|
||||
return (h for h in self.plist)
|
||||
|
||||
def get_place_handles(self, sort_handles=True):
|
||||
"""
|
||||
Return a list of database handles, one handle for each Place in
|
||||
@ -420,7 +428,7 @@ class FilterProxyDb(ProxyDbBase):
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = [i for i in find_backlink_handles(handle)]
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
#FIXME: add a filter for returned handles (see private.py as an example)
|
||||
return self.db.find_backlink_handles(handle, include_classes)
|
||||
|
@ -227,6 +227,19 @@ class LivingProxyDb(ProxyDbBase):
|
||||
handles = self.db.get_person_handles(sort_handles)
|
||||
return handles
|
||||
|
||||
def iter_person_handles(self):
|
||||
"""
|
||||
Return an iterator over database handles, one handle for each Person in
|
||||
the database. If sort_handles is True, the list is sorted by surnames
|
||||
"""
|
||||
if self.mode == self.MODE_EXCLUDE_ALL:
|
||||
for handle in self.db.iter_person_handles():
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
if not self.__is_living(person):
|
||||
yield handle
|
||||
else:
|
||||
handles = self.db.iter_person_handles()
|
||||
|
||||
def get_place_handles(self, sort_handles=True):
|
||||
"""
|
||||
Return a list of database handles, one handle for each Place in
|
||||
@ -364,7 +377,7 @@ class LivingProxyDb(ProxyDbBase):
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = [i for i in find_backlink_handles(handle)]
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
handle_itr = self.db.find_backlink_handles(handle, include_classes)
|
||||
for (class_name, handle) in handle_itr:
|
||||
|
@ -218,6 +218,16 @@ class PrivateProxyDb(ProxyDbBase):
|
||||
handles.append(handle)
|
||||
return handles
|
||||
|
||||
def iter_person_handles(self):
|
||||
"""
|
||||
Return an iterator over database handles, one handle for each Person in
|
||||
the database. If sort_handles is True, the list is sorted by surnames
|
||||
"""
|
||||
for handle in self.db.iter_person_handles():
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
if not person.get_privacy():
|
||||
yield handle
|
||||
|
||||
def get_place_handles(self, sort_handles=True):
|
||||
"""
|
||||
Return a list of database handles, one handle for each Place in
|
||||
|
@ -445,7 +445,7 @@ class ProxyDbBase(DbBase):
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = [i for i in find_backlink_handles(handle)]
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -172,6 +172,13 @@ class ReferencedProxyDb(ProxyDbBase):
|
||||
"""
|
||||
return self.db.get_person_handles(sort_handles)
|
||||
|
||||
def iter_person_handles(self):
|
||||
"""
|
||||
Return an iterator over database handles, one handle for each Person in
|
||||
the database. If sort_handles is True, the list is sorted by surnames
|
||||
"""
|
||||
return self.db.iter_person_handles()
|
||||
|
||||
def get_place_handles(self, sort_handles=True):
|
||||
"""
|
||||
Return a list of database handles, one handle for each Place still
|
||||
@ -310,7 +317,7 @@ class ReferencedProxyDb(ProxyDbBase):
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = [i for i in find_backlink_handles(handle)]
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
handle_itr = self.db.find_backlink_handles(handle, include_classes)
|
||||
for (class_name, handle) in handle_itr:
|
||||
@ -366,22 +373,17 @@ class ReferencedProxyDb(ProxyDbBase):
|
||||
'handle_list': self.get_note_handles}
|
||||
}
|
||||
|
||||
has_unreferenced_handles = True
|
||||
|
||||
last_count = 0
|
||||
while has_unreferenced_handles:
|
||||
while True:
|
||||
current_count = 0
|
||||
for object_type, object_dict in object_types.iteritems():
|
||||
unref_list = object_dict['unref_list']
|
||||
handle_list = object_dict['handle_list']()
|
||||
for handle in handle_list:
|
||||
ref_handles = [i for i in \
|
||||
self.find_backlink_handles(handle)]
|
||||
if len(ref_handles) == 0:
|
||||
if not any(self.find_backlink_handles(handle)):
|
||||
unref_list.append(handle)
|
||||
current_count += len(unref_list)
|
||||
|
||||
if current_count == last_count:
|
||||
has_unreferenced_handles = False
|
||||
else:
|
||||
last_count = current_count
|
||||
break
|
||||
last_count = current_count
|
||||
|
@ -100,7 +100,7 @@ def _find_records(db, filter, callname):
|
||||
person_oldestfather = []
|
||||
person_oldestmother = []
|
||||
|
||||
person_handle_list = db.get_person_handles(sort_handles=False)
|
||||
person_handle_list = db.iter_person_handles()
|
||||
|
||||
if filter:
|
||||
person_handle_list = filter.apply(db, person_handle_list)
|
||||
|
@ -245,8 +245,8 @@ class Calendar(Report):
|
||||
This method runs through the data, and collects the relevant dates
|
||||
and text.
|
||||
"""
|
||||
people = self.database.get_person_handles(sort_handles=False)
|
||||
self.progress.set_pass(_('Applying Filter...'), len(people))
|
||||
people = self.database.iter_person_handles()
|
||||
self.progress.set_pass(_('Applying Filter...'), self.database.get_number_of_people())
|
||||
people = self.filter.apply(self.database, people, self.progress)
|
||||
pmgr = PluginManager.get_instance()
|
||||
rel_calc = pmgr.get_relationship_calculator()
|
||||
|
@ -417,7 +417,7 @@ class Extract(object):
|
||||
data.append((ext[name][1], {}, ext[name][2], ext[name][3]))
|
||||
|
||||
# go through the people and collect data
|
||||
for person_handle in filter_func.apply(db, db.get_person_handles(sort_handles=False)):
|
||||
for person_handle in filter_func.apply(db, db.iter_person_handles()):
|
||||
|
||||
person = db.get_person_from_handle(person_handle)
|
||||
# check whether person has suitable gender
|
||||
|
@ -239,7 +239,7 @@ class TimeLine(Report):
|
||||
high = -999999
|
||||
|
||||
self.plist = self.filter.apply(self.database,
|
||||
self.database.get_person_handles(sort_handles=False))
|
||||
self.database.iter_person_handles())
|
||||
|
||||
for p_id in self.plist:
|
||||
p = self.database.get_person_from_handle(p_id)
|
||||
@ -280,7 +280,7 @@ class TimeLine(Report):
|
||||
|
||||
def name_size(self):
|
||||
self.plist = self.filter.apply(self.database,
|
||||
self.database.get_person_handles(sort_handles=False))
|
||||
self.database.iter_person_handles())
|
||||
|
||||
style_sheet = self.doc.get_style_sheet()
|
||||
gstyle = style_sheet.get_draw_style('TLG-text')
|
||||
|
@ -185,7 +185,7 @@ class PackageWriter(object):
|
||||
p.set_media_list(nl)
|
||||
self.db.commit_family(p, None)
|
||||
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
for key in self.db.iter_person_handles():
|
||||
p = self.db.get_person_from_handle(key)
|
||||
nl = p.get_media_list()
|
||||
for o in nl:
|
||||
|
@ -254,7 +254,7 @@ class CSVWriter(object):
|
||||
if not option_box.cfilter.is_empty():
|
||||
self.db = gen.proxy.FilterProxyDb(self.db, option_box.cfilter)
|
||||
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
# get the families for which these people are spouses:
|
||||
self.flist = {}
|
||||
|
@ -144,14 +144,15 @@ class FtreeWriter(object):
|
||||
|
||||
self.restrict = self.option_box.restrict
|
||||
if self.option_box.cfilter is None:
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
self.plist[p] = 1
|
||||
self.plist.update((p,1)
|
||||
for p in self.db.iter_person_handles())
|
||||
|
||||
else:
|
||||
try:
|
||||
for p in self.option_box.cfilter.apply(
|
||||
self.db, self.db.get_person_handles(sort_handles=False)
|
||||
):
|
||||
self.plist[p] = 1
|
||||
self.plist.update((p,1)
|
||||
for p in self.option_box.cfilter.apply(
|
||||
self.db, self.db.iter_person_handles()))
|
||||
|
||||
except Errors.FilterError, msg:
|
||||
(m1, m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
@ -169,8 +170,8 @@ class FtreeWriter(object):
|
||||
|
||||
def cl_setup(self):
|
||||
self.restrict = True
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
self.plist[p] = 1
|
||||
self.plist.update((p,1)
|
||||
for p in self.db.iter_person_handles())
|
||||
|
||||
def export_data(self):
|
||||
name_map = {}
|
||||
|
@ -413,7 +413,6 @@ class GedcomWriter(BasicUtils.UpdateCallback):
|
||||
|
||||
self.dirname = os.path.dirname (filename)
|
||||
self.gedcom_file = open(filename, "w")
|
||||
|
||||
self.__header(filename)
|
||||
self.__submitter()
|
||||
self.__individuals()
|
||||
@ -574,8 +573,8 @@ class GedcomWriter(BasicUtils.UpdateCallback):
|
||||
self.reset(_("Writing individuals"))
|
||||
self.progress_cnt += 1
|
||||
self.update(self.progress_cnt)
|
||||
phandles = self.dbase.get_person_handles()
|
||||
|
||||
phandles = self.dbase.iter_person_handles()
|
||||
|
||||
sorted_list = []
|
||||
for handle in phandles:
|
||||
person = self.dbase.get_person_from_handle(handle)
|
||||
|
@ -174,7 +174,7 @@ class GeneWebWriter(object):
|
||||
if not option_box.cfilter.is_empty():
|
||||
self.db = gen.proxy.FilterProxyDb(self.db, option_box.cfilter)
|
||||
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
|
||||
self.flist = {}
|
||||
|
@ -122,7 +122,7 @@ class PackageWriter(object):
|
||||
nl.remove(o)
|
||||
p.set_media_list(nl)
|
||||
self.db.commit_family(p,None)
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
for key in self.db.iter_person_handles():
|
||||
p = self.db.get_person_from_handle(key)
|
||||
nl = p.get_media_list()
|
||||
for o in nl:
|
||||
|
@ -145,12 +145,12 @@ class CalendarWriter(object):
|
||||
self.option_box.parse_options()
|
||||
|
||||
if self.option_box.cfilter is None:
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
else:
|
||||
try:
|
||||
for p in self.option_box.cfilter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False)):
|
||||
self.db.iter_person_handles()):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1, m2) = msg.messages()
|
||||
@ -174,7 +174,7 @@ class CalendarWriter(object):
|
||||
self.oldval = newval
|
||||
|
||||
def cl_setup(self):
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
|
||||
self.flist = {}
|
||||
|
@ -136,12 +136,12 @@ class CardWriter(object):
|
||||
self.option_box.parse_options()
|
||||
|
||||
if self.option_box.cfilter is None:
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
else:
|
||||
try:
|
||||
for p in self.option_box.cfilter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False)):
|
||||
self.db.iter_person_handles()):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1, m2) = msg.messages()
|
||||
@ -159,7 +159,7 @@ class CardWriter(object):
|
||||
self.oldval = newval
|
||||
|
||||
def cl_setup(self):
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
for p in self.db.iter_person_handles():
|
||||
self.plist[p] = 1
|
||||
|
||||
def writeln(self, text):
|
||||
|
@ -83,7 +83,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
mother_handles = [[] for age in range(self.max_mother_diff)]
|
||||
father_handles = [[] for age in range(self.max_father_diff)]
|
||||
text = ""
|
||||
handles = self.dbstate.db.get_person_handles(sort_handles=False)
|
||||
handles = self.dbstate.db.iter_person_handles()
|
||||
for h in handles:
|
||||
yield True
|
||||
p = self.dbstate.db.get_person_from_handle(h)
|
||||
@ -203,7 +203,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
print "compute_stats", hash
|
||||
hashkeys = sorted(hash)
|
||||
count = sum(hash.itervalues())
|
||||
sumval = sum([k * hash[k] for k in hash])
|
||||
sumval = sum(k * hash[k] for k in hash)
|
||||
minval = min(hashkeys)
|
||||
maxval = max(hashkeys)
|
||||
median = 0
|
||||
|
@ -25,6 +25,8 @@ from gettext import gettext as _
|
||||
from DataViews import Gramplet, register
|
||||
import Config
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
|
||||
def make_tag_size(n, counts, mins=8, maxs=20):
|
||||
# return font sizes mins to maxs
|
||||
diff = maxs - mins
|
||||
@ -56,11 +58,11 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
def main(self):
|
||||
self.set_text(_("Processing...") + "\n")
|
||||
yield True
|
||||
people = self.dbstate.db.get_person_handles(sort_handles=False)
|
||||
people = self.dbstate.db.iter_person_handles()
|
||||
givensubnames = {}
|
||||
representative_handle = {}
|
||||
cnt = 0
|
||||
for person_handle in people:
|
||||
|
||||
for cnt, person_handle in enumerate(people):
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||
@ -69,32 +71,31 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
for givensubname in givenname.split():
|
||||
givensubnames[givensubname] = givensubnames.get(givensubname, 0) + 1
|
||||
representative_handle[givensubname] = person_handle
|
||||
if cnt % 350 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_people = cnt
|
||||
givensubname_sort = []
|
||||
total = 0
|
||||
cnt = 0
|
||||
for givensubname in givensubnames:
|
||||
|
||||
for cnt, givensubname in enumerate(givensubnames):
|
||||
givensubname_sort.append( (givensubnames[givensubname], givensubname) )
|
||||
total += givensubnames[givensubname]
|
||||
if cnt % 100 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_givensubnames = cnt
|
||||
givensubname_sort.sort(lambda a,b: -cmp(a,b))
|
||||
givensubname_sort.sort(reverse=True)
|
||||
cloud_names = []
|
||||
cloud_values = []
|
||||
cnt = 0
|
||||
for (count, givensubname) in givensubname_sort:
|
||||
|
||||
for cnt, (count, givensubname) in enumerate(givensubname_sort):
|
||||
cloud_names.append( (count, givensubname) )
|
||||
cloud_values.append( count )
|
||||
cnt += 1
|
||||
cloud_names.sort(lambda a,b: cmp(a[1], b[1]))
|
||||
|
||||
cloud_names.sort(key=lambda k: k[1])
|
||||
counts = list(set(cloud_values))
|
||||
counts.sort()
|
||||
counts.reverse()
|
||||
counts.sort(reverse=True)
|
||||
line = 0
|
||||
### All done!
|
||||
# Now, find out how many we can display without going over top_size:
|
||||
@ -111,9 +112,9 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
include_greater_than = s
|
||||
break
|
||||
# Ok, now we can show those counts > include_greater_than:
|
||||
showing = 0
|
||||
|
||||
self.set_text("")
|
||||
for (count, givensubname) in cloud_names: # givensubname_sort:
|
||||
for showing, (count, givensubname) in enumerate(cloud_names): # givensubname_sort:
|
||||
if count > include_greater_than:
|
||||
if len(givensubname) == 0:
|
||||
text = Config.get(Config.NO_SURNAME_TEXT)
|
||||
@ -126,7 +127,7 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
(float(count)/total_people) * 100,
|
||||
count))
|
||||
self.append_text(" ")
|
||||
showing += 1
|
||||
|
||||
self.append_text(("\n\n" + _("Total unique given names") + ": %d\n") %
|
||||
total_givensubnames)
|
||||
self.append_text((_("Total given names showing") + ": %d\n") % showing)
|
||||
|
@ -36,6 +36,14 @@ from Utils import media_path_full
|
||||
import DateHandler
|
||||
import gen
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
_YIELD_INTERVAL = 200
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramplet class
|
||||
@ -58,7 +66,7 @@ class StatsGramplet(Gramplet):
|
||||
def main(self):
|
||||
self.set_text(_("Processing..."))
|
||||
database = self.dbstate.db
|
||||
personList = database.get_person_handles(sort_handles=False)
|
||||
personList = database.iter_person_handles()
|
||||
familyList = database.get_family_handles()
|
||||
|
||||
with_photos = 0
|
||||
@ -73,7 +81,7 @@ class StatsGramplet(Gramplet):
|
||||
namelist = []
|
||||
notfound = []
|
||||
|
||||
pobjects = len(database.get_media_object_handles())
|
||||
pobjects = database.get_number_of_media_objects()
|
||||
for photo_id in database.get_media_object_handles():
|
||||
photo = database.get_object_from_handle(photo_id)
|
||||
fullname = media_path_full(database, photo.get_path())
|
||||
@ -82,8 +90,7 @@ class StatsGramplet(Gramplet):
|
||||
except:
|
||||
notfound.append(photo.get_path())
|
||||
|
||||
cnt = 0
|
||||
for person_handle in personList:
|
||||
for cnt, person_handle in enumerate(personList):
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if not person:
|
||||
continue
|
||||
@ -92,16 +99,17 @@ class StatsGramplet(Gramplet):
|
||||
with_photos = with_photos + 1
|
||||
total_photos = total_photos + length
|
||||
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
names = [person.get_primary_name()] + person.get_alternate_names()
|
||||
for name in names:
|
||||
if name.get_first_name() == "" or name.get_group_name() == "":
|
||||
incomp_names = incomp_names + 1
|
||||
if name.get_group_name() not in namelist:
|
||||
namelist.append(name.get_group_name())
|
||||
|
||||
if ((not person.get_main_parents_family_handle()) and
|
||||
(not len(person.get_family_handle_list()))):
|
||||
disconnected = disconnected + 1
|
||||
|
||||
birth_ref = person.get_birth_ref()
|
||||
if birth_ref:
|
||||
birth = database.get_event_from_handle(birth_ref.ref)
|
||||
@ -109,22 +117,22 @@ class StatsGramplet(Gramplet):
|
||||
missing_bday = missing_bday + 1
|
||||
else:
|
||||
missing_bday = missing_bday + 1
|
||||
|
||||
if person.get_gender() == gen.lib.Person.FEMALE:
|
||||
females = females + 1
|
||||
elif person.get_gender() == gen.lib.Person.MALE:
|
||||
males = males + 1
|
||||
else:
|
||||
unknowns += 1
|
||||
if cnt % 200 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
self.clear_text()
|
||||
self.append_text(_("Individuals") + "\n")
|
||||
self.append_text("----------------------------\n")
|
||||
self.link(_("Number of individuals") + ":",
|
||||
'Filter', 'all people')
|
||||
self.append_text(" %s" % len(personList))
|
||||
self.append_text(" %s" % database.get_number_of_people())
|
||||
self.append_text("\n")
|
||||
self.link("%s:" % _("Males"), 'Filter', 'males')
|
||||
self.append_text(" %s" % males)
|
||||
|
@ -27,6 +27,14 @@ from DataViews import register, Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import Config
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Local functions
|
||||
@ -70,11 +78,10 @@ class SurnameCloudGramplet(Gramplet):
|
||||
def main(self):
|
||||
self.set_text(_("Processing...") + "\n")
|
||||
yield True
|
||||
people = self.dbstate.db.get_person_handles(sort_handles=False)
|
||||
people = self.dbstate.db.iter_person_handles()
|
||||
surnames = {}
|
||||
representative_handle = {}
|
||||
cnt = 0
|
||||
for person_handle in people:
|
||||
for cnt, person_handle in enumerate(people):
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||
@ -82,32 +89,29 @@ class SurnameCloudGramplet(Gramplet):
|
||||
for surname in allnames:
|
||||
surnames[surname] = surnames.get(surname, 0) + 1
|
||||
representative_handle[surname] = person_handle
|
||||
if cnt % 350 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_people = cnt
|
||||
surname_sort = []
|
||||
total = 0
|
||||
cnt = 0
|
||||
for surname in surnames:
|
||||
for cnt, surname in enumerate(surnames):
|
||||
surname_sort.append( (surnames[surname], surname) )
|
||||
total += surnames[surname]
|
||||
if cnt % 350 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_surnames = cnt
|
||||
surname_sort.sort(lambda a,b: -cmp(a,b))
|
||||
surname_sort.sort(reverse=True)
|
||||
cloud_names = []
|
||||
cloud_values = []
|
||||
cnt = 0
|
||||
for (count, surname) in surname_sort:
|
||||
for cnt, (count, surname) in enumerate(surname_sort):
|
||||
cloud_names.append( (count, surname) )
|
||||
cloud_values.append( count )
|
||||
cnt += 1
|
||||
cloud_names.sort(lambda a,b: cmp(a[1], b[1]))
|
||||
|
||||
cloud_names.sort(key=lambda k:k[1])
|
||||
counts = list(set(cloud_values))
|
||||
counts.sort()
|
||||
counts.reverse()
|
||||
counts.sort(reverse=True)
|
||||
line = 0
|
||||
### All done!
|
||||
# Now, find out how many we can display without going over top_size:
|
||||
|
@ -27,6 +27,14 @@ from DataViews import register, Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import Config
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramplet class
|
||||
@ -54,11 +62,11 @@ class TopSurnamesGramplet(Gramplet):
|
||||
|
||||
def main(self):
|
||||
self.set_text(_("Processing...") + "\n")
|
||||
people = self.dbstate.db.get_person_handles(sort_handles=False)
|
||||
people = self.dbstate.db.iter_person_handles()
|
||||
surnames = {}
|
||||
representative_handle = {}
|
||||
cnt = 0
|
||||
for person_handle in people:
|
||||
|
||||
for cnt, person_handle in enumerate(people):
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||
@ -66,32 +74,28 @@ class TopSurnamesGramplet(Gramplet):
|
||||
for surname in allnames:
|
||||
surnames[surname] = surnames.get(surname, 0) + 1
|
||||
representative_handle[surname] = person_handle
|
||||
if cnt % 350 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_people = cnt
|
||||
surname_sort = []
|
||||
total = 0
|
||||
cnt = 0
|
||||
for surname in surnames:
|
||||
|
||||
for cnt, surname in enumerate(surnames):
|
||||
surname_sort.append( (surnames[surname], surname) )
|
||||
total += surnames[surname]
|
||||
if cnt % 350 == 0:
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
yield True
|
||||
cnt += 1
|
||||
|
||||
total_surnames = cnt
|
||||
surname_sort.sort(lambda a,b: -cmp(a,b))
|
||||
surname_sort.sort(reverse=True)
|
||||
line = 0
|
||||
### All done!
|
||||
self.set_text("")
|
||||
nosurname = Config.get(Config.NO_SURNAME_TEXT)
|
||||
for (count, surname) in surname_sort:
|
||||
if len(surname) == 0:
|
||||
text = "%s, %d%% (%d)\n" % (Config.get(Config.NO_SURNAME_TEXT),
|
||||
int((float(count)/total) * 100),
|
||||
count)
|
||||
else:
|
||||
text = "%s, %d%% (%d)\n" % (surname, int((float(count)/total) * 100),
|
||||
count)
|
||||
text = "%s, " % (surname if surname else nosurname)
|
||||
text += "%d%% (%d)\n" % (int((float(count)/total) * 100), count)
|
||||
self.append_text(" %d. " % (line + 1))
|
||||
self.link(text, 'Surname', representative_handle[surname])
|
||||
line += 1
|
||||
|
@ -153,7 +153,7 @@ class RelGraphReport(Report):
|
||||
|
||||
def write_report(self):
|
||||
self.person_handles = self._filter.apply(self.database,
|
||||
self.database.get_person_handles(sort_handles=False))
|
||||
self.database.iter_person_handles())
|
||||
|
||||
if len(self.person_handles) > 1:
|
||||
self.add_persons_and_families()
|
||||
@ -164,9 +164,9 @@ class RelGraphReport(Report):
|
||||
children"
|
||||
person_dict = {}
|
||||
# Hash people in a dictionary for faster inclusion checking
|
||||
|
||||
for person_handle in self.person_handles:
|
||||
person_dict[person_handle] = 1
|
||||
for person_handle in self.person_handles:
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
p_id = person.get_gramps_id()
|
||||
for fam_handle in person.get_parent_family_handle_list():
|
||||
|
@ -34,7 +34,7 @@ def run(database, document, attribute, value=None):
|
||||
sdoc.paragraph("")
|
||||
stab.columns(_("Person"), str(attribute))
|
||||
matches = 0
|
||||
for person_handle in database.get_person_handles(sort_handles=False):
|
||||
for person_handle in database.iter_person_handles():
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
matched = False
|
||||
for attr in person.attribute_list:
|
||||
|
@ -60,7 +60,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches = 0
|
||||
if (filter_name == 'all people'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
stab.row(person, sdb.birth_date_obj(person),
|
||||
@ -68,7 +68,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'males'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person.gender == Person.MALE:
|
||||
@ -77,7 +77,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'females'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person.gender == Person.FEMALE:
|
||||
@ -86,7 +86,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'people with unknown gender'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person.gender not in [Person.FEMALE, Person.MALE]:
|
||||
@ -95,7 +95,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'people with incomplete names'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
for name in [person.get_primary_name()] + person.get_alternate_names():
|
||||
@ -105,7 +105,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'people with missing birth dates'):
|
||||
stab.columns(_("Person"), _("Type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
@ -120,7 +120,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'disconnected people'):
|
||||
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
@ -139,7 +139,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'unique surnames'):
|
||||
namelist = {}
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
@ -158,7 +158,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
name))
|
||||
elif (filter_name == 'people with media'):
|
||||
stab.columns(_("Person"), _("Media count"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if not person:
|
||||
@ -169,7 +169,7 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
matches += 1
|
||||
elif (filter_name == 'media references'):
|
||||
stab.columns(_("Person"), _("Reference"))
|
||||
people = database.get_person_handles(sort_handles=False)
|
||||
people = database.iter_person_handles()
|
||||
for person_handle in people:
|
||||
person = database.get_person_from_handle(person_handle)
|
||||
if not person:
|
||||
|
@ -115,13 +115,13 @@ def run(database, document, person):
|
||||
rule = IncompleteSurname([])
|
||||
filter.add_rule(rule)
|
||||
people = filter.apply(database,
|
||||
database.get_person_handles(sort_handles=False))
|
||||
matches = 0
|
||||
for person_handle in people:
|
||||
database.iter_person_handles())
|
||||
|
||||
for matches, person_handle in enumerate(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
|
||||
|
||||
sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
|
||||
,
|
||||
"There are %d people with a matching name, or alternate name.\n"
|
||||
@ -154,13 +154,12 @@ def run_given(database, document, person):
|
||||
rule = IncompleteGiven([])
|
||||
filter.add_rule(rule)
|
||||
people = filter.apply(database,
|
||||
database.get_person_handles(sort_handles=False))
|
||||
matches = 0
|
||||
for person_handle in people:
|
||||
database.iter_person_handles())
|
||||
for matches, person_handle in enumerate(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
|
||||
|
||||
sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
|
||||
,
|
||||
"There are %d people with a matching name, or alternate name.\n"
|
||||
|
@ -193,8 +193,9 @@ class CalendarReport(Report):
|
||||
This method runs through the data, and collects the relevant dates
|
||||
and text.
|
||||
"""
|
||||
people = self.database.get_person_handles(sort_handles=False)
|
||||
self.progress.set_pass(_('Applying Filter...'), len(people))
|
||||
people = self.database.iter_person_handles()
|
||||
self.progress.set_pass(_('Applying Filter...'),
|
||||
self.database.get_number_of_people())
|
||||
people = self.filter.apply(self.database, people, self.progress)
|
||||
pmgr = PluginManager.get_instance()
|
||||
rel_calc = pmgr.get_relationship_calculator()
|
||||
|
@ -379,18 +379,16 @@ class IndivCompleteReport(Report):
|
||||
self.doc.end_cell()
|
||||
|
||||
def write_report(self):
|
||||
plist = self.database.get_person_handles(sort_handles=False)
|
||||
plist = self.database.iter_person_handles()
|
||||
if self.filter:
|
||||
ind_list = self.filter.apply(self.database,plist)
|
||||
else:
|
||||
ind_list = plist
|
||||
|
||||
count = 0
|
||||
for person_handle in ind_list:
|
||||
for count, person_handle in enumerate(ind_list):
|
||||
self.person = self.database.get_person_from_handle(
|
||||
person_handle)
|
||||
self.write_person(count)
|
||||
count = count + 1
|
||||
|
||||
def write_person(self,count):
|
||||
if count != 0:
|
||||
|
@ -91,7 +91,7 @@ class MarkerReport(Report):
|
||||
self.write_notes()
|
||||
|
||||
def write_people(self):
|
||||
plist = self.database.get_person_handles(sort_handles=False)
|
||||
plist = self.database.iter_person_handles()
|
||||
FilterClass = GenericFilterFactory('Person')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(Rules.Person.HasMarkerOf([self.marker]))
|
||||
|
@ -99,11 +99,12 @@ class SummaryReport(Report):
|
||||
self.doc.write_text(_("Individuals"))
|
||||
self.doc.end_paragraph()
|
||||
|
||||
person_list = self.__db.get_person_handles(sort_handles=False)
|
||||
for person_handle in person_list:
|
||||
person_list = self.__db.iter_person_handles()
|
||||
for num_people, person_handle in enumerate(person_list):
|
||||
person = self.__db.get_person_from_handle(person_handle)
|
||||
if not person:
|
||||
continue
|
||||
num_people += 1
|
||||
|
||||
# Count people with media.
|
||||
length = len(person.get_media_list())
|
||||
@ -142,7 +143,7 @@ class SummaryReport(Report):
|
||||
namelist.append(name.get_surname())
|
||||
|
||||
self.doc.start_paragraph("SR-Normal")
|
||||
self.doc.write_text(_("Number of individuals: %d") % len(person_list))
|
||||
self.doc.write_text(_("Number of individuals: %d") % num_people)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_paragraph("SR-Normal")
|
||||
|
@ -160,7 +160,8 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
||||
self.filter_option = self.options.menu.get_option_by_name('filter')
|
||||
self.filter = self.filter_option.get_filter() # the actual filter
|
||||
people = self.filter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False))
|
||||
self.db.iter_person_handles())
|
||||
num_people = self.db.get_number_of_people()
|
||||
source_text = self.options.handler.options_dict['source_text']
|
||||
add_birth = self.options.handler.options_dict['add_birth']
|
||||
add_death = self.options.handler.options_dict['add_death']
|
||||
@ -174,7 +175,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
||||
if remove_old:
|
||||
self.results_write(_("Replacing...\n"))
|
||||
self.progress.set_pass((_("Removing '%s'...") % source_text),
|
||||
len(people))
|
||||
num_people)
|
||||
for person_handle in people:
|
||||
self.progress.step()
|
||||
pupdate = 0
|
||||
@ -216,7 +217,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
||||
if add_birth or add_death:
|
||||
self.results_write(_("Calculating...\n"))
|
||||
self.progress.set_pass(_('Calculating estimated dates...'),
|
||||
len(people))
|
||||
num_people)
|
||||
source = self.get_or_create_source(source_text)
|
||||
for person_handle in people:
|
||||
self.progress.step()
|
||||
|
@ -107,7 +107,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
s1 = 0
|
||||
if namesplitSP[0].lower() in prefix_list:
|
||||
s1 = 1
|
||||
for x in range(len(namesplitSP)-s1):
|
||||
for x in xrange(len(namesplitSP)-s1):
|
||||
# check if any subsurname is not cap
|
||||
notcap = False
|
||||
if namesplitSP[s1+x] != namesplitSP[s1+x].capitalize():
|
||||
@ -121,7 +121,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
# check if first string is in prefix_list, if so test for cap
|
||||
if namesplitSP[0].lower() in prefix_list:
|
||||
namesplitHY[0] = namesplitHY[0].replace(namesplitSP[0],'').strip()
|
||||
for x in range(len(namesplitHY)):
|
||||
for x in xrange(len(namesplitHY)):
|
||||
# check if any subsurname is not cap
|
||||
notcap = False
|
||||
if namesplitHY[x] != namesplitHY[x].capitalize():
|
||||
@ -234,7 +234,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
for node in self.iter_list
|
||||
if self.model.get_value(node,0)]
|
||||
|
||||
for handle in self.db.get_person_handles():
|
||||
for handle in self.db.iter_person_handles():
|
||||
change = False
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
for name in [person.get_primary_name()] + person.get_alternate_names():
|
||||
|
@ -176,7 +176,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
progress_bar.set_pass(_('Selecting people'),1)
|
||||
|
||||
plist = cfilter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False))
|
||||
self.db.iter_person_handles())
|
||||
|
||||
progress_bar.step()
|
||||
progress_bar.close()
|
||||
|
@ -83,7 +83,7 @@ class EventNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
self.change = False
|
||||
counter = 0
|
||||
|
||||
for handle in self.db.get_person_handles():
|
||||
for handle in self.db.iter_person_handles():
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
for event_ref in person.get_event_ref_list():
|
||||
if event_ref.get_role() == gen.lib.EventRoleType.PRIMARY:
|
||||
|
@ -187,13 +187,12 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
males = {}
|
||||
females = {}
|
||||
|
||||
self.person_list = self.db.get_person_handles(sort_handles=False)
|
||||
length = len(self.person_list)
|
||||
length = self.db.get_number_of_people()
|
||||
|
||||
self.progress.set_pass(_('Pass 1: Building preliminary lists'),
|
||||
length)
|
||||
|
||||
for p1_id in self.person_list:
|
||||
for p1_id in self.db.iter_person_handles():
|
||||
self.progress.step()
|
||||
p1 = self.db.get_person_from_handle(p1_id)
|
||||
key = self.gen_key(p1.get_primary_name().get_surname())
|
||||
@ -211,7 +210,7 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
self.progress.set_pass(_('Pass 2: Calculating potential matches'),
|
||||
length)
|
||||
|
||||
for p1key in self.person_list:
|
||||
for p1key in self.db.iter_person_handles():
|
||||
self.progress.step()
|
||||
p1 = self.db.get_person_from_handle(p1key)
|
||||
|
||||
@ -221,9 +220,9 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
else:
|
||||
remaining = females[key]
|
||||
|
||||
index = 0
|
||||
#index = 0
|
||||
for p2key in remaining:
|
||||
index += 1
|
||||
#index += 1
|
||||
if p1key == p2key:
|
||||
continue
|
||||
p2 = self.db.get_person_from_handle(p2key)
|
||||
|
@ -333,7 +333,7 @@ class NotRelated(Tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
|
||||
self.numberOfUnrelatedPeople, self.numberOfPeopleInDatabase)
|
||||
|
||||
# loop through everyone in the database
|
||||
for handle in self.db.get_person_handles(False):
|
||||
for handle in self.db.iter_person_handles():
|
||||
|
||||
self.progress.step()
|
||||
|
||||
|
@ -122,7 +122,7 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
self.progress.set_pass(_('Analyzing names'),
|
||||
self.db.get_number_of_people())
|
||||
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
for key in self.db.iter_person_handles():
|
||||
|
||||
person = self.db.get_person_from_handle(key)
|
||||
name = person.get_primary_name()
|
||||
|
@ -110,9 +110,9 @@ class SortEvents(PluginWindows.ToolManagedWindowBatch):
|
||||
Sort the personal events associated with the selected people.
|
||||
"""
|
||||
people_handles = self.filter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False))
|
||||
self.db.iter_person_handles())
|
||||
self.progress.set_pass(_("Sorting personal events..."),
|
||||
len(people_handles))
|
||||
self.db.get_number_of_people())
|
||||
family_handles = []
|
||||
for handle in people_handles:
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
|
@ -76,7 +76,7 @@ class SoundGen(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
|
||||
names = []
|
||||
person = None
|
||||
for person_handle in self.db.get_person_handles(sort_handles=False):
|
||||
for person_handle in self.db.iter_person_handles():
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
lastname = person.get_primary_name().get_surname()
|
||||
if lastname not in names:
|
||||
|
@ -316,7 +316,7 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
|
||||
|
||||
def run_tool(self,cli=False):
|
||||
|
||||
person_handles = self.db.get_person_handles(sort_handles=False)
|
||||
person_handles = self.db.iter_person_handles()
|
||||
|
||||
for option, value in \
|
||||
self.options.handler.options_dict.iteritems():
|
||||
|
@ -1736,7 +1736,7 @@ class MediaPage(BasePage):
|
||||
# TODO. Mixup url and path
|
||||
# path = convert_disk_path_to_url(path)
|
||||
url = self.report.build_url_fname(path, None, self.up)
|
||||
hyper += Html('img', src=url, alt=html_escape(self.page_title)
|
||||
hyper += Html('img', src=url, alt=html_escape(self.page_title))
|
||||
if target_exists:
|
||||
mediadisplay += hyper
|
||||
else:
|
||||
@ -4186,8 +4186,9 @@ class NavWebReport(Report):
|
||||
"""
|
||||
|
||||
# gets the person list and applies the requested filter
|
||||
ind_list = self.database.get_person_handles(sort_handles=False)
|
||||
self.progress.set_pass(_('Applying Filter...'), len(ind_list))
|
||||
|
||||
ind_list = self.database.iter_person_handles()
|
||||
self.progress.set_pass(_('Applying Filter...'), self.database.get_number_of_people())
|
||||
ind_list = self.filter.apply(self.database, ind_list, self.progress)
|
||||
|
||||
return ind_list
|
||||
|
@ -1078,8 +1078,8 @@ class WebCalReport(Report):
|
||||
This method runs through the data, and collects the relevant dates
|
||||
and text.
|
||||
"""
|
||||
people = self.database.get_person_handles(sort_handles=False)
|
||||
self.progress.set_pass(_('Applying Filter...'), len(people))
|
||||
people = self.database.iter_person_handles()
|
||||
self.progress.set_pass(_('Applying Filter...'), self.database.get_number_of_people())
|
||||
people = self.filter.apply(self.database, people, self.progress)
|
||||
|
||||
self.progress.set_pass(_("Reading database..."), len(people))
|
||||
|
Loading…
x
Reference in New Issue
Block a user