Change default to return handles unsorted on get_object_handles methods

svn: r17537
This commit is contained in:
Michiel Nauta 2011-05-19 20:36:17 +00:00
parent cd0f3a4a36
commit 654fb81665
12 changed files with 25 additions and 24 deletions

View File

@ -192,7 +192,7 @@ class SidebarFilter(DbGUIElement):
Called when the tag list needs to be rebuilt.
"""
self.__tag_list = []
for handle in self.dbstate.db.get_tag_handles():
for handle in self.dbstate.db.get_tag_handles(sort_handles=True):
tag = self.dbstate.db.get_tag_from_handle(handle)
self.__tag_list.append((tag.get_name(), handle))
self.on_tags_changed([item[0] for item in self.__tag_list])

View File

@ -163,7 +163,7 @@ class RepositoryTip(object):
# Get the list of sources that reference this repository
repos_handle = self._obj.get_handle()
source_list = [ src_handle for src_handle \
in self._db.get_source_handles() \
in self._db.get_source_handles(sort_handles=True) \
if self._db.get_source_from_handle(src_handle).has_repo_reference(repos_handle)]
if len(source_list) > 0:

View File

@ -249,7 +249,7 @@ class CommandLineReport(object):
if isinstance(option, PersonOption):
id_list = []
for person_handle in self.database.get_person_handles():
for person_handle in self.database.get_person_handles(True):
person = self.database.get_person_from_handle(person_handle)
id_list.append("%s\t%s" % (
person.get_gramps_id(),

View File

@ -323,7 +323,7 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_media_object_handles(self, sort_handles=True):
def get_media_object_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each MediaObject in
the database.
@ -515,7 +515,7 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_person_handles(self, sort_handles=True):
def get_person_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Person in
the database.
@ -553,7 +553,7 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_place_handles(self, sort_handles=True):
def get_place_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Place in
the database.
@ -719,7 +719,7 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_source_handles(self, sort_handles=True):
def get_source_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Source in
the database.
@ -764,7 +764,7 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_tag_handles(self, sort_handles=True):
def get_tag_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Tag in
the database.

View File

@ -856,7 +856,7 @@ class DbBsddbRead(DbReadBase, Callback):
def all_handles(self, table):
return table.keys(txn=self.txn)
def get_person_handles(self, sort_handles=True):
def get_person_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Person in
the database.
@ -870,7 +870,7 @@ class DbBsddbRead(DbReadBase, Callback):
return handle_list
return []
def get_place_handles(self, sort_handles=True):
def get_place_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Place in
the database.
@ -885,7 +885,7 @@ class DbBsddbRead(DbReadBase, Callback):
return handle_list
return []
def get_source_handles(self, sort_handles=True):
def get_source_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Source in
the database.
@ -899,7 +899,7 @@ class DbBsddbRead(DbReadBase, Callback):
return handle_list
return []
def get_media_object_handles(self, sort_handles=True):
def get_media_object_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each MediaObject in
the database.
@ -949,7 +949,7 @@ class DbBsddbRead(DbReadBase, Callback):
return self.all_handles(self.note_map)
return []
def get_tag_handles(self, sort_handles=True):
def get_tag_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Tag in
the database.

View File

@ -302,7 +302,7 @@ class FilterProxyDb(ProxyDbBase):
if note:
return self.get_note_from_handle(note.get_handle())
def get_person_handles(self, sort_handles=True):
def get_person_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Person in
the database. If sort_handles is True, the list is sorted by surnames

View File

@ -102,7 +102,7 @@ class ProxyDbBase(DbReadBase):
include_tag = \
None
def get_person_handles(self, sort_handles=True):
def get_person_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Person in
the database.
@ -132,7 +132,7 @@ class ProxyDbBase(DbReadBase):
else:
return []
def get_source_handles(self, sort_handles=True):
def get_source_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Source in
the database.
@ -142,7 +142,7 @@ class ProxyDbBase(DbReadBase):
else:
return []
def get_place_handles(self, sort_handles=True):
def get_place_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Place in
the database.
@ -152,7 +152,7 @@ class ProxyDbBase(DbReadBase):
else:
return []
def get_media_object_handles(self, sort_handles=True):
def get_media_object_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each MediaObject in
the database.
@ -182,7 +182,7 @@ class ProxyDbBase(DbReadBase):
else:
return []
def get_tag_handles(self, sort_handles=True):
def get_tag_handles(self, sort_handles=False):
"""
Return a list of database handles, one handle for each Tag in
the database.

View File

@ -1122,6 +1122,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
filter_set.add(gfilter)
def get_all_handles(self):
# Why use iter for some and get for others?
if self.namespace == 'Person':
return self.db.iter_person_handles()
elif self.namespace == 'Family':

View File

@ -179,7 +179,7 @@ class Tags(DbGUIElement):
Called when the tag list needs to be rebuilt.
"""
self.__tag_list = []
for handle in self.db.get_tag_handles():
for handle in self.db.get_tag_handles(sort_handles=True):
tag = self.db.get_tag_from_handle(handle)
self.__tag_list.append((tag.get_name(), tag.get_handle()))
self.update_tag_menu()

View File

@ -180,7 +180,7 @@ class PackageWriter(object):
# Write media files first, since the database may be modified
# during the process (i.e. when removing object)
for m_id in self.db.get_media_object_handles():
for m_id in self.db.get_media_object_handles(sort_handles=True):
mobject = self.db.get_object_from_handle(m_id)
filename = Utils.media_path_full(self.db, mobject.get_path())
archname = str(mobject.get_path())

View File

@ -94,7 +94,7 @@ class WhatNextGramplet(Gramplet):
self.opts[3].add_item('', '')
self.opts[4].add_item('', '')
self.opts[5].add_item('', '')
for tag_handle in self.dbstate.db.get_tag_handles():
for tag_handle in self.dbstate.db.get_tag_handles(sort_handles=True):
tag = self.dbstate.db.get_tag_from_handle(tag_handle)
tag_name = tag.get_name()
self.opts[3].add_item(tag_name, tag_name)

View File

@ -426,7 +426,7 @@ class TagReport(Report):
self.doc.end_table()
def write_media(self):
mlist = self.database.get_media_object_handles()
mlist = self.database.get_media_object_handles(sort_handles=True)
FilterClass = GenericFilterFactory('MediaObject')
filter = FilterClass()
filter.add_rule(Rules.MediaObject.HasTag([self.tag]))
@ -526,7 +526,7 @@ class TagOptions(MenuReportOptions):
category_name = _("Report Options")
all_tags = []
for handle in self.__db.get_tag_handles():
for handle in self.__db.get_tag_handles(sort_handles=True):
tag = self.__db.get_tag_from_handle(handle)
all_tags.append(tag.get_name())