diff --git a/ChangeLog b/ChangeLog index 3541b3139..3dd358a2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-10-06 Don Allingham + * various: creation of gen.db package + 2007-10-06 Benny Malengier * src/DataViews/_RelationView.py: don't crash on missing media ref * src/DisplayTabs/_GalleryTab.py: on missing media ref, notify to run check tool diff --git a/configure.in b/configure.in index 0ad49b808..88de51d28 100644 --- a/configure.in +++ b/configure.in @@ -179,6 +179,7 @@ src/plugins/Makefile src/DateHandler/Makefile src/gen/Makefile src/gen/proxy/Makefile +src/gen/db/Makefile src/data/Makefile src/data/templates/Makefile src/glade/Makefile diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 87bbf9d8a..3949a1662 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -68,15 +68,15 @@ from Filters.SideBar import PersonSidebarFilter from DdTargets import DdTargets column_names = [ - _('Name'), - _('ID') , - _('Gender'), - _('Birth Date'), - _('Birth Place'), - _('Death Date'), - _('Death Place'), - _('Spouse'), - _('Last Change'), + _('Name'), + _('ID') , + _('Gender'), + _('Birth Date'), + _('Birth Place'), + _('Death Date'), + _('Death Place'), + _('Spouse'), + _('Last Change'), ] class PersonView(PageView.PersonNavView): @@ -97,27 +97,27 @@ class PersonView(PageView.PersonNavView): self.generic_filter = None self.func_list = { - 'F2' : self.key_goto_home_person, - 'F3' : self.key_edit_selected_person, - 'BackSpace' : self.key_delete_selected_person, - 'J' : self.jump, + 'F2' : self.key_goto_home_person, + 'F3' : self.key_edit_selected_person, + 'BackSpace' : self.key_delete_selected_person, + 'J' : self.jump, } self.dirty = True - Config.client.notify_add("/apps/gramps/interface/filter", + Config.client.notify_add("/apps/gramps/interface/filter", self.filter_toggle) def change_page(self): PageView.PersonNavView.change_page(self) self.edit_action.set_visible(True) self.edit_action.set_sensitive(not self.dbstate.db.readonly) - self.uistate.show_filter_results(self.dbstate, - self.model.displayed, + self.uistate.show_filter_results(self.dbstate, + self.model.displayed, self.model.total) def set_active(self): PageView.PersonNavView.set_active(self) - self.key_active_changed = self.dbstate.connect('active-changed', + self.key_active_changed = self.dbstate.connect('active-changed', self.goto_active_person) self.goto_active_person() @@ -129,7 +129,7 @@ class PersonView(PageView.PersonNavView): def define_actions(self): """ Required define_actions function for PageView. Builds the action - group information required. We extend beyond the normal here, + group information required. We extend beyond the normal here, since we want to have more than one action group for the PersonView. Most PageViews really won't care about this. @@ -147,28 +147,28 @@ class PersonView(PageView.PersonNavView): self.all_action.add_actions([ ('OpenAllNodes', None, _("Expand all nodes"), None, None, - self.open_all_nodes), + self.open_all_nodes), ('Edit', gtk.STOCK_EDIT, _("_Edit"), "Return", - _("Edit the selected person"), self.edit), + _("Edit the selected person"), self.edit), ('CloseAllNodes', None, _("Collapse all nodes"), None, None, - self.close_all_nodes), - ('QuickReport', None, _("Quick Report"), None, None, None), - ('Dummy', None, ' ', None, None, self.dummy_report), + self.close_all_nodes), + ('QuickReport', None, _("Quick Report"), None, None, None), + ('Dummy', None, ' ', None, None, self.dummy_report), ]) self.edit_action.add_actions( [ ('Add', gtk.STOCK_ADD, _("_Add"), "Insert", - _("Add a new person"), self.add), + _("Add a new person"), self.add), ('Remove', gtk.STOCK_REMOVE, _("_Remove"), "Delete", - _("Remove the selected person"), self.remove), + _("Remove the selected person"), self.remove), ('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor'), None, - None, self._column_editor), + None, self._column_editor), ('CmpMerge', None, _('_Compare and merge'), None, None, - self.cmp_merge), + self.cmp_merge), ('FastMerge', None, _('_Fast merge'), None, None, - self.fast_merge), - ('ExportTab', None, _('Export view'), None, None, self.export), + self.fast_merge), + ('ExportTab', None, _('Export view'), None, None, self.export), ]) self._add_action_group(self.edit_action) @@ -191,7 +191,7 @@ class PersonView(PageView.PersonNavView): if len(mlist) != 2: QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Exactly two people must be selected to perform a merge. " "A second person can be selected by holding down the " "control key while clicking on the desired person.")) @@ -204,7 +204,7 @@ class PersonView(PageView.PersonNavView): person2, self.build_tree) else: QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Exactly two people must be selected to perform a " "merge. A second person can be selected by holding " "down the control key while clicking on the desired " @@ -215,7 +215,7 @@ class PersonView(PageView.PersonNavView): if len(mlist) != 2: QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Exactly two people must be selected to perform a merge. " "A second person can be selected by holding down the " "control key while clicking on the desired person.")) @@ -229,7 +229,7 @@ class PersonView(PageView.PersonNavView): person2, self.build_tree) else: QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Exactly two people must be selected to perform a merge. " "A second person can be selected by holding down the " "control key while clicking on the desired person.")) @@ -238,10 +238,10 @@ class PersonView(PageView.PersonNavView): import ColumnOrder ColumnOrder.ColumnOrder( - _('Select Person Columns'), - self.uistate, - self.dbstate.db.get_person_column_order(), - column_names, + _('Select Person Columns'), + self.uistate, + self.dbstate.db.get_person_column_order(), + column_names, self.set_column_order) def set_column_order(self, column_list): @@ -274,7 +274,7 @@ class PersonView(PageView.PersonNavView): self.vbox.set_border_width(4) self.vbox.set_spacing(4) - self.search_bar = SearchBar(self.dbstate, self.uistate, + self.search_bar = SearchBar(self.dbstate, self.uistate, self.build_tree, self.goto_active_person) filter_box = self.search_bar.build() @@ -283,7 +283,7 @@ class PersonView(PageView.PersonNavView): self.tree.set_headers_visible(True) self.tree.set_fixed_height_mode(True) self.tree.connect('key-press-event', self._key_press) - self.tree.connect('start-interactive-search',self.open_all_nodes) + self.tree.connect('start-interactive-search', self.open_all_nodes) scrollwindow = gtk.ScrolledWindow() scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) @@ -310,7 +310,7 @@ class PersonView(PageView.PersonNavView): self.selection.set_mode(gtk.SELECTION_MULTIPLE) self.selection.connect('changed', self.row_changed) - self.filter_sidebar = PersonSidebarFilter(self.dbstate, self.uistate, + self.filter_sidebar = PersonSidebarFilter(self.dbstate, self.uistate, self.filter_clicked) self.filter_pane = self.filter_sidebar.get_widget() @@ -448,19 +448,19 @@ class PersonView(PageView.PersonNavView): in the display tree. We have a bit of a problem due to the nature of how GTK works. - We have unselect the previous path and select the new path. However, + We have unselect the previous path and select the new path. However, these cause a row change, which calls the row_change callback, which can end up calling change_active_person, which can call goto_active_person, causing a bit of recusion. Confusing, huh? - Unforunately, we row_change has to be able to call change_active_person, + Unforunately, we row_change has to be able to call change_active_person, because the can occur from the interface in addition to programatically. TO handle this, we set the self.inactive variable that we can check in row_change to look for this particular condition. """ - # if there is no active person, or if we have been marked inactive, + # if there is no active person, or if we have been marked inactive, # simply return if not self.dbstate.active or self.inactive: @@ -500,7 +500,7 @@ class PersonView(PageView.PersonNavView): self.tree.scroll_to_cell(path, None, 1, 0.5, 0) except KeyError: self.selection.unselect_all() - self.uistate.push_message(self.dbstate, + self.uistate.push_message(self.dbstate, _("Active person not visible")) self.dbstate.active = person @@ -521,7 +521,7 @@ class PersonView(PageView.PersonNavView): def build_tree(self, skip=[]): """ Creates a new PeopleModel instance. Essentially creates a complete - rebuild of the data. We need to temporarily store the active person, + rebuild of the data. We need to temporarily store the active person, since it can change when rows are unselected when the model is set. """ if self.active: @@ -535,8 +535,8 @@ class PersonView(PageView.PersonNavView): self.tree.set_model(self.model) if const.USE_TIPS and self.model.tooltip_column != None: - self.tooltips = TreeTips.TreeTips(self.tree, - self.model.tooltip_column, + self.tooltips = TreeTips.TreeTips(self.tree, + self.model.tooltip_column, True) self.build_columns() @@ -544,8 +544,8 @@ class PersonView(PageView.PersonNavView): self.dbstate.change_active_person(active) self._goto() self.dirty = False - self.uistate.show_filter_results(self.dbstate, - self.model.displayed, + self.uistate.show_filter_results(self.dbstate, + self.model.displayed, self.model.total) else: self.dirty = True @@ -610,8 +610,8 @@ class PersonView(PageView.PersonNavView): 'from the database.') msg = "%s %s" % (msg, Utils.data_recover_msg) QuestionDialog.QuestionDialog(_('Delete %s?') % name, - msg, - _('_Delete Person'), + msg, + _('_Delete Person'), self.delete_person_response) def delete_person_response(self): @@ -646,9 +646,9 @@ class PersonView(PageView.PersonNavView): self.tree.remove_column(column) try: column = gtk.TreeViewColumn( - _('Name'), - self.renderer, - text=0, + _('Name'), + self.renderer, + text=0, foreground=self.model.marker_color_column) except AttributeError: @@ -666,7 +666,7 @@ class PersonView(PageView.PersonNavView): name = column_names[pair[1]] try: column = gtk.TreeViewColumn( - name, self.renderer, markup=pair[1], + name, self.renderer, markup=pair[1], foreground=self.model.marker_color_column) except AttributeError: column = gtk.TreeViewColumn( @@ -697,12 +697,12 @@ class PersonView(PageView.PersonNavView): pass if len(selected_ids) == 1: - self.tree.drag_source_set(BUTTON1_MASK, - [DdTargets.PERSON_LINK.target()], + self.tree.drag_source_set(BUTTON1_MASK, + [DdTargets.PERSON_LINK.target()], ACTION_COPY) elif len(selected_ids) > 1: - self.tree.drag_source_set(BUTTON1_MASK, - [DdTargets.PERSON_LINK_LIST.target()], + self.tree.drag_source_set(BUTTON1_MASK, + [DdTargets.PERSON_LINK_LIST.target()], ACTION_COPY) self.uistate.modify_statusbar(self.dbstate) @@ -852,7 +852,7 @@ class PersonView(PageView.PersonNavView): reportactions = [] if menu and self.dbstate.active: (ui, reportactions) = create_quickreport_menu( - CATEGORY_QR_PERSON, + CATEGORY_QR_PERSON, self.dbstate, self.dbstate.active.handle) if len(reportactions) > 1 : @@ -866,8 +866,8 @@ class PersonView(PageView.PersonNavView): return True return False - def _key_press(self,obj,event): - if not event.state or event.state in (gtk.gdk.MOD2_MASK,): + def _key_press(self, obj, event): + if not event.state or event.state in (gtk.gdk.MOD2_MASK, ): if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter): if self.dbstate.active: self.edit(obj) @@ -884,25 +884,25 @@ class PersonView(PageView.PersonNavView): def key_goto_home_person(self): self.home(None) - self.uistate.push_message(self.dbstate, + self.uistate.push_message(self.dbstate, _("Go to default person")) def key_edit_selected_person(self): self.edit(None) - self.uistate.push_message(self.dbstate, + self.uistate.push_message(self.dbstate, _("Edit selected person")) def key_delete_selected_person(self): self.remove(None) - self.uistate.push_message(self.dbstate, + self.uistate.push_message(self.dbstate, _("Delete selected person")) def export(self, obj): chooser = gtk.FileChooserDialog( - _("Export view as spreadsheet"), + _("Export view as spreadsheet"), self.uistate.window, - gtk.FILE_CHOOSER_ACTION_SAVE, + gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) chooser.set_do_overwrite_confirmation(True) @@ -967,23 +967,23 @@ class PersonView(PageView.PersonNavView): ofile.write_cell(name) ofile.end_row() - # The tree model works different from the rest of the list-based models, + # The tree model works different from the rest of the list-based models, # since the iterator method only works on top level nodes. So we must # loop through based off of paths - path = (0,) + path = (0, ) node = self.model.on_get_iter(path) while node: real_iter = self.model.get_iter(path) for subindex in range(0, self.model.iter_n_children(real_iter)): - subpath = ((path[0],subindex)) + subpath = ((path[0], subindex)) row = self.model[subpath] ofile.start_row() for index in data_cols: ofile.write_cell(row[index]) ofile.end_row() node = self.model.on_iter_next(node) - path = (path[0]+1,) + path = (path[0]+1, ) ofile.end_page() ofile.close() diff --git a/src/DbLoader.py b/src/DbLoader.py index 3e66a5953..ea54e48a7 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -57,6 +57,7 @@ import const import Config import Mime import GrampsDb +import gen.db import GrampsDbUtils import Utils from PluginUtils import import_list @@ -117,7 +118,7 @@ class DbLoader: filetype = type_selector.get_value() if filetype == 'auto': filetype = Mime.get_type(filename) - (the_path, the_file) = os.path.split(filename) +# (the_path, the_file) = os.path.split(filename) choose.destroy() if filetype in OPEN_FORMATS: self.read_file(filename, filetype) @@ -376,8 +377,9 @@ class DbLoader: mode = 'w' try: - dbclass = GrampsDb.gramps_db_factory(db_type = filetype) - except GrampsDb.GrampsDbException, msg: + #dbclass = GrampsDb.gramps_db_factory(db_type = filetype) + dbclass = gen.db.GrampsDBDir + except gen.db.GrampsDbException, msg: QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename, _("This may be caused by an improper installation of GRAMPS.") + diff --git a/src/DbState.py b/src/DbState.py index 59932c682..d49fa053b 100644 --- a/src/DbState.py +++ b/src/DbState.py @@ -25,7 +25,7 @@ Provides the database state class __author__ = "Donald N. Allingham" __revision__ = "$Revision: 8032 $" -from GrampsDb import GrampsDBCallback, GrampsDbBase +from gen.db import GrampsDBCallback, GrampsDbBase import Config class DbState(GrampsDBCallback): diff --git a/src/DisplayModels/_FamilyModel.py b/src/DisplayModels/_FamilyModel.py index 6d7db380f..7b0274423 100644 --- a/src/DisplayModels/_FamilyModel.py +++ b/src/DisplayModels/_FamilyModel.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -59,36 +59,36 @@ class FamilyModel(BaseModel): _MARKER_COL = 13 - def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None, + def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None, skip=set(), sort_map=None): self.gen_cursor = db.get_family_cursor self.map = db.get_raw_family_data self.fmap = [ - self.column_id, - self.column_father, - self.column_mother, - self.column_type, - self.column_marriage, - self.column_change, - self.column_handle, - self.column_tooltip, - self.column_marker_text, - self.column_marker_color, + self.column_id, + self.column_father, + self.column_mother, + self.column_type, + self.column_marriage, + self.column_change, + self.column_handle, + self.column_tooltip, + self.column_marker_text, + self.column_marker_color, ] self.smap = [ - self.column_id, - self.sort_father, - self.sort_mother, - self.column_type, - self.sort_marriage, - self.sort_change, - self.column_handle, - self.column_tooltip, - self.column_marker_text, - self.column_marker_color, + self.column_id, + self.sort_father, + self.sort_mother, + self.column_type, + self.sort_marriage, + self.sort_change, + self.column_handle, + self.column_tooltip, + self.column_marker_text, + self.column_marker_color, ] self.marker_color_column = 9 - BaseModel.__init__(self, db, scol, order, tooltip_column=6, + BaseModel.__init__(self, db, scol, order, tooltip_column=6, search=search, skip=skip, sort_map=sort_map) def on_get_n_columns(self): @@ -151,7 +151,7 @@ class FamilyModel(BaseModel): return "%012x" % data[13] def column_change(self, data): - return unicode(time.strftime('%x %X',time.localtime(data[13])), + return unicode(time.strftime('%x %X', time.localtime(data[13])), GrampsLocale.codeset) def column_marker_text(self, data): @@ -175,11 +175,12 @@ class FamilyModel(BaseModel): pass return None - def column_tooltip(self,data): + def column_tooltip(self, data): if const.USE_TIPS: try: - t = ToolTips.TipFromFunction(self.db, lambda: - self.db.get_family_from_handle(data[0])) + t = ToolTips.TipFromFunction( + self.db, lambda: + self.db.get_family_from_handle(data[0])) except: log.error("Failed to create tooltip.", exc_info=True) return t diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index 3f16b068e..555dea11b 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -65,7 +65,7 @@ import DateHandler import ToolTips import GrampsLocale import Config -from GrampsDb import LongOpStatus +from gen.db.longop import LongOpStatus from Filters import SearchFilter, ExactSearchFilter from Lru import LRU diff --git a/src/DisplayState.py b/src/DisplayState.py index cd23e71a6..db8b4ac98 100644 --- a/src/DisplayState.py +++ b/src/DisplayState.py @@ -49,7 +49,7 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------- -import GrampsDb +import gen.db import Config from BasicUtils import name_displayer import const @@ -63,7 +63,7 @@ DISABLED = -1 # History manager # #------------------------------------------------------------------------- -class History(GrampsDb.GrampsDBCallback): +class History(gen.db.GrampsDBCallback): """ History manages the objects of a certain type that have been viewed, with ability to go back, or forward. When accessing an object, it should be pushed on the History. @@ -75,7 +75,7 @@ class History(GrampsDb.GrampsDBCallback): } def __init__(self): - GrampsDb.GrampsDBCallback.__init__(self) + gen.db.GrampsDBCallback.__init__(self) self.clear() def clear(self): @@ -290,7 +290,7 @@ class WarnHandler(RotateHandler): top.run() top.destroy() -class DisplayState(GrampsDb.GrampsDBCallback): +class DisplayState(gen.db.GrampsDBCallback): __signals__ = { 'filters-changed' : (str, ), @@ -306,7 +306,7 @@ class DisplayState(GrampsDb.GrampsDBCallback): self.uimanager = uimanager self.progress_monitor = progress_monitor self.window = window - GrampsDb.GrampsDBCallback.__init__(self) + gen.db.GrampsDBCallback.__init__(self) self.status = status self.status_id = status.get_context_id('GRAMPS') self.progress = progress diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index a80406824..cb011f4f6 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -45,13 +45,13 @@ __LOG = logging.getLogger(".GrampsDb") # #------------------------------------------------------------------------- from RelLib import * -from _GrampsDbBase import * +from gen.db.base import * from _DbUtils import db_copy -import _GrampsDbConst as const +import gen.db.const as const from _GrampsDbExceptions import FileVersionError from BasicUtils import UpdateCallback -from _GrampsCursor import GrampsCursor +from gen.db.cursor import GrampsCursor _MINVERSION = 9 _DBVERSION = 13 diff --git a/src/GrampsDb/_GrampsDbFactories.py b/src/GrampsDb/_GrampsDbFactories.py index caf0b1735..9266141b7 100644 --- a/src/GrampsDb/_GrampsDbFactories.py +++ b/src/GrampsDb/_GrampsDbFactories.py @@ -38,7 +38,8 @@ required e.g.: > GrampsDb.gramps_db_reader_factory(db_type = const.APP_GEDCOM) """ -import _GrampsDbConst as const +import gen.db.dbconst as const +from gen.db.exceptions import GrampsDbException import logging log = logging.getLogger(".GrampDb") @@ -50,7 +51,6 @@ except: log.warn("No Config module available, using defaults.") config = None -from _GrampsDbExceptions import GrampsDbException def gramps_db_factory(db_type): """Factory class for obtaining a Gramps database backend. diff --git a/src/GrampsDb/_GrampsDbWriteXML.py b/src/GrampsDb/_GrampsDbWriteXML.py index 4539977c1..ac818ce90 100644 --- a/src/GrampsDb/_GrampsDbWriteXML.py +++ b/src/GrampsDb/_GrampsDbWriteXML.py @@ -54,12 +54,12 @@ log = logging.getLogger(".WriteXML") import RelLib from BasicUtils import UpdateCallback -from _GrampsDbConst import \ +from gen.db.dbconst import \ PERSON_KEY,FAMILY_KEY,SOURCE_KEY,EVENT_KEY,\ MEDIA_KEY,PLACE_KEY,REPOSITORY_KEY,NOTE_KEY -from _GrampsDbExceptions import * -from _LongOpStatus import LongOpStatus +from gen.db.exceptions import * +from gen.db.longop import LongOpStatus import gen.proxy diff --git a/src/GrampsDb/__init__.py b/src/GrampsDb/__init__.py index 718ad5a17..a9c3f0de2 100644 --- a/src/GrampsDb/__init__.py +++ b/src/GrampsDb/__init__.py @@ -38,22 +38,21 @@ the database objects. Read the comments in _GrampsDBCallback.py for more information. """ -from _GrampsDbBase import GrampsDbBase +#from _GrampsDbBase import GrampsDbBase -from _GrampsDbFactories import \ - gramps_db_factory +from _GrampsDbFactories import gramps_db_factory -from _GrampsDbExceptions import * +#from _GrampsDbExceptions import * -from _GrampsDBCallback import GrampsDBCallback +#from _GrampsDBCallback import GrampsDBCallback from _DbUtils import * -import _GrampsDbConst as GrampsDbConst +#import _GrampsDbConst as GrampsDbConst from _GrampsDbWriteXML import GrampsDbXmlWriter, \ exportData, quick_write -from _LongOpStatus import LongOpStatus +#from _LongOpStatus import LongOpStatus from _ProgressMonitor import ProgressMonitor diff --git a/src/GrampsDbUtils/_Backup.py b/src/GrampsDbUtils/_Backup.py index f29ab7837..e5357e83c 100644 --- a/src/GrampsDbUtils/_Backup.py +++ b/src/GrampsDbUtils/_Backup.py @@ -66,7 +66,7 @@ from QuestionDialog import ErrorDialog #------------------------------------------------------------------------ import logging import os -from GrampsDb import _GrampsDBDir as GrampsDBDir +from gen.db.dbdir import GrampsDBDir import cPickle as pickle LOG = logging.getLogger(".Backup") diff --git a/src/GrampsDbUtils/_GedcomParse.py b/src/GrampsDbUtils/_GedcomParse.py index 20f0b8369..d30f3f5c9 100644 --- a/src/GrampsDbUtils/_GedcomParse.py +++ b/src/GrampsDbUtils/_GedcomParse.py @@ -122,7 +122,7 @@ import _GedcomUtils as GedcomUtils import _GedcomLex as GedcomLex import _GedcomChar as GedcomChar -from GrampsDb._GrampsDbConst import EVENT_KEY +from gen.db.dbconst import EVENT_KEY #------------------------------------------------------------------------- # diff --git a/src/GrampsDbUtils/_GrampsDbWRFactories.py b/src/GrampsDbUtils/_GrampsDbWRFactories.py index f5b32b8c6..8cc7aa922 100644 --- a/src/GrampsDbUtils/_GrampsDbWRFactories.py +++ b/src/GrampsDbUtils/_GrampsDbWRFactories.py @@ -41,7 +41,7 @@ import logging log = logging.getLogger(".GrampDb") -from GrampsDb import GrampsDbException +from gen.db import GrampsDbException def gramps_db_writer_factory(db_type): diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index 7e42ca4f1..a69788143 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -26,7 +26,6 @@ # #------------------------------------------------------------------------- from gettext import gettext as _ -import sets #------------------------------------------------------------------------- # @@ -57,7 +56,7 @@ class PersonCompare(ManagedWindow.ManagedWindow): def __init__(self, dbstate, uistate, person1, person2, update=None) : - ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) + ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__) self.glade = gtk.glade.XML(const.MERGE_GLADE, "merge") window = self.glade.get_widget('merge') @@ -69,36 +68,36 @@ class PersonCompare(ManagedWindow.ManagedWindow): self.p2 = person2 self.update = update - self.set_window(window,self.glade.get_widget('title'), + self.set_window(window, self.glade.get_widget('title'), _("Compare People")) self.display(self.text1.get_buffer(), person1) self.display(self.text2.get_buffer(), person2) - self.glade.get_widget('cancel').connect('clicked',self.close) - self.glade.get_widget('close').connect('clicked',self.merge) - self.glade.get_widget('help').connect('clicked',self.help) + self.glade.get_widget('cancel').connect('clicked', self.close) + self.glade.get_widget('close').connect('clicked', self.merge) + self.glade.get_widget('help').connect('clicked', self.help) - def help(self,obj): + def help(self, obj): """Display the relevant portion of GRAMPS manual""" GrampsDisplay.help('adv-merge-people') - def merge(self,obj): - if check_for_spouse(self.p1,self.p2): + def merge(self, obj): + if check_for_spouse(self.p1, self.p2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Spouses cannot be merged. To merge these people, " "you must first break the relationship between them.")) - elif check_for_child(self.p1,self.p2): + elif check_for_child(self.p1, self.p2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("A parent and child cannot be merged. To merge these " "people, you must first break the relationship between " "them.")) else: if self.glade.get_widget('select1').get_active(): - merge = MergePeople(self.db,self.p1,self.p2) + merge = MergePeople(self.db, self.p1, self.p2) else: - merge = MergePeople(self.db,self.p2,self.p1) + merge = MergePeople(self.db, self.p2, self.p1) self.close() merge.merge() if self.update: @@ -106,90 +105,90 @@ class PersonCompare(ManagedWindow.ManagedWindow): def add(self, tobj, tag, text): text += "\n" - tobj.insert_with_tags(tobj.get_end_iter(),text,tag) + tobj.insert_with_tags(tobj.get_end_iter(), text, tag) def display(self, tobj, person): normal = tobj.create_tag() - normal.set_property('indent',10) - normal.set_property('pixels-above-lines',1) - normal.set_property('pixels-below-lines',1) + normal.set_property('indent', 10) + normal.set_property('pixels-above-lines', 1) + normal.set_property('pixels-below-lines', 1) indent = tobj.create_tag() - indent.set_property('indent',30) - indent.set_property('pixels-above-lines',1) - indent.set_property('pixels-below-lines',1) + indent.set_property('indent', 30) + indent.set_property('pixels-above-lines', 1) + indent.set_property('pixels-below-lines', 1) title = tobj.create_tag() - title.set_property('weight',pango.WEIGHT_BOLD) - title.set_property('scale',pango.SCALE_LARGE) - self.add(tobj,title,name_displayer.display(person)) - self.add(tobj,normal,"%s:\t%s" % (_('ID'),person.get_gramps_id())) - self.add(tobj,normal,"%s:\t%s" % (_('Gender'),sex[person.get_gender()])) + title.set_property('weight', pango.WEIGHT_BOLD) + title.set_property('scale', pango.SCALE_LARGE) + self.add(tobj, title, name_displayer.display(person)) + self.add(tobj, normal, "%s:\t%s" % (_('ID'), person.get_gramps_id())) + self.add(tobj, normal, "%s:\t%s" % (_('Gender'), sex[person.get_gender()])) bref = person.get_birth_ref() if bref: - self.add(tobj,normal,"%s:\t%s" % (_('Birth'),self.get_event_info(bref.ref))) + self.add(tobj, normal, "%s:\t%s" % (_('Birth'), self.get_event_info(bref.ref))) dref = person.get_death_ref() if dref: - self.add(tobj,normal,"%s:\t%s" % (_('Death'),self.get_event_info(dref.ref))) + self.add(tobj, normal, "%s:\t%s" % (_('Death'), self.get_event_info(dref.ref))) nlist = person.get_alternate_names() if len(nlist) > 0: - self.add(tobj,title,_("Alternate Names")) + self.add(tobj, title, _("Alternate Names")) for name in nlist: - self.add(tobj,normal,name_displayer.display_name(name)) + self.add(tobj, normal, name_displayer.display_name(name)) elist = person.get_event_ref_list() if len(elist) > 0: - self.add(tobj,title,_("Events")) + self.add(tobj, title, _("Events")) for event_ref in person.get_event_ref_list(): event_handle = event_ref.ref name = str( self.db.get_event_from_handle(event_handle).get_type()) - self.add(tobj,normal,"%s:\t%s" % (name,self.get_event_info(event_handle))) + self.add(tobj, normal, "%s:\t%s" % (name, self.get_event_info(event_handle))) plist = person.get_parent_family_handle_list() if len(plist) > 0: - self.add(tobj,title,_("Parents")) + self.add(tobj, title, _("Parents")) for fid in person.get_parent_family_handle_list(): - (fn,mn,gid) = self.get_parent_info(fid) - self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),gid)) + (fn, mn, gid) = self.get_parent_info(fid) + self.add(tobj, normal, "%s:\t%s" % (_('Family ID'), gid)) if fn: - self.add(tobj,indent,"%s:\t%s" % (_('Father'),fn)) + self.add(tobj, indent, "%s:\t%s" % (_('Father'), fn)) if mn: - self.add(tobj,indent,"%s:\t%s" % (_('Mother'),mn)) + self.add(tobj, indent, "%s:\t%s" % (_('Mother'), mn)) else: - self.add(tobj,normal,_("No parents found")) + self.add(tobj, normal, _("No parents found")) - self.add(tobj,title,_("Spouses")) + self.add(tobj, title, _("Spouses")) slist = person.get_family_handle_list() if len(slist) > 0: for fid in slist: - (fn,mn,pid) = self.get_parent_info(fid) + (fn, mn, pid) = self.get_parent_info(fid) family = self.db.get_family_from_handle(fid) - self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),pid)) - spouse_id = ReportUtils.find_spouse(person,family) + self.add(tobj, normal, "%s:\t%s" % (_('Family ID'), pid)) + spouse_id = ReportUtils.find_spouse(person, family) if spouse_id: spouse = self.db.get_person_from_handle(spouse_id) - self.add(tobj,indent,"%s:\t%s" % (_('Spouse'),name_of(spouse))) + self.add(tobj, indent, "%s:\t%s" % (_('Spouse'), name_of(spouse))) relstr = str(family.get_relationship()) - self.add(tobj,indent,"%s:\t%s" % (_('Type'),relstr)) - event = ReportUtils.find_marriage(self.db,family) + self.add(tobj, indent, "%s:\t%s" % (_('Type'), relstr)) + event = ReportUtils.find_marriage(self.db, family) if event: - self.add(tobj,indent,"%s:\t%s" % ( + self.add(tobj, indent, "%s:\t%s" % ( _('Marriage'), self.get_event_info(event.get_handle()))) for child_ref in family.get_child_ref_list(): child = self.db.get_person_from_handle(child_ref.ref) - self.add(tobj,indent,"%s:\t%s" % (_('Child'),name_of(child))) + self.add(tobj, indent, "%s:\t%s" % (_('Child'), name_of(child))) else: - self.add(tobj,normal,_("No spouses or children found")) + self.add(tobj, normal, _("No spouses or children found")) alist = person.get_address_list() if len(alist) > 0: - self.add(tobj,title,_("Addresses")) + self.add(tobj, title, _("Addresses")) for addr in alist: - location = ", ".join([addr.get_street(),addr.get_city(), - addr.get_state(),addr.get_country()]) - self.add(tobj,normal,location.strip()) + location = ", ".join([addr.get_street(), addr.get_city(), + addr.get_state(), addr.get_country()]) + self.add(tobj, normal, location.strip()) - def get_parent_info(self,fid): + def get_parent_info(self, fid): family = self.db.get_family_from_handle(fid) father_id = family.get_father_handle() mother_id = family.get_mother_handle() @@ -203,9 +202,9 @@ class PersonCompare(ManagedWindow.ManagedWindow): mname = name_of(mother) else: mname = u"" - return (fname,mname,family.get_gramps_id()) + return (fname, mname, family.get_gramps_id()) - def get_event_info(self,handle): + def get_event_info(self, handle): date = "" place = "" if handle: @@ -214,7 +213,7 @@ class PersonCompare(ManagedWindow.ManagedWindow): place = self.place_name(event) if date: if place: - return "%s, %s" % (date,place) + return "%s, %s" % (date, place) else: return date else: @@ -225,7 +224,7 @@ class PersonCompare(ManagedWindow.ManagedWindow): else: return "" - def place_name(self,event): + def place_name(self, event): place_id = event.get_place_handle() if place_id: place = self.db.get_place_from_handle(place_id) @@ -236,18 +235,18 @@ class PersonCompare(ManagedWindow.ManagedWindow): def check_for_spouse(p1, p2): - f1 = sets.Set(p1.get_family_handle_list()) - f2 = sets.Set(p2.get_family_handle_list()) + f1 = set(p1.get_family_handle_list()) + f2 = set(p2.get_family_handle_list()) return len(f1.intersection(f2)) != 0 def check_for_child(p1, p2): - fs1 = sets.Set(p1.get_family_handle_list()) - fp1 = sets.Set(p1.get_parent_family_handle_list()) + fs1 = set(p1.get_family_handle_list()) + fp1 = set(p1.get_parent_family_handle_list()) - fs2 = sets.Set(p2.get_family_handle_list()) - fp2 = sets.Set(p2.get_parent_family_handle_list()) + fs2 = set(p2.get_family_handle_list()) + fp2 = set(p2.get_parent_family_handle_list()) return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1)) @@ -262,20 +261,20 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): if check_for_spouse(person1, person2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Spouses cannot be merged. To merge these people, " "you must first break the relationship between them.")) return if check_for_child(person1, person2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("A parent and child cannot be merged. To merge these " "people, you must first break the relationship between " "them.")) return - ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) + ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__) glade = gtk.glade.XML(const.MERGE_GLADE, 'merge_people') window = glade.get_widget('merge_people') @@ -290,7 +289,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): p1.set_label(n1) p2.set_label(n2) - glade.get_widget('help').connect('clicked',self.help) + glade.get_widget('help').connect('clicked', self.help) ret = gtk.RESPONSE_HELP while ret == gtk.RESPONSE_HELP: @@ -298,31 +297,31 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): if ret == gtk.RESPONSE_OK: - if check_for_spouse(person1,person2): + if check_for_spouse(person1, person2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("Spouses cannot be merged. To merge these people, " "you must first break the relationship between them.")) - elif check_for_child(person1,person2): + elif check_for_child(person1, person2): QuestionDialog.ErrorDialog( - _("Cannot merge people"), + _("Cannot merge people"), _("A parent and child cannot be merged. To merge these " "people, you must first break the relationship between " "them.")) else: if p1.get_active(): - merge = MergePeople(dbstate.db,person1,person2) + merge = MergePeople(dbstate.db, person1, person2) else: - merge = MergePeople(dbstate.db,person2,person1) + merge = MergePeople(dbstate.db, person2, person1) merge.merge() if update: update() self.close() - def build_menu_names(self,obj): - return (_('Merge People'),None) + def build_menu_names(self, obj): + return (_('Merge People'), None) - def help(self,obj): + def help(self, obj): """Display the relevant portion of GRAMPS manual""" GrampsDisplay.help('adv-merge-people') @@ -330,7 +329,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): def name_of(p): if not p: return "" - return "%s [%s]" % (name_displayer.display(p),p.get_gramps_id()) + return "%s [%s]" % (name_displayer.display(p), p.get_gramps_id()) #------------------------------------------------------------------------- # @@ -339,15 +338,15 @@ def name_of(p): #------------------------------------------------------------------------- class MergePeople: - def __init__(self,db,person1,person2): + def __init__(self, db, person1, person2): self.db = db self.p1 = person1 self.p2 = person2 - def copy_note(self,one,two): + def copy_note(self, one, two): one.set_note_list(one.get_note_list() + two.get_note_list()) - def copy_sources(self,one,two): + def copy_sources(self, one, two): slist = one.get_source_references()[:] for xsrc in two.get_source_references(): for src in slist: @@ -356,13 +355,13 @@ class MergePeople: else: one.add_source_reference(xsrc) - def debug_person(self,person, msg=""): + def debug_person(self, person, msg=""): if __debug__: - print "## %s person handle %s" % (msg,person.get_handle()) + print "## %s person handle %s" % (msg, person.get_handle()) for h in person.get_family_handle_list(): fam = self.db.get_family_from_handle(h) print " - family %s has father: %s, mother: %s" % \ - (h,fam.get_father_handle(),fam.get_mother_handle()) + (h, fam.get_father_handle(), fam.get_mother_handle()) for h in person.get_parent_family_handle_list(): print " - parent family %s" % h @@ -384,18 +383,18 @@ class MergePeople: new = RelLib.Person() trans = self.db.transaction_begin() - self.merge_person_information(new,trans) + self.merge_person_information(new, trans) self.debug_person(new, "NEW") - self.merge_family_information(new,trans) + self.merge_family_information(new, trans) self.debug_person(new, "NEW") - self.db.commit_person(new,trans) + self.db.commit_person(new, trans) self.debug_person(new, "NEW") - self.db.remove_person(self.old_handle,trans) - self.db.transaction_commit(trans,"Merge Person") + self.db.remove_person(self.old_handle, trans) + self.db.transaction_commit(trans, "Merge Person") - def merge_person_information(self,new,trans): + def merge_person_information(self, new, trans): """ Merging the person's individual information is pretty simple. The person 'new' is a new, empty person. The data is loaded in this @@ -454,7 +453,7 @@ class MergePeople: # note new.set_note_list(self.p1.get_note_list() + self.p2.get_note_list()) - def merge_gramps_ids(self,new): + def merge_gramps_ids(self, new): """ Merges the GRAMPS IDs. The new GRAMPS ID is taken from destination person. The GRAMPS ID of the other person is added @@ -497,7 +496,7 @@ class MergePeople: else: new.add_alternate_name(name) - def merge_birth(self, new,trans): + def merge_birth(self, new, trans): """ Merges the birth events of the two people. If the primary person does not have a birth event, then the birth event from @@ -560,7 +559,7 @@ class MergePeople: list any parents that are not already there. This eliminates any duplicates. - Once this has been completed, we loop through each family, + Once this has been completed, we loop through each family, converting any child handles referring to the secondary person to the destination person. """ @@ -579,7 +578,7 @@ class MergePeople: # person for family_handle in parent_list: - self.convert_child_ids(family_handle, self.new_handle, + self.convert_child_ids(family_handle, self.new_handle, self.old_handle, trans) new.add_parent_family_handle(family_handle) @@ -610,9 +609,9 @@ class MergePeople: if [ref.ref for ref in new_ref_list] \ != [ref.ref for ref in orig_ref_list]: family.set_child_ref_list(new_ref_list) - self.db.commit_family(family,trans) + self.db.commit_family(family, trans) - def merge_relationships(self,new,trans): + def merge_relationships(self, new, trans): """ Merges the relationships associated with the merged people. """ @@ -649,14 +648,14 @@ class MergePeople: else: if __debug__: print "Merging family pair" - self.merge_family_pair(tgt_family,src_family,trans) + self.merge_family_pair(tgt_family, src_family, trans) # change parents of the family to point to the new # family self.adjust_family_pointers(tgt_family, src_family, trans) new.remove_family_handle(src_handle) - self.db.remove_family(src_handle,trans) + self.db.remove_family(src_handle, trans) if __debug__: print "Deleted src_family %s" % src_handle else: @@ -680,7 +679,7 @@ class MergePeople: if __debug__: print "Family %s now has mother %s" % ( src_handle, self.new_handle) - self.db.commit_family(src_family,trans) + self.db.commit_family(src_family, trans) # a little debugging here @@ -697,10 +696,10 @@ class MergePeople: ## if self.p2 == fam.get_mother_handle(): ## fam.set_mother_handle(self.p1) ## if fam.get_father_handle() == None and fam.get_mother_handle() == None: -## self.delete_empty_family(fam,trans) +## self.delete_empty_family(fam, trans) ## data = cursor.next() - def find_modified_family(self,family): + def find_modified_family(self, family): """ Look for a existing family that matches the merged person. This means looking at the current family, and replacing the secondary person's @@ -736,7 +735,7 @@ class MergePeople: myfamily = None while node: # data[2] == father_handle field, data[2] == mother_handle field - (thandle,data) = node + (thandle, data) = node if data[2] == fhandle and data[3] == mhandle and thandle != family_handle: myfamily = RelLib.Family() myfamily.unserialize(data) @@ -766,14 +765,14 @@ class MergePeople: father.remove_family_handle(src_family_handle) if __debug__: print "Removed family %s from father %s" % (src_family_handle, father_id) - self.db.commit_person(father,trans) + self.db.commit_person(father, trans) if mother and src_family_handle in mother.get_family_handle_list(): mother.remove_family_handle(src_family_handle) if __debug__: print "Removed family %s from mother %s" % (src_family_handle, mother_id) - self.db.commit_person(mother,trans) + self.db.commit_person(mother, trans) - self.merge_family_pair(tgt_family,src_family,trans) + self.merge_family_pair(tgt_family, src_family, trans) for child_ref in src_family.get_child_ref_list(): child_handle = child_ref.ref @@ -782,19 +781,19 @@ class MergePeople: if child.remove_parent_family_handle(src_family_handle): if __debug__: print "Remove parent family %s from %s" \ - % (src_family_handle,child_handle) + % (src_family_handle, child_handle) child.add_parent_family_handle(tgt_family.handle) - self.db.commit_person(child,trans) + self.db.commit_person(child, trans) # delete the old source family - self.db.remove_family(src_family_handle,trans) + self.db.remove_family(src_family_handle, trans) if __debug__: print "Deleted src_family %s" % src_family_handle - self.db.commit_family(tgt_family,trans) + self.db.commit_family(tgt_family, trans) if tgt_family.get_handle() not in new.get_family_handle_list(): new.add_family_handle(tgt_family.get_handle()) - def merge_family_pair(self,tgt_family,src_family,trans): + def merge_family_pair(self, tgt_family, src_family, trans): tgt_family_child_handles = [ref.ref for ref in tgt_family.get_child_ref_list()] @@ -810,9 +809,9 @@ class MergePeople: i = 0 for fam in parents[:]: if fam[0] == src_family.get_handle(): - parents[i] = (tgt_family.get_handle(),fam[1],fam[2]) + parents[i] = (tgt_family.get_handle(), fam[1], fam[2]) i += 1 - self.db.commit_person(child,trans) + self.db.commit_person(child, trans) # merge family events @@ -834,7 +833,7 @@ class MergePeople: # merge family top-level sources - self.copy_sources(tgt_family,src_family) + self.copy_sources(tgt_family, src_family) # merge multimedia objects @@ -861,7 +860,7 @@ class MergePeople: tgt_family_handle, father_handle) # commit the change - self.db.commit_person(father,trans) + self.db.commit_person(father, trans) mother_handle = src_family.get_mother_handle() if mother_handle: @@ -874,7 +873,7 @@ class MergePeople: tgt_family_handle, mother_handle) # commit the change - self.db.commit_person(mother,trans) + self.db.commit_person(mother, trans) # remove the children from the old family for child_ref in src_family.get_child_ref_list(): @@ -882,16 +881,16 @@ class MergePeople: if child_handle != self.new_handle: child = self.db.get_person_from_handle(child_handle) if child.remove_parent_family_handle(src_family_handle): - self.db.commit_person(child,trans) + self.db.commit_person(child, trans) - def remove_marriage(self,family,person,trans): + def remove_marriage(self, family, person, trans): if person: person.remove_family_handle(family.get_handle()) - if family.get_father_handle() == None and family.get_mother_handle() == None: - self.delete_empty_family(family,trans) + if family.get_father_handle() is None and family.get_mother_handle() is None: + self.delete_empty_family(family, trans) - def delete_empty_family(self,family,trans): + def delete_empty_family(self, family, trans): family_handle = family.get_handle() for child_ref in family.get_child_ref_list(): child_handle = child_ref.ref @@ -900,8 +899,8 @@ class MergePeople: child.set_main_parent_family_handle(None) else: child.remove_parent_family_handle(family_handle) - self.db.commit_person(child,trans) - self.db.remove_family(family_handle,trans) + self.db.commit_person(child, trans) + self.db.remove_family(family_handle, trans) if __debug__: print "Deleted empty family %s" % family_handle diff --git a/src/ProgressDialog.py b/src/ProgressDialog.py index 65cec2c63..6afa3d032 100644 --- a/src/ProgressDialog.py +++ b/src/ProgressDialog.py @@ -87,7 +87,7 @@ class GtkProgressDialog(gtk.Dialog): self._progress_bars = [] - def add(self,long_op_status): + def add(self, long_op_status): """Add a new status object to the progress dialog. @param long_op_status: the status object. @@ -145,7 +145,7 @@ class GtkProgressDialog(gtk.Dialog): gtk.Dialog.hide(self) self._process_events() - def _warn(self,x,y): + def _warn(self, x, y): return True def close(self): @@ -155,7 +155,7 @@ if __name__ == '__main__': import time from GrampsDb import LongOpStatus, ProgressMonitor - def test(a,b): + def test(a, b): d = ProgressMonitor(GtkProgressDialog) s = LongOpStatus("Doing very long operation", 100, 10) @@ -165,7 +165,7 @@ if __name__ == '__main__': for i in xrange(0, 99): time.sleep(0.1) if i == 30: - t = LongOpStatus("doing a shorter one", 100, 10, + t = LongOpStatus("doing a shorter one", 100, 10, can_cancel=True) d.add_op(t) for j in xrange(0, 99): @@ -193,4 +193,4 @@ if __name__ == '__main__': w.show() gtk.main() print 'done' - \ No newline at end of file + diff --git a/src/ReportBase/_Endnotes.py b/src/ReportBase/_Endnotes.py index 929091bf2..2d0390f85 100644 --- a/src/ReportBase/_Endnotes.py +++ b/src/ReportBase/_Endnotes.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -24,6 +24,7 @@ Provide utilities for printing endnotes in text reports. """ import BaseDoc +from gettext import gettext as _ def add_endnote_styles(style_sheet): """ @@ -33,30 +34,30 @@ def add_endnote_styles(style_sheet): @type style_sheet: L{Basedoc.StyleSheet} """ font = BaseDoc.FontStyle() - font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1) + font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1) para = BaseDoc.ParagraphStyle() para.set_font(font) para.set_header_level(2) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_description(_('The style used for the generation header.')) - style_sheet.add_paragraph_style("Endnotes-Header",para) + style_sheet.add_paragraph_style("Endnotes-Header", para) para = BaseDoc.ParagraphStyle() - para.set(first_indent=-0.75,lmargin=.75) + para.set(first_indent=-0.75, lmargin=.75) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_description(_('The basic style used for the endnotes source display.')) - style_sheet.add_paragraph_style("Endnotes-Source",para) + style_sheet.add_paragraph_style("Endnotes-Source", para) para = BaseDoc.ParagraphStyle() para.set(lmargin=1.5) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_description(_('The basic style used for the endnotes reference display.')) - style_sheet.add_paragraph_style("Endnotes-Ref",para) + style_sheet.add_paragraph_style("Endnotes-Ref", para) -def cite_source(bibliography,obj): +def cite_source(bibliography, obj): """ Cite any sources for the object and add them to the bibliography. @@ -71,15 +72,15 @@ def cite_source(bibliography,obj): first = 1 for ref in slist: if not first: - txt += ',' + txt += ', ' first = 0 - (cindex,key) = bibliography.add_reference(ref) + (cindex, key) = bibliography.add_reference(ref) txt += "%d" % (cindex + 1) if key != None: txt += key return txt -def write_endnotes(bibliography,database,doc): +def write_endnotes(bibliography, database, doc): """ Write all the entries in the bibliography as endnotes. @@ -103,7 +104,7 @@ def write_endnotes(bibliography,database,doc): source = database.get_source_from_handle(citation.get_source_handle()) first = True - doc.start_paragraph('Endnotes-Source',"%d." % cindex) + doc.start_paragraph('Endnotes-Source', "%d." % cindex) src_txt = _format_source_text(source) @@ -117,8 +118,8 @@ def write_endnotes(bibliography,database,doc): first = True rindex = 0 - for key,ref in ref_list: - txt = "%s: %s" % (key,ref.get_page()) + for key, ref in ref_list: + txt = "%s: %s" % (key, ref.get_page()) if first: doc.write_text(txt) first = False @@ -149,4 +150,4 @@ def _format_source_text(source): src_txt += ", " src_txt += "(%s)" % source.get_abbreviation() - return src_txt \ No newline at end of file + return src_txt diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py index f483a38e1..a7d13e25b 100644 --- a/src/ReportBase/_ReportUtils.py +++ b/src/ReportBase/_ReportUtils.py @@ -10,7 +10,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -54,92 +54,92 @@ import BaseDoc born_full_date_with_place = [ { - RelLib.Person.UNKNOWN : _("This person was born on %(birth_date)s in %(birth_place)s."), - RelLib.Person.MALE : _("He was born on %(birth_date)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("She was born on %(birth_date)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born on %(birth_date)s in %(birth_place)s."), + RelLib.Person.MALE : _("He was born on %(birth_date)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("She was born on %(birth_date)s in %(birth_place)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born on %(birth_date)s in %(birth_place)s."), - RelLib.Person.MALE : _("%(male_name)s was born on %(birth_date)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born on %(birth_date)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born on %(birth_date)s in %(birth_place)s."), + RelLib.Person.MALE : _("%(male_name)s was born on %(birth_date)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born on %(birth_date)s in %(birth_place)s."), + }, ] born_modified_date_with_place = [ { - RelLib.Person.UNKNOWN : _("This person was born %(modified_date)s in %(birth_place)s."), - RelLib.Person.MALE : _("He was born %(modified_date)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("She was born %(modified_date)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born %(modified_date)s in %(birth_place)s."), + RelLib.Person.MALE : _("He was born %(modified_date)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("She was born %(modified_date)s in %(birth_place)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born %(modified_date)s in %(birth_place)s."), - RelLib.Person.MALE : _("%(male_name)s was born %(modified_date)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born %(modified_date)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born %(modified_date)s in %(birth_place)s."), + RelLib.Person.MALE : _("%(male_name)s was born %(modified_date)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born %(modified_date)s in %(birth_place)s."), + }, ] born_full_date_no_place = [ { - RelLib.Person.UNKNOWN : _("This person was born on %(birth_date)s."), - RelLib.Person.MALE : _("He was born on %(birth_date)s."), - RelLib.Person.FEMALE : _("She was born on %(birth_date)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born on %(birth_date)s."), + RelLib.Person.MALE : _("He was born on %(birth_date)s."), + RelLib.Person.FEMALE : _("She was born on %(birth_date)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born on %(birth_date)s."), - RelLib.Person.MALE : _("%(male_name)s was born on %(birth_date)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born on %(birth_date)s."), - }, + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born on %(birth_date)s."), + RelLib.Person.MALE : _("%(male_name)s was born on %(birth_date)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born on %(birth_date)s."), + }, ] born_modified_date_no_place = [ { - RelLib.Person.UNKNOWN : _("This person was born %(modified_date)s."), - RelLib.Person.MALE : _("He was born %(modified_date)s."), - RelLib.Person.FEMALE : _("She was born %(modified_date)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born %(modified_date)s."), + RelLib.Person.MALE : _("He was born %(modified_date)s."), + RelLib.Person.FEMALE : _("She was born %(modified_date)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born %(modified_date)s."), - RelLib.Person.MALE : _("%(male_name)s was born %(modified_date)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born %(modified_date)s."), - }, + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born %(modified_date)s."), + RelLib.Person.MALE : _("%(male_name)s was born %(modified_date)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born %(modified_date)s."), + }, ] born_partial_date_with_place = [ { - RelLib.Person.UNKNOWN : _("This person was born in %(month_year)s in %(birth_place)s."), - RelLib.Person.MALE : _("He was born in %(month_year)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("She was born in %(month_year)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born in %(month_year)s in %(birth_place)s."), + RelLib.Person.MALE : _("He was born in %(month_year)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("She was born in %(month_year)s in %(birth_place)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(month_year)s in %(birth_place)s."), - RelLib.Person.MALE : _("%(male_name)s was born in %(month_year)s in %(birth_place)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born in %(month_year)s in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(month_year)s in %(birth_place)s."), + RelLib.Person.MALE : _("%(male_name)s was born in %(month_year)s in %(birth_place)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born in %(month_year)s in %(birth_place)s."), + }, ] born_partial_date_no_place = [ { - RelLib.Person.UNKNOWN : _("This person was born in %(month_year)s."), - RelLib.Person.MALE : _("He was born in %(month_year)s."), - RelLib.Person.FEMALE : _("She was born in %(month_year)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born in %(month_year)s."), + RelLib.Person.MALE : _("He was born in %(month_year)s."), + RelLib.Person.FEMALE : _("She was born in %(month_year)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(month_year)s."), - RelLib.Person.MALE : _("%(male_name)s was born in %(month_year)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born in %(month_year)s."), + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(month_year)s."), + RelLib.Person.MALE : _("%(male_name)s was born in %(month_year)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born in %(month_year)s."), } ] born_no_date_with_place = [ { - RelLib.Person.UNKNOWN : _("This person was born in %(birth_place)s."), - RelLib.Person.MALE : _("He was born in %(birth_place)s."), - RelLib.Person.FEMALE : _("She was born in %(birth_place)s."), - }, + RelLib.Person.UNKNOWN : _("This person was born in %(birth_place)s."), + RelLib.Person.MALE : _("He was born in %(birth_place)s."), + RelLib.Person.FEMALE : _("She was born in %(birth_place)s."), + }, { - RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(birth_place)s."), - RelLib.Person.MALE : _("%(male_name)s was born in %(birth_place)s."), - RelLib.Person.FEMALE : _("%(female_name)s was born in %(birth_place)s."), + RelLib.Person.UNKNOWN : _("%(unknown_gender_name)s was born in %(birth_place)s."), + RelLib.Person.MALE : _("%(male_name)s was born in %(birth_place)s."), + RelLib.Person.FEMALE : _("%(female_name)s was born in %(birth_place)s."), } ] @@ -151,331 +151,331 @@ born_no_date_with_place = [ died_full_date_with_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died on %(death_date)s in %(death_place)s."), - _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("This person died on %(death_date)s in %(death_place)s."), + _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("This person died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died on %(death_date)s in %(death_place)s."), - _("He died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("He died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("He died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("He died on %(death_date)s in %(death_place)s."), + _("He died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("He died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("He died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died on %(death_date)s in %(death_place)s."), - _("She died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("She died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("She died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], - }, + _("She died on %(death_date)s in %(death_place)s."), + _("She died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("She died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("She died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s."), - _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s."), + _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died on %(death_date)s in %(death_place)s."), - _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(male_name)s died on %(death_date)s in %(death_place)s."), + _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(male_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died on %(death_date)s in %(death_place)s."), - _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], - }, + _("%(female_name)s died on %(death_date)s in %(death_place)s."), + _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(female_name)s died on %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], + }, ] died_modified_date_with_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died %(death_date)s in %(death_place)s."), - _("This person died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("This person died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("This person died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("This person died %(death_date)s in %(death_place)s."), + _("This person died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("This person died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("This person died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died %(death_date)s in %(death_place)s."), - _("He died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("He died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("He died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("He died %(death_date)s in %(death_place)s."), + _("He died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("He died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("He died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died %(death_date)s in %(death_place)s."), - _("She died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("She died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("She died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], - }, + _("She died %(death_date)s in %(death_place)s."), + _("She died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("She died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("She died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s."), - _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s."), + _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died %(death_date)s in %(death_place)s."), - _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(male_name)s died %(death_date)s in %(death_place)s."), + _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(male_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died %(death_date)s in %(death_place)s."), - _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), - _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), - _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), - ], - }, + _("%(female_name)s died %(death_date)s in %(death_place)s."), + _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d years."), + _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d months."), + _("%(female_name)s died %(death_date)s in %(death_place)s at the age of %(age)d days."), + ], + }, ] died_full_date_no_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died on %(death_date)s."), - _("This person died on %(death_date)s at the age of %(age)d years."), - _("This person died on %(death_date)s at the age of %(age)d months."), - _("This person died on %(death_date)s at the age of %(age)d days."), - ], + _("This person died on %(death_date)s."), + _("This person died on %(death_date)s at the age of %(age)d years."), + _("This person died on %(death_date)s at the age of %(age)d months."), + _("This person died on %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died on %(death_date)s."), - _("He died on %(death_date)s at the age of %(age)d years."), - _("He died on %(death_date)s at the age of %(age)d months."), - _("He died on %(death_date)s at the age of %(age)d days."), - ], + _("He died on %(death_date)s."), + _("He died on %(death_date)s at the age of %(age)d years."), + _("He died on %(death_date)s at the age of %(age)d months."), + _("He died on %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died on %(death_date)s."), - _("She died on %(death_date)s at the age of %(age)d years."), - _("She died on %(death_date)s at the age of %(age)d months."), - _("She died on %(death_date)s at the age of %(age)d days."), - ], - }, + _("She died on %(death_date)s."), + _("She died on %(death_date)s at the age of %(age)d years."), + _("She died on %(death_date)s at the age of %(age)d months."), + _("She died on %(death_date)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died on %(death_date)s."), - _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died on %(death_date)s."), + _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died on %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died on %(death_date)s."), - _("%(male_name)s died on %(death_date)s at the age of %(age)d years."), - _("%(male_name)s died on %(death_date)s at the age of %(age)d months."), - _("%(male_name)s died on %(death_date)s at the age of %(age)d days."), - ], + _("%(male_name)s died on %(death_date)s."), + _("%(male_name)s died on %(death_date)s at the age of %(age)d years."), + _("%(male_name)s died on %(death_date)s at the age of %(age)d months."), + _("%(male_name)s died on %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died on %(death_date)s."), - _("%(female_name)s died on %(death_date)s at the age of %(age)d years."), - _("%(female_name)s died on %(death_date)s at the age of %(age)d months."), - _("%(female_name)s died on %(death_date)s at the age of %(age)d days."), - ], - }, + _("%(female_name)s died on %(death_date)s."), + _("%(female_name)s died on %(death_date)s at the age of %(age)d years."), + _("%(female_name)s died on %(death_date)s at the age of %(age)d months."), + _("%(female_name)s died on %(death_date)s at the age of %(age)d days."), + ], + }, ] died_modified_date_no_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died %(death_date)s."), - _("This person died %(death_date)s at the age of %(age)d years."), - _("This person died %(death_date)s at the age of %(age)d months."), - _("This person died %(death_date)s at the age of %(age)d days."), - ], + _("This person died %(death_date)s."), + _("This person died %(death_date)s at the age of %(age)d years."), + _("This person died %(death_date)s at the age of %(age)d months."), + _("This person died %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died %(death_date)s."), - _("He died %(death_date)s at the age of %(age)d years."), - _("He died %(death_date)s at the age of %(age)d months."), - _("He died %(death_date)s at the age of %(age)d days."), - ], + _("He died %(death_date)s."), + _("He died %(death_date)s at the age of %(age)d years."), + _("He died %(death_date)s at the age of %(age)d months."), + _("He died %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died %(death_date)s."), - _("She died %(death_date)s at the age of %(age)d years."), - _("She died %(death_date)s at the age of %(age)d months."), - _("She died %(death_date)s at the age of %(age)d days."), - ], - }, + _("She died %(death_date)s."), + _("She died %(death_date)s at the age of %(age)d years."), + _("She died %(death_date)s at the age of %(age)d months."), + _("She died %(death_date)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died %(death_date)s."), - _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died %(death_date)s."), + _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died %(death_date)s."), - _("%(male_name)s died %(death_date)s at the age of %(age)d years."), - _("%(male_name)s died %(death_date)s at the age of %(age)d months."), - _("%(male_name)s died %(death_date)s at the age of %(age)d days."), - ], + _("%(male_name)s died %(death_date)s."), + _("%(male_name)s died %(death_date)s at the age of %(age)d years."), + _("%(male_name)s died %(death_date)s at the age of %(age)d months."), + _("%(male_name)s died %(death_date)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died %(death_date)s."), - _("%(female_name)s died %(death_date)s at the age of %(age)d years."), - _("%(female_name)s died %(death_date)s at the age of %(age)d months."), - _("%(female_name)s died %(death_date)s at the age of %(age)d days."), - ], - }, + _("%(female_name)s died %(death_date)s."), + _("%(female_name)s died %(death_date)s at the age of %(age)d years."), + _("%(female_name)s died %(death_date)s at the age of %(age)d months."), + _("%(female_name)s died %(death_date)s at the age of %(age)d days."), + ], + }, ] died_partial_date_with_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died in %(month_year)s in %(death_place)s."), - _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d days."), - ], + _("This person died in %(month_year)s in %(death_place)s."), + _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("This person died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died in %(month_year)s in %(death_place)s."), - _("He died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("He died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("He died in %(month_year)s in %(death_place)s at the age of %(age)d days."), - ], + _("He died in %(month_year)s in %(death_place)s."), + _("He died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("He died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("He died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died in %(month_year)s in %(death_place)s."), - _("She died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("She died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("She died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + _("She died in %(month_year)s in %(death_place)s."), + _("She died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("She died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("She died in %(month_year)s in %(death_place)s at the age of %(age)d days."), ] - }, + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s."), - _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s."), + _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died in %(month_year)s in %(death_place)s."), - _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), - ], + _("%(male_name)s died in %(month_year)s in %(death_place)s."), + _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("%(male_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died in %(month_year)s in %(death_place)s."), - _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), - _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), - _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), - ], - }, + _("%(female_name)s died in %(month_year)s in %(death_place)s."), + _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d years."), + _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d months."), + _("%(female_name)s died in %(month_year)s in %(death_place)s at the age of %(age)d days."), + ], + }, ] died_partial_date_no_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died in %(month_year)s."), - _("This person died in %(month_year)s at the age of %(age)d years."), - _("This person died in %(month_year)s at the age of %(age)d months."), - _("This person died in %(month_year)s at the age of %(age)d days."), - ], + _("This person died in %(month_year)s."), + _("This person died in %(month_year)s at the age of %(age)d years."), + _("This person died in %(month_year)s at the age of %(age)d months."), + _("This person died in %(month_year)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died in %(month_year)s."), - _("He died in %(month_year)s at the age of %(age)d years."), - _("He died in %(month_year)s at the age of %(age)d months."), - _("He died in %(month_year)s at the age of %(age)d days."), - ], + _("He died in %(month_year)s."), + _("He died in %(month_year)s at the age of %(age)d years."), + _("He died in %(month_year)s at the age of %(age)d months."), + _("He died in %(month_year)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died in %(month_year)s."), - _("She died in %(month_year)s at the age of %(age)d years."), - _("She died in %(month_year)s at the age of %(age)d months."), - _("She died in %(month_year)s at the age of %(age)d days."), - ], - }, + _("She died in %(month_year)s."), + _("She died in %(month_year)s at the age of %(age)d years."), + _("She died in %(month_year)s at the age of %(age)d months."), + _("She died in %(month_year)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died in %(month_year)s."), - _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died in %(month_year)s."), + _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died in %(month_year)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died in %(month_year)s."), - _("%(male_name)s died in %(month_year)s at the age of %(age)d years."), - _("%(male_name)s died in %(month_year)s at the age of %(age)d months."), - _("%(male_name)s died in %(month_year)s at the age of %(age)d days."), - ], + _("%(male_name)s died in %(month_year)s."), + _("%(male_name)s died in %(month_year)s at the age of %(age)d years."), + _("%(male_name)s died in %(month_year)s at the age of %(age)d months."), + _("%(male_name)s died in %(month_year)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died in %(month_year)s."), - _("%(female_name)s died in %(month_year)s at the age of %(age)d years."), - _("%(female_name)s died in %(month_year)s at the age of %(age)d months."), - _("%(female_name)s died in %(month_year)s at the age of %(age)d days."), - ], + _("%(female_name)s died in %(month_year)s."), + _("%(female_name)s died in %(month_year)s at the age of %(age)d years."), + _("%(female_name)s died in %(month_year)s at the age of %(age)d months."), + _("%(female_name)s died in %(month_year)s at the age of %(age)d days."), + ], } ] died_no_date_with_place = [ { RelLib.Person.UNKNOWN : [ - _("This person died in %(death_place)s."), - _("This person died in %(death_place)s at the age of %(age)d years."), - _("This person died in %(death_place)s at the age of %(age)d months."), - _("This person died in %(death_place)s at the age of %(age)d days."), - ], + _("This person died in %(death_place)s."), + _("This person died in %(death_place)s at the age of %(age)d years."), + _("This person died in %(death_place)s at the age of %(age)d months."), + _("This person died in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("He died in %(death_place)s."), - _("He died in %(death_place)s at the age of %(age)d years."), - _("He died in %(death_place)s at the age of %(age)d months."), - _("He died in %(death_place)s at the age of %(age)d days."), - ], + _("He died in %(death_place)s."), + _("He died in %(death_place)s at the age of %(age)d years."), + _("He died in %(death_place)s at the age of %(age)d months."), + _("He died in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("She died in %(death_place)s."), - _("She died in %(death_place)s at the age of %(age)d years."), - _("She died in %(death_place)s at the age of %(age)d months."), - _("She died in %(death_place)s at the age of %(age)d days."), - ], - }, + _("She died in %(death_place)s."), + _("She died in %(death_place)s at the age of %(age)d years."), + _("She died in %(death_place)s at the age of %(age)d months."), + _("She died in %(death_place)s at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s died in %(death_place)s."), - _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d years."), - _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d months."), - _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d days."), - ], + _("%(unknown_gender_name)s died in %(death_place)s."), + _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d years."), + _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d months."), + _("%(unknown_gender_name)s died in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - _("%(male_name)s died in %(death_place)s."), - _("%(male_name)s died in %(death_place)s at the age of %(age)d years."), - _("%(male_name)s died in %(death_place)s at the age of %(age)d months."), - _("%(male_name)s died in %(death_place)s at the age of %(age)d days."), - ], + _("%(male_name)s died in %(death_place)s."), + _("%(male_name)s died in %(death_place)s at the age of %(age)d years."), + _("%(male_name)s died in %(death_place)s at the age of %(age)d months."), + _("%(male_name)s died in %(death_place)s at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s died in %(death_place)s."), - _("%(female_name)s died in %(death_place)s at the age of %(age)d years."), - _("%(female_name)s died in %(death_place)s at the age of %(age)d months."), - _("%(female_name)s died in %(death_place)s at the age of %(age)d days."), - ], + _("%(female_name)s died in %(death_place)s."), + _("%(female_name)s died in %(death_place)s at the age of %(age)d years."), + _("%(female_name)s died in %(death_place)s at the age of %(age)d months."), + _("%(female_name)s died in %(death_place)s at the age of %(age)d days."), + ], } ] died_no_date_no_place = [ { RelLib.Person.UNKNOWN : [ - "", - _("This person died at the age of %(age)d years."), - _("This person died at the age of %(age)d months."), - _("This person died at the age of %(age)d days."), - ], + "", + _("This person died at the age of %(age)d years."), + _("This person died at the age of %(age)d months."), + _("This person died at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - "", - _("He died at the age of %(age)d years."), - _("He died at the age of %(age)d months."), - _("He died at the age of %(age)d days."), - ], + "", + _("He died at the age of %(age)d years."), + _("He died at the age of %(age)d months."), + _("He died at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - "", - _("She died at the age of %(age)d years."), - _("She died at the age of %(age)d months."), - _("She died at the age of %(age)d days."), - ], - }, + "", + _("She died at the age of %(age)d years."), + _("She died at the age of %(age)d months."), + _("She died at the age of %(age)d days."), + ], + }, { RelLib.Person.UNKNOWN : [ - "", - _("%(unknown_gender_name)s died at the age of %(age)d years."), - _("%(unknown_gender_name)s died at the age of %(age)d months."), - _("%(unknown_gender_name)s died at the age of %(age)d days."), - ], + "", + _("%(unknown_gender_name)s died at the age of %(age)d years."), + _("%(unknown_gender_name)s died at the age of %(age)d months."), + _("%(unknown_gender_name)s died at the age of %(age)d days."), + ], RelLib.Person.MALE : [ - "", - _("%(male_name)s died at the age of %(age)d years."), - _("%(male_name)s died at the age of %(age)d months."), - _("%(male_name)s died at the age of %(age)d days."), - ], + "", + _("%(male_name)s died at the age of %(age)d years."), + _("%(male_name)s died at the age of %(age)d months."), + _("%(male_name)s died at the age of %(age)d days."), + ], RelLib.Person.FEMALE : [ - "", - _("%(female_name)s died at the age of %(age)d years."), - _("%(female_name)s died at the age of %(age)d months."), - _("%(female_name)s died at the age of %(age)d days."), - ], - }, + "", + _("%(female_name)s died at the age of %(age)d years."), + _("%(female_name)s died at the age of %(age)d months."), + _("%(female_name)s died at the age of %(age)d days."), + ], + }, ] #------------------------------------------------------------------------ @@ -486,121 +486,121 @@ died_no_date_no_place = [ buried_full_date_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried on %(burial_date)s in %(burial_place)s."), - _("He was buried on %(burial_date)s in %(burial_place)s."), - ], + _("%(male_name)s was buried on %(burial_date)s in %(burial_place)s."), + _("He was buried on %(burial_date)s in %(burial_place)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried on %(burial_date)s in %(burial_place)s."), - _("She was buried on %(burial_date)s in %(burial_place)s."), - ], + _("%(female_name)s was buried on %(burial_date)s in %(burial_place)s."), + _("She was buried on %(burial_date)s in %(burial_place)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried on %(burial_date)s in %(burial_place)s."), - _("This person was buried on %(burial_date)s in %(burial_place)s."), - ], + _("%(unknown_gender_name)s was buried on %(burial_date)s in %(burial_place)s."), + _("This person was buried on %(burial_date)s in %(burial_place)s."), + ], } buried_full_date_no_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried on %(burial_date)s."), - _("He was buried on %(burial_date)s."), - ], + _("%(male_name)s was buried on %(burial_date)s."), + _("He was buried on %(burial_date)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried on %(burial_date)s."), - _("She was buried on %(burial_date)s."), - ], + _("%(female_name)s was buried on %(burial_date)s."), + _("She was buried on %(burial_date)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried on %(burial_date)s."), - _("This person was buried on %(burial_date)s."), - ], + _("%(unknown_gender_name)s was buried on %(burial_date)s."), + _("This person was buried on %(burial_date)s."), + ], } buried_partial_date_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried in %(month_year)s in %(burial_place)s."), - _("He was buried in %(month_year)s in %(burial_place)s."), - ], + _("%(male_name)s was buried in %(month_year)s in %(burial_place)s."), + _("He was buried in %(month_year)s in %(burial_place)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried in %(month_year)s in %(burial_place)s."), - _("She was buried in %(month_year)s in %(burial_place)s."), - ], + _("%(female_name)s was buried in %(month_year)s in %(burial_place)s."), + _("She was buried in %(month_year)s in %(burial_place)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried in %(month_year)s in %(burial_place)s."), - _("This person was buried in %(month_year)s in %(burial_place)s."), - ], + _("%(unknown_gender_name)s was buried in %(month_year)s in %(burial_place)s."), + _("This person was buried in %(month_year)s in %(burial_place)s."), + ], } buried_partial_date_no_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried in %(month_year)s."), - _("He was buried in %(month_year)s."), - ], + _("%(male_name)s was buried in %(month_year)s."), + _("He was buried in %(month_year)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried in %(month_year)s."), - _("She was buried in %(month_year)s."), - ], + _("%(female_name)s was buried in %(month_year)s."), + _("She was buried in %(month_year)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried in %(month_year)s."), - _("This person was buried in %(month_year)s."), - ], + _("%(unknown_gender_name)s was buried in %(month_year)s."), + _("This person was buried in %(month_year)s."), + ], } buried_modified_date_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried %(modified_date)s in %(burial_place)s."), - _("He was buried %(modified_date)s in %(burial_place)s."), - ], + _("%(male_name)s was buried %(modified_date)s in %(burial_place)s."), + _("He was buried %(modified_date)s in %(burial_place)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried %(modified_date)s in %(burial_place)s."), - _("She was buried %(modified_date)s in %(burial_place)s."), - ], + _("%(female_name)s was buried %(modified_date)s in %(burial_place)s."), + _("She was buried %(modified_date)s in %(burial_place)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried %(modified_date)s in %(burial_place)s."), - _("This person was buried %(modified_date)s in %(burial_place)s."), - ], + _("%(unknown_gender_name)s was buried %(modified_date)s in %(burial_place)s."), + _("This person was buried %(modified_date)s in %(burial_place)s."), + ], } buried_modified_date_no_place = { RelLib.Person.MALE: [ - _("%(male_name)s was buried %(modified_date)s."), - _("He was buried %(modified_date)s."), - ], + _("%(male_name)s was buried %(modified_date)s."), + _("He was buried %(modified_date)s."), + ], RelLib.Person.FEMALE: [ - _("%(female_name)s was buried %(modified_date)s."), - _("She was buried %(modified_date)s."), - ], + _("%(female_name)s was buried %(modified_date)s."), + _("She was buried %(modified_date)s."), + ], RelLib.Person.UNKNOWN: [ - _("%(unknown_gender_name)s was buried %(modified_date)s."), - _("This person was buried %(modified_date)s."), - ], + _("%(unknown_gender_name)s was buried %(modified_date)s."), + _("This person was buried %(modified_date)s."), + ], } buried_no_date_place = { RelLib.Person.MALE : [ - _("%(male_name)s was buried in %(burial_place)s."), - _("He was buried in %(burial_place)s."), - ], + _("%(male_name)s was buried in %(burial_place)s."), + _("He was buried in %(burial_place)s."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s was buried in %(burial_place)s."), - _("She was buried in %(burial_place)s."), - ], + _("%(female_name)s was buried in %(burial_place)s."), + _("She was buried in %(burial_place)s."), + ], RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s was buried in %(burial_place)s."), - _("This person was buried in %(burial_place)s."), - ], + _("%(unknown_gender_name)s was buried in %(burial_place)s."), + _("This person was buried in %(burial_place)s."), + ], } buried_no_date_no_place = { RelLib.Person.MALE : [ - _("%(male_name)s was buried."), - _("He was buried."), - ], + _("%(male_name)s was buried."), + _("He was buried."), + ], RelLib.Person.FEMALE : [ - _("%(female_name)s was buried."), - _("She was buried."), - ], + _("%(female_name)s was buried."), + _("She was buried."), + ], RelLib.Person.UNKNOWN : [ - _("%(unknown_gender_name)s was buried."), - _("This person was buried."), + _("%(unknown_gender_name)s was buried."), + _("This person was buried."), ] } @@ -612,98 +612,98 @@ buried_no_date_no_place = { marriage_first_date_place = { RelLib.Person.UNKNOWN : [ - _('This person married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } marriage_also_date_place = { RelLib.Person.UNKNOWN : [ - _('This person also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She also married %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She also married %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She also married %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } marriage_first_date = { RelLib.Person.UNKNOWN : [ - _('This person married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } marriage_also_date = { RelLib.Person.UNKNOWN : [ - _('This person also married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person also married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person also married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person also married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person also married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person also married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He also married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He also married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He also married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He also married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He also married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also married %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She also married %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She also married %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She also married %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She also married %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She also married %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } marriage_first_place = { - RelLib.Person.UNKNOWN : _('This person married %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He married %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She married %(spouse)s in %(place)s%(endnotes)s.'), } marriage_also_place = { - RelLib.Person.UNKNOWN : _('This person also married %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also married %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also married %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also married %(spouse)s in %(place)s%(endnotes)s.'), } marriage_first_only = { - RelLib.Person.UNKNOWN : _('This person married %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He married %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She married %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person married %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He married %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She married %(spouse)s%(endnotes)s.'), } marriage_also_only = { - RelLib.Person.UNKNOWN : _('This person also married %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also married %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also married %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also married %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also married %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also married %(spouse)s%(endnotes)s.'), } #------------------------------------------------------------------------ @@ -714,98 +714,98 @@ marriage_also_only = { unmarried_first_date_place = { RelLib.Person.UNKNOWN : [ - _('This person had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } unmarried_also_date_place = { RelLib.Person.UNKNOWN : [ - _('This person also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She also had an unmarried relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She also had an unmarried relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She also had an unmarried relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } unmarried_first_date = { RelLib.Person.UNKNOWN : [ - _('This person had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } unmarried_also_date = { RelLib.Person.UNKNOWN : [ - _('This person also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She also had an unmarried relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She also had an unmarried relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She also had an unmarried relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } unmarried_first_place = { - RelLib.Person.UNKNOWN : _('This person had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), } unmarried_also_place = { - RelLib.Person.UNKNOWN : _('This person also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also had an unmarried relationship with %(spouse)s in %(place)s%(endnotes)s.'), } unmarried_first_only = { - RelLib.Person.UNKNOWN : _('This person had an unmarried relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He had an unmarried relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She had an unmarried relationship with %(spouse)s%(endnotes)s.'), } unmarried_also_only = { - RelLib.Person.UNKNOWN : _('This person also had an unmarried relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also had an unmarried relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also had an unmarried relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also had an unmarried relationship with %(spouse)s%(endnotes)s.'), } #------------------------------------------------------------------------ @@ -817,98 +817,98 @@ unmarried_also_only = { relationship_first_date_place = { RelLib.Person.UNKNOWN : [ - _('This person had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } relationship_also_date_place = { RelLib.Person.UNKNOWN : [ - _('This person also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('This person also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('This person also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('This person also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('This person also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('This person also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('He also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('He also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('He also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('He also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('He also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), - _('She also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), - _('She also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), - ], + _('She also had a relationship with %(spouse)s in %(partial_date)s in %(place)s%(endnotes)s.'), + _('She also had a relationship with %(spouse)s on %(full_date)s in %(place)s%(endnotes)s.'), + _('She also had a relationship with %(spouse)s %(modified_date)s in %(place)s%(endnotes)s.'), + ], } relationship_first_date = { RelLib.Person.UNKNOWN : [ - _('This person had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } relationship_also_date = { RelLib.Person.UNKNOWN : [ - _('This person also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('This person also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('This person also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('This person also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('This person also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('This person also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.MALE : [ - _('He also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('He also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('He also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('He also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('He also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('He also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], RelLib.Person.FEMALE : [ - _('She also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), - _('She also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), - _('She also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), - ], + _('She also had a relationship with %(spouse)s in %(partial_date)s%(endnotes)s.'), + _('She also had a relationship with %(spouse)s on %(full_date)s%(endnotes)s.'), + _('She also had a relationship with %(spouse)s %(modified_date)s%(endnotes)s.'), + ], } relationship_first_place = { - RelLib.Person.UNKNOWN : _('This person had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), } relationship_also_place = { - RelLib.Person.UNKNOWN : _('This person also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also had a relationship with %(spouse)s in %(place)s%(endnotes)s.'), } relationship_first_only = { - RelLib.Person.UNKNOWN : _('This person had a relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He had a relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She had a relationship with %(spouse)s%(endnotes)s.'), } relationship_also_only = { - RelLib.Person.UNKNOWN : _('This person also had a relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.MALE : _('He also had a relationship with %(spouse)s%(endnotes)s.'), - RelLib.Person.FEMALE : _('She also had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.UNKNOWN : _('This person also had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.MALE : _('He also had a relationship with %(spouse)s%(endnotes)s.'), + RelLib.Person.FEMALE : _('She also had a relationship with %(spouse)s%(endnotes)s.'), } #------------------------------------------------------------------------- @@ -920,100 +920,100 @@ relationship_also_only = { child_father_mother = { RelLib.Person.UNKNOWN: [ [ - _("This person is the child of %(father)s and %(mother)s."), - _("This person was the child of %(father)s and %(mother)s."), - ], + _("This person is the child of %(father)s and %(mother)s."), + _("This person was the child of %(father)s and %(mother)s."), + ], [ - _("%(male_name)s is the child of %(father)s and %(mother)s."), - _("%(male_name)s was the child of %(father)s and %(mother)s."), - ], - ], + _("%(male_name)s is the child of %(father)s and %(mother)s."), + _("%(male_name)s was the child of %(father)s and %(mother)s."), + ], + ], RelLib.Person.MALE : [ [ - _("He is the son of %(father)s and %(mother)s."), - _("He was the son of %(father)s and %(mother)s."), - ], + _("He is the son of %(father)s and %(mother)s."), + _("He was the son of %(father)s and %(mother)s."), + ], [ - _("%(male_name)s is the son of %(father)s and %(mother)s."), - _("%(male_name)s was the son of %(father)s and %(mother)s."), + _("%(male_name)s is the son of %(father)s and %(mother)s."), + _("%(male_name)s was the son of %(father)s and %(mother)s."), ] - ], + ], RelLib.Person.FEMALE : [ [ - _("She is the daughter of %(father)s and %(mother)s."), - _("She was the daughter of %(father)s and %(mother)s."), - ], + _("She is the daughter of %(father)s and %(mother)s."), + _("She was the daughter of %(father)s and %(mother)s."), + ], [ - _("%(female_name)s is the daughter of %(father)s and %(mother)s."), - _("%(female_name)s was the daughter of %(father)s and %(mother)s."), - ], + _("%(female_name)s is the daughter of %(father)s and %(mother)s."), + _("%(female_name)s was the daughter of %(father)s and %(mother)s."), + ], ] } child_father = { RelLib.Person.UNKNOWN : [ [ - _("This person is the child of %(father)s."), - _("This person was the child of %(father)s."), - ], + _("This person is the child of %(father)s."), + _("This person was the child of %(father)s."), + ], [ - _("%(male_name)s is the child of %(father)s."), - _("%(male_name)s was the child of %(father)s."), - ], - ], + _("%(male_name)s is the child of %(father)s."), + _("%(male_name)s was the child of %(father)s."), + ], + ], RelLib.Person.MALE : [ [ - _("He is the son of %(father)s."), - _("He was the son of %(father)s."), - ], + _("He is the son of %(father)s."), + _("He was the son of %(father)s."), + ], [ - _("%(male_name)s is the son of %(father)s."), - _("%(male_name)s was the son of %(father)s."), - ], - ], + _("%(male_name)s is the son of %(father)s."), + _("%(male_name)s was the son of %(father)s."), + ], + ], RelLib.Person.FEMALE : [ [ - _("She is the daughter of %(father)s."), - _("She was the daughter of %(father)s."), + _("She is the daughter of %(father)s."), + _("She was the daughter of %(father)s."), ], [ - _("%(female_name)s is the daughter of %(father)s."), - _("%(female_name)s was the daughter of %(father)s."), - ], - ], + _("%(female_name)s is the daughter of %(father)s."), + _("%(female_name)s was the daughter of %(father)s."), + ], + ], } child_mother = { RelLib.Person.UNKNOWN : [ [ - _("This person is the child of %(mother)s."), - _("This person was the child of %(mother)s."), - ], + _("This person is the child of %(mother)s."), + _("This person was the child of %(mother)s."), + ], [ - _("%(male_name)s is the child of %(mother)s."), - _("%(male_name)s was the child of %(mother)s."), - ], - ], + _("%(male_name)s is the child of %(mother)s."), + _("%(male_name)s was the child of %(mother)s."), + ], + ], RelLib.Person.MALE : [ [ - _("He is the son of %(mother)s."), - _("He was the son of %(mother)s."), - ], + _("He is the son of %(mother)s."), + _("He was the son of %(mother)s."), + ], [ - _("%(male_name)s is the son of %(mother)s."), - _("%(male_name)s was the son of %(mother)s."), - ], - ], + _("%(male_name)s is the son of %(mother)s."), + _("%(male_name)s was the son of %(mother)s."), + ], + ], RelLib.Person.FEMALE : [ [ - _("She is the daughter of %(mother)s."), - _("She was the daughter of %(mother)s."), - ], + _("She is the daughter of %(mother)s."), + _("She was the daughter of %(mother)s."), + ], [ - _("%(female_name)s is the daughter of %(mother)s."), - _("%(female_name)s was the daughter of %(mother)s."), - ], - ], + _("%(female_name)s is the daughter of %(mother)s."), + _("%(female_name)s was the daughter of %(mother)s."), + ], + ], } #------------------------------------------------------------------------- @@ -1022,10 +1022,10 @@ child_mother = { # #------------------------------------------------------------------------- _rtype = { - RelLib.FamilyRelType.UNMARRIED : _("unmarried"), - RelLib.FamilyRelType.CIVIL_UNION : _("civil union"), - RelLib.FamilyRelType.UNKNOWN : _("Unknown"), - RelLib.FamilyRelType.CUSTOM : _("Other"), + RelLib.FamilyRelType.UNMARRIED : _("unmarried"), + RelLib.FamilyRelType.CIVIL_UNION : _("civil union"), + RelLib.FamilyRelType.UNKNOWN : _("Unknown"), + RelLib.FamilyRelType.CUSTOM : _("Other"), } #------------------------------------------------------------------------- @@ -1035,7 +1035,7 @@ _rtype = { #------------------------------------------------------------------------- def pt2cm(pt): """ - Converts points to centimeters. Fonts are typically specified in points, + Converts points to centimeters. Fonts are typically specified in points, but the BaseDoc classes use centimeters. @param pt: points @@ -1047,7 +1047,7 @@ def pt2cm(pt): def cm2pt(cm): """ - Converts centimeters to points. Fonts are typically specified in points, + Converts centimeters to points. Fonts are typically specified in points, but the BaseDoc classes use centimeters. @param cm: centimeters @@ -1063,13 +1063,13 @@ def rgb_color(color): @param color: list or tuple of integer values for red, green, and blue @type color: int - @returns: (r,g,b) tuple of floating point color values + @returns: (r, g, b) tuple of floating point color values @rtype: 3-tuple """ r = float(color[0])/255.0 g = float(color[1])/255.0 b = float(color[2])/255.0 - return (r,g,b) + return (r, g, b) def draw_wedge(doc, style, centerx, centery, radius, start_angle, end_angle, short_radius=0): @@ -1121,7 +1121,7 @@ def draw_wedge(doc, style, centerx, centery, radius, start_angle, delta = (eangle - sangle) / 2.0 rad = short_radius + (radius - short_radius) / 2.0 - return ( (centerx + cos(sangle + delta) * rad), + return ( (centerx + cos(sangle + delta) * rad), (centery + sin(sangle + delta) * rad)) @@ -1159,7 +1159,7 @@ def draw_pie_chart(doc, center_x, center_y, radius, data, start=0): for item in data: incr = 360.0*(item[1]/total) - draw_wedge(doc,item[0], center_x, center_y, radius, start, start + incr) + draw_wedge(doc, item[0], center_x, center_y, radius, start, start + incr) start += incr def draw_legend(doc, start_x, start_y, data, title, label_style): @@ -1178,7 +1178,7 @@ def draw_legend(doc, start_x, start_y, data, title, label_style): @type start_y: float @param data: List of tuples containing the data to be used to create the legend. In order to be compatible with the graph plots, the first and - third values of the tuple used. The format is (graphics_format, value, + third values of the tuple used. The format is (graphics_format, value, legend_description). @type data: list """ @@ -1225,12 +1225,12 @@ def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data): the L{draw_legend} function. @type data: list """ - doc.draw_line(format,start_x,start_y+height,start_x,start_y) - doc.draw_line(format,start_x,start_y+height,start_x+width,start_y+height) + doc.draw_line(format, start_x, start_y+height, start_x, start_y) + doc.draw_line(format, start_x, start_y+height, start_x+width, start_y+height) largest = 0.0 for item in data: - largest = max(item[1],largest) + largest = max(item[1], largest) scale = float(height)/float(largest) units = len(data) @@ -1241,19 +1241,19 @@ def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data): start = 0.5*box_width + start_x for index in range(units): size = float(data[index][1]) * scale - doc.draw_box(data[index][0],"",start,bottom-size,box_width,box_height) + doc.draw_box(data[index][0], "", start, bottom-size, box_width, box_height) start += box_width * 1.5 _t = time.localtime(time.time()) -_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % (_t[0],_t[1],_t[2])) +_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % (_t[0], _t[1], _t[2])) def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): """ Estimates the age of a person based off the birth and death dates of the person. A tuple containing the estimated upper and lower bounds of the person's age is returned. If either - the birth or death date is missing, a (-1,-1) is returned. + the birth or death date is missing, a (-1, -1) is returned. @param db: GRAMPS database to which the Person object belongs @type db: GrampsDbBase @@ -1267,7 +1267,7 @@ def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): used @type start_handle: str @returns: tuple containing the lower and upper bounds of the - person's age, or (-1,-1) if it could not be determined. + person's age, or (-1, -1) if it could not be determined. @rtype: tuple """ @@ -1289,7 +1289,7 @@ def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): # if either of the events is not defined, return an error message if not bhandle: - return (-1,-1) + return (-1, -1) bdata = db.get_event_from_handle(bhandle).get_date_object() if dhandle: @@ -1298,15 +1298,15 @@ def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): if today != None: ddata = today else: - return (-1,-1) + return (-1, -1) # if the date is not valid, return an error message if not bdata.get_valid() or not ddata.get_valid(): - return (-1,-1) + return (-1, -1) # if a year is not valid, return an error message if not bdata.get_year_valid() or not ddata.get_year_valid(): - return (-1,-1) + return (-1, -1) bstart = bdata.get_start_date() bstop = bdata.get_stop_date() @@ -1314,27 +1314,27 @@ def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): dstart = ddata.get_start_date() dstop = ddata.get_stop_date() - def _calc_diff(low,high): - if (low[1],low[0]) > (high[1],high[0]): + def _calc_diff(low, high): + if (low[1], low[0]) > (high[1], high[0]): return high[2] - low[2] - 1 else: return high[2] - low[2] if bstop == RelLib.Date.EMPTY and dstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstart,dstart) + lower = _calc_diff(bstart, dstart) age = (lower, lower) elif bstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstart,dstart) - upper = _calc_diff(bstart,dstop) - age = (lower,upper) + lower = _calc_diff(bstart, dstart) + upper = _calc_diff(bstart, dstop) + age = (lower, upper) elif dstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstop,dstart) - upper = _calc_diff(bstart,dstart) - age = (lower,upper) + lower = _calc_diff(bstop, dstart) + upper = _calc_diff(bstart, dstart) + age = (lower, upper) else: - lower = _calc_diff(bstop,dstart) - upper = _calc_diff(bstart,dstop) - age = (lower,upper) + lower = _calc_diff(bstop, dstart) + upper = _calc_diff(bstart, dstop) + age = (lower, upper) return age def estimate_age_on_date(db, person, ddata=_TODAY): @@ -1346,38 +1346,38 @@ def estimate_age_on_date(db, person, ddata=_TODAY): if bref: bhandle = bref.get_reference_handle() if not bhandle: - return (-1,-1) + return (-1, -1) bdata = db.get_event_from_handle(bhandle).get_date_object() # if the date is not valid, return an error message if not bdata.get_valid() or not ddata.get_valid(): - return (-1,-1) + return (-1, -1) # if a year is not valid, return an error message if not bdata.get_year_valid() or not ddata.get_year_valid(): - return (-1,-1) + return (-1, -1) bstart = bdata.get_start_date() bstop = bdata.get_stop_date() dstart = ddata.get_start_date() dstop = ddata.get_stop_date() - def _calc_diff(low,high): - if (low[1],low[0]) > (high[1],high[0]): + def _calc_diff(low, high): + if (low[1], low[0]) > (high[1], high[0]): return high[2] - low[2] - 1 else: return high[2] - low[2] if bstop == RelLib.Date.EMPTY and dstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstart,dstart) + lower = _calc_diff(bstart, dstart) age = [lower, lower] elif bstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstart,dstart) - upper = _calc_diff(bstart,dstop) - age = [lower,upper] + lower = _calc_diff(bstart, dstart) + upper = _calc_diff(bstart, dstop) + age = [lower, upper] elif dstop == RelLib.Date.EMPTY: - lower = _calc_diff(bstop,dstart) - upper = _calc_diff(bstart,dstart) - age = [lower,upper] + lower = _calc_diff(bstop, dstart) + upper = _calc_diff(bstart, dstart) + age = [lower, upper] else: - lower = _calc_diff(bstop,dstart) - upper = _calc_diff(bstart,dstop) - age = [lower,upper] + lower = _calc_diff(bstop, dstart) + upper = _calc_diff(bstart, dstop) + age = [lower, upper] if age[0] < 0 and age[1] < 0: age = (-1, -1) elif age[0] > 120 and age[1] > 120: @@ -1396,7 +1396,7 @@ def roman(num): if not 0 < num < 4000: return "?" vals = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1) - nums = ( 'M','CM', 'D','CD', 'C','XC', 'L','XL', 'X','IX', 'V','IV', 'I') + nums = ( 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I') retval = "" for i in range(len(vals)): amount = int(num / vals[i]) @@ -1409,7 +1409,7 @@ def roman(num): # # #------------------------------------------------------------------------- -def place_name(db,place_handle): +def place_name(db, place_handle): if place_handle: place = db.get_place_from_handle(place_handle).get_title() else: @@ -1432,9 +1432,9 @@ def insert_image(database, doc, photo, w_cm=4.0, h_cm=4.0): if mime_type and mime_type.startswith("image"): filename = media_object.get_path() if os.path.exists(filename): - doc.add_media_object(filename,"right",w_cm,h_cm) + doc.add_media_object(filename, "right", w_cm, h_cm) else: - WarningDialog(_("Could not add photo to page"), + WarningDialog(_("Could not add photo to page"), "%s: %s" % (filename, _('File does not exist'))) #------------------------------------------------------------------------- @@ -1446,7 +1446,7 @@ def empty_notes(whatever): # Empty stab function for when endnotes are not needed return "" -def get_birth_death_strings(database,person,empty_date="",empty_place=""): +def get_birth_death_strings(database, person, empty_date="", empty_place=""): """ Returns strings for dates and places of birth and death. """ @@ -1481,9 +1481,9 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""): ddate_full = ddate_obj and ddate_obj.get_day_valid() ddate_mod = ddate_obj and ddate_obj.get_modifier() != RelLib.Date.MOD_NONE - return (bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod) + return (bdate, bplace, bdate_full, bdate_mod, ddate, dplace, ddate_full, ddate_mod) -def born_died_str(database,person,endnotes=None,name_object=None,person_name=None): +def born_died_str(database, person, endnotes=None, name_object=None, person_name=None): """ Composes a string describing birth and death of a person. Missing information will be omitted without loss of readability. @@ -1522,8 +1522,8 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non else: person_name = _('She') - bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \ - get_birth_death_strings(database,person) + bdate, bplace, bdate_full, bdate_mod, ddate, dplace, ddate_full, ddate_mod = \ + get_birth_death_strings(database, person) birth = None birth_ref = person.get_birth_ref() @@ -1536,17 +1536,17 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non death = database.get_event_from_handle(death_ref.ref) values = { - 'unknown_gender_name' : person_name, - 'name' : person_name, - 'male_name' : person_name, - 'female_name' : person_name, - 'endnotes' : endnotes(name_object), - 'birth_date' : bdate, - 'birth_place' : bplace, - 'birth_endnotes' : endnotes(birth), - 'death_date' : ddate, - 'death_place' : dplace, - 'death_endnotes' : endnotes(death), + 'unknown_gender_name' : person_name, + 'name' : person_name, + 'male_name' : person_name, + 'female_name' : person_name, + 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, + 'birth_place' : bplace, + 'birth_endnotes' : endnotes(birth), + 'death_date' : ddate, + 'death_place' : dplace, + 'death_endnotes' : endnotes(death), } if person.get_gender() == RelLib.Person.MALE: @@ -1700,8 +1700,8 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non # married_str # #------------------------------------------------------------------------- -def married_str(database,person,family,endnotes=None, - empty_date="",empty_place="",is_first=True): +def married_str(database, person, family, endnotes=None, + empty_date="", empty_place="", is_first=True): """ Composes a string describing marriage of a person. Missing information will be omitted without loss of readability. Optional references may be added to @@ -1744,12 +1744,12 @@ def married_str(database,person,family,endnotes=None, relationship = family.get_relationship() values = { - 'spouse' : spouse_name, - 'endnotes' : endnotes(event), - 'full_date' : date, - 'modified_date' : date, - 'partial_date' : date, - 'place' : place, + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'full_date' : date, + 'modified_date' : date, + 'partial_date' : date, + 'place' : place, } if event: @@ -1866,12 +1866,12 @@ def child_str(person, father_name="", mother_name="", dead=0, person_name=0): """ values = { - 'father' : father_name, - 'mother' : mother_name, - 'male_name' : person_name, - 'name' : person_name, - 'female_name' : person_name, - 'unknown_gender_name' : person_name, + 'father' : father_name, + 'mother' : mother_name, + 'male_name' : person_name, + 'name' : person_name, + 'female_name' : person_name, + 'unknown_gender_name' : person_name, } if person_name == 0: @@ -1897,7 +1897,7 @@ def child_str(person, father_name="", mother_name="", dead=0, person_name=0): # find_spouse # #------------------------------------------------------------------------- -def find_spouse(person,family): +def find_spouse(person, family): if person.get_handle() == family.get_father_handle(): spouse_handle = family.get_mother_handle() else: @@ -1909,7 +1909,7 @@ def find_spouse(person,family): # find_marriage # #------------------------------------------------------------------------- -def find_marriage(database,family): +def find_marriage(database, family): for event_ref in family.get_event_ref_list(): event = database.get_event_from_handle(event_ref.ref) if event and int(event.get_type()) == RelLib.EventType.MARRIAGE: @@ -1921,7 +1921,7 @@ def find_marriage(database,family): # born_str # #------------------------------------------------------------------------- -def born_str(database,person,person_name=None,empty_date="",empty_place=""): +def born_str(database, person, person_name=None, empty_date="", empty_place=""): """ Check birth record. Statement formats name precedes this @@ -1941,18 +1941,18 @@ def born_str(database,person,person_name=None,empty_date="",empty_place=""): text = "" - bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \ - get_birth_death_strings(database,person,empty_date,empty_place) + bdate, bplace, bdate_full, bdate_mod, ddate, dplace, ddate_full, ddate_mod = \ + get_birth_death_strings(database, person, empty_date, empty_place) value_map = { 'name' : person_name, 'male_name' : person_name, 'unknown_gender_name' : person_name, 'female_name' : person_name, - 'birth_date' : bdate, - 'birth_place' : bplace, - 'month_year' : bdate, - 'modified_date' : bdate, + 'birth_date' : bdate, + 'birth_place' : bplace, + 'month_year' : bdate, + 'modified_date' : bdate, } gender = person.get_gender() @@ -1987,8 +1987,8 @@ def born_str(database,person,person_name=None,empty_date="",empty_place=""): # died_str # #------------------------------------------------------------------------- -def died_str(database,person,person_name=None,empty_date="",empty_place="", - age=None,age_units=0): +def died_str(database, person, person_name=None, empty_date="", empty_place="", + age=None, age_units=0): """ Write obit sentence. FIRSTNAME died on Date @@ -2025,19 +2025,19 @@ def died_str(database,person,person_name=None,empty_date="",empty_place="", text = "" - bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \ - get_birth_death_strings(database,person,empty_date,empty_place) + bdate, bplace, bdate_full, bdate_mod, ddate, dplace, ddate_full, ddate_mod = \ + get_birth_death_strings(database, person, empty_date, empty_place) value_map = { 'name' : person_name, 'unknown_gender_name' : person_name, 'male_name' : person_name, 'female_name' : person_name, - 'death_date' : ddate, - 'modified_date' : ddate, - 'death_place' : dplace, - 'age' : age , - 'month_year' : ddate, + 'death_date' : ddate, + 'modified_date' : ddate, + 'death_place' : dplace, + 'age' : age , + 'month_year' : ddate, } gender = person.get_gender() @@ -2072,7 +2072,7 @@ def died_str(database,person,person_name=None,empty_date="",empty_place="", # buried_str # #------------------------------------------------------------------------- -def buried_str(database,person,person_name=None,empty_date="",empty_place=""): +def buried_str(database, person, person_name=None, empty_date="", empty_place=""): """ Check burial record. Statement formats name precedes this @@ -2122,10 +2122,10 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): 'male_name' : person_name, 'name' : person_name, 'female_name' : person_name, - 'burial_date' : bdate, - 'burial_place' : bplace, - 'month_year' : bdate, - 'modified_date' : bdate, + 'burial_date' : bdate, + 'burial_place' : bplace, + 'month_year' : bdate, + 'modified_date' : bdate, } if bdate and bdate_mod: @@ -2157,21 +2157,21 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): # list_person_str # #------------------------------------------------------------------------- -def list_person_str(database,person,empty_date="",empty_place=""): +def list_person_str(database, person, empty_date="", empty_place=""): """ Briefly list person and birth/death events. """ - bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \ - get_birth_death_strings(database,person) + bdate, bplace, bdate_full, bdate_mod, ddate, dplace, ddate_full, ddate_mod = \ + get_birth_death_strings(database, person) text = "" values = { - 'birth_date' : bdate, - 'birth_place' : bplace, - 'death_date' : ddate, - 'death_place' : dplace, + 'birth_date' : bdate, + 'birth_place' : bplace, + 'death_date' : ddate, + 'death_place' : dplace, } if bdate: @@ -2229,7 +2229,7 @@ def list_person_str(database,person,empty_date="",empty_place=""): text = "" return text -def get_birth_or_fallback(database,person): +def get_birth_or_fallback(database, person): birth_ref = person.get_birth_ref() if birth_ref: # regular birth found return database.get_event_from_handle(birth_ref.ref) @@ -2240,7 +2240,7 @@ def get_birth_or_fallback(database,person): return event return None -def get_death_or_fallback(database,person): +def get_death_or_fallback(database, person): birth_ref = person.get_death_ref() if birth_ref: # regular death found return database.get_event_from_handle(birth_ref.ref) @@ -2251,11 +2251,11 @@ def get_death_or_fallback(database,person): return event return None -def old_calc_age(database,person): +def old_calc_age(database, person): """ Calulate age. - Returns a tuple (age,units) where units is an integer representing + Returns a tuple (age, units) where units is an integer representing time units: no age info: 0 years: 1 @@ -2286,7 +2286,7 @@ def old_calc_age(database,person): # wihtout at least a year for each event we're clueless if not (birth_year_valid and death_year_valid): - return (age,units) + return (age, units) # FIXME: The code below uses hard-coded 31 days in a month # and 12 month in a year. This is incorrect for half the Gregorian @@ -2328,10 +2328,10 @@ def old_calc_age(database,person): age = death.get_day() + 31 - birth.get_day() unit = DAYS - return (age,units) + return (age, units) -def common_name(person,use_call=False): +def common_name(person, use_call=False): if use_call and person.get_primary_name().get_call_name(): return person.get_primary_name().get_call_name() else: @@ -2342,7 +2342,7 @@ def common_name(person,use_call=False): # Indexing function # #------------------------------------------------------------------------- -def get_person_mark(db,person): +def get_person_mark(db, person): """ Returns a IndexMark that can be used to index a person in a report @@ -2370,7 +2370,7 @@ def get_person_mark(db,person): if birth == " " and death == " ": key = name else: - key = "%s (%s - %s)" % (name,birth,death) + key = "%s (%s - %s)" % (name, birth, death) return BaseDoc.IndexMark( key, BaseDoc.INDEX_TYPE_ALP ) @@ -2386,12 +2386,12 @@ def get_address_str(addr): @param addr: the GRAMPS address instance """ str = "" - elems = [ addr.get_street(), - addr.get_city(), - addr.get_county(), - addr.get_state(), - addr.get_country(), - addr.get_postal_code(), + elems = [ addr.get_street(), + addr.get_city(), + addr.get_county(), + addr.get_state(), + addr.get_country(), + addr.get_postal_code(), addr.get_phone() ] for info in elems: @@ -2399,7 +2399,7 @@ def get_address_str(addr): if str == "": str = info else: - str = "%s, %s" % (str,info) + str = "%s, %s" % (str, info) return str #------------------------------------------------------------------------- @@ -2407,7 +2407,7 @@ def get_address_str(addr): # People Filters # #------------------------------------------------------------------------- -def get_person_filters(person,include_single=True): +def get_person_filters(person, include_single=True): """ Returns a list of filters that are relevant for the given person @@ -2437,23 +2437,23 @@ def get_person_filters(person,include_single=True): des = GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(Rules.Person.IsDescendantOf([gramps_id,1])) + des.add_rule(Rules.Person.IsDescendantOf([gramps_id, 1])) df = GenericFilter() df.set_name(_("Descendant Families of %s") % name) - df.add_rule(Rules.Person.IsDescendantFamilyOf([gramps_id,1])) + df.add_rule(Rules.Person.IsDescendantFamilyOf([gramps_id, 1])) ans = GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(Rules.Person.IsAncestorOf([gramps_id,1])) + ans.add_rule(Rules.Person.IsAncestorOf([gramps_id, 1])) com = GenericFilter() com.set_name(_("People with common ancestor with %s") % name) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) if include_single == True: - the_filters = [filt_id,all,des,df,ans,com] + the_filters = [filt_id, all, des, df, ans, com] else: - the_filters = [all,des,df,ans,com] + the_filters = [all, des, df, ans, com] the_filters.extend(CustomFilters.get_filters('Person')) return the_filters diff --git a/src/ViewManager.py b/src/ViewManager.py index f9588043d..aafe03ec9 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -77,6 +77,8 @@ import UndoHistory from DbLoader import DbLoader import GrampsDisplay from GrampsDb import ProgressMonitor +import gen.db + import ProgressDialog def show_url(dialog, link, user_data): @@ -1050,8 +1052,6 @@ class ViewManager: should enable signals, as well as finish up with other UI goodies. """ - import GrampsDb - if os.path.exists(filename): if not os.access(filename, os.W_OK): mode = "r" @@ -1071,8 +1071,8 @@ class ViewManager: mode = 'w' try: - dbclass = GrampsDb.gramps_db_factory(db_type = filetype) - except GrampsDb.GrampsDbException, msg: + dbclass = gen.db.dbdir.GrampsDBDir + except gen.db.exceptions.GrampsDbException, msg: QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename, _("This may be caused by an improper installation of GRAMPS.") + diff --git a/src/gen/__init__.py b/src/gen/__init__.py index b9222c227..08fcba51c 100644 --- a/src/gen/__init__.py +++ b/src/gen/__init__.py @@ -19,4 +19,4 @@ # __version__ = "$Revision: $" -__all__ = [ "proxy" ] +__all__ = [ "proxy", "db" ] diff --git a/src/gen/db/Makefile.am b/src/gen/db/Makefile.am new file mode 100644 index 000000000..8deffb1b1 --- /dev/null +++ b/src/gen/db/Makefile.am @@ -0,0 +1,30 @@ +# This is the src/RelLib level Makefile for Gramps +# We could use GNU make's ':=' syntax for nice wildcard use, +# but that is not necessarily portable. +# If not using GNU make, then list all .py files individually + +pkgdatadir = $(datadir)/@PACKAGE@/db + +pkgdata_PYTHON = \ + __init__.py\ + base.py \ + callback.py \ + cursor.py \ + dbconst.py \ + dbdir.py \ + exceptions.py \ + iterator.py \ + longop.py + +pkgpyexecdir = @pkgpyexecdir@/db +pkgpythondir = @pkgpythondir@/db + + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/gen/db/base.py similarity index 99% rename from src/GrampsDb/_GrampsDbBase.py rename to src/gen/db/base.py index 62a76afe5..0e3d63102 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/gen/db/base.py @@ -51,16 +51,16 @@ LOG = logging.getLogger(".GrampsDb") # #------------------------------------------------------------------------- from RelLib import * -from _GrampsDBCallback import GrampsDBCallback -from _CursorIterator import CursorIterator +from callback import GrampsDBCallback +from iterator import CursorIterator #------------------------------------------------------------------------- # # constants # #------------------------------------------------------------------------- -from _GrampsDbConst import * -from _GrampsCursor import GrampsCursor +from dbconst import * +from cursor import GrampsCursor _UNDO_SIZE = 1000 diff --git a/src/GrampsDb/_GrampsDBCallback.py b/src/gen/db/callback.py similarity index 100% rename from src/GrampsDb/_GrampsDBCallback.py rename to src/gen/db/callback.py diff --git a/src/GrampsDb/_GrampsCursor.py b/src/gen/db/cursor.py similarity index 100% rename from src/GrampsDb/_GrampsCursor.py rename to src/gen/db/cursor.py diff --git a/src/GrampsDb/_GrampsDbConst.py b/src/gen/db/dbconst.py similarity index 100% rename from src/GrampsDb/_GrampsDbConst.py rename to src/gen/db/dbconst.py diff --git a/src/GrampsDb/_GrampsDBDir.py b/src/gen/db/dbdir.py similarity index 99% rename from src/GrampsDb/_GrampsDBDir.py rename to src/gen/db/dbdir.py index 20ed41787..886543eb8 100644 --- a/src/GrampsDb/_GrampsDBDir.py +++ b/src/gen/db/dbdir.py @@ -48,12 +48,11 @@ log = logging.getLogger(".GrampsDb") # #------------------------------------------------------------------------- from RelLib import * -from _GrampsDbBase import * -from _DbUtils import db_copy -import _GrampsDbConst as const -from _GrampsDbExceptions import FileVersionError +from base import * +import dbconst as const +from exceptions import FileVersionError from BasicUtils import UpdateCallback -from _GrampsCursor import GrampsCursor +from cursor import GrampsCursor import Errors _MINVERSION = 9 @@ -172,7 +171,7 @@ class GrampsDBDirDupCursor(GrampsDBDirAssocCursor): # GrampsDBDir # #------------------------------------------------------------------------- -class GrampsDBDir(GrampsDbBase,UpdateCallback): +class GrampsDBDir(GrampsDbBase, UpdateCallback): """GRAMPS database object. This object is a base class for other objects.""" @@ -590,6 +589,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback): def load_from(self, other_database, filename, callback): try: self.load(filename,callback) + from GrampsDb import db_copy db_copy(other_database,self,callback) return 1 except DBERRS, msg: diff --git a/src/GrampsDb/_GrampsDbExceptions.py b/src/gen/db/exceptions.py similarity index 100% rename from src/GrampsDb/_GrampsDbExceptions.py rename to src/gen/db/exceptions.py diff --git a/src/GrampsDb/_CursorIterator.py b/src/gen/db/iterator.py similarity index 96% rename from src/GrampsDb/_CursorIterator.py rename to src/gen/db/iterator.py index cea1827d8..7ee6e87bd 100644 --- a/src/GrampsDb/_CursorIterator.py +++ b/src/gen/db/iterator.py @@ -1,4 +1,4 @@ -from _LongOpStatus import LongOpStatus +from longop import LongOpStatus class CursorIterator(object): diff --git a/src/GrampsDb/_LongOpStatus.py b/src/gen/db/longop.py similarity index 99% rename from src/GrampsDb/_LongOpStatus.py rename to src/gen/db/longop.py index e45eaf8d7..2ba24f714 100644 --- a/src/GrampsDb/_LongOpStatus.py +++ b/src/gen/db/longop.py @@ -1,6 +1,6 @@ import time -from _GrampsDBCallback import GrampsDBCallback +from callback import GrampsDBCallback class LongOpStatus(GrampsDBCallback): """LongOpStatus provides a way of communicating the status of a long diff --git a/src/gramps_main.py b/src/gramps_main.py index f0dfa2c28..0792764c8 100644 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -72,70 +72,70 @@ def register_stock_icons (): #iconpath to the base image. The front of the list has highest priority if platform.system() == "Windows": iconpaths = [ - (os.path.join(const.IMAGE_DIR,'48x48'),'.png'), - (const.IMAGE_DIR,'.png'), + (os.path.join(const.IMAGE_DIR, '48x48'), '.png'), + (const.IMAGE_DIR, '.png'), ] else : iconpaths = [ - (os.path.join(const.IMAGE_DIR,'scalable'),'.svg'), - (const.IMAGE_DIR,'.svg'), (const.IMAGE_DIR,'.png'), + (os.path.join(const.IMAGE_DIR, 'scalable'), '.svg'), + (const.IMAGE_DIR, '.svg'), (const.IMAGE_DIR, '.png'), ] - #sizes: menu=16, small_toolbar=18, large_toolbar=24, + #sizes: menu=16, small_toolbar=18, large_toolbar=24, # button=20, dnd=32, dialog=48 #add to the back of this list to overrule images set at beginning of list extraiconsize = [ - (os.path.join(const.IMAGE_DIR, '22x22'), - gtk.ICON_SIZE_LARGE_TOOLBAR), - (os.path.join(const.IMAGE_DIR, '16x16'), - gtk.ICON_SIZE_MENU), - (os.path.join(const.IMAGE_DIR, '22x22'), - gtk.ICON_SIZE_BUTTON), + (os.path.join(const.IMAGE_DIR, '22x22'), + gtk.ICON_SIZE_LARGE_TOOLBAR), + (os.path.join(const.IMAGE_DIR, '16x16'), + gtk.ICON_SIZE_MENU), + (os.path.join(const.IMAGE_DIR, '22x22'), + gtk.ICON_SIZE_BUTTON), ] items = [ - ('gramps-db',_('Family Trees'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-address',_('Address'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-attribute',_('Attribute'),gtk.gdk.CONTROL_MASK,0,''), - #('gramps-bookmark',_('Bookmarks'),gtk.gdk.CONTROL_MASK,0,''), - #('gramps-bookmark-delete',_('Delete bookmark'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-bookmark-edit',_('Edit Bookmarks'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-bookmark-new',_('Add Bookmark'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-date',_('Date'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-date-edit',_('Edit Date'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-event',_('Events'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-family',_('Family'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-font',_('Font'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-font-color',_('Font Color'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-font-bgcolor',_('Font Background Color'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-lock',_('Public'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-media',_('Media'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-notes',_('Notes'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-parents',_('Parents'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-parents-add',_('Add Parents'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-parents-open',_('Select Parents'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-pedigree',_('Pedigree'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-person',_('Person'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-place',_('Places'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-relation',_('Relationships'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-reports',_('Reports'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-repository',_('Repositories'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-source',_('Sources'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-spouse',_('Add Spouse'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-tools',_('Tools'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-unlock',_('Private'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-viewmedia',_('View'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-zoom-in',_('Zoom In'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-zoom-out',_('Zoom Out'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-zoom-fit-width',_('Fit Width'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-zoom-best-fit',_('Fit Page'),gtk.gdk.CONTROL_MASK,0,''), + ('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-address', _('Address'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-attribute', _('Attribute'), gtk.gdk.CONTROL_MASK, 0, ''), + #('gramps-bookmark', _('Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''), + #('gramps-bookmark-delete', _('Delete bookmark'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-bookmark-edit', _('Edit Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-bookmark-new', _('Add Bookmark'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-date', _('Date'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-date-edit', _('Edit Date'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-event', _('Events'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-family', _('Family'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-font', _('Font'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-font-color', _('Font Color'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-font-bgcolor', _('Font Background Color'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-lock', _('Public'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-media', _('Media'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-notes', _('Notes'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-parents', _('Parents'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-parents-add', _('Add Parents'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-parents-open', _('Select Parents'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-pedigree', _('Pedigree'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-person', _('Person'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-place', _('Places'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-relation', _('Relationships'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-reports', _('Reports'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-repository', _('Repositories'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-source', _('Sources'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-spouse', _('Add Spouse'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-tools', _('Tools'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-unlock', _('Private'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-viewmedia', _('View'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-zoom-in', _('Zoom In'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-zoom-out', _('Zoom Out'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-zoom-fit-width', _('Fit Width'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-zoom-best-fit', _('Fit Page'), gtk.gdk.CONTROL_MASK, 0, ''), ] # the following icons are not yet in new directory structure # they should be ported in the near future items_legacy = [ - ('gramps-export',_('Export'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-undo-history',_('Undo History'),gtk.gdk.CONTROL_MASK,0,''), - ('gramps-url',_('URL'),gtk.gdk.CONTROL_MASK,0,''), + ('gramps-export', _('Export'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-undo-history', _('Undo History'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-url', _('URL'), gtk.gdk.CONTROL_MASK, 0, ''), ] # Register our stock items @@ -147,8 +147,8 @@ def register_stock_icons (): for data in items+items_legacy: pixbuf = 0 - for (dirname,ext) in iconpaths: - icon_file = os.path.expanduser(os.path.join(dirname,data[0]+ext)) + for (dirname, ext) in iconpaths: + icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext)) if os.path.isfile(icon_file): try: pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file) @@ -157,7 +157,7 @@ def register_stock_icons (): pass if not pixbuf : - icon_file = os.path.join(const.IMAGE_DIR,'gramps.png') + icon_file = os.path.join(const.IMAGE_DIR, 'gramps.png') pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file) pixbuf = pixbuf.add_alpha(True, chr(0xff), chr(0xff), chr(0xff)) @@ -184,12 +184,12 @@ def register_stock_icons (): def build_user_paths(): - user_paths = [const.HOME_DIR, - os.path.join(const.HOME_DIR,"filters"), - os.path.join(const.HOME_DIR,"plugins"), - os.path.join(const.HOME_DIR,"docgen"), - os.path.join(const.HOME_DIR,"templates"), - os.path.join(const.HOME_DIR,"thumb")] + user_paths = [const.HOME_DIR, + os.path.join(const.HOME_DIR, "filters"), + os.path.join(const.HOME_DIR, "plugins"), + os.path.join(const.HOME_DIR, "docgen"), + os.path.join(const.HOME_DIR, "templates"), + os.path.join(const.HOME_DIR, "thumb")] for path in user_paths: if not os.path.isdir(path): @@ -208,33 +208,29 @@ class Gramps: process. It may spawn several windows and control several databases. """ - def __init__(self,args): + def __init__(self, args): try: build_user_paths() self.welcome() except OSError, msg: - ErrorDialog(_("Configuration error"),str(msg)) - return + ErrorDialog(_("Configuration error"), str(msg)) except Errors.GConfSchemaError, val: - ErrorDialog(_("Configuration error"),str(val) + + ErrorDialog(_("Configuration error"), str(val) + _("\n\nPossibly the installation of GRAMPS " "was incomplete. Make sure the GConf schema " "of GRAMPS is properly installed.")) gtk.main_quit() - return except: log.error("Error reading configuration.", exc_info=True) - return if not mime_type_is_defined(const.APP_GRAMPS): - ErrorDialog(_("Configuration error"), + ErrorDialog(_("Configuration error"), _("A definition for the MIME-type %s could not " "be found \n\nPossibly the installation of GRAMPS " "was incomplete. Make sure the MIME-types " "of GRAMPS are properly installed.") % const.APP_GRAMPS) gtk.main_quit() - return register_stock_icons() @@ -245,9 +241,9 @@ class Gramps: self.vm.init_interface() - # Depending on the nature of this session, + # Depending on the nature of this session, # we may need to change the order of operation - ah = ArgHandler.ArgHandler(state,self.vm,args) + ah = ArgHandler.ArgHandler(state, self.vm, args) if ah.need_gui(): ah.handle_args() self.vm.post_init_interface() @@ -263,7 +259,7 @@ class Gramps: # if not Config.get(Config.BETAWARN): # from QuestionDialog import WarningDialog # WarningDialog( -# _('Danger: This is unstable code!'), +# _('Danger: This is unstable code!'), # _("The GRAMPS 2.1 release is an early, experimental " # "branch of the future 2.2 release. This version is " # "not meant for normal usage. Use at your own risk.\n\n" @@ -275,6 +271,6 @@ class Gramps: # "releases of GRAMPS. BACKUP your existing databases " # "before opening them with this version, and make " # "sure to export your data to XML every now and then.")) -# Config.set(Config.AUTOLOAD,False) -# Config.set(Config.BETAWARN,True) +# Config.set(Config.AUTOLOAD, False) +# Config.set(Config.BETAWARN, True) diff --git a/src/plugins/Checkpoint.py b/src/plugins/Checkpoint.py index dc3b645cb..3aed3d1e3 100644 --- a/src/plugins/Checkpoint.py +++ b/src/plugins/Checkpoint.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -67,14 +67,14 @@ else: # Some message strings rcs_setup_failure_msg = [ - _("Checkpoint Archive Creation Failed"), + _("Checkpoint Archive Creation Failed"), _("No checkpointing archive was found. " "An attempt to create it has failed with the " "following message:\n\n%s") ] rcs_setup_success_msg = [ - _("Checkpoint Archive Created"), + _("Checkpoint Archive Created"), _("No checkpointing archive was found, " "so it was created to enable archiving.\n\n" "The archive file name is %s\n" @@ -84,24 +84,24 @@ rcs_setup_success_msg = [ ] archive_failure_msg = [ - _("Checkpoint Failed"), + _("Checkpoint Failed"), _("An attempt to archive the data failed " "with the following message:\n\n%s") ] archive_success_msg = [ - _("Checkpoint Succeeded "), + _("Checkpoint Succeeded "), _("The data was successfully archived.") ] retrieve_failure_msg = [ - _("Checkpoint Failed"), + _("Checkpoint Failed"), _("An attempt to retrieve the data failed " "with the following message:\n\n%s") ] retrieve_success_msg = [ - _("Checkpoint Succeeded "), + _("Checkpoint Succeeded "), _("The data was successfully retrieved.") ] @@ -118,7 +118,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): self.dbstate = dbstate if uistate: - ManagedWindow.ManagedWindow.__init__(self, uistate, [], + ManagedWindow.ManagedWindow.__init__(self, uistate, [], Checkpoint) self.callback = self.callback_real self.init_gui() @@ -130,8 +130,8 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): # Draw dialog and make it handle everything base = os.path.dirname(__file__) - glade_file = "%s/%s" % (base,"checkpoint.glade") - self.glade = gtk.glade.XML(glade_file,"top","gramps") + glade_file = "%s/%s" % (base, "checkpoint.glade") + self.glade = gtk.glade.XML(glade_file, "top", "gramps") self.cust_arch_cb = self.glade.get_widget("cust_arch") self.cust_ret_cb = self.glade.get_widget("cust_ret") @@ -153,7 +153,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): self.cust_arch_cb.set_sensitive(self.cust_rb.get_active()) self.cust_ret_cb.set_sensitive(self.cust_rb.get_active()) - self.rcs_rb.connect('toggled',self.rcs_toggled) + self.rcs_rb.connect('toggled', self.rcs_toggled) # Disable RCS if the rcs binary is not available # and show the normally hidden warning @@ -161,13 +161,13 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): self.title = _("Checkpoint Data") window = self.glade.get_widget('top') - self.set_window(window,self.glade.get_widget('title'),self.title) + self.set_window(window, self.glade.get_widget('title'), self.title) self.glade.signal_autoconnect({ - "on_close_clicked" : self.close, - "on_arch_clicked" : self.on_archive_clicked, - "on_ret_clicked" : self.on_retrieve_clicked, - "on_help_clicked" : self.on_help_clicked, + "on_close_clicked" : self.close, + "on_arch_clicked" : self.on_archive_clicked, + "on_ret_clicked" : self.on_retrieve_clicked, + "on_help_clicked" : self.on_help_clicked, }) self.show() @@ -179,38 +179,38 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): else: warning_label.hide() - def build_menu_names(self,obj): - return (_("Checkpoint tool"),None) + def build_menu_names(self, obj): + return (_("Checkpoint tool"), None) - def rcs_toggled(self,obj): + def rcs_toggled(self, obj): self.cust_arch_cb.set_sensitive(not obj.get_active()) self.cust_ret_cb.set_sensitive(not obj.get_active()) - def on_help_clicked(self,obj): + def on_help_clicked(self, obj): """Display the relevant portion of GRAMPS manual""" GrampsDisplay.help('index') - def on_archive_clicked(self,obj): + def on_archive_clicked(self, obj): self.options.handler.options_dict['cacmd'] = unicode( self.cust_arch_cb.get_text()) self.options.handler.options_dict['rcs'] = int( self.rcs_rb.get_active()) - self.run_tool(archive=True,cli=False) + self.run_tool(archive=True, cli=False) # Save options self.options.handler.save_options() - def on_retrieve_clicked(self,obj): + def on_retrieve_clicked(self, obj): self.options.handler.options_dict['crcmd'] = unicode( self.cust_ret_cb.get_text()) self.options.handler.options_dict['rcs'] = int( self.rcs_rb.get_active()) - self.run_tool(archive=False,cli=False) + self.run_tool(archive=False, cli=False) # Save options self.options.handler.save_options() - def run_tool(self,archive=True,cli=False): + def run_tool(self, archive=True, cli=False): """ RCS will be a builtin command, since we can handle all configuration on our own. This isn't true for most versioning @@ -237,15 +237,15 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): self.uistate.modify_statusbar(self.dbstate) def timestamp(self): - return unicode(time.strftime('%x %X',time.localtime(time.time()))) + return unicode(time.strftime('%x %X', time.localtime(time.time()))) - def custom(self,cmd,checkin,cli): + def custom(self, cmd, checkin, cli): """ Passed the generated XML file to the specified command. """ proc = subprocess.Popen( - cmd, - stderr = subprocess.PIPE, + cmd, + stderr = subprocess.PIPE, stdin = subprocess.PIPE ) if checkin: xmlwrite = GrampsDbUtils.XmlWriter(self.db, self.callback, @@ -282,19 +282,19 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): print msg1 print msg2 else: - dialog(msg1,msg2) + dialog(msg1, msg2) def rcs(self, checkin, cli): """ Check the generated XML file into RCS. Initialize the RCS file if it does not already exist. """ - (archive_base,ext) = os.path.splitext(self.db.get_save_path()) + (archive_base, ext) = os.path.splitext(self.db.get_save_path()) archive_base = os.path.join(archive_base, "archive") comment = self.timestamp() - archive = archive_base + ",v" + archive = archive_base + ", v" # If the archive file does not exist, we either set it up # or die trying @@ -319,7 +319,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): print msg1 print msg2 else: - dialog(msg1,msg2) + dialog(msg1, msg2) if status: return @@ -333,8 +333,8 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): cmd = ["ci", archive_base] proc = subprocess.Popen( - cmd, - stdin = subprocess.PIPE, + cmd, + stdin = subprocess.PIPE, stderr = subprocess.PIPE ) proc.stdin.write(comment) proc.stdin.close() @@ -356,10 +356,10 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): print msg1 print msg2 else: - dialog(msg1,msg2) + dialog(msg1, msg2) else: proc = subprocess.Popen( - ("co", "-p", archive_base), stdout=subprocess.PIPE, + ("co", "-p", archive_base), stdout=subprocess.PIPE, stderr = subprocess.PIPE ) status = proc.wait() message = "\n".join(proc.stderr.readlines()) @@ -379,9 +379,9 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow): print msg1 print msg2 else: - dialog(msg1,msg2) + dialog(msg1, msg2) - def callback_real(self,value): + def callback_real(self, value): """ Call back function for the WriteXML function that updates the status progress bar. @@ -400,30 +400,30 @@ class CheckpointOptions(Tool.ToolOptions): Defines options and provides handling interface. """ - def __init__(self,name,person_id=None): - Tool.ToolOptions.__init__(self,name,person_id) + def __init__(self, name, person_id=None): + Tool.ToolOptions.__init__(self, name, person_id) def set_new_options(self): # Options specific for this report self.options_dict = { - 'rcs' : 1, - 'archive' : 1, - 'cacmd' : '', - 'crcmd' : '', + 'rcs' : 1, + 'archive' : 1, + 'cacmd' : '', + 'crcmd' : '', } self.options_help = { - 'rcs' : ("=0/1", - "Whether to use RCS (ignores custom commands).", - ["Do not use RCS","Use RCS"], - True), - 'archive' : ("=0/1", - "Whether to archive or retrieve.", - ["Retrieve","Archive"], - True), - 'cacmd' : ("=str","Custom command line for archiving", - "Custom command string"), - 'crcmd' : ("=str","Custom command line for retrieval", - "Custom command string"), + 'rcs' : ("=0/1", + "Whether to use RCS (ignores custom commands).", + ["Do not use RCS", "Use RCS"], + True), + 'archive' : ("=0/1", + "Whether to archive or retrieve.", + ["Retrieve", "Archive"], + True), + 'cacmd' : ("=str", "Custom command line for archiving", + "Custom command string"), + 'crcmd' : ("=str", "Custom command line for retrieval", + "Custom command string"), } #------------------------------------------------------------------------ @@ -432,15 +432,15 @@ class CheckpointOptions(Tool.ToolOptions): # #------------------------------------------------------------------------ register_tool( - name = 'chkpoint', - category = Tool.TOOL_REVCTL, - tool_class = Checkpoint, - options_class = CheckpointOptions, - modes = Tool.MODE_GUI | Tool.MODE_CLI, - translated_name = _("Checkpoint the database"), - status = _("Stable"), - author_name = "Alex Roitman", - author_email = "shura@gramps-project.org", + name = 'chkpoint', + category = Tool.TOOL_REVCTL, + tool_class = Checkpoint, + options_class = CheckpointOptions, + modes = Tool.MODE_GUI | Tool.MODE_CLI, + translated_name = _("Checkpoint the database"), + status = _("Stable"), + author_name = "Alex Roitman", + author_email = "shura@gramps-project.org", description = _("Store a snapshot of the current database into " "a revision control system") ) diff --git a/src/plugins/ReadGrdb.py b/src/plugins/ReadGrdb.py index 409d7ab76..9063a554f 100644 --- a/src/plugins/ReadGrdb.py +++ b/src/plugins/ReadGrdb.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -20,7 +20,7 @@ # $Id$ -# Written by Alex Roitman, +# Written by Alex Roitman, # largely based on ReadXML by Don Allingham #------------------------------------------------------------------------- @@ -57,11 +57,11 @@ from PluginUtils import register_import # Importing data into the currently open database. # #------------------------------------------------------------------------- -def importData(database, filename, callback=None,cl=0,use_trans=True): +def importData(database, filename, callback=None, cl=0, use_trans=True): other_database = GrampsBSDDB() - # Since we don't want to modify the file being imported, + # Since we don't want to modify the file being imported, # we create new temp file into which we will copy the imported file orig_filename = os.path.normpath(filename) new_filename = tempfile.mkstemp()[1] @@ -72,14 +72,14 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): other_database.make_env_name = lambda x: new_env_name # Copy data - shutil.copyfile(orig_filename,new_filename) + shutil.copyfile(orig_filename, new_filename) # Copy env if we need and if it exists if other_database.UseTXN and os.path.isdir(orig_env_name): shutil.rmtree(new_env_name) - shutil.copytree(orig_env_name,new_env_name) + shutil.copytree(orig_env_name, new_env_name) try: - other_database.load(new_filename,callback) + other_database.load(new_filename, callback) except: if cl: print "Error: %s could not be opened. Exiting." % new_filename @@ -90,96 +90,96 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): if not other_database.version_supported(): if cl: print "Error: %s could not be opened.\n%s Exiting." \ - % (filename, + % (filename, _("The database version is not supported " "by this version of GRAMPS.\n"\ "Please upgrade to the corresponding version " "or use XML for porting data between different " "database versions.")) else: - ErrorDialog(_("%s could not be opened") % filename, + ErrorDialog(_("%s could not be opened") % filename, _("The Database version is not supported " "by this version of GRAMPS.")) return - # If other_database contains its custom name formats, + # If other_database contains its custom name formats, # we need to do tricks to remap the format numbers if len(other_database.name_formats) > 0: - formats_map = remap_name_formats(database,other_database) + formats_map = remap_name_formats(database, other_database) name_displayer.set_name_format(database.name_formats) - get_person = make_peron_name_remapper(other_database,formats_map) + get_person = make_peron_name_remapper(other_database, formats_map) else: # No remapping necessary, proceed as usual get_person = other_database.get_person_from_handle # Prepare table and method definitions tables = { - 'Person' : {'table' : database.person_map, - 'id_table' : database.id_trans, - 'add_obj' : database.add_person, - 'find_next_gramps_id' :database.find_next_person_gramps_id, + 'Person' : {'table' : database.person_map, + 'id_table' : database.id_trans, + 'add_obj' : database.add_person, + 'find_next_gramps_id' :database.find_next_person_gramps_id, 'other_get_from_handle': - get_person, + get_person, 'other_table': other_database.person_map, - }, - 'Family' : {'table' : database.family_map, - 'id_table' : database.fid_trans, - 'add_obj' : database.add_family, - 'find_next_gramps_id' :database.find_next_family_gramps_id, + }, + 'Family' : {'table' : database.family_map, + 'id_table' : database.fid_trans, + 'add_obj' : database.add_family, + 'find_next_gramps_id' :database.find_next_family_gramps_id, 'other_get_from_handle': - other_database.get_family_from_handle, + other_database.get_family_from_handle, 'other_table': other_database.family_map, - }, + }, - 'Event' : {'table' : database.event_map, - 'id_table' : database.eid_trans, - 'add_obj' : database.add_event, - 'find_next_gramps_id' : database.find_next_event_gramps_id, + 'Event' : {'table' : database.event_map, + 'id_table' : database.eid_trans, + 'add_obj' : database.add_event, + 'find_next_gramps_id' : database.find_next_event_gramps_id, 'other_get_from_handle': - other_database.get_event_from_handle, + other_database.get_event_from_handle, 'other_table': other_database.event_map, - }, - 'Source' : {'table' : database.source_map, - 'id_table' : database.sid_trans, - 'add_obj' : database.add_source, - 'find_next_gramps_id': database.find_next_source_gramps_id, + }, + 'Source' : {'table' : database.source_map, + 'id_table' : database.sid_trans, + 'add_obj' : database.add_source, + 'find_next_gramps_id': database.find_next_source_gramps_id, 'other_get_from_handle': - other_database.get_source_from_handle, + other_database.get_source_from_handle, 'other_table': other_database.source_map, - }, - 'Place' : {'table' : database.place_map, - 'id_table' : database.pid_trans, - 'add_obj' : database.add_place, - 'find_next_gramps_id' :database.find_next_place_gramps_id, + }, + 'Place' : {'table' : database.place_map, + 'id_table' : database.pid_trans, + 'add_obj' : database.add_place, + 'find_next_gramps_id' :database.find_next_place_gramps_id, 'other_get_from_handle': - other_database.get_place_from_handle, + other_database.get_place_from_handle, 'other_table': other_database.place_map, - }, - 'Media' : {'table' : database.media_map, - 'id_table' : database.oid_trans, - 'add_obj' : database.add_object, - 'find_next_gramps_id' : database.find_next_object_gramps_id, + }, + 'Media' : {'table' : database.media_map, + 'id_table' : database.oid_trans, + 'add_obj' : database.add_object, + 'find_next_gramps_id' : database.find_next_object_gramps_id, 'other_get_from_handle': - other_database.get_object_from_handle, + other_database.get_object_from_handle, 'other_table': other_database.media_map, - }, - 'Repository' : {'table' : database.repository_map, - 'id_table' : database.rid_trans, - 'add_obj' : database.add_repository, + }, + 'Repository' : {'table' : database.repository_map, + 'id_table' : database.rid_trans, + 'add_obj' : database.add_repository, 'find_next_gramps_id' : - database.find_next_repository_gramps_id, + database.find_next_repository_gramps_id, 'other_get_from_handle': - other_database.get_repository_from_handle, - 'other_table': other_database.repository_map, - }, - 'Note' : {'table': database.note_map, - 'id_table': database.nid_trans, - 'add_obj': database.add_note, - 'find_next_gramps_id': database.find_next_note_gramps_id, - 'other_get_from_handle': - other_database.get_note_from_handle, - 'other_table': other_database.note_map, - }, + other_database.get_repository_from_handle, + 'other_table': other_database.repository_map, + }, + 'Note' : {'table': database.note_map, + 'id_table': database.nid_trans, + 'add_obj': database.add_note, + 'find_next_gramps_id': database.find_next_note_gramps_id, + 'other_get_from_handle': + other_database.get_note_from_handle, + 'other_table': other_database.note_map, + }, } uc = UpdateCallback(callback) @@ -193,19 +193,19 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): table = table_dict['table'] other_table = table_dict['other_table'] msg = '%s handles in two databases overlap.' % key - the_len += check_common_handles(table,other_table,msg) + the_len += check_common_handles(table, other_table, msg) uc.update() # Proceed with preparing for import if use_trans: - trans = database.transaction_begin("",batch=True) + trans = database.transaction_begin("", batch=True) else: print "Transaction is None! This is no way to go!" trans = None database.disable_signals() - # copy all data from new_database to database, + # copy all data from new_database to database, # rename gramps IDs of first-class objects when conflicts are found uc.set_total(the_len) @@ -216,8 +216,8 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): find_next_gramps_id = table_dict['find_next_gramps_id'] other_table = table_dict['other_table'] other_get_from_handle = table_dict['other_get_from_handle'] - import_table(id_table,add_obj,find_next_gramps_id, - other_table,other_get_from_handle,trans,uc) + import_table(id_table, add_obj, find_next_gramps_id, + other_table, other_get_from_handle, trans, uc) # Copy bookmarks over: # we already know that there's no overlap in handles anywhere @@ -237,12 +237,12 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): os.unlink(new_filename) shutil.rmtree(new_env_name) - database.transaction_commit(trans,_("Import database")) + database.transaction_commit(trans, _("Import database")) database.enable_signals() database.request_rebuild() -def check_common_handles(table,other_table,msg): - # Check for duplicate handles. At the moment we simply exit here, +def check_common_handles(table, other_table, msg): + # Check for duplicate handles. At the moment we simply exit here, # before modifying any data. In the future we will need to handle # this better. How? handles = set(table.keys()) @@ -251,8 +251,8 @@ def check_common_handles(table,other_table,msg): raise HandleError(msg) return len(other_handles) -def import_table(id_table,add_obj,find_next_gramps_id, - other_table,other_get_from_handle,trans,uc): +def import_table(id_table, add_obj, find_next_gramps_id, + other_table, other_get_from_handle, trans, uc): for handle in other_table.keys(): obj = other_get_from_handle(handle) @@ -262,14 +262,14 @@ def import_table(id_table,add_obj,find_next_gramps_id, if id_table.has_key(gramps_id): gramps_id = find_next_gramps_id() obj.gramps_id = gramps_id - add_obj(obj,trans) + add_obj(obj, trans) uc.update() -def remap_name_formats(database,other_database): +def remap_name_formats(database, other_database): formats_map = {} - taken_numbers = [num for (num,name,fmt_str,active) + taken_numbers = [num for (num, name, fmt_str, active) in database.name_formats] - for (number,name,fmt_str,act) in other_database.name_formats: + for (number, name, fmt_str, act) in other_database.name_formats: if number in taken_numbers: new_number = -1 while new_number in taken_numbers: @@ -278,10 +278,10 @@ def remap_name_formats(database,other_database): formats_map[number] = new_number else: new_number = number - database.name_formats.append((new_number,name,fmt_str,act)) + database.name_formats.append((new_number, name, fmt_str, act)) return formats_map -def remap_name(person,formats_map): +def remap_name(person, formats_map): for name in [person.primary_name] + person.alternate_names: try: name.sort_as = formats_map[name.sort_as] @@ -292,10 +292,10 @@ def remap_name(person,formats_map): except KeyError: pass -def make_peron_name_remapper(other_database,formats_map): +def make_peron_name_remapper(other_database, formats_map): def new_get_person(handle): person = other_database.get_person_from_handle(handle) - remap_name(person,formats_map) + remap_name(person, formats_map) return person return new_get_person @@ -310,4 +310,4 @@ _filter.set_name(_('GRAMPS 2.x database')) _filter.add_mime_type(_mime_type) _format_name = _('GRAMPS 2.x database') -register_import(importData,_filter,_mime_type,0,_format_name) +register_import(importData, _filter, _mime_type, 0, _format_name) diff --git a/src/plugins/ReadPkg.py b/src/plugins/ReadPkg.py index a45bba34b..9f3b41540 100644 --- a/src/plugins/ReadPkg.py +++ b/src/plugins/ReadPkg.py @@ -5,10 +5,10 @@ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -62,41 +62,41 @@ from PluginUtils import register_import # # #------------------------------------------------------------------------- -def impData(database, name,cb=None,cl=0): +def impData(database, name, cb=None, cl=0): # Create tempdir, if it does not exist, then check for writability # THE TEMP DIR is named as the filname.gpkg.media and is created # in the same dir as the database that we are importing into. db_path = os.path.dirname(database.get_save_path()) media_dir = "%s.media" % os.path.basename(name) - tmpdir_path = os.path.join(db_path,media_dir) + tmpdir_path = os.path.join(db_path, media_dir) if not os.path.isdir(tmpdir_path): try: - os.mkdir(tmpdir_path,0700) + os.mkdir(tmpdir_path, 0700) except: ErrorDialog( _("Could not create temporary directory %s") % tmpdir_path ) return - elif not os.access(tmpdir_path,os.W_OK): + elif not os.access(tmpdir_path, os.W_OK): ErrorDialog(_("Temporary directory %s is not writable") % tmpdir_path) return else: # tempdir exists and writable -- clean it up if not empty files = os.listdir(tmpdir_path) ; for filename in files: - os.remove(os.path.join(tmpdir_path,filename)) + os.remove(os.path.join(tmpdir_path, filename)) try: archive = tarfile.open(name) for tarinfo in archive: - archive.extract(tarinfo,tmpdir_path) + archive.extract(tarinfo, tmpdir_path) archive.close() except: ErrorDialog(_("Error extracting into %s") % tmpdir_path) return - imp_db_name = os.path.join(tmpdir_path,const.XMLFILE) + imp_db_name = os.path.join(tmpdir_path, const.XMLFILE) importer = gramps_db_reader_factory(const.APP_GRAMPS_XML) - importer(database,imp_db_name,cb) + importer(database, imp_db_name, cb) # Clean up tempdir after ourselves # THIS HAS BEEN CHANGED, because now we want to keep images @@ -105,7 +105,7 @@ def impData(database, name,cb=None,cl=0): ## files = os.listdir(tmpdir_path) ## for filename in files: -## os.remove(os.path.join(tmpdir_path,filename)) +## os.remove(os.path.join(tmpdir_path, filename)) ## os.rmdir(tmpdir_path) #------------------------------------------------------------------------ @@ -119,4 +119,4 @@ _filter.set_name(_('GRAMPS packages')) _filter.add_mime_type(_mime_type) _format_name = _('GRAMPS package') -register_import(impData,_filter,_mime_type,0,_format_name) +register_import(impData, _filter, _mime_type, 0, _format_name) diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 877b93360..225c4a654 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -82,8 +82,7 @@ _title_string = _("Export to CD") def writeData(database, filename, person, option_box=None, callback=None): ret = 0 writer = PackageWriter(database, filename, callback) - ret = writer.export() - return ret + writer.export() #------------------------------------------------------------------------- #