0001238: Web report: sort references for places and media (use locale.strcoll for sorting)
svn: r9162
This commit is contained in:
parent
4c2e57cb2e
commit
563298e7c8
@ -1,3 +1,8 @@
|
|||||||
|
2007-10-12 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/plugins/NarrativeWeb.py:
|
||||||
|
* src/Sort.py: (use locale.strcoll for sorting)
|
||||||
|
0001238: Web report: sort references for places and media
|
||||||
|
|
||||||
2007-10-12 Don Allingham <don@gramps-project.org>
|
2007-10-12 Don Allingham <don@gramps-project.org>
|
||||||
* src/gen/lib/note.py (Note.get): fix typo
|
* src/gen/lib/note.py (Note.get): fix typo
|
||||||
|
|
||||||
|
11
src/Sort.py
11
src/Sort.py
@ -128,4 +128,13 @@ class Sort:
|
|||||||
return 0
|
return 0
|
||||||
a_obj = self.database.get_place_from_handle(a_id)
|
a_obj = self.database.get_place_from_handle(a_id)
|
||||||
b_obj = self.database.get_place_from_handle(b_id)
|
b_obj = self.database.get_place_from_handle(b_id)
|
||||||
return cmp(a_obj.title, b_obj.title)
|
return locale.strcoll(a_obj.title, b_obj.title)
|
||||||
|
|
||||||
|
def by_media_title(self,a_id,b_id):
|
||||||
|
"""Sort routine for comparing two media objects by their title. """
|
||||||
|
if not (a_id and b_id):
|
||||||
|
return False
|
||||||
|
a = self.database.get_object_from_handle(a_id)
|
||||||
|
b = self.database.get_object_from_handle(b_id)
|
||||||
|
return locale.strcoll(a.desc,b.desc)
|
||||||
|
|
||||||
|
@ -1529,7 +1529,8 @@ class GalleryPage(BasePage):
|
|||||||
|
|
||||||
index = 1
|
index = 1
|
||||||
mlist = media_list.keys()
|
mlist = media_list.keys()
|
||||||
mlist.sort(self.by_media_title)
|
sort = Sort.Sort(self.db)
|
||||||
|
mlist.sort(sort.by_media_title)
|
||||||
for handle in mlist:
|
for handle in mlist:
|
||||||
media = db.get_object_from_handle(handle)
|
media = db.get_object_from_handle(handle)
|
||||||
date = _dd.display(media.get_date_object())
|
date = _dd.display(media.get_date_object())
|
||||||
@ -1554,15 +1555,6 @@ class GalleryPage(BasePage):
|
|||||||
self.display_footer(of,db)
|
self.display_footer(of,db)
|
||||||
self.close_file(of)
|
self.close_file(of)
|
||||||
|
|
||||||
def by_media_title(self,a_id,b_id):
|
|
||||||
"""Sort routine for comparing two events by their dates. """
|
|
||||||
if not (a_id and b_id):
|
|
||||||
return False
|
|
||||||
a = self.db.get_object_from_handle(a_id)
|
|
||||||
b = self.db.get_object_from_handle(b_id)
|
|
||||||
return cmp(a.desc,b.desc)
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -2589,7 +2581,8 @@ class WebReport(Report):
|
|||||||
total = len(self.photo_list)
|
total = len(self.photo_list)
|
||||||
index = 1
|
index = 1
|
||||||
photo_keys = self.photo_list.keys()
|
photo_keys = self.photo_list.keys()
|
||||||
photo_keys.sort(self.by_media_title)
|
sort = Sort.Sort(self.database)
|
||||||
|
photo_keys.sort(sort.by_media_title)
|
||||||
|
|
||||||
for photo_handle in photo_keys:
|
for photo_handle in photo_keys:
|
||||||
gc.collect() # Reduce memory usage when there are many images.
|
gc.collect() # Reduce memory usage when there are many images.
|
||||||
@ -2604,14 +2597,6 @@ class WebReport(Report):
|
|||||||
prev = photo_handle
|
prev = photo_handle
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
def by_media_title(self,a_id,b_id):
|
|
||||||
"""Sort routine for comparing two events by their dates. """
|
|
||||||
if not (a_id and b_id):
|
|
||||||
return False
|
|
||||||
a = self.database.get_object_from_handle(a_id)
|
|
||||||
b = self.database.get_object_from_handle(b_id)
|
|
||||||
return cmp(a.desc,b.desc)
|
|
||||||
|
|
||||||
def base_pages(self, photo_list, archive):
|
def base_pages(self, photo_list, archive):
|
||||||
|
|
||||||
if self.use_home:
|
if self.use_home:
|
||||||
|
Loading…
Reference in New Issue
Block a user