GEPS008: Moved Sort module

svn: r19801
This commit is contained in:
Nick Hall 2012-06-08 20:58:40 +00:00
parent a2af7d66b3
commit d13b4e585d
10 changed files with 22 additions and 23 deletions

View File

@ -6,7 +6,6 @@
#src
src/AutoComp.py
src/ImgManip.py
src/Sort.py
src/TreeTips.py
# cli
@ -17,6 +16,7 @@ src/cli/user.py
src/gen/errors.py
src/gen/__init__.py
src/gen/recentfiles.py
src/gen/sort.py
src/gen/soundex.py
src/gen/updatecallback.py
src/gen/user.py

View File

@ -21,7 +21,6 @@ gdir_PYTHON = \
ImgManip.py\
LdsUtils.py \
MacTransUtils.py\
Sort.py\
Spell.py\
ToolTips.py\
TransUtils.py\

View File

@ -27,6 +27,7 @@ pkgpython_PYTHON = \
ggettext.py \
recentfiles.py \
relationship.py \
sort.py \
soundex.py \
updatecallback.py \
user.py

View File

@ -45,7 +45,7 @@ from gen.plug.report import MenuReportOptions
pt2cm = ReportUtils.pt2cm
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SANS_SERIF, DASHED, PARA_ALIGN_CENTER)
import Sort
from gen.sort import Sort
from gen.display.name import displayer as name_displayer
import config
from gen.utils import get_birth_or_fallback, get_death_or_fallback
@ -99,7 +99,7 @@ class TimeLine(Report):
self.filter = menu.get_option_by_name('filter').get_filter()
sort_func_num = menu.get_option_by_name('sortby').get_value()
sort_functions = _get_sort_functions(Sort.Sort(database))
sort_functions = _get_sort_functions(Sort(database))
self.sort_name = sort_functions[sort_func_num][0]
self.sort_func = sort_functions[sort_func_num][1]
self.calendar = config.get('preferences.calendar-format-report')
@ -381,7 +381,7 @@ class TimeLineOptions(MenuReportOptions):
sortby = EnumeratedListOption(_('Sort by'), 0 )
idx = 0
for item in _get_sort_functions(Sort.Sort(self.__db)):
for item in _get_sort_functions(Sort(self.__db)):
sortby.add_item(idx,item[0])
idx += 1
sortby.set_help( _("Sorting method to use"))

View File

@ -52,7 +52,7 @@ from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import gen.datehandler
import Sort
from gen.sort import Sort
from gen.utils import (get_birth_or_fallback, get_death_or_fallback,
get_marriage_or_fallback, get_divorce_or_fallback)
@ -333,7 +333,7 @@ class DescendantReport(Report):
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
sort = Sort.Sort(self.database)
sort = Sort(self.database)
self.by_birthdate = sort.by_birthdate
#Initialize the Printinfo class

View File

@ -45,7 +45,7 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.proxy import PrivateProxyDb
import gen.datehandler
import Sort
from gen.sort import Sort
from gen.display.name import displayer as _nd
class PlaceReport(Report):
@ -87,7 +87,7 @@ class PlaceReport(Report):
filter_option = menu.get_option_by_name('filter')
self.filter = filter_option.get_filter()
self.sort = Sort.Sort(self.database)
self.sort = Sort(self.database)
if self.filter.get_name() != '':
# Use the selected filter to provide a list of place handles

View File

@ -46,7 +46,7 @@ import gtk
#------------------------------------------------------------------------
from gen.filters import GenericFilter, rules
from gui.filters import build_filter_model
import Sort
from gen.sort import Sort
import Utils
from gui.utils import ProgressMeter
from docgen import ODSTab
@ -243,7 +243,7 @@ class DisplayChart(ManagedWindow):
_('Event Comparison Results'))
self.eventlist = self.topDialog.get_object('treeview')
self.sort = Sort.Sort(self.db)
self.sort = Sort(self.db)
self.my_list.sort(self.sort.by_last_name)
self.event_titles = self.make_event_titles()

View File

@ -35,8 +35,7 @@ from gen.ggettext import gettext as _
# gramps modules
#
#-------------------------------------------------------------------------
import Sort
from gen.sort import Sort
from gen.db import DbTxn
from gui.plug import MenuToolOptions, PluginWindows
from gen.plug.report import utils as ReportUtils
@ -92,10 +91,10 @@ class SortEvents(PluginWindows.ToolManagedWindowBatch):
sort_func_num = menu.get_option_by_name('sort_by').get_value()
self.sort_desc = menu.get_option_by_name('sort_desc').get_value()
self.fam_events = menu.get_option_by_name('family_events').get_value()
sort_functions = _get_sort_functions(Sort.Sort(self.db))
sort_functions = _get_sort_functions(Sort(self.db))
self.sort_name = sort_functions[sort_func_num][0]
self.sort_func = sort_functions[sort_func_num][1]
self.sort = Sort.Sort(self.db)
self.sort = Sort(self.db)
with DbTxn(_("Sort event changes"), self.db, batch=True) as trans:
self.db.disable_signals()
family_handles = self.sort_person_events(trans)
@ -179,7 +178,7 @@ class SortEventOptions(MenuToolOptions):
sort_by = EnumeratedListOption(_('Sort by'), 0 )
idx = 0
for item in _get_sort_functions(Sort.Sort(self.__db)):
for item in _get_sort_functions(Sort(self.__db)):
sort_by.add_item(idx, item[0])
idx += 1
sort_by.set_help( _("Sorting method to use"))

View File

@ -80,7 +80,7 @@ from gen.ggettext import sgettext as _
import gen.lib
from gen.lib import UrlType, date, NoteType, EventRoleType
import const
import Sort
from gen.sort import Sort
from gen.plug.menu import PersonOption, NumberOption, StringOption, \
BooleanOption, EnumeratedListOption, FilterOption, \
NoteOption, MediaOption, DestinationOption
@ -3374,7 +3374,7 @@ class PlaceListPage(BasePage):
[_("Longitude"), "ColumnLongitude"] ]
)
sort = Sort.Sort(self.dbase_)
sort = Sort(self.dbase_)
handle_list = sorted(place_handles, key = sort.by_place_title_key)
last_letter = ''
@ -4701,7 +4701,7 @@ class SourcePage(BasePage):
# Citation Referents has Media Objects...
if (self.create_media and media_list):
sort = Sort.Sort(self.dbase_)
sort = Sort(self.dbase_)
media_list = sorted(media_list, key = sort.by_media_title_key)
list2 = Html("li")
@ -4894,7 +4894,7 @@ class MediaListPage(BasePage):
table += tbody
index = 1
sort = Sort.Sort(self.dbase_)
sort = Sort(self.dbase_)
mlist = sorted(self.report.photo_list, key = sort.by_media_title_key)
for media_handle in mlist:
@ -4946,7 +4946,7 @@ class ThumbnailPreviewPage(BasePage):
BasePage.__init__(self, report, title)
self.create_thumbs_only = report.options['create_thumbs_only']
sort = Sort.Sort(self.dbase_)
sort = Sort(self.dbase_)
self.photo_keys = sorted(self.report.photo_list, key =sort.by_media_title_key)
if not self.photo_keys:
return
@ -7330,7 +7330,7 @@ class NavWebReport(Report):
prev = None
total = len(self.photo_list)
sort = Sort.Sort(self.database)
sort = Sort(self.database)
photo_keys = sorted(self.photo_list, key =sort.by_media_title_key)
index = 1
@ -8218,7 +8218,7 @@ class NavWebOptions(MenuReportOptions):
else:
self.__googleopts.set_available(False)
# FIXME. Why do we need our own sorting? Why not use Sort.Sort?
# FIXME. Why do we need our own sorting? Why not use Sort?
def sort_people(dbase, handle_list):
"""
will sort the database people by surname