Changes to imports - part 8

svn: r20493
This commit is contained in:
Nick Hall 2012-10-02 21:59:59 +00:00
parent 55c19e4180
commit 760806a7f9
26 changed files with 59 additions and 53 deletions

View File

@ -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()

View File

@ -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:

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
#------------------------------------------------------------------------
#

View File

@ -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)

View File

@ -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)

View File

@ -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 = "<i>%s</i>" % 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 = "<i>%s</i>" % cgi.escape(sdate)

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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
#-------------------------------------------------------------------------
#

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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():

View File

@ -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