From d13b4e585dc23fe5ab094d0ff6f7b5a230ece6cc Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 8 Jun 2012 20:58:40 +0000 Subject: [PATCH] GEPS008: Moved Sort module svn: r19801 --- po/POTFILES.skip | 2 +- src/Makefile.am | 1 - src/gen/Makefile.am | 1 + src/{Sort.py => gen/sort.py} | 0 src/plugins/drawreport/TimeLine.py | 6 +++--- src/plugins/textreport/DescendReport.py | 4 ++-- src/plugins/textreport/PlaceReport.py | 4 ++-- src/plugins/tool/EventCmp.py | 4 ++-- src/plugins/tool/SortEvents.py | 9 ++++----- src/plugins/webreport/NarrativeWeb.py | 14 +++++++------- 10 files changed, 22 insertions(+), 23 deletions(-) rename src/{Sort.py => gen/sort.py} (100%) diff --git a/po/POTFILES.skip b/po/POTFILES.skip index d04d5fab8..ded5ace5e 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index c2b907aa3..3345dd3b6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,6 @@ gdir_PYTHON = \ ImgManip.py\ LdsUtils.py \ MacTransUtils.py\ - Sort.py\ Spell.py\ ToolTips.py\ TransUtils.py\ diff --git a/src/gen/Makefile.am b/src/gen/Makefile.am index b04f05442..313df1fb8 100644 --- a/src/gen/Makefile.am +++ b/src/gen/Makefile.am @@ -27,6 +27,7 @@ pkgpython_PYTHON = \ ggettext.py \ recentfiles.py \ relationship.py \ + sort.py \ soundex.py \ updatecallback.py \ user.py diff --git a/src/Sort.py b/src/gen/sort.py similarity index 100% rename from src/Sort.py rename to src/gen/sort.py diff --git a/src/plugins/drawreport/TimeLine.py b/src/plugins/drawreport/TimeLine.py index 7c4af3776..efba66c7d 100644 --- a/src/plugins/drawreport/TimeLine.py +++ b/src/plugins/drawreport/TimeLine.py @@ -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")) diff --git a/src/plugins/textreport/DescendReport.py b/src/plugins/textreport/DescendReport.py index f28d0f133..8314038db 100644 --- a/src/plugins/textreport/DescendReport.py +++ b/src/plugins/textreport/DescendReport.py @@ -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 diff --git a/src/plugins/textreport/PlaceReport.py b/src/plugins/textreport/PlaceReport.py index d9349f77c..4b4e73691 100644 --- a/src/plugins/textreport/PlaceReport.py +++ b/src/plugins/textreport/PlaceReport.py @@ -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 diff --git a/src/plugins/tool/EventCmp.py b/src/plugins/tool/EventCmp.py index fa4f3b3d5..61e0e6584 100644 --- a/src/plugins/tool/EventCmp.py +++ b/src/plugins/tool/EventCmp.py @@ -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() diff --git a/src/plugins/tool/SortEvents.py b/src/plugins/tool/SortEvents.py index c4ef79052..a99f40027 100644 --- a/src/plugins/tool/SortEvents.py +++ b/src/plugins/tool/SortEvents.py @@ -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")) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index ade57237f..f9d2fe01b 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -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