Replace get_place_handles with iter_place_handles
svn: r12778
This commit is contained in:
parent
b601f4bdf2
commit
181c0c9b41
@ -1515,7 +1515,7 @@ class GeoView(HtmlView):
|
|||||||
latitude = ""
|
latitude = ""
|
||||||
longitude = ""
|
longitude = ""
|
||||||
self.center = True
|
self.center = True
|
||||||
for place_handle in dbstate.db.get_place_handles():
|
for place_handle in dbstate.iter.get_place_handles():
|
||||||
place = dbstate.db.get_place_from_handle( place_handle)
|
place = dbstate.db.get_place_from_handle( place_handle)
|
||||||
if place:
|
if place:
|
||||||
descr = place.get_title()
|
descr = place.get_title()
|
||||||
|
@ -244,7 +244,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
|
|||||||
elif self.namespace == 'Source':
|
elif self.namespace == 'Source':
|
||||||
return self.db.get_source_handles()
|
return self.db.get_source_handles()
|
||||||
elif self.namespace == 'Place':
|
elif self.namespace == 'Place':
|
||||||
return self.db.get_place_handles()
|
return self.db.iter_place_handles()
|
||||||
elif self.namespace == 'MediaObject':
|
elif self.namespace == 'MediaObject':
|
||||||
return self.db.get_media_object_handles()
|
return self.db.get_media_object_handles()
|
||||||
elif self.namespace == 'Repository':
|
elif self.namespace == 'Repository':
|
||||||
|
@ -197,7 +197,7 @@ class MergeSources(ManagedWindow.ManagedWindow):
|
|||||||
self.db.commit_source(source,trans)
|
self.db.commit_source(source,trans)
|
||||||
|
|
||||||
# places
|
# places
|
||||||
for handle in self.db.get_place_handles():
|
for handle in self.iter.get_place_handles():
|
||||||
place = self.db.get_place_from_handle(handle)
|
place = self.db.get_place_from_handle(handle)
|
||||||
if place.has_source_reference(self.old_handle):
|
if place.has_source_reference(self.old_handle):
|
||||||
place.replace_source_references(self.old_handle,
|
place.replace_source_references(self.old_handle,
|
||||||
|
@ -297,6 +297,13 @@ class FilterProxyDb(ProxyDbBase):
|
|||||||
"""
|
"""
|
||||||
return self.db.get_place_handles(sort_handles)
|
return self.db.get_place_handles(sort_handles)
|
||||||
|
|
||||||
|
def iter_place_handles(self):
|
||||||
|
"""
|
||||||
|
Return an iterator database handles, one handle for each Place in
|
||||||
|
the database.
|
||||||
|
"""
|
||||||
|
return self.db.iter_place_handles(sort_handles)
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
def get_source_handles(self, sort_handles=True):
|
||||||
"""
|
"""
|
||||||
Return a list of database handles, one handle for each Source in
|
Return a list of database handles, one handle for each Source in
|
||||||
|
@ -235,10 +235,11 @@ class LivingProxyDb(ProxyDbBase):
|
|||||||
if self.mode == self.MODE_EXCLUDE_ALL:
|
if self.mode == self.MODE_EXCLUDE_ALL:
|
||||||
for handle in self.db.iter_person_handles():
|
for handle in self.db.iter_person_handles():
|
||||||
person = self.db.get_person_from_handle(handle)
|
person = self.db.get_person_from_handle(handle)
|
||||||
if not self.__is_living(person):
|
if self.mode == self.MODE_EXCLUDE_ALL:
|
||||||
|
if not self.__is_living(person):
|
||||||
|
yield handle
|
||||||
|
else:
|
||||||
yield handle
|
yield handle
|
||||||
else:
|
|
||||||
return self.db.iter_person_handles()
|
|
||||||
|
|
||||||
def get_place_handles(self, sort_handles=True):
|
def get_place_handles(self, sort_handles=True):
|
||||||
"""
|
"""
|
||||||
@ -248,6 +249,13 @@ class LivingProxyDb(ProxyDbBase):
|
|||||||
"""
|
"""
|
||||||
return self.db.get_place_handles(sort_handles)
|
return self.db.get_place_handles(sort_handles)
|
||||||
|
|
||||||
|
def iter_place_handles(self):
|
||||||
|
"""
|
||||||
|
Return an iterator over database handles, one handle for each Place in
|
||||||
|
the database.
|
||||||
|
"""
|
||||||
|
return self.db.get_place_handles(sort_handles)
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
def get_source_handles(self, sort_handles=True):
|
||||||
"""
|
"""
|
||||||
Return a list of database handles, one handle for each Source in
|
Return a list of database handles, one handle for each Source in
|
||||||
|
@ -241,6 +241,16 @@ class PrivateProxyDb(ProxyDbBase):
|
|||||||
handles.append(handle)
|
handles.append(handle)
|
||||||
return handles
|
return handles
|
||||||
|
|
||||||
|
def iter_place_handles(self):
|
||||||
|
"""
|
||||||
|
Return an iterator over database handles, one handle for each Place in
|
||||||
|
the database.
|
||||||
|
"""
|
||||||
|
for handle in self.db.get_place_handles(sort_handles):
|
||||||
|
place = self.db.get_place_from_handle(handle)
|
||||||
|
if not place.get_privacy():
|
||||||
|
yield handle
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
def get_source_handles(self, sort_handles=True):
|
||||||
"""
|
"""
|
||||||
Return a list of database handles, one handle for each Source in
|
Return a list of database handles, one handle for each Source in
|
||||||
|
@ -188,6 +188,15 @@ class ReferencedProxyDb(ProxyDbBase):
|
|||||||
return list(set(self.db.get_place_handles(sort_handles)) -
|
return list(set(self.db.get_place_handles(sort_handles)) -
|
||||||
set(self.unreferenced_places))
|
set(self.unreferenced_places))
|
||||||
|
|
||||||
|
def iter_place_handles(self):
|
||||||
|
"""
|
||||||
|
Return an iterator over database handles, one handle for each Place still
|
||||||
|
referenced in the database.
|
||||||
|
"""
|
||||||
|
for handle in self.db.iter_place_handles():
|
||||||
|
if handle not in self.unreferenced_places:
|
||||||
|
yield handle
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
def get_source_handles(self, sort_handles=True):
|
||||||
"""
|
"""
|
||||||
Return a list of database handles, one handle for each Source still
|
Return a list of database handles, one handle for each Source still
|
||||||
|
@ -282,7 +282,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
|
|
||||||
def get_or_create_place(self, place_name):
|
def get_or_create_place(self, place_name):
|
||||||
if place_name == "": return (-1, None)
|
if place_name == "": return (-1, None)
|
||||||
place_list = self.dbstate.db.get_place_handles()
|
place_list = self.dbstate.iter.get_place_handles()
|
||||||
for place_handle in place_list:
|
for place_handle in place_list:
|
||||||
place = self.dbstate.db.get_place_from_handle(place_handle)
|
place = self.dbstate.db.get_place_from_handle(place_handle)
|
||||||
if place.get_title().strip() == place_name:
|
if place.get_title().strip() == place_name:
|
||||||
|
@ -808,8 +808,8 @@ class CSVParser(object):
|
|||||||
return person
|
return person
|
||||||
|
|
||||||
def get_or_create_place(self,place_name):
|
def get_or_create_place(self,place_name):
|
||||||
place_list = self.db.get_place_handles()
|
place_list = self.db.iter_place_handles()
|
||||||
if self.debug: print "get_or_create_place: list:", place_list
|
if self.debug: print "get_or_create_place: list:", list(place_list)
|
||||||
if self.debug: print "get_or_create_place: looking for:", place_name
|
if self.debug: print "get_or_create_place: looking for:", place_name
|
||||||
for place_handle in place_list:
|
for place_handle in place_list:
|
||||||
place = self.db.get_place_from_handle(place_handle)
|
place = self.db.get_place_from_handle(place_handle)
|
||||||
|
@ -75,7 +75,7 @@ class PlaceReport(Report):
|
|||||||
|
|
||||||
if self.filter.get_name() != '':
|
if self.filter.get_name() != '':
|
||||||
# Use the selected filter to provide a list of place handles
|
# Use the selected filter to provide a list of place handles
|
||||||
plist = self.database.get_place_handles(sort_handles=False)
|
plist = self.database.iter_place_handles()
|
||||||
self.place_handles = self.filter.apply(self.database, plist)
|
self.place_handles = self.filter.apply(self.database, plist)
|
||||||
else:
|
else:
|
||||||
# Use the place handles selected without a filter
|
# Use the place handles selected without a filter
|
||||||
|
@ -430,11 +430,11 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
self.progress = ProgressMeter(_('Checking Place Titles'), '')
|
self.progress = ProgressMeter(_('Checking Place Titles'), '')
|
||||||
self.progress.set_pass(_('Looking for place fields'),
|
self.progress.set_pass(_('Looking for place fields'),
|
||||||
len(self.db.get_place_handles()))
|
self.db.get_number_of_places())
|
||||||
|
|
||||||
self.name_list = []
|
self.name_list = []
|
||||||
|
|
||||||
for handle in db.get_place_handles():
|
for handle in db.iter_place_handles():
|
||||||
place = db.get_place_from_handle(handle)
|
place = db.get_place_from_handle(handle)
|
||||||
descr = place.get_title()
|
descr = place.get_title()
|
||||||
loc = place.get_main_location()
|
loc = place.get_main_location()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user