diff --git a/ChangeLog b/ChangeLog index eaeb44e3c..d6bce392b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-10-07 Don Allingham + * various: gen.utils integrationk + 2007-10-07 Gary Burton * src/DataViews/_RelationView.py: init scroll pos on new person, issue #442 diff --git a/configure.in b/configure.in index 88de51d28..c80fc1302 100644 --- a/configure.in +++ b/configure.in @@ -180,6 +180,7 @@ src/DateHandler/Makefile src/gen/Makefile src/gen/proxy/Makefile src/gen/db/Makefile +src/gen/utils/Makefile src/data/Makefile src/data/templates/Makefile src/glade/Makefile diff --git a/src/DataViews/_FamilyList.py b/src/DataViews/_FamilyList.py index f18277d56..cdabb617c 100644 --- a/src/DataViews/_FamilyList.py +++ b/src/DataViews/_FamilyList.py @@ -201,13 +201,13 @@ class FamilyListView(PageView.ListView): def remove(self, obj): self.uistate.set_busy_cursor(1) - import GrampsDb + import gen.utils mlist = [] self.selection.selected_foreach(self.blist, mlist) for handle in mlist: - GrampsDb.remove_family_relationships(self.dbstate.db, handle) + gen.utils.remove_family_relationships(self.dbstate.db, handle) self.build_tree() self.uistate.set_busy_cursor(0) diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index af0863f45..5d5cefae0 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -54,7 +54,7 @@ import ThumbNails import Config import GrampsWidgets import Errors -import GrampsDb +import gen.utils from ReportBase import ReportUtils @@ -1226,7 +1226,7 @@ class RelationshipView(PageView.PersonNavView): active_handle = self.dbstate.active.handle child = self.dbstate.db.get_person_from_handle(active_handle) - GrampsDb.add_child_to_family( + gen.utils.add_child_to_family( self.dbstate.db, family, child) @@ -1246,7 +1246,7 @@ class RelationshipView(PageView.PersonNavView): active_handle = self.dbstate.active.handle child = self.dbstate.db.get_person_from_handle(active_handle) - GrampsDb.add_child_to_family( + gen.utils.add_child_to_family( self.dbstate.db, family, child) @@ -1285,15 +1285,15 @@ class RelationshipView(PageView.PersonNavView): def delete_family(self, obj, event, handle): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: - GrampsDb.remove_parent_from_family(self.dbstate.db, - self.dbstate.active.handle, - handle) + gen.utils.remove_parent_from_family(self.dbstate.db, + self.dbstate.active.handle, + handle) def delete_parent_family(self, obj, event, handle): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: - GrampsDb.remove_child_from_family(self.dbstate.db, - self.dbstate.active.handle, - handle) + gen.utils.remove_child_from_family(self.dbstate.db, + self.dbstate.active.handle, + handle) def change_to(self, obj, handle): self.dbstate.change_active_handle(handle) diff --git a/src/DisplayModels/_FamilyModel.py b/src/DisplayModels/_FamilyModel.py index 7b0274423..2150e1ca6 100644 --- a/src/DisplayModels/_FamilyModel.py +++ b/src/DisplayModels/_FamilyModel.py @@ -46,7 +46,7 @@ import GrampsLocale import DateHandler from BasicUtils import name_displayer import RelLib -import GrampsDb +import gen.utils from _BaseModel import BaseModel @@ -130,7 +130,7 @@ class FamilyModel(BaseModel): def column_marriage(self, data): erlist = [ RelLib.EventRef().unserialize(d) for d in data[6] ] - event = GrampsDb.marriage_from_eventref_list(self.db, erlist) + event = gen.utils.marriage_from_eventref_list(self.db, erlist) if event: return DateHandler.displayer.display(event.date) else: @@ -138,7 +138,7 @@ class FamilyModel(BaseModel): def sort_marriage(self, data): erlist = [ RelLib.EventRef().unserialize(d) for d in data[6] ] - event = GrampsDb.marriage_from_eventref_list(self.db, erlist) + event = gen.utils.marriage_from_eventref_list(self.db, erlist) if event: return "%09d" % event.date.get_sort_value() else: diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index 3148953a9..910b80e84 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -56,7 +56,7 @@ import GrampsWidgets from BasicUtils import name_displayer import Errors -from GrampsDb import set_birth_death_index +from gen.utils import set_birth_death_index from _EditPrimary import EditPrimary from QuestionDialog import * diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index cb011f4f6..b3748562b 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -46,7 +46,7 @@ __LOG = logging.getLogger(".GrampsDb") #------------------------------------------------------------------------- from RelLib import * from gen.db.base import * -from _DbUtils import db_copy +from gen.utils import db_copy import gen.db.const as const from _GrampsDbExceptions import FileVersionError from BasicUtils import UpdateCallback diff --git a/src/GrampsDb/_GrampsGEDDB.py b/src/GrampsDb/_GrampsGEDDB.py index abd53f919..c76497be9 100644 --- a/src/GrampsDb/_GrampsGEDDB.py +++ b/src/GrampsDb/_GrampsGEDDB.py @@ -29,7 +29,7 @@ from RelLib import * from _GrampsInMemDB import * from _GrampsDbExceptions import GrampsDbException -from _DbUtils import db_copy +from gen.utils import db_copy #------------------------------------------------------------------------- # diff --git a/src/GrampsDb/_GrampsXMLDB.py b/src/GrampsDb/_GrampsXMLDB.py index 082652495..8130009f9 100644 --- a/src/GrampsDb/_GrampsXMLDB.py +++ b/src/GrampsDb/_GrampsXMLDB.py @@ -32,7 +32,7 @@ from RelLib import * from _GrampsInMemDB import * from _GrampsDbExceptions import GrampsDbException -from _DbUtils import db_copy +from gen.utils import db_copy #------------------------------------------------------------------------- diff --git a/src/GrampsDb/__init__.py b/src/GrampsDb/__init__.py index a9c3f0de2..f51b23e0b 100644 --- a/src/GrampsDb/__init__.py +++ b/src/GrampsDb/__init__.py @@ -46,7 +46,7 @@ from _GrampsDbFactories import gramps_db_factory #from _GrampsDBCallback import GrampsDBCallback -from _DbUtils import * +#from _DbUtils import * #import _GrampsDbConst as GrampsDbConst diff --git a/src/GrampsDbUtils/_WriteGrdb.py b/src/GrampsDbUtils/_WriteGrdb.py index 16cc63692..44e01c92d 100644 --- a/src/GrampsDbUtils/_WriteGrdb.py +++ b/src/GrampsDbUtils/_WriteGrdb.py @@ -37,7 +37,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- from _GrampsBSDDB import GrampsBSDDB from QuestionDialog import ErrorDialog -from _DbUtils import db_copy +from gen.utils import db_copy #------------------------------------------------------------------------- # diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index a69788143..d94488816 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -48,7 +48,7 @@ import DateHandler import QuestionDialog import GrampsDisplay import ManagedWindow -import GrampsDb +import gen.utils sex = ( _("female"), _("male"), _("unknown")) @@ -422,7 +422,7 @@ class MergePeople: # merge the event lists self.merge_event_lists(new) - GrampsDb.set_birth_death_index(self.db, new) + gen.utils.set_birth_death_index(self.db, new) # copy attributes new.set_attribute_list(self.p1.get_attribute_list() + diff --git a/src/gen/utils/Makefile.am b/src/gen/utils/Makefile.am new file mode 100644 index 000000000..3fed5e751 --- /dev/null +++ b/src/gen/utils/Makefile.am @@ -0,0 +1,24 @@ +# 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@/utils + +pkgdata_PYTHON = \ + __init__.py \ + dbutils.py + + +pkgpyexecdir = @pkgpyexecdir@/utils +pkgpythondir = @pkgpythondir@/utils + + +# 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/gen/utils/__init__.py b/src/gen/utils/__init__.py new file mode 100644 index 000000000..7c911a4c9 --- /dev/null +++ b/src/gen/utils/__init__.py @@ -0,0 +1,24 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2007 Donald N. Allingham +# +# 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 +# (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +__version__ = "$Revision: $" + +from dbutils import * + diff --git a/src/GrampsDb/_DbUtils.py b/src/gen/utils/dbutils.py similarity index 100% rename from src/GrampsDb/_DbUtils.py rename to src/gen/utils/dbutils.py