diff --git a/Gramps.py b/Gramps.py index ecf3c56c5..c3b812f55 100644 --- a/Gramps.py +++ b/Gramps.py @@ -26,14 +26,5 @@ able to run gramps from the source directory without setting PYTHONPATH From this position, import gramps works great """ - -# here import gramps works. As __temporary__ workaround, we also put the gramps -# folder itself on the systempath -import sys, os -pathgramps = os.path.dirname(os.path.abspath(__file__)) -pathgramps += os.sep + 'gramps' -sys.path.append(pathgramps) - -#now start gramps import gramps.grampsapp as app app.main() diff --git a/gramps/cli/arghandler.py b/gramps/cli/arghandler.py index 4375b7072..4860d62fb 100644 --- a/gramps/cli/arghandler.py +++ b/gramps/cli/arghandler.py @@ -48,7 +48,7 @@ from gramps.gen.ggettext import gettext as _ from gramps.gen.recentfiles import recent_files from gramps.gen.utils.file import (rm_tempdir, get_empty_tempdir, get_unicode_path_from_env_var) -import gen +from gramps.gen.db import DbBsddb from clidbman import CLIDbManager, NAME_FILE, find_locker_name from gramps.gen.plug import BasePluginManager @@ -476,7 +476,7 @@ class ArgHandler(object): else: self.imp_db_path = get_empty_tempdir("import_dbdir") \ .encode(sys.getfilesystemencoding()) - newdb = gen.db.DbBsddb() + newdb = DbBsddb() newdb.write_version(self.imp_db_path) try: diff --git a/gramps/cli/plug/__init__.py b/gramps/cli/plug/__init__.py index 04879ff8c..e21b7befb 100644 --- a/gramps/cli/plug/__init__.py +++ b/gramps/cli/plug/__init__.py @@ -61,7 +61,7 @@ from gramps.gen.plug.report._paper import paper_sizes from gramps.gen.const import USER_HOME from gramps.gen.dbstate import DbState from gramps.cli.grampscli import CLIManager -import cli.user +from gramps.cli.user import User #------------------------------------------------------------------------ # @@ -581,7 +581,7 @@ def cl_report(database, name, category, report_class, options_class, if clr.css_filename is not None and \ hasattr(clr.option_class.handler.doc, 'set_css_filename'): clr.option_class.handler.doc.set_css_filename(clr.css_filename) - MyReport = report_class(database, clr.option_class, cli.user.User()) + MyReport = report_class(database, clr.option_class, User()) MyReport.doc.init() MyReport.begin_report() MyReport.write_report() diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index c7cf60e14..ca341defa 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -56,7 +56,7 @@ from gramps.gui.utils import is_right_click, open_file_with_default_application from gramps.gen.utils.db import get_birth_or_fallback from gramps.gen.lib import NoteType, Person, Surname from gramps.gen.db import DbTxn -from gui import widgets +from gramps.gui import widgets from gramps.gen.display.name import displayer as name_displayer from gramps.gen.errors import WindowActiveError from gramps.gui.glade import Glade diff --git a/gramps/gui/filters/sidebar/_eventsidebarfilter.py b/gramps/gui/filters/sidebar/_eventsidebarfilter.py index 8c58b9df3..ac46edbad 100644 --- a/gramps/gui/filters/sidebar/_eventsidebarfilter.py +++ b/gramps/gui/filters/sidebar/_eventsidebarfilter.py @@ -39,7 +39,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gen.lib import Event, EventType from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter diff --git a/gramps/gui/filters/sidebar/_familysidebarfilter.py b/gramps/gui/filters/sidebar/_familysidebarfilter.py index 40e8e8553..491801063 100644 --- a/gramps/gui/filters/sidebar/_familysidebarfilter.py +++ b/gramps/gui/filters/sidebar/_familysidebarfilter.py @@ -40,7 +40,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gen.lib import Event, EventType, Family, FamilyRelType from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter diff --git a/gramps/gui/filters/sidebar/_mediasidebarfilter.py b/gramps/gui/filters/sidebar/_mediasidebarfilter.py index 331802348..bedaee48c 100644 --- a/gramps/gui/filters/sidebar/_mediasidebarfilter.py +++ b/gramps/gui/filters/sidebar/_mediasidebarfilter.py @@ -40,7 +40,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter from gramps.gen.filters import GenericFilterFactory, rules diff --git a/gramps/gui/filters/sidebar/_notesidebarfilter.py b/gramps/gui/filters/sidebar/_notesidebarfilter.py index 68276dff0..bd9946fcf 100644 --- a/gramps/gui/filters/sidebar/_notesidebarfilter.py +++ b/gramps/gui/filters/sidebar/_notesidebarfilter.py @@ -40,7 +40,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gen.lib import Note, NoteType from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter diff --git a/gramps/gui/filters/sidebar/_personsidebarfilter.py b/gramps/gui/filters/sidebar/_personsidebarfilter.py index f62c6d8d8..cce69d87e 100644 --- a/gramps/gui/filters/sidebar/_personsidebarfilter.py +++ b/gramps/gui/filters/sidebar/_personsidebarfilter.py @@ -41,7 +41,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gen.lib import Date, Event, EventType from gramps.gen.datehandler import displayer from gramps.gui.filters import build_filter_model diff --git a/gramps/gui/filters/sidebar/_placesidebarfilter.py b/gramps/gui/filters/sidebar/_placesidebarfilter.py index b801af306..03cd234f3 100644 --- a/gramps/gui/filters/sidebar/_placesidebarfilter.py +++ b/gramps/gui/filters/sidebar/_placesidebarfilter.py @@ -41,7 +41,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter from gramps.gen.filters import GenericFilterFactory, rules diff --git a/gramps/gui/filters/sidebar/_reposidebarfilter.py b/gramps/gui/filters/sidebar/_reposidebarfilter.py index fb69a0c66..a677fddd3 100644 --- a/gramps/gui/filters/sidebar/_reposidebarfilter.py +++ b/gramps/gui/filters/sidebar/_reposidebarfilter.py @@ -39,7 +39,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gen.lib import Repository, RepositoryType from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter diff --git a/gramps/gui/filters/sidebar/_sidebarfilter.py b/gramps/gui/filters/sidebar/_sidebarfilter.py index 35f3ebcc3..0bc1cd254 100644 --- a/gramps/gui/filters/sidebar/_sidebarfilter.py +++ b/gramps/gui/filters/sidebar/_sidebarfilter.py @@ -27,7 +27,7 @@ from gi.repository import Gdk from gi.repository import Gtk from gi.repository import Pango -from gui import widgets +from gramps.gui import widgets from gramps.gui.dbguielement import DbGUIElement from gramps.gen.config import config diff --git a/gramps/gui/filters/sidebar/_sourcesidebarfilter.py b/gramps/gui/filters/sidebar/_sourcesidebarfilter.py index b8629d699..c416c1fd4 100644 --- a/gramps/gui/filters/sidebar/_sourcesidebarfilter.py +++ b/gramps/gui/filters/sidebar/_sourcesidebarfilter.py @@ -39,7 +39,7 @@ from gi.repository import Gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gui import widgets +from gramps.gui import widgets from gramps.gui.filters import build_filter_model from gramps.gui.filters.sidebar import SidebarFilter from gramps.gen.filters import GenericFilterFactory, rules diff --git a/gramps/gui/plug/_guioptions.py b/gramps/gui/plug/_guioptions.py index 3735f92cf..4d307ffc7 100644 --- a/gramps/gui/plug/_guioptions.py +++ b/gramps/gui/plug/_guioptions.py @@ -54,13 +54,12 @@ from gi.repository import GObject from gramps.gen.utils.file import get_unicode_path_from_file_chooser from gramps.gui.utils import ProgressMeter from gramps.gui.pluginmanager import GuiPluginManager -from gui import widgets +from gramps.gui import widgets from gramps.gui.managedwindow import ManagedWindow from gramps.gui.dialog import OptionDialog from gramps.gui.selectors import SelectorFactory from gramps.gen.display.name import displayer as _nd from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules -import gen #------------------------------------------------------------------------ # diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 0cddef363..755c320b7 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -85,7 +85,7 @@ from gramps.gen.config import config from gramps.gen.errors import WindowActiveError from gramps.gui.dialog import (ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog) -from gui import widgets +from gramps.gui import widgets from gramps.gui.undohistory import UndoHistory from gramps.gen.utils.file import (media_path_full, get_unicode_path_from_env_var, get_unicode_path_from_file_chooser) diff --git a/gramps/plugins/bookreport.py b/gramps/plugins/bookreport.py index 2e2c711d4..8e309fd06 100644 --- a/gramps/plugins/bookreport.py +++ b/gramps/plugins/bookreport.py @@ -89,7 +89,7 @@ from gramps.gui.plug.report._reportdialog import ReportDialog from gramps.gui.plug.report._docreportdialog import DocReportDialog from gramps.gen.plug.report._options import ReportOptions from gramps.cli.plug import CommandLineReport -import cli.user +from gramps.cli.user import User from gramps.gen.display.name import displayer as _nd @@ -1428,7 +1428,7 @@ def cl_report(database, name, category, options_str_dict): doc = clr.format(selected_style, PaperStyle(clr.paper, clr.orien, clr.marginl, clr.marginr, clr.margint, clr.marginb)) - user = cli.user.User() + user = User() rptlist = [] for item in book.get_item_list(): item.option_class.set_document(doc) diff --git a/gramps/plugins/gramplet/pedigreegramplet.py b/gramps/plugins/gramplet/pedigreegramplet.py index 5b73a6836..2cc5b5efb 100644 --- a/gramps/plugins/gramplet/pedigreegramplet.py +++ b/gramps/plugins/gramplet/pedigreegramplet.py @@ -37,7 +37,7 @@ from gramps.gen.ggettext import sgettext as _ from gramps.gen.ggettext import ngettext from gramps.gen.display.name import displayer as name_displayer from gramps.gen.datehandler import get_date -import gen +from gramps.gen.lib import EventType from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback #------------------------------------------------------------------------ @@ -195,7 +195,7 @@ class PedigreeGramplet(Gramplet): def info_string(self, person): birth = get_birth_or_fallback(self.dbstate.db, person) - if birth and birth.get_type() != gen.lib.EventType.BIRTH: + if birth and birth.get_type() != EventType.BIRTH: sdate = get_date(birth) if sdate: bdate = "%s" % cgi.escape(sdate) @@ -207,7 +207,7 @@ class PedigreeGramplet(Gramplet): bdate = "" death = get_death_or_fallback(self.dbstate.db, person) - if death and death.get_type() != gen.lib.EventType.DEATH: + if death and death.get_type() != EventType.DEATH: sdate = get_date(death) if sdate: ddate = "%s" % cgi.escape(sdate) diff --git a/gramps/plugins/gramplet/statsgramplet.py b/gramps/plugins/gramplet/statsgramplet.py index faf8d3a3b..61321de77 100644 --- a/gramps/plugins/gramplet/statsgramplet.py +++ b/gramps/plugins/gramplet/statsgramplet.py @@ -34,7 +34,7 @@ from gramps.gen.plug import Gramplet from gramps.gen.ggettext import sgettext as _ from gramps.gen.utils.file import media_path_full from gramps.gen.datehandler import get_date -import gen +from gramps.gen.lib import Person #------------------------------------------------------------------------ # @@ -126,9 +126,9 @@ class StatsGramplet(Gramplet): else: missing_bday += 1 - if person.get_gender() == gen.lib.Person.FEMALE: + if person.get_gender() == Person.FEMALE: females += 1 - elif person.get_gender() == gen.lib.Person.MALE: + elif person.get_gender() == Person.MALE: males += 1 else: unknowns += 1 diff --git a/gramps/plugins/import/importgedcom.py b/gramps/plugins/import/importgedcom.py index b971f6a24..7b75ec624 100644 --- a/gramps/plugins/import/importgedcom.py +++ b/gramps/plugins/import/importgedcom.py @@ -46,7 +46,7 @@ LOG = logging.getLogger(".GedcomImport") from gramps.gen.errors import DbError, GedcomError from gramps.gui.glade import Glade from gramps.plugins.lib.libmixin import DbMixin -import gramps.plugins.lib.libgedcom as libgedcom +from gramps.plugins.lib import libgedcom module = __import__("libgedcom") reload (module) diff --git a/gramps/plugins/import/importprogen.py b/gramps/plugins/import/importprogen.py index 6abb3158b..4e5772a84 100644 --- a/gramps/plugins/import/importprogen.py +++ b/gramps/plugins/import/importprogen.py @@ -49,7 +49,10 @@ log = logging.getLogger('.ImportProGen') #------------------------------------------------------------------------- from gramps.gen.utils.id import create_id from gramps.gui.utils import ProgressMeter -from gramps.gen.lib import Attribute, AttributeType, ChildRef, Date, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, SourceRef, Surname +from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Date, Event, + EventRef, EventType, Family, FamilyRelType, Name, + NameType, Note, NoteType, Person, Place, Source, + SourceRef, Surname) from gramps.gen.db import DbTxn class ProgenError(Exception): diff --git a/gramps/plugins/import/importxml.py b/gramps/plugins/import/importxml.py index 5dea6f4a2..0a6ce347e 100644 --- a/gramps/plugins/import/importxml.py +++ b/gramps/plugins/import/importxml.py @@ -44,7 +44,14 @@ LOG = logging.getLogger(".ImportXML") # #------------------------------------------------------------------------- from gramps.gen.mime import get_type -from gramps.gen.lib import Address, Attribute, AttributeType, ChildRef, ChildRefType, Citation, Date, Event, EventRef, EventRoleType, EventType, Family, LdsOrd, Location, MediaObject, MediaRef, Name, NameOriginType, NameType, Note, NoteType, Person, PersonRef, Place, RepoRef, Repository, Researcher, Source, StyledText, StyledTextTag, StyledTextTagType, Surname, Tag, Url +from gramps.gen.lib import (Address, Attribute, AttributeType, ChildRef, + ChildRefType, Citation, Date, Event, EventRef, + EventRoleType, EventType, Family, LdsOrd, Location, + MediaObject, MediaRef, Name, NameOriginType, + NameType, Note, NoteType, Person, PersonRef, + Place, RepoRef, Repository, Researcher, Source, + StyledText, StyledTextTag, StyledTextTagType, + Surname, Tag, Url) from gramps.gen.db import DbTxn from gramps.gen.db.write import CLASS_TO_KEY_MAP from gramps.gen.errors import GrampsImportError @@ -53,12 +60,14 @@ from gramps.gen.utils.db import family_name from gramps.gen.utils.unknown import make_unknown, create_explanation_note from gramps.gen.datehandler import parser, set_date from gramps.gen.display.name import displayer as name_displayer -from gramps.gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, - MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY, - TAG_KEY, CITATION_KEY) +from gramps.gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, + EVENT_KEY, MEDIA_KEY, PLACE_KEY, + REPOSITORY_KEY, NOTE_KEY, TAG_KEY, + CITATION_KEY) from gramps.gen.updatecallback import UpdateCallback from gramps.gen.const import VERSION -import gramps.plugins.lib.libgrampsxml +#import gramps.plugins.lib.libgrampsxml +from gramps.plugins.lib import libgrampsxml #------------------------------------------------------------------------- # diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index cb65fa4eb..5b8c71684 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -55,7 +55,9 @@ from gi.repository import Pango # Gramps Modules # #------------------------------------------------------------------------- -from gramps.gen.lib import ChildRef, EventRoleType, EventType, Family, FamilyRelType, Name, Person, Surname +from gramps.gen.lib import (ChildRef, EventRoleType, EventType, Family, + FamilyRelType, Name, Person, Surname) +from gramps.gen.lib.date import Today from gramps.gen.db import DbTxn from gramps.gui.views.navigationview import NavigationView from gramps.gui.editors import EditPerson, EditFamily @@ -67,7 +69,7 @@ from gramps.gui.utils import open_file_with_default_application from gramps.gen.datehandler import displayer, get_date from gramps.gui.thumbnails import get_thumbnail_image from gramps.gen.config import config -from gui import widgets +from gramps.gui import widgets from gramps.gui.widgets.reorderfam import Reorder from gramps.gui.selectors import SelectorFactory from gramps.gen.errors import WindowActiveError @@ -662,7 +664,7 @@ class RelationshipView(NavigationView): 2, 3, 2, 3, yoptions=0) showed_death = True if not showed_death: - age = gen.lib.date.Today() - birth_date + age = Today() - birth_date if probably_alive(person, self.dbstate.db): subtbl.attach(widgets.BasicLabel("%s:" % _("Alive")), 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=0) diff --git a/gramps/webapp/dbdjango.py b/gramps/webapp/dbdjango.py index 3901ae217..bdf87666d 100644 --- a/gramps/webapp/dbdjango.py +++ b/gramps/webapp/dbdjango.py @@ -29,8 +29,10 @@ import cPickle import base64 import time -import gen import re +from gramps.gen.lib import (Person, Family, Event, Place, Repository, + Citation, Source, Note, MediaObject, Tag, + Researcher) from gramps.gen.db import DbReadBase, DbWriteBase, DbTxn from gramps.gen.db import (PERSON_KEY, FAMILY_KEY, diff --git a/gramps/webapp/libdjango.py b/gramps/webapp/libdjango.py index 0c2710a2b..437c04d1e 100644 --- a/gramps/webapp/libdjango.py +++ b/gramps/webapp/libdjango.py @@ -46,7 +46,7 @@ from django.db import transaction #------------------------------------------------------------------------ import webapp.grampsdb.models as models import webapp -import gen +from gramps.gen.lib import Name from gramps.gen.utils.id import create_id # To get a django person from a django database: @@ -192,13 +192,13 @@ class DjangoInterface(object): def get_primary_name(self, person): names = person.name_set.filter(preferred=True).order_by("order") if len(names) > 0: - return gen.lib.Name.create(self.pack_name(names[0])) + return Name.create(self.pack_name(names[0])) else: - return gen.lib.Name() + return Name() def get_alternate_names(self, person): names = person.name_set.filter(preferred=False).order_by("order") - return [gen.lib.Name.create(self.pack_name(n)) for n in names] + return [Name.create(self.pack_name(n)) for n in names] def get_names(self, person, preferred): names = person.name_set.filter(preferred=preferred).order_by("order") @@ -206,7 +206,7 @@ class DjangoInterface(object): if len(names) > 0: return self.pack_name(names[0]) else: - return gen.lib.Name().serialize() + return Name().serialize() else: return map(self.pack_name, names) diff --git a/gramps/webapp/shell.py b/gramps/webapp/shell.py index 3e409c019..d08bad52d 100644 --- a/gramps/webapp/shell.py +++ b/gramps/webapp/shell.py @@ -20,7 +20,7 @@ from webapp.libdjango import DjangoInterface, totime, todate from gramps.gen.datehandler import displayer, parser from webapp.utils import StyledNoteFormatter, parse_styled_text from gramps.gen.lib import StyledText -import cli.user +from gramps.cli.user import User db = DbDjango() dji = DjangoInterface() @@ -29,7 +29,7 @@ dp = parser.parse #import_file(db, # "/home/dblank/gramps/trunk/example/gramps/data.gramps", -# cli.user.User()) +# User()) #snf = StyledNoteFormatter(db) #for n in Note.objects.all(): diff --git a/test/GrampsDb/GrampsDbTestBase.py b/test/GrampsDb/GrampsDbTestBase.py index 2392feda2..58b28fee9 100644 --- a/test/GrampsDb/GrampsDbTestBase.py +++ b/test/GrampsDb/GrampsDbTestBase.py @@ -14,7 +14,7 @@ try: except NameError: from sets import Set as set -from gen.db import DbBsddb +from gramps.gen.db import DbBsddb from cli.clidbman import CLIDbManager import const import gen.lib